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 <[EMAIL PROTECTED]>
--- 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 <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>
- *
- */
-
-#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
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel