From: Alex Williamson <alex.williamson@hp.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: xen-ia64-devel <xen-ia64-devel@lists.xensource.com>
Subject: [PATCH] Allow checker to support unions
Date: Fri, 11 May 2007 10:34:48 -0600 [thread overview]
Message-ID: <1178901288.6463.4.camel@lappy> (raw)
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@hp.com>
---
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",
reply other threads:[~2007-05-11 16:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1178901288.6463.4.camel@lappy \
--to=alex.williamson@hp.com \
--cc=xen-devel@lists.xensource.com \
--cc=xen-ia64-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.