]> xenbits.xensource.com Git - xen.git/commitdiff
xen/hypfs: make struct hypfs_entry_leaf initializers work with gcc 4.1
authorJuergen Gross <jgross@suse.com>
Fri, 29 May 2020 10:14:24 +0000 (12:14 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 29 May 2020 10:14:24 +0000 (12:14 +0200)
gcc 4.1 has problems with static initializers for anonymous unions.
Fix this by naming the union in struct hypfs_entry_leaf.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Jan Beulich <jbeulich@suse.com>
xen/common/hypfs.c
xen/include/xen/hypfs.h

index 9c2213a0682b887222b06df54c42e25ea4d219f8..a111c2f86d7eaea8eb38310ad06d4aefbbea9ccf 100644 (file)
@@ -126,7 +126,7 @@ int hypfs_add_leaf(struct hypfs_entry_dir *parent,
 {
     int ret;
 
-    if ( !leaf->content )
+    if ( !leaf->u.content )
         ret = -EINVAL;
     else
         ret = add_entry(parent, &leaf->e);
@@ -255,7 +255,7 @@ int hypfs_read_leaf(const struct hypfs_entry *entry,
 
     l = container_of(entry, const struct hypfs_entry_leaf, e);
 
-    return copy_to_guest(uaddr, l->content, entry->size) ? -EFAULT: 0;
+    return copy_to_guest(uaddr, l->u.content, entry->size) ? -EFAULT: 0;
 }
 
 static int hypfs_read(const struct hypfs_entry *entry,
@@ -317,7 +317,7 @@ int hypfs_write_leaf(struct hypfs_entry_leaf *leaf,
         goto out;
 
     ret = 0;
-    memcpy(leaf->write_ptr, buf, ulen);
+    memcpy(leaf->u.write_ptr, buf, ulen);
     leaf->e.size = ulen;
 
  out:
@@ -341,7 +341,7 @@ int hypfs_write_bool(struct hypfs_entry_leaf *leaf,
     if ( copy_from_guest(&buf, uaddr, ulen) )
         return -EFAULT;
 
-    *(bool *)leaf->write_ptr = buf;
+    *(bool *)leaf->u.write_ptr = buf;
 
     return 0;
 }
index 5c6a0ccece68639b4907d9f916b8a0855b057cdb..39845ec5ae9dcf238311bdb5c49824a95b32e790 100644 (file)
@@ -26,7 +26,7 @@ struct hypfs_entry_leaf {
     union {
         const void *content;
         void *write_ptr;
-    };
+    } u;
 };
 
 struct hypfs_entry_dir {
@@ -68,7 +68,7 @@ struct hypfs_entry_dir {
 static inline void hypfs_string_set_reference(struct hypfs_entry_leaf *leaf,
                                               const char *str)
 {
-    leaf->content = str;
+    leaf->u.content = str;
     leaf->e.size = strlen(str) + 1;
 }
 
@@ -81,7 +81,7 @@ static inline void hypfs_string_set_reference(struct hypfs_entry_leaf *leaf,
         .e.max_size = (wr) ? sizeof(contvar) : 0,        \
         .e.read = hypfs_read_leaf,                       \
         .e.write = (wr),                                 \
-        .content = &(contvar),                           \
+        .u.content = &(contvar),                         \
     }
 
 #define HYPFS_UINT_INIT(var, nam, contvar)                       \