[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Allow checker to support unions



   We ran into a problem on ia64 that checker doesn't support structures
containing unions.  This adds that support and changes the output format
to allow for longer structure names.  We've got both unions and a long
struct name in the ia64 tree, so these changes will get used next time
we merge.  Thanks,

        Alex

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---

diff -r 22c5695b7c73 xen/include/public/foreign/mkchecker.py
--- a/xen/include/public/foreign/mkchecker.py   Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/mkchecker.py   Fri May 11 10:23:36 2007 -0600
@@ -29,14 +29,14 @@ f.write('int main(int argc, char *argv[]
 f.write('int main(int argc, char *argv[])\n{\n');
 
 f.write('\tprintf("\\n");');
-f.write('printf("%-20s |", "structs");\n');
+f.write('printf("%-25s |", "structs");\n');
 for a in archs:
     f.write('\tprintf("%%8s", "%s");\n' % a);
 f.write('\tprintf("\\n");');
 
 f.write('\tprintf("\\n");');
 for struct in structs:
-    f.write('\tprintf("%%-20s |", "%s");\n' % struct);
+    f.write('\tprintf("%%-25s |", "%s");\n' % struct);
     for a in archs:
         if a == arch:
             s = struct; # native
diff -r 22c5695b7c73 xen/include/public/foreign/mkheader.py
--- a/xen/include/public/foreign/mkheader.py    Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/mkheader.py    Fri May 11 10:21:26 2007 -0600
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 import sys, re;
-from structs import structs, defines;
+from structs import unions, structs, defines;
 
 # command line arguments
 arch    = sys.argv[1];
@@ -110,6 +110,16 @@ input = re.compile("/\*(.*?)\*/", re.S).
 input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
 input = re.compile("\n\s*\n", re.S).sub("\n", input);
 
+# add unions to output
+for union in unions:
+    regex = "union\s+%s\s*\{(.*?)\n\};" % union;
+    match = re.search(regex, input, re.S)
+    if None == match:
+        output += "#define %s_has_no_%s 1\n" % (arch, union);
+    else:
+        output += "union %s_%s {%s\n};\n" % (union, arch, match.group(1));
+    output += "\n";
+
 # add structs to output
 for struct in structs:
     regex = "struct\s+%s\s*\{(.*?)\n\};" % struct;
@@ -135,6 +145,10 @@ for define in defines:
         replace = define + "_" + arch;
     output = re.sub("\\b%s\\b" % define, replace, output);
 
+# replace: unions
+for union in unions:
+    output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
+
 # replace: structs + struct typedefs
 for struct in structs:
     output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);
diff -r 22c5695b7c73 xen/include/public/foreign/reference.size
--- a/xen/include/public/foreign/reference.size Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/reference.size Fri May 11 10:25:48 2007 -0600
@@ -1,17 +1,17 @@
 
-structs              |  x86_32  x86_64    ia64
+structs                   |  x86_32  x86_64    ia64
 
-start_info           |    1104    1152    1152
-trap_info            |       8      16       -
-pt_fpreg             |       -       -      16
-cpu_user_regs        |      68     200     496
-xen_ia64_boot_param  |       -       -      96
-ia64_tr_entry        |       -       -      32
-vcpu_extra_regs      |       -       -     536
-vcpu_guest_context   |    2800    5168    1056
-arch_vcpu_info       |      24      16       0
-vcpu_time_info       |      32      32      32
-vcpu_info            |      64      64      48
-arch_shared_info     |     268     280     272
-shared_info          |    2584    3368    4384
+start_info                |    1104    1152    1152
+trap_info                 |       8      16       -
+pt_fpreg                  |       -       -      16
+cpu_user_regs             |      68     200     496
+xen_ia64_boot_param       |       -       -      96
+ia64_tr_entry             |       -       -      32
+vcpu_extra_regs           |       -       -     536
+vcpu_guest_context        |    2800    5168    1056
+arch_vcpu_info            |      24      16       0
+vcpu_time_info            |      32      32      32
+vcpu_info                 |      64      64      48
+arch_shared_info          |     268     280     272
+shared_info               |    2584    3368    4384
 
diff -r 22c5695b7c73 xen/include/public/foreign/structs.py
--- a/xen/include/public/foreign/structs.py     Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/structs.py     Fri May 11 10:22:34 2007 -0600
@@ -1,4 +1,6 @@
 # configuration: what needs translation
+
+unions  = [ ];
 
 structs = [ "start_info",
             "trap_info",



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.