* Broken external module build on 2.6.23
@ 2008-02-04 21:01 Chris Lalancette
[not found] ` <47A77D2B.90902-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Chris Lalancette @ 2008-02-04 21:01 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Hello,
The merge with upstream changeset: af5ca3f4ec5cc4432a42a73b050dd8898ce8fd00
broke building an external module against 2.6.23:
CC [M] /root/kvm-userspace/kernel/kvm_main.o
/root/kvm-userspace/kernel/kvm_main.c:1271: error: unknown field ‘name’
specified in initializer
Which makes sense, since the .name parameter doesn't exist pre-2.6.24. I've
been trying to think of a way to work around it in external-module-compat.h, but
have so far been unsuccessful. Does anyone have any good ideas?
Chris Lalancette
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 7+ messages in thread[parent not found: <47A77D2B.90902-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: Broken external module build on 2.6.23 [not found] ` <47A77D2B.90902-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2008-02-05 23:15 ` Andrea Arcangeli 2008-02-11 8:14 ` Avi Kivity 0 siblings, 1 reply; 7+ messages in thread From: Andrea Arcangeli @ 2008-02-05 23:15 UTC (permalink / raw) To: Chris Lalancette; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f On Mon, Feb 04, 2008 at 04:01:31PM -0500, Chris Lalancette wrote: > Hello, > The merge with upstream changeset: af5ca3f4ec5cc4432a42a73b050dd8898ce8fd00 > broke building an external module against 2.6.23: > > CC [M] /root/kvm-userspace/kernel/kvm_main.o > /root/kvm-userspace/kernel/kvm_main.c:1271: error: unknown field ‘name’ > specified in initializer > > Which makes sense, since the .name parameter doesn't exist pre-2.6.24. I've > been trying to think of a way to work around it in external-module-compat.h, but > have so far been unsuccessful. Does anyone have any good ideas? This will solve it: Signed-off-by: Andrea Arcangeli <andrea@qumranet.com> --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1267,7 +1279,11 @@ static int kvm_resume(struct sys_device *dev) } static struct sysdev_class kvm_sysdev_class = { +#ifdef set_kset_name + set_kset_name("kvm"), +#else .name = "kvm", +#endif .suspend = kvm_suspend, .resume = kvm_resume, }; The major breakage with the external module isn't the above, but the fact when kvm_host.h and friends were added to mainline, the external module build miscompiles and crashes if you're not in full sync with the headers of kvm.git and the kernel that you compile against. I posted a patch already but it was only a band aid and it didn't make it more robust. I'm perfectly fine with a compile error, but I don't want to risk miscompiles if somebody changes the order of the #include or adds some more #include, again. The below patch should be much more robust. The empty files that I removed can be placed later in a include-compat directory and an -I`pwd`/include-compat can be added after -I`pwd`/include, if they're still needed. This way it's always safe to build against any new kernel source. So I recommend you use this too even if it shouldn't be needed with 2.6.23 because 2.6.23 is still old enough and it misses kvm_host.h etc... (my miscompile troubles stared with 2.6.24) Signed-off-by: Andrea Arcangeli <andrea@qumranet.com> diff --git a/kernel/Makefile b/kernel/Makefile index 7a435b5..faec72b 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -25,7 +25,9 @@ hack = $(call _hack,tmp/$(strip $1)) unifdef = $(call _unifdef,tmp/$(strip $1)) all:: - $(MAKE) -C $(KERNELDIR) M=`pwd` "$$@" + $(MAKE) -C $(KERNELDIR) M=`pwd` \ + LINUXINCLUDE="-I`pwd`/include -Iinclude -include include/linux/autoconf.h" \ + "$$@" sync: rm -rf tmp diff --git a/kernel/include/asm-x86/cmpxchg.h b/kernel/include/asm-x86/cmpxchg.h deleted file mode 100644 index 4258b93..0000000 --- a/kernel/include/asm-x86/cmpxchg.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Empty file to satisfy #include <linux/cmpxchg.h> for older kernels. - */ - - diff --git a/kernel/include/linux/anon_inodes.h b/kernel/include/linux/anon_inodes.h deleted file mode 100644 index b2e1ba3..0000000 --- a/kernel/include/linux/anon_inodes.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * include/linux/anon_inodes.h - * - * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> - * - */ - -#ifndef _LINUX_ANON_INODES_H -#define _LINUX_ANON_INODES_H - -int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, - const char *name, const struct file_operations *fops, - void *priv); - -#endif /* _LINUX_ANON_INODES_H */ - diff --git a/kernel/include/linux/magic.h b/kernel/include/linux/magic.h deleted file mode 100644 index a9c6567..0000000 --- a/kernel/include/linux/magic.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __LINUX_MAGIC_H__ -#define __LINUX_MAGIC_H__ - -#define ADFS_SUPER_MAGIC 0xadf5 -#define AFFS_SUPER_MAGIC 0xadff -#define AFS_SUPER_MAGIC 0x5346414F -#define AUTOFS_SUPER_MAGIC 0x0187 -#define CODA_SUPER_MAGIC 0x73757245 -#define EFS_SUPER_MAGIC 0x414A53 -#define EXT2_SUPER_MAGIC 0xEF53 -#define EXT3_SUPER_MAGIC 0xEF53 -#define EXT4_SUPER_MAGIC 0xEF53 -#define HPFS_SUPER_MAGIC 0xf995e849 -#define ISOFS_SUPER_MAGIC 0x9660 -#define JFFS2_SUPER_MAGIC 0x72b6 -#define KVMFS_SUPER_MAGIC 0x19700426 - -#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ -#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ -#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ -#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ -#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ - -#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ -#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ -#define NFS_SUPER_MAGIC 0x6969 -#define OPENPROM_SUPER_MAGIC 0x9fa1 -#define PROC_SUPER_MAGIC 0x9fa0 -#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ - -#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ - /* used by file system utilities that - look at the superblock, etc. */ -#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" -#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" -#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" - -#define SMB_SUPER_MAGIC 0x517B -#define USBDEVICE_SUPER_MAGIC 0x9fa2 - -#endif /* __LINUX_MAGIC_H__ */ diff --git a/kernel/include/linux/mutex.h b/kernel/include/linux/mutex.h deleted file mode 100644 index 71b2ae1..0000000 --- a/kernel/include/linux/mutex.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Empty file to satisfy #include <linux/mutex.h> for older kernels. - */ - - ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Broken external module build on 2.6.23 2008-02-05 23:15 ` Andrea Arcangeli @ 2008-02-11 8:14 ` Avi Kivity 2008-02-11 11:19 ` Andrea Arcangeli 0 siblings, 1 reply; 7+ messages in thread From: Avi Kivity @ 2008-02-11 8:14 UTC (permalink / raw) To: Andrea Arcangeli; +Cc: kvm-devel, Chris Lalancette Andrea Arcangeli wrote: > On Mon, Feb 04, 2008 at 04:01:31PM -0500, Chris Lalancette wrote: > >> Hello, >> The merge with upstream changeset: af5ca3f4ec5cc4432a42a73b050dd8898ce8fd00 >> broke building an external module against 2.6.23: >> >> CC [M] /root/kvm-userspace/kernel/kvm_main.o >> /root/kvm-userspace/kernel/kvm_main.c:1271: error: unknown field ‘name’ >> specified in initializer >> >> Which makes sense, since the .name parameter doesn't exist pre-2.6.24. I've >> been trying to think of a way to work around it in external-module-compat.h, but >> have so far been unsuccessful. Does anyone have any good ideas? >> > > This will solve it: > > Signed-off-by: Andrea Arcangeli <andrea@qumranet.com> > > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -1267,7 +1279,11 @@ static int kvm_resume(struct sys_device *dev) > } > > static struct sysdev_class kvm_sysdev_class = { > +#ifdef set_kset_name > + set_kset_name("kvm"), > +#else > .name = "kvm", > +#endif > .suspend = kvm_suspend, > .resume = kvm_resume, > }; > > > I fixed it in a different way (in hack-module.awk) as I don't like compatibility stuff in mainline. > diff --git a/kernel/include/asm-x86/cmpxchg.h b/kernel/include/asm-x86/cmpxchg.h > deleted file mode 100644 > index 4258b93..0000000 > --- a/kernel/include/asm-x86/cmpxchg.h > +++ /dev/null > @@ -1,5 +0,0 @@ > -/* > - * Empty file to satisfy #include <linux/cmpxchg.h> for older kernels. > - */ > - > - > What happens if you compile kvm against a kernel that doesn't have linux/cmpxchg.h? > diff --git a/kernel/include/linux/anon_inodes.h b/kernel/include/linux/anon_inodes.h > deleted file mode 100644 > index b2e1ba3..0000000 > --- a/kernel/include/linux/anon_inodes.h > +++ /dev/null > @@ -1,16 +0,0 @@ > -/* > - * include/linux/anon_inodes.h > - * > - * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> > - * > - */ > Or linux/anon_inodes.h? etc. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broken external module build on 2.6.23 2008-02-11 8:14 ` Avi Kivity @ 2008-02-11 11:19 ` Andrea Arcangeli 2008-02-11 11:26 ` Andrea Arcangeli 2008-02-11 12:24 ` Avi Kivity 0 siblings, 2 replies; 7+ messages in thread From: Andrea Arcangeli @ 2008-02-11 11:19 UTC (permalink / raw) To: Avi Kivity; +Cc: kvm-devel, Chris Lalancette On Mon, Feb 11, 2008 at 10:14:56AM +0200, Avi Kivity wrote: > What happens if you compile kvm against a kernel that doesn't have > linux/cmpxchg.h? > >> diff --git a/kernel/include/linux/anon_inodes.h >> b/kernel/include/linux/anon_inodes.h >> deleted file mode 100644 >> index b2e1ba3..0000000 >> --- a/kernel/include/linux/anon_inodes.h >> +++ /dev/null >> @@ -1,16 +0,0 @@ >> -/* >> - * include/linux/anon_inodes.h >> - * >> - * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> >> - * >> - */ >> > > Or linux/anon_inodes.h? etc. Yes, the patch wasn't complete, it was primarily to show the idea to remove the fragile dependency on exact #include order in the headers. If the only trouble is the lack of build for older kernels I guess I can proceed to add that last bit. Those compat files for old kernels should be added to a brand new include-compat directory instead of being mixed with the kvm headers and -Iinclude-compat can be added at the end of the LINUXINCLUDES definition. $LINUX kvm headers should be included before the $KERNELDIR headers, and include-compat should be included after the $KERNELDIR headers. I created a more complete patch below, this will solve all my silent time-wasting miscompilations (currnently when building kvm.git on a newer mainline kernels, certain kvm*.h $KERNELDIR headers are included instead of my modified ones in $LINUX, so the build can crash if $LINUX and $KERNELDIR don't have the kvm*.h headers in sync) and this below patch will retain compatibility with older kernels too. If patch doesn't wipe kernel/include you can follow it with a rm -r kernel/include. I verified libkvm already gives more priority to whatever is in kernel/include and only if kernel/include are missing it uses the kvm.h in /usr/include/linux/kvm.h (I filled all my /usr/src and /usr/include headers with #error "x" to be sure... along with running gcc -E and checking the cpp work). Signed-off-by: Andrea Arcangeli <andrea@qumranet.com> diff -urN 1/kernel/include/asm-x86/cmpxchg.h 2/kernel/include/asm-x86/cmpxchg.h --- 1/kernel/include/asm-x86/cmpxchg.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/asm-x86/cmpxchg.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -/* - * Empty file to satisfy #include <linux/cmpxchg.h> for older kernels. - */ - - diff -urN 1/kernel/include/linux/anon_inodes.h 2/kernel/include/linux/anon_inodes.h --- 1/kernel/include/linux/anon_inodes.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/linux/anon_inodes.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -/* - * include/linux/anon_inodes.h - * - * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> - * - */ - -#ifndef _LINUX_ANON_INODES_H -#define _LINUX_ANON_INODES_H - -int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, - const char *name, const struct file_operations *fops, - void *priv); - -#endif /* _LINUX_ANON_INODES_H */ - diff -urN 1/kernel/include/linux/magic.h 2/kernel/include/linux/magic.h --- 1/kernel/include/linux/magic.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/linux/magic.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -#ifndef __LINUX_MAGIC_H__ -#define __LINUX_MAGIC_H__ - -#define ADFS_SUPER_MAGIC 0xadf5 -#define AFFS_SUPER_MAGIC 0xadff -#define AFS_SUPER_MAGIC 0x5346414F -#define AUTOFS_SUPER_MAGIC 0x0187 -#define CODA_SUPER_MAGIC 0x73757245 -#define EFS_SUPER_MAGIC 0x414A53 -#define EXT2_SUPER_MAGIC 0xEF53 -#define EXT3_SUPER_MAGIC 0xEF53 -#define EXT4_SUPER_MAGIC 0xEF53 -#define HPFS_SUPER_MAGIC 0xf995e849 -#define ISOFS_SUPER_MAGIC 0x9660 -#define JFFS2_SUPER_MAGIC 0x72b6 -#define KVMFS_SUPER_MAGIC 0x19700426 - -#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ -#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ -#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ -#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ -#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ - -#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ -#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ -#define NFS_SUPER_MAGIC 0x6969 -#define OPENPROM_SUPER_MAGIC 0x9fa1 -#define PROC_SUPER_MAGIC 0x9fa0 -#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ - -#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ - /* used by file system utilities that - look at the superblock, etc. */ -#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" -#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" -#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" - -#define SMB_SUPER_MAGIC 0x517B -#define USBDEVICE_SUPER_MAGIC 0x9fa2 - -#endif /* __LINUX_MAGIC_H__ */ diff -urN 1/kernel/include/linux/mutex.h 2/kernel/include/linux/mutex.h --- 1/kernel/include/linux/mutex.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/linux/mutex.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -/* - * Empty file to satisfy #include <linux/mutex.h> for older kernels. - */ - - diff -urN 1/kernel/include-compat/asm-x86/cmpxchg.h 2/kernel/include-compat/asm-x86/cmpxchg.h --- 1/kernel/include-compat/asm-x86/cmpxchg.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/asm-x86/cmpxchg.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,5 @@ +/* + * Empty file to satisfy #include <linux/cmpxchg.h> for older kernels. + */ + + diff -urN 1/kernel/include-compat/linux/anon_inodes.h 2/kernel/include-compat/linux/anon_inodes.h --- 1/kernel/include-compat/linux/anon_inodes.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/linux/anon_inodes.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,16 @@ +/* + * include/linux/anon_inodes.h + * + * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> + * + */ + +#ifndef _LINUX_ANON_INODES_H +#define _LINUX_ANON_INODES_H + +int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, + const char *name, const struct file_operations *fops, + void *priv); + +#endif /* _LINUX_ANON_INODES_H */ + diff -urN 1/kernel/include-compat/linux/magic.h 2/kernel/include-compat/linux/magic.h --- 1/kernel/include-compat/linux/magic.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/linux/magic.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,41 @@ +#ifndef __LINUX_MAGIC_H__ +#define __LINUX_MAGIC_H__ + +#define ADFS_SUPER_MAGIC 0xadf5 +#define AFFS_SUPER_MAGIC 0xadff +#define AFS_SUPER_MAGIC 0x5346414F +#define AUTOFS_SUPER_MAGIC 0x0187 +#define CODA_SUPER_MAGIC 0x73757245 +#define EFS_SUPER_MAGIC 0x414A53 +#define EXT2_SUPER_MAGIC 0xEF53 +#define EXT3_SUPER_MAGIC 0xEF53 +#define EXT4_SUPER_MAGIC 0xEF53 +#define HPFS_SUPER_MAGIC 0xf995e849 +#define ISOFS_SUPER_MAGIC 0x9660 +#define JFFS2_SUPER_MAGIC 0x72b6 +#define KVMFS_SUPER_MAGIC 0x19700426 + +#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ +#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ +#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ + +#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ +#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ +#define NFS_SUPER_MAGIC 0x6969 +#define OPENPROM_SUPER_MAGIC 0x9fa1 +#define PROC_SUPER_MAGIC 0x9fa0 +#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ + +#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ + /* used by file system utilities that + look at the superblock, etc. */ +#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" +#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" +#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" + +#define SMB_SUPER_MAGIC 0x517B +#define USBDEVICE_SUPER_MAGIC 0x9fa2 + +#endif /* __LINUX_MAGIC_H__ */ diff -urN 1/kernel/include-compat/linux/mutex.h 2/kernel/include-compat/linux/mutex.h --- 1/kernel/include-compat/linux/mutex.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/linux/mutex.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,5 @@ +/* + * Empty file to satisfy #include <linux/mutex.h> for older kernels. + */ + + diff --git a/kernel/external-module-compat.h b/kernel/external-module-compat.h index 052d561..ae69799 100644 --- a/kernel/external-module-compat.h +++ b/kernel/external-module-compat.h @@ -10,8 +10,8 @@ #include <linux/compiler.h> #include <linux/version.h> #include <linux/string.h> -#include "include/linux/kvm.h" -#include "include/linux/kvm_para.h" +#include <include/linux/kvm.h> +#include <include/linux/kvm_para.h> #include <linux/cpu.h> #include <asm/processor.h> #include <linux/hrtimer.h> diff --git a/kernel/Makefile b/kernel/Makefile index 7a435b5..0ee55a0 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -25,17 +25,21 @@ hack = $(call _hack,tmp/$(strip $1)) unifdef = $(call _unifdef,tmp/$(strip $1)) all:: - $(MAKE) -C $(KERNELDIR) M=`pwd` "$$@" + # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat + $(MAKE) -C $(KERNELDIR) M=`pwd` \ + LINUXINCLUDE="-I`pwd`/include -Iinclude -Iinclude-compat \ + -include include/linux/autoconf.h" \ + "$$@" sync: - rm -rf tmp + rm -rf tmp include rsync --exclude='*.mod.c' -R \ "$(LINUX)"/arch/x86/kvm/./*.[ch] \ "$(LINUX)"/virt/kvm/./*.[ch] \ "$(LINUX)"/./include/linux/kvm*.h \ "$(LINUX)"/./include/asm-x86/kvm*.h \ tmp/ - rm -rf include/asm + mkdir -p include/linux include/asm-x86 ln -s asm-x86 include/asm $(call unifdef, include/linux/kvm.h) @@ -78,6 +82,7 @@ rpm: all clean: $(MAKE) -C $(KERNELDIR) M=`pwd` $@ + rm -rf include svnclean: svn st | grep '^\?' | awk '{print $2}' | xargs rm -rf ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Broken external module build on 2.6.23 2008-02-11 11:19 ` Andrea Arcangeli @ 2008-02-11 11:26 ` Andrea Arcangeli 2008-02-11 12:24 ` Avi Kivity 1 sibling, 0 replies; 7+ messages in thread From: Andrea Arcangeli @ 2008-02-11 11:26 UTC (permalink / raw) To: Avi Kivity; +Cc: kvm-devel, Chris Lalancette On Mon, Feb 11, 2008 at 12:19:44PM +0100, Andrea Arcangeli wrote: > + LINUXINCLUDE="-I`pwd`/include -Iinclude -Iinclude-compat \ woops, here the last version: Signed-off-by: Andrea Arcangeli <andrea@qumranet.com> diff -urN 1/kernel/include/asm-x86/cmpxchg.h 2/kernel/include/asm-x86/cmpxchg.h --- 1/kernel/include/asm-x86/cmpxchg.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/asm-x86/cmpxchg.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -/* - * Empty file to satisfy #include <linux/cmpxchg.h> for older kernels. - */ - - diff -urN 1/kernel/include/linux/anon_inodes.h 2/kernel/include/linux/anon_inodes.h --- 1/kernel/include/linux/anon_inodes.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/linux/anon_inodes.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -/* - * include/linux/anon_inodes.h - * - * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> - * - */ - -#ifndef _LINUX_ANON_INODES_H -#define _LINUX_ANON_INODES_H - -int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, - const char *name, const struct file_operations *fops, - void *priv); - -#endif /* _LINUX_ANON_INODES_H */ - diff -urN 1/kernel/include/linux/magic.h 2/kernel/include/linux/magic.h --- 1/kernel/include/linux/magic.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/linux/magic.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -#ifndef __LINUX_MAGIC_H__ -#define __LINUX_MAGIC_H__ - -#define ADFS_SUPER_MAGIC 0xadf5 -#define AFFS_SUPER_MAGIC 0xadff -#define AFS_SUPER_MAGIC 0x5346414F -#define AUTOFS_SUPER_MAGIC 0x0187 -#define CODA_SUPER_MAGIC 0x73757245 -#define EFS_SUPER_MAGIC 0x414A53 -#define EXT2_SUPER_MAGIC 0xEF53 -#define EXT3_SUPER_MAGIC 0xEF53 -#define EXT4_SUPER_MAGIC 0xEF53 -#define HPFS_SUPER_MAGIC 0xf995e849 -#define ISOFS_SUPER_MAGIC 0x9660 -#define JFFS2_SUPER_MAGIC 0x72b6 -#define KVMFS_SUPER_MAGIC 0x19700426 - -#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ -#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ -#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ -#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ -#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ - -#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ -#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ -#define NFS_SUPER_MAGIC 0x6969 -#define OPENPROM_SUPER_MAGIC 0x9fa1 -#define PROC_SUPER_MAGIC 0x9fa0 -#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ - -#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ - /* used by file system utilities that - look at the superblock, etc. */ -#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" -#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" -#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" - -#define SMB_SUPER_MAGIC 0x517B -#define USBDEVICE_SUPER_MAGIC 0x9fa2 - -#endif /* __LINUX_MAGIC_H__ */ diff -urN 1/kernel/include/linux/mutex.h 2/kernel/include/linux/mutex.h --- 1/kernel/include/linux/mutex.h 2008-02-11 12:00:19.000000000 +0100 +++ 2/kernel/include/linux/mutex.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -/* - * Empty file to satisfy #include <linux/mutex.h> for older kernels. - */ - - diff -urN 1/kernel/include-compat/asm-x86/cmpxchg.h 2/kernel/include-compat/asm-x86/cmpxchg.h --- 1/kernel/include-compat/asm-x86/cmpxchg.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/asm-x86/cmpxchg.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,5 @@ +/* + * Empty file to satisfy #include <linux/cmpxchg.h> for older kernels. + */ + + diff -urN 1/kernel/include-compat/linux/anon_inodes.h 2/kernel/include-compat/linux/anon_inodes.h --- 1/kernel/include-compat/linux/anon_inodes.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/linux/anon_inodes.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,16 @@ +/* + * include/linux/anon_inodes.h + * + * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> + * + */ + +#ifndef _LINUX_ANON_INODES_H +#define _LINUX_ANON_INODES_H + +int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, + const char *name, const struct file_operations *fops, + void *priv); + +#endif /* _LINUX_ANON_INODES_H */ + diff -urN 1/kernel/include-compat/linux/magic.h 2/kernel/include-compat/linux/magic.h --- 1/kernel/include-compat/linux/magic.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/linux/magic.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,41 @@ +#ifndef __LINUX_MAGIC_H__ +#define __LINUX_MAGIC_H__ + +#define ADFS_SUPER_MAGIC 0xadf5 +#define AFFS_SUPER_MAGIC 0xadff +#define AFS_SUPER_MAGIC 0x5346414F +#define AUTOFS_SUPER_MAGIC 0x0187 +#define CODA_SUPER_MAGIC 0x73757245 +#define EFS_SUPER_MAGIC 0x414A53 +#define EXT2_SUPER_MAGIC 0xEF53 +#define EXT3_SUPER_MAGIC 0xEF53 +#define EXT4_SUPER_MAGIC 0xEF53 +#define HPFS_SUPER_MAGIC 0xf995e849 +#define ISOFS_SUPER_MAGIC 0x9660 +#define JFFS2_SUPER_MAGIC 0x72b6 +#define KVMFS_SUPER_MAGIC 0x19700426 + +#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ +#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ +#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ + +#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ +#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ +#define NFS_SUPER_MAGIC 0x6969 +#define OPENPROM_SUPER_MAGIC 0x9fa1 +#define PROC_SUPER_MAGIC 0x9fa0 +#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ + +#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ + /* used by file system utilities that + look at the superblock, etc. */ +#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" +#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" +#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" + +#define SMB_SUPER_MAGIC 0x517B +#define USBDEVICE_SUPER_MAGIC 0x9fa2 + +#endif /* __LINUX_MAGIC_H__ */ diff -urN 1/kernel/include-compat/linux/mutex.h 2/kernel/include-compat/linux/mutex.h --- 1/kernel/include-compat/linux/mutex.h 1970-01-01 01:00:00.000000000 +0100 +++ 2/kernel/include-compat/linux/mutex.h 2008-02-11 12:00:19.000000000 +0100 @@ -0,0 +1,5 @@ +/* + * Empty file to satisfy #include <linux/mutex.h> for older kernels. + */ + + diff --git a/kernel/Makefile b/kernel/Makefile index 7a435b5..9e72f56 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -25,17 +25,21 @@ hack = $(call _hack,tmp/$(strip $1)) unifdef = $(call _unifdef,tmp/$(strip $1)) all:: - $(MAKE) -C $(KERNELDIR) M=`pwd` "$$@" + # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat + $(MAKE) -C $(KERNELDIR) M=`pwd` \ + LINUXINCLUDE="-I`pwd`/include -Iinclude -I`pwd`/include-compat \ + -include include/linux/autoconf.h" \ + "$$@" sync: - rm -rf tmp + rm -rf tmp include rsync --exclude='*.mod.c' -R \ "$(LINUX)"/arch/x86/kvm/./*.[ch] \ "$(LINUX)"/virt/kvm/./*.[ch] \ "$(LINUX)"/./include/linux/kvm*.h \ "$(LINUX)"/./include/asm-x86/kvm*.h \ tmp/ - rm -rf include/asm + mkdir -p include/linux include/asm-x86 ln -s asm-x86 include/asm $(call unifdef, include/linux/kvm.h) @@ -78,6 +82,7 @@ rpm: all clean: $(MAKE) -C $(KERNELDIR) M=`pwd` $@ + rm -rf include svnclean: svn st | grep '^\?' | awk '{print $2}' | xargs rm -rf diff --git a/kernel/external-module-compat.h b/kernel/external-module-compat.h index 052d561..fdd903c 100644 --- a/kernel/external-module-compat.h +++ b/kernel/external-module-compat.h @@ -10,8 +10,8 @@ #include <linux/compiler.h> #include <linux/version.h> #include <linux/string.h> -#include "include/linux/kvm.h" -#include "include/linux/kvm_para.h" +#include <linux/kvm.h> +#include <linux/kvm_para.h> #include <linux/cpu.h> #include <asm/processor.h> #include <linux/hrtimer.h> ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Broken external module build on 2.6.23 2008-02-11 11:19 ` Andrea Arcangeli 2008-02-11 11:26 ` Andrea Arcangeli @ 2008-02-11 12:24 ` Avi Kivity 2008-02-11 12:24 ` Avi Kivity 1 sibling, 1 reply; 7+ messages in thread From: Avi Kivity @ 2008-02-11 12:24 UTC (permalink / raw) To: Andrea Arcangeli; +Cc: kvm-devel, Chris Lalancette Andrea Arcangeli wrote: > I created a more complete patch below, this will solve all my silent > time-wasting miscompilations (currnently when building kvm.git on a > newer mainline kernels, certain kvm*.h $KERNELDIR headers are included > instead of my modified ones in $LINUX, so the build can crash if > $LINUX and $KERNELDIR don't have the kvm*.h headers in sync) and this > below patch will retain compatibility with older kernels too. If patch > doesn't wipe kernel/include you can follow it with a rm -r > kernel/include. I verified libkvm already gives more priority to > whatever is in kernel/include and only if kernel/include are missing > it uses the kvm.h in /usr/include/linux/kvm.h (I filled all my > /usr/src and /usr/include headers with #error "x" to be sure... along > with running gcc -E and checking the cpp work). > > Thanks, applied that. I added an include-compat/asm symlink so that it builds. Please turn on git rename detection for better readability with such patches. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broken external module build on 2.6.23 2008-02-11 12:24 ` Avi Kivity @ 2008-02-11 12:24 ` Avi Kivity 0 siblings, 0 replies; 7+ messages in thread From: Avi Kivity @ 2008-02-11 12:24 UTC (permalink / raw) To: Andrea Arcangeli; +Cc: kvm-devel, Chris Lalancette Avi Kivity wrote: > Thanks, applied that. I added an include-compat/asm symlink so that > it builds. > Actually I applied the second version you sent. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-02-11 12:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-04 21:01 Broken external module build on 2.6.23 Chris Lalancette
[not found] ` <47A77D2B.90902-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-02-05 23:15 ` Andrea Arcangeli
2008-02-11 8:14 ` Avi Kivity
2008-02-11 11:19 ` Andrea Arcangeli
2008-02-11 11:26 ` Andrea Arcangeli
2008-02-11 12:24 ` Avi Kivity
2008-02-11 12:24 ` Avi Kivity
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox