WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XEN] Partial fix for compat build non-po

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Partial fix for compat build non-portability.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Jan 2007 13:30:09 -0800
Delivery-date: Wed, 10 Jan 2007 13:30:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Date 1168451814 0
# Node ID b61be7771104597b14a991f852799d0bc3d8e1b4
# Parent  aa127e545b7352c1923c99bf167fcd33716a690f
[XEN] Partial fix for compat build non-portability.

Signed-off-by: John Levon <john.levon@xxxxxxx>
---
 xen/include/Makefile             |   50 +++++++++++++++++++++------------------
 xen/tools/compat-build-header.py |   21 ++++++++++++++++
 xen/tools/compat-build-source.py |   27 +++++++++++++++++++++
 xen/tools/get-fields.sh          |   37 +++++++++++++++++-----------
 4 files changed, 97 insertions(+), 38 deletions(-)

diff -r aa127e545b73 -r b61be7771104 xen/include/Makefile
--- a/xen/include/Makefile      Wed Jan 10 17:26:58 2007 +0000
+++ b/xen/include/Makefile      Wed Jan 10 17:56:54 2007 +0000
@@ -2,8 +2,28 @@ ifneq ($(CONFIG_COMPAT),)
 
 compat-arch-$(CONFIG_X86) := x86_32
 
-headers-y                 := $(shell echo public/*.h | sed -e 
's,[^[:space:]]*-[^[:space:]]*,,g' -e 's,public/,compat/,g')
-headers-y                 := $(filter-out %/dom0_ops.h,$(headers-y))
+headers-y := \
+    compat/acm.h \
+    compat/acm_ops.h \
+    compat/callback.h \
+    compat/domctl.h \
+    compat/elfnote.h \
+    compat/event_channel.h \
+    compat/features.h \
+    compat/grant_table.h \
+    compat/kexec.h \
+    compat/memory.h \
+    compat/nmi.h \
+    compat/physdev.h \
+    compat/platform.h \
+    compat/sched.h \
+    compat/sysctl.h \
+    compat/trace.h \
+    compat/vcpu.h \
+    compat/version.h \
+    compat/xen.h \
+    compat/xencomm.h \
+    compat/xenoprof.h
 headers-$(CONFIG_X86)     += compat/arch-x86/xen.h
 headers-$(CONFIG_X86)     += compat/arch-x86/xen-$(compat-arch-y).h
 headers-y                 += compat/arch-$(compat-arch-y).h compat/xlat.h
@@ -21,24 +41,14 @@ all: $(headers-y)
 all: $(headers-y)
 
 compat/%.h: compat/%.i Makefile
-       id=_$$(echo $@ | sed 
'y,abcdefghijklmnopqrstuvwxyz-/.,ABCDEFGHIJKLMNOPQRSTUVWXYZ___,'); \
+       id=_$$(echo $@ | tr '[:lower:]-/.' '[:upper:]___'); \
        echo "#ifndef $$id" >$@.new; \
        echo "#define $$id" >>$@.new; \
        echo "#include <xen/compat.h>" >>$@.new; \
        $(if $(filter-out compat/arch-%.h,$@),echo "#include <$(patsubst 
compat/%,public/%,$@)>" >>$@.new;) \
        $(if $(prefix-y),echo "$(prefix-y)" >>$@.new;) \
-       grep -v '^# [[:digit:]]' $< | \
-       sed -e 's,__InClUdE__,#include,' \
-           -e 's,"xen-compat.h",<public/xen-compat.h>,' \
-           -e 
's,\(struct\|union\|enum\)[[:space:]]\+\(xen_\?\)\?\([[:alpha:]_]\),\1 
compat_\3,g' \
-           -e 's,@KeeP@,,g' \
-           -e 's,_t\([^[:alnum:]_]\|$$\),_compat_t\1,g' \
-           -e 's,\(8\|16\|32\|64\)_compat_t\([^[:alnum:]_]\|$$\),\1_t\2,g' \
-           -e 
's,\(^\|[^[:alnum:]_]\)xen_\?\([[:alnum:]_]*\)_compat_t\([^[:alnum:]_]\|$$\),\1compat_\2_t\3,g'
 \
-           -e 's,\(^\|[^[:alnum:]_]\)XEN_\?,\1COMPAT_,' \
-           -e 's,\(^\|[^[:alnum:]_]\)Xen_\?,\1Compat_,' \
-           -e 's,\(^\|[^[:alnum:]]\)long\([^[:alnum:]]\|$$\),\1int\2,g' | \
-       uniq >>$@.new; \
+       grep -v '^# [0-9]' $< | \
+       $(BASEDIR)/tools/compat-build-header.py | uniq >>$@.new; \
        $(if $(suffix-y),echo "$(suffix-y)" >>$@.new;) \
        echo "#endif /* $$id */" >>$@.new
        mv -f $@.new $@
@@ -49,17 +59,11 @@ compat/%.c: public/%.h xlat.lst Makefile
 compat/%.c: public/%.h xlat.lst Makefile
        mkdir -p $(@D)
        grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \
-       sed -e 's,^[[:space:]]*#[[:space:]]*include[[:space:]]\+,__InClUdE__ ,' 
\
-           -e 
's,^[[:space:]]*#[[:space:]]*define[[:space:]]\+\([[:upper:]_]*_GUEST_HANDLE\),#define
 HIDE_\1,' \
-           -e 
's,^[[:space:]]*#[[:space:]]*define[[:space:]]\+\([[:lower:]_]*_guest_handle\),#define
 hide_\1,' \
-           -e 's,XEN_GUEST_HANDLE\(_[[:xdigit:]]\+\)\?,COMPAT_HANDLE,g' \
-           $(foreach n,$(shell sed -n 
's,^[[:space:]]*?[[:space:]]\+\([[:alnum:]_]*\)[[:space:]].*,\1,p' xlat.lst), \
-                       -e 
's,\(struct\|union\)[[:space:]]\+\(xen_\?\)\?$n[[:space:]]\+\([[:alpha:]_]\),\1 
@KeeP@\2$n \3,g') \
-           >$@.new
+        $(BASEDIR)/tools/compat-build-source.py >$@.new
        mv -f $@.new $@
 
 compat/xlat.h: xlat.lst $(filter-out compat/xlat.h,$(headers-y)) 
