]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Fix build breakage due to <linux/stddef.h> changes
authorPekka Enberg <penberg@kernel.org>
Tue, 8 May 2012 05:27:13 +0000 (08:27 +0300)
committerPekka Enberg <penberg@kernel.org>
Tue, 8 May 2012 05:28:39 +0000 (08:28 +0300)
Commit 2084c24 ("do not export kernel's NULL #define to userspace") broken KVM
tool build:

  FYI:

   CC       framebuffer.o
  In file included from include/kvm/framebuffer.h:5:0,
                from framebuffer.c:1:
  ../../include/linux/list.h: In function ‘INIT_HLIST_NODE’:
  ../../include/linux/list.h:572:12: error: ‘NULL’ undeclared (first use in this function)
  ../../include/linux/list.h:572:12: note: each undeclared identifier is reported only once for each function it appears in
  ../../include/linux/list.h: In function ‘hlist_move_list’:
  ../../include/linux/list.h:657:15: error: ‘NULL’ undeclared (first use in this function)
  make: *** [framebuffer.o] Error 1

  due to this upstream commit:

   2084c24a8141 do not export kernel's NULL #define to userspace

Fix that.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/include/linux/stddef.h [new file with mode: 0644]

diff --git a/tools/kvm/include/linux/stddef.h b/tools/kvm/include/linux/stddef.h
new file mode 100644 (file)
index 0000000..60ea512
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef _LINUX_STDDEF_H
+#define _LINUX_STDDEF_H
+
+#include <linux/compiler.h>
+
+#undef NULL
+#define NULL ((void *)0)
+
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+#endif