Skip to contentSkip to conversation

convert inline alloc_domheap_pages to static inline

PATCH New S.Çağlar Onur 1 participant 1 message Mar 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 convert inline alloc_domheap_pages to static inline

Hi;

GCC manual says it is best to use static inline to guarantee compatibility, and with gcc-4.2.0 RC1 xen fails to compile like following;

make[3]: Entering directory `/home/caglar/svn/xen-3.0.4-testing.hg/xen/common'
gcc -O2 -fomit-frame-pointer -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -iwithprefix
include -Werror -Wno-pointer-arith -pipe -I/home/caglar/svn/xen-3.0.4-testing.hg/xen/include -I/home/caglar/svn/xen-3.0.4-testing.hg/xen/include/asm-x86/mach-generic -I/home/caglar/svn/xen-3.0.4-testing.hg/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -g -D__XEN__ -c page_alloc.c -o page_alloc.o
cc1: warnings being treated as errors
page_alloc.c:744: warning: C99 inline functions are not supported; using GNU89
page_alloc.c:744: warning: to disable this warning use -fgnu89-inline or the
gnu_inline function attribute

*** 2 errors, 0 warnings
make[3]: *** [page_alloc.o] Error 1
make[3]: Leaving directory `/home/caglar/svn/xen-3.0.4-testing.hg/xen/common' make[2]: *** [/home/caglar/svn/xen-3.0.4-testing.hg/xen/common/built_in.o] Error 2
make[2]: Leaving directory `/home/caglar/svn/xen-3.0.4-testing.hg/xen/arch/x86'
make[1]: *** [/home/caglar/svn/xen-3.0.4-testing.hg/xen/xen] Error 2 make[1]: Leaving directory `/home/caglar/svn/xen-3.0.4-testing.hg/xen'
make: *** [build] Error 2

This problem introduced by that [1] patch and as patch stated gcc changing its default behaviour.

Following patch (against xen-3.0.4-testing) converts inline alloc_domheap_pages to static inline.

xen/common/page_alloc.c +0 -6
diff -r 3341afbb1953 xen/common/page_alloc.c
@@ -739,12 +739,6 @@ struct page_info *__alloc_domheap_pages(
     return pg;
 }
 
-inline struct page_info *alloc_domheap_pages(
-    struct domain *d, unsigned int order, unsigned int flags)
-{
-    return __alloc_domheap_pages(d, smp_processor_id(), order, flags);
-}
-
 void free_domheap_pages(struct page_info *pg, unsigned int order)
 {
     int            i, drop_dom_ref;
xen/include/xen/mm.h +6 -2
diff -r 3341afbb1953 xen/include/xen/mm.h
@@ -32,6 +32,7 @@
 #include <xen/types.h>
 #include <xen/list.h>
 #include <xen/spinlock.h>
+#include <xen/smp.h>
 
 struct domain;
 struct page_info;
@@ -61,11 +62,14 @@ void free_xenheap_pages(void *v, unsigne
 
 /* Domain suballocator. These functions are *not* interrupt-safe.*/
 void init_domheap_pages(paddr_t ps, paddr_t pe);
-struct page_info *alloc_domheap_pages(
-    struct domain *d, unsigned int order, unsigned int memflags);
 struct page_info *__alloc_domheap_pages(
     struct domain *d, unsigned int cpu, unsigned int order, 
     unsigned int memflags);
+static inline struct page_info *alloc_domheap_pages(
+    struct domain *d, unsigned int order, unsigned int memflags)
+{
+    return __alloc_domheap_pages( d, smp_processor_id(), order, memflags );
+}
 void free_domheap_pages(struct page_info *pg, unsigned int order);
 unsigned long avail_domheap_pages(void);
 unsigned long avail_heap_pages(int zone, int node);

[1] http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00702.html

Cheers

Signature · 4 lines
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!

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