Skip to contentSkip to conversation

tools: include sys/sysmacros.h on Linux

PATCH Superseded Olaf Hering 2 participants 5 messages Mar 14, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: include sys/sysmacros.h on Linux

Due to a bug in the glibc headers the macros makedev(), major() and minor() where avaialble by including sys/types.h. This bug was addressed in glibc-2.25 by introducing a warning when these macros are used. Since Xen is build with -Werror this new warning cause a compile error.

Use sys/sysmacros.h to define these three macros.

blktap2 is already Linux specific. The kernel header which was used to get makedev() does not provided it anymore, and it was wrong to use a kernel header anyway.

---
 tools/blktap2/control/tap-ctl-allocate.c | 2 +-
 tools/libxl/libxl_osdeps.h               | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
tools/blktap2/control/tap-ctl-allocate.c +1 -1
index 8a6471e987..908c87f305 100644
@@ -36,7 +36,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
-#include <linux/major.h>
+#include <sys/sysmacros.h>
 
 #include "tap-ctl.h"
 #include "blktap2.h"
tools/libxl/libxl_osdeps.h +1 -0
index a40d62066b..de1d24ecae 100644
@@ -39,6 +39,7 @@
 #define SYSFS_PCI_DEV          "/sys/bus/pci/devices"
 #define SYSFS_PCIBACK_DRIVER   "/sys/bus/pci/drivers/pciback"
 #define NETBACK_NIC_NAME       "vif%u.%d"
+#include <sys/sysmacros.h>
 #include <pty.h>
 #include <uuid/uuid.h>
 #elif defined(__sun__)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Olaf Hering

Due to a bug in the glibc headers the macros makedev(), major() and minor() where avaialble by including sys/types.h. This bug was addressed in glibc-2.25 by introducing a warning when these macros are used. Since Xen is build with -Werror this new warning cause a compile error.

Quoted 7 lines

Use sys/sysmacros.h to define these three macros.

blktap2 is already Linux specific. The kernel header which was used to get makedev() does not provided it anymore, and it was wrong to use a kernel header anyway.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 9 lines · Wei Liu
Quoted 8 lines · Olaf Hering

Due to a bug in the glibc headers the macros makedev(), major() and minor() where avaialble by including sys/types.h. This bug was addressed in glibc-2.25 by introducing a warning when these macros are used. Since Xen is build with -Werror this new warning cause a compile error.

Use sys/sysmacros.h to define these three macros.

Quoted 7 lines
Quoted 5 lines

blktap2 is already Linux specific. The kernel header which was used to get makedev() does not provided it anymore, and it was wrong to use a kernel header anyway.

Got this while compiling on Debian Stretch:

tap-ctl-allocate.c: In function ‘tap_ctl_check_environment’:
tap-ctl-allocate.c:143:9: error: ‘MISC_MAJOR’ undeclared (first use in this function)

         MISC_MAJOR,
         ^~~~~~~~~~

tap-ctl-allocate.c:143:9: note: each undeclared identifier is reported only once for each
function it appears in /local/work/COMMITTER/xen.git/tools/blktap2/control/../../..//tools/Rules.mk:212:
recipe f
or target 'tap-ctl-allocate.opic' failed
make[5]: *** [tap-ctl-allocate.opic] Error 1

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Am Tue, 14 Mar 2017 11:54:46 +0000
schrieb Wei Liu <[email protected]>:

Quoted 1 line

tap-ctl-allocate.c:143:9: error: ‘MISC_MAJOR’ undeclared (first use in

That happened because the variant of the change I sent was untested... I will revisit this part. sys/types.h is needed according to mknod(2).

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 8 lines · Olaf Hering

Am Tue, 14 Mar 2017 11:54:46 +0000
schrieb Wei Liu <[email protected]>:

Quoted 1 line

tap-ctl-allocate.c:143:9: error: ‘MISC_MAJOR’ undeclared (first use in

That happened because the variant of the change I sent was untested... I will revisit this part. sys/types.h is needed according to mknod(2).

Right, please send an updated version. :-)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel