diff mbox

[v2] tools: include sys/sysmacros.h on Linux

Message ID 20170315070134.22864-1-olaf@aepfle.de (mailing list archive)
State New, archived
Headers show

Commit Message

Olaf Hering March 15, 2017, 7:01 a.m. UTC
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.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---

v2:
 keep include linux/major.h for MISC_MAJOR, move inclusion of sysmacros.h before stat.h

 tools/blktap2/control/tap-ctl-allocate.c | 1 +
 tools/libxl/libxl_osdeps.h               | 1 +
 2 files changed, 2 insertions(+)

Comments

Wei Liu March 15, 2017, 10:43 a.m. UTC | #1
On Wed, Mar 15, 2017 at 07:01:34AM +0000, Olaf Hering wrote:
> 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.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

diff --git a/tools/blktap2/control/tap-ctl-allocate.c b/tools/blktap2/control/tap-ctl-allocate.c
index 8a6471e987..187cadcde7 100644
--- a/tools/blktap2/control/tap-ctl-allocate.c
+++ b/tools/blktap2/control/tap-ctl-allocate.c
@@ -33,6 +33,7 @@ 
 #include <string.h>
 #include <getopt.h>
 #include <libgen.h>
+#include <sys/sysmacros.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
diff --git a/tools/libxl/libxl_osdeps.h b/tools/libxl/libxl_osdeps.h
index a40d62066b..de1d24ecae 100644
--- a/tools/libxl/libxl_osdeps.h
+++ b/tools/libxl/libxl_osdeps.h
@@ -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__)