$(BASEDIR)/tools/get-fields.sh Makefile
-       grep -v '^[[:space:]]*#' xlat.lst | \
+       grep -v '^[      ]*#' xlat.lst | \
        while read what name hdr; do \
                $(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name 
$$(echo compat/$$hdr | sed 's,@arch@,$(compat-arch-y),g') || exit $$?; \
        done >$@.new
diff -r aa127e545b73 -r b61be7771104 xen/tools/compat-build-header.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/tools/compat-build-header.py  Wed Jan 10 17:56:54 2007 +0000
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import re,sys
+
+pats = [
+ [ r"__InClUdE__", r"#include" ],
+ [ r"\"xen-compat.h\"", r"<public/xen-compat.h>" ],
+ [ r"(struct|union|enum)\s+(xen_?)?(\w)", r"\1 compat_\3" ],
+ [ r"@KeeP@", r"" ],
+ [ r"_t([^\w]|$)", r"_compat_t\1" ],
+ [ r"(8|16|32|64)_compat_t([^\w]|$)", r"\1_t\2" ],
+ [ r"(^|[^\w])xen_?(\w*)_compat_t([^\w]|$$)", r"\1compat_\2_t\3" ],
+ [ r"(^|[^\w])XEN_?", r"\1COMPAT_" ],
+ [ r"(^|[^\w])Xen_?", r"\1Compat_" ],
+ [ r"(^|[^\w])long([^\w]|$$)", r"\1int\2" ]
+];
+
+for line in sys.stdin.readlines():
+    for pat in pats:
+        line = re.subn(pat[0], pat[1], line)[0]
+    print line.rstrip()
diff -r aa127e545b73 -r b61be7771104 xen/tools/compat-build-source.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/tools/compat-build-source.py  Wed Jan 10 17:56:54 2007 +0000
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import re,sys
+
+pats = [
+ [ r"^\s*#\s*include\s+", r"__InClUdE__ " ],
+ [ r"^\s*#\s*define\s+([A-Z_]*_GUEST_HANDLE)", r"#define HIDE_\1" ],
+ [ r"^\s*#\s*define\s+([a-z_]*_guest_handle)", r"#define hide_\1" ],
+ [ r"XEN_GUEST_HANDLE(_[0-9A-Fa-f]+)?", r"COMPAT_HANDLE" ],
+];
+
+xlats = []
+
+xlatf = open('xlat.lst', 'r')
+for line in xlatf.readlines():
+    match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip())
+    if match[1]:
+        xlats.append(match[0])
+xlatf.close()
+
+for line in sys.stdin.readlines():
+    for pat in pats:
+        line = re.subn(pat[0], pat[1], line)[0]
+    for xlat in xlats:
+        line = re.subn(r"(struct|union)\s+(%s|xen_%s)\s+(\w)" % (xlat, xlat),
+            r"\1 @KeeP@\2 \3", line.rstrip())[0]
+    print line.rstrip()
diff -r aa127e545b73 -r b61be7771104 xen/tools/get-fields.sh
--- a/xen/tools/get-fields.sh   Wed Jan 10 17:26:58 2007 +0000
+++ b/xen/tools/get-fields.sh   Wed Jan 10 17:56:54 2007 +0000
@@ -1,6 +1,9 @@
-#!/bin/sh
+#!/bin/bash
 test -n "$1" -a -n "$2" -a -n "$3"
 set -ef
+
+SED=sed
+[ -x /usr/xpg4/bin/sed ] && SED=/usr/xpg4/bin/sed
 
 get_fields() {
        local level=1 aggr=0 name= fields=
@@ -90,11 +93,15 @@ handle_field() {
                then
                        echo -n "$1(_d_)->$3 = (_s_)->$3;"
                else
-                       echo -n "$1XLAT_${2}_HNDL_$(echo $3 | sed 
's,\.,_,g')(_d_, _s_);"
+                       echo -n "$1XLAT_${2}_HNDL_$(echo $3 | $SED 
's,\.,_,g')(_d_, _s_);"
                fi
-       elif [ -z "$(echo "$5" | sed 's,[^{}],,g')" ]
+       elif [ -z "$(echo "$5" | $SED 's,[^{}],,g')" ]
        then
-               local tag=$(echo "$5" | sed 
's,[[:space:]]*\(struct\|union\)[[:space:]]\+\(compat_\)\?\([[:alnum:]_]\+\)[[:space:]].*,\3,')
+               local tag=$(echo "$5" | python -c '
+import re,sys
+for line in sys.stdin.readlines():
+    print re.subn(r"\s*(struct|union)\s+(compat_)?(\w+)\s.*", r"\3", 
line)[0].rstrip()
+')
                echo " \\"
                echo -n "${1}XLAT_$tag(&(_d_)->$3, &(_s_)->$3);"
        else
@@ -110,7 +117,7 @@ handle_field() {
                                        if [ $kind = union ]
                                        then
                                                echo " \\"
-                                               echo -n "${1}switch ($(echo $3 
| sed 's,\.,_,g')) {"
+                                               echo -n "${1}switch ($(echo $3 
| $SED 's,\.,_,g')) {"
                                        fi
                                fi
                                ;;
@@ -158,12 +165,12 @@ handle_field() {
                                id=$token
                                ;;
                        [\,\;])
-                               if [ $level == 2 -a -n "$(echo $id | sed 
's,^_pad[[:digit:]]*,,')" ]
+                               if [ $level == 2 -a -n "$(echo $id | $SED 
's,^_pad[[:digit:]]*,,')" ]
                                then
                                        if [ $kind = union ]
                                        then
                                                echo " \\"
-                                               echo -n "${1}case 
XLAT_${2}_$(echo $3.$id | sed 's,\.,_,g'):"
+                                               echo -n "${1}case 
XLAT_${2}_$(echo $3.$id | $SED 's,\.,_,g'):"
                                                handle_field "$1    " $2 $3.$id 
"$type" "$fields"
                                        elif [ -z "$array" -a -z "$array_type" ]
                                        then
@@ -202,7 +209,7 @@ copy_array() {
 }
 
 handle_array() {
-       local i="i$(echo $4 | sed 's,[^;], ,g' | wc -w)"
+       local i="i$(echo $4 | $SED 's,[^;], ,g' | wc -w | $SED 
's,[[:space:]]*,,g')"
        echo " \\"
        echo "$1{ \\"
        echo "$1    unsigned int $i; \\"
@@ -272,7 +279,7 @@ build_body() {
                        fi
                        ;;
                [\,\;])
-                       if [ $level == 2 -a -n "$(echo $id | sed 
's,^_pad[[:digit:]]*,,')" ]
+                       if [ $level == 2 -a -n "$(echo $id | $SED 
's,^_pad[[:digit:]]*,,')" ]
                        then
                                if [ -z "$array" -a -z "$array_type" ]
                                then
@@ -300,10 +307,10 @@ build_body() {
 }
 
 check_field() {
-       if [ -z "$(echo "$4" | sed 's,[^{}],,g')" ]
+       if [ -z "$(echo "$4" | $SED 's,[^{}],,g')" ]
        then
                echo "; \\"
-               local n=$(echo $3 | sed 's,[^.], ,g' | wc -w)
+               local n=$(echo $3 | $SED 's,[^.], ,g' | wc -w | $SED 
's,[[:space:]]*,,g')
                if [ -n "$4" ]
                then
                        for n in $4
@@ -325,7 +332,7 @@ check_field() {
                then
                        echo -n "    CHECK_FIELD_($1, $2, $3)"
                else
-                       echo -n "    CHECK_SUBFIELD_${n}_($1, $2, $(echo $3 | 
sed 's!\.!, !g'))"
+                       echo -n "    CHECK_SUBFIELD_${n}_($1, $2, $(echo $3 | 
$SED 's!\.!, !g'))"
                fi
        else
                local level=1 fields= id= token
