Skip to contentSkip to conversation

compiler.h include fix for usb-linux.c

PATCH In review ( अमेय पाळंदे ) Ameya Palande 3 participants 4 messages Jan 10, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compiler.h include fix for usb-linux.c

Hi,

Redhat and its derivatives don't have /usr/include/linux/compiler.h But debian, opensuse etc. have compiler.h

Without including compiler.h in usb-linux.c build fails on opensuse.

So instead of removing compiler.h, its better to check if it is there on build host and if it is there then include it.

patch is made against qemu-snapshot-2007-01-10_05

Regards,
Ameya.

configure +3 -1
diff -ur qemu-snapshot-2007-01-10_05/configure qemu-snapshot-2007-01-10_05.new/configure
@@ -749,7 +749,9 @@
 if [ "$build_docs" = "yes" ] ; then
   echo "BUILD_DOCS=yes" >> $config_mak
 fi
-
+if test -f "/usr/include/linux/compiler.h" ; then
+  echo "#define HAVE_COMPILER_H 1" >> $config_h
+fi
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "#define O_LARGEFILE 0" >> $config_h
usb-linux.c +3 -0
diff -ur qemu-snapshot-2007-01-10_05/usb-linux.c qemu-snapshot-2007-01-10_05.new/usb-linux.c
@@ -24,6 +24,9 @@
 #include "vl.h"
 
 #if defined(__linux__)
+#ifdef HAVE_COMPILER_H
+#include <linux/compiler.h>
+#endif
 #include <dirent.h>
 #include <sys/ioctl.h>
 #include <linux/usbdevice_fs.h>
#1 lore raw
Quoted 6 lines · ( ???????????? ?????????????????? ) Ameya Palande

Hi,

Redhat and its derivatives don't have /usr/include/linux/compiler.h But debian, opensuse etc. have compiler.h

Without including compiler.h in usb-linux.c build fails on opensuse.

JFTR, it works on debian.

Thiemo

#2 lore raw
Quoted 6 lines · Thiemo Seufer
Quoted 5 lines · ( ???????????? ?????????????????? ) Ameya Palande

Hi,

Redhat and its derivatives don't have /usr/include/linux/compiler.h But debian, opensuse etc. have compiler.h

Quoted 7 lines
Quoted 1 line

Without including compiler.h in usb-linux.c build fails on opensuse.

JFTR, it works on debian.

Thiemo

It works on debian because on debian /usr/include/linux/usbdevice_fs.h file includes <linux/compiler.h>

Regards,
Ameya.

#3 lore raw
Quoted 9 lines · ( अमेय पाळंदे ) Ameya Palande
Quoted 8 lines · Thiemo Seufer
Quoted 6 lines · ( ???????????? ?????????????????? ) Ameya Palande

Hi,

Redhat and its derivatives don't have /usr/include/linux/compiler.h But debian, opensuse etc. have compiler.h

Without including compiler.h in usb-linux.c build fails on opensuse.

Quoted 8 lines
Quoted 5 lines

JFTR, it works on debian.

Thiemo

It works on debian because on debian /usr/include/linux/usbdevice_fs.h file includes <linux/compiler.h>

The issue before is that usb-linux.c should not be including linux/compiler.h. See the xen approach to fixing this for the broken distros:

http://xenbits2.xensource.com/xen-unstable.hg?rev/ba7487569374;style=rev
%3Dusb