Skip to contentSkip to conversation

Fix 'contents' field of set structures in libxen iinterface

PATCH In review Jim Fehlig 2 participants 2 messages Nov 4, 2006 – Nov 8, 2006

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

PATCH 1/1 Fix 'contents' field of set structures in libxen iinterface

Many of the set structures in the libxen interface contain a 'contents' field with too many dimensions, particularly when 'contents' stores references. References are defined in the various xen_*_decl.h headers as 'void *'. Sets of the various classes are defined for example as

typedef void *xen_vm;

typedef struct xen_vm_set

 {
    size_t size;
    xen_vm *contents[];

} xen_vm_set;

The additional dimension on 'contents' for sets of references is not required.

- Jim

# HG changeset patch
# User [email protected]
# Date 1162600035 25200
# Node ID 1db6537014fea7042b5b5be0031d1a74ec0f6581
# Parent 20204db0891b0b7c10959822e3283656c3600500
Many of the xen_*_set structures in the libxen interface contain a 'contents' field with too many dimensions, particularly when 'contents' stores references.

tools/libxen/include/xen_host_cpu.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_host_cpu.h
@@ -43,7 +43,7 @@ typedef struct xen_host_cpu_set
 typedef struct xen_host_cpu_set
 {
     size_t size;
-    xen_host_cpu *contents[];
+    xen_host_cpu contents[];
 } xen_host_cpu_set;
 
 /**
tools/libxen/include/xen_network.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_network.h
@@ -43,7 +43,7 @@ typedef struct xen_network_set
 typedef struct xen_network_set
 {
     size_t size;
-    xen_network *contents[];
+    xen_network contents[];
 } xen_network_set;
 
 /**
tools/libxen/include/xen_pif.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_pif.h
@@ -44,7 +44,7 @@ typedef struct xen_pif_set
 typedef struct xen_pif_set
 {
     size_t size;
-    xen_pif *contents[];
+    xen_pif contents[];
 } xen_pif_set;
 
 /**
tools/libxen/include/xen_sr.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_sr.h
@@ -42,7 +42,7 @@ typedef struct xen_sr_set
 typedef struct xen_sr_set
 {
     size_t size;
-    xen_sr *contents[];
+    xen_sr contents[];
 } xen_sr_set;
 
 /**
tools/libxen/include/xen_user.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_user.h
@@ -41,7 +41,7 @@ typedef struct xen_user_set
 typedef struct xen_user_set
 {
     size_t size;
-    xen_user *contents[];
+    xen_user contents[];
 } xen_user_set;
 
 /**
tools/libxen/include/xen_vbd.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_vbd.h
@@ -45,7 +45,7 @@ typedef struct xen_vbd_set
 typedef struct xen_vbd_set
 {
     size_t size;
-    xen_vbd *contents[];
+    xen_vbd contents[];
 } xen_vbd_set;
 
 /**
tools/libxen/include/xen_vdi.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_vdi.h
@@ -44,7 +44,7 @@ typedef struct xen_vdi_set
 typedef struct xen_vdi_set
 {
     size_t size;
-    xen_vdi *contents[];
+    xen_vdi contents[];
 } xen_vdi_set;
 
 /**
tools/libxen/include/xen_vif.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_vif.h
@@ -44,7 +44,7 @@ typedef struct xen_vif_set
 typedef struct xen_vif_set
 {
     size_t size;
-    xen_vif *contents[];
+    xen_vif contents[];
 } xen_vif_set;
 
 /**
tools/libxen/include/xen_vm.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_vm.h
@@ -52,7 +52,7 @@ typedef struct xen_vm_set
 typedef struct xen_vm_set
 {
     size_t size;
-    xen_vm *contents[];
+    xen_vm contents[];
 } xen_vm_set;
 
 /**
tools/libxen/include/xen_vtpm.h +1 -1
diff -r 20204db0891b -r 1db6537014fe tools/libxen/include/xen_vtpm.h
@@ -44,7 +44,7 @@ typedef struct xen_vtpm_set
 typedef struct xen_vtpm_set
 {
     size_t size;
-    xen_vtpm *contents[];
+    xen_vtpm contents[];
 } xen_vtpm_set;
 
 /**

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 7 lines · Jim Fehlig

Many of the set structures in the libxen interface contain a 'contents' field with too many dimensions, particularly when 'contents' stores references. References are defined in the various xen_*_decl.h headers as 'void *'. Sets of the various classes are defined for example as

typedef void *xen_vm;

Quoted 9 lines

typedef struct xen_vm_set

 {
    size_t size;
    xen_vm *contents[];

} xen_vm_set;

The additional dimension on 'contents' for sets of references is not required.

I meant to discuss this with you when you sent this privately a few weeks ago -- sorry I forgot.

I can see what you're trying to do here. The problem is that populating this set becomes difficult. The sets are read off the wire using the generic code in xen_common.c, guided by the abstract_type that's passed in. The thing is, we have only one indicator for sets (SET) but with your patch we'll need to introduce a second indicator, to distinguish between sets where the value is put in place (like handles) and sets where the value placed is a pointer (like sets of records). This will have to be part of a larger patch, unfortunately. I'll have a hack now and see what I can do.

Cheers,

Ewan.