@@ -345,7 +352,7 @@ check_field() {
                                id=$token
                                ;;
                        [\,\;])
-                               if [ $level == 2 -a -n "$(echo $id | sed 
's,^_pad[[:digit:]]*,,')" ]
+                               if [ $level == 2 -a -n "$(echo $id | $SED 
's,^_pad[[:digit:]]*,,')" ]
                                then
                                        check_field $1 $2 $3.$id "$fields"
                                        test "$token" != ";" || fields= id=
@@ -390,7 +397,7 @@ build_check() {
                        test $level != 2 -o $arrlvl != 1 || id=$token
                        ;;
                [\,\;])
-                       if [ $level == 2 -a -n "$(echo $id | sed 
's,^_pad[[:digit:]]*,,')" ]
+                       if [ $level == 2 -a -n "$(echo $id | $SED 
's,^_pad[[:digit:]]*,,')" ]
                        then
                                check_field $kind $1 $id "$fields"
                                test "$token" != ";" || fields= id=
@@ -402,7 +409,7 @@ build_check() {
        echo ""
 }
 
-fields="$(get_fields $(echo $2 | sed 's,^compat_xen,compat_,') "$(sed -e 
's,^[[:space:]]#.*,,' -e 's!\([]\[,;:{}]\)! \1 !g' $3)")"
+fields="$(get_fields $(echo $2 | $SED 's,^compat_xen,compat_,') "$($SED -e 
's,^[[:space:]]#.*,,' -e 's!\([]\[,;:{}]\)! \1 !g' $3)")"
 if [ -z "$fields" ]
 then
        echo "Fields of '$2' not found in '$3'" >&2

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] Partial fix for compat build non-portability., Xen patchbot-unstable <=