Here is a few fixes for non-Linux builds (Hurd builds, in particular). Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> diff --git a/fsck/fsck.c b/fsck/fsck.c index 87f8210..e8f433e 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -233,7 +233,7 @@ static dev_t get_disk(const char *device) static int is_irrotational_disk(dev_t disk) { - char path[PATH_MAX]; + char path[33+2*11+1]; FILE *f; int rc, x; @@ -1034,7 +1034,7 @@ static int count_slaves(dev_t disk) { DIR *dir; struct dirent *dp; - char dirname[PATH_MAX]; + char dirname[24+2*11+1]; int count = 0; snprintf(dirname, sizeof(dirname), diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 44358fd..fb88356 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -465,12 +465,14 @@ static int is_readonly_device(struct blkdev_cxt *cxt) if (sysfs_scanf(cxt, "ro", "%d", &ro) == 0) return ro; +#ifdef BLKROGET /* fallback if "ro" attribute does not exist */ fd = open(cxt->filename, O_RDONLY); if (fd != -1) { ioctl(fd, BLKROGET, &ro); close(fd); } +#endif return ro; } diff --git a/shlibs/blkid/src/topology/ioctl.c b/shlibs/blkid/src/topology/ioctl.c index 73c18ec..d89aebc 100644 --- a/shlibs/blkid/src/topology/ioctl.c +++ b/shlibs/blkid/src/topology/ioctl.c @@ -30,10 +30,18 @@ static struct topology_val { int (*set_int)(blkid_probe, int); } topology_vals[] = { +#ifdef BLKALIGNOFF { BLKALIGNOFF, NULL, blkid_topology_set_alignment_offset }, +#endif +#ifdef BLKIOMIN { BLKIOMIN, blkid_topology_set_minimum_io_size }, +#endif +#ifdef BLKIOOPT { BLKIOOPT, blkid_topology_set_optimal_io_size }, +#endif +#ifdef BLKPBSZGET { BLKPBSZGET, blkid_topology_set_physical_sector_size } +#endif /* we read BLKSSZGET in topology.c */ }; diff --git a/shlibs/mount/samples/Makefile.am b/shlibs/mount/samples/Makefile.am index b0c655f..2710f8b 100644 --- a/shlibs/mount/samples/Makefile.am +++ b/shlibs/mount/samples/Makefile.am @@ -3,5 +3,7 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -I$(ul_libmount_incdir) AM_LDFLAGS += $(ul_libmount_la) +if LINUX noinst_PROGRAMS = mount +endif diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 8fedd41..6ed22db 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -12,7 +12,6 @@ usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = mountP.h version.c utils.c test.c init.c cache.c \ optstr.c optmap.c iter.c lock.c \ fs.c tab.c tab_parse.c tab_update.c \ - context.c context_mount.c context_umount.c \ $(mountinc_HEADERS) \ $(top_srcdir)/lib/at.c \ $(top_srcdir)/include/list.h \ @@ -21,6 +20,10 @@ libmount_la_SOURCES = mountP.h version.c utils.c test.c init.c cache.c \ $(top_srcdir)/lib/strutils.c \ $(top_srcdir)/lib/env.c +if LINUX +libmount_la_SOURCES += context.c context_mount.c context_umount.c +endif + nodist_libmount_la_SOURCES = mountP.h libmount_la_LIBADD = $(ul_libblkid_la) $(SELINUX_LIBS)
diff --git a/fsck/fsck.c b/fsck/fsck.c index 87f8210..e8f433e 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -233,7 +233,7 @@ static dev_t get_disk(const char *device) static int is_irrotational_disk(dev_t disk) { - char path[PATH_MAX]; + char path[33+2*11+1]; FILE *f; int rc, x; @@ -1034,7 +1034,7 @@ static int count_slaves(dev_t disk) { DIR *dir; struct dirent *dp; - char dirname[PATH_MAX]; + char dirname[24+2*11+1]; int count = 0; snprintf(dirname, sizeof(dirname), diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 44358fd..fb88356 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -465,12 +465,14 @@ static int is_readonly_device(struct blkdev_cxt *cxt) if (sysfs_scanf(cxt, "ro", "%d", &ro) == 0) return ro; +#ifdef BLKROGET /* fallback if "ro" attribute does not exist */ fd = open(cxt->filename, O_RDONLY); if (fd != -1) { ioctl(fd, BLKROGET, &ro); close(fd); } +#endif return ro; } diff --git a/shlibs/blkid/src/topology/ioctl.c b/shlibs/blkid/src/topology/ioctl.c index 73c18ec..d89aebc 100644 --- a/shlibs/blkid/src/topology/ioctl.c +++ b/shlibs/blkid/src/topology/ioctl.c @@ -30,10 +30,18 @@ static struct topology_val { int (*set_int)(blkid_probe, int); } topology_vals[] = { +#ifdef BLKALIGNOFF { BLKALIGNOFF, NULL, blkid_topology_set_alignment_offset }, +#endif +#ifdef BLKIOMIN { BLKIOMIN, blkid_topology_set_minimum_io_size }, +#endif +#ifdef BLKIOOPT { BLKIOOPT, blkid_topology_set_optimal_io_size }, +#endif +#ifdef BLKPBSZGET { BLKPBSZGET, blkid_topology_set_physical_sector_size } +#endif /* we read BLKSSZGET in topology.c */ }; diff --git a/shlibs/mount/samples/Makefile.am b/shlibs/mount/samples/Makefile.am index b0c655f..2710f8b 100644 --- a/shlibs/mount/samples/Makefile.am +++ b/shlibs/mount/samples/Makefile.am @@ -3,5 +3,7 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -I$(ul_libmount_incdir) AM_LDFLAGS += $(ul_libmount_la) +if LINUX noinst_PROGRAMS = mount +endif diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 8fedd41..6ed22db 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -12,7 +12,6 @@ usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = mountP.h version.c utils.c test.c init.c cache.c \ optstr.c optmap.c iter.c lock.c \ fs.c tab.c tab_parse.c tab_update.c \ - context.c context_mount.c context_umount.c \ $(mountinc_HEADERS) \ $(top_srcdir)/lib/at.c \ $(top_srcdir)/include/list.h \ @@ -21,6 +20,10 @@ libmount_la_SOURCES = mountP.h version.c utils.c test.c init.c cache.c \ $(top_srcdir)/lib/strutils.c \ $(top_srcdir)/lib/env.c +if LINUX +libmount_la_SOURCES += context.c context_mount.c context_umount.c +endif + nodist_libmount_la_SOURCES = mountP.h libmount_la_LIBADD = $(ul_libblkid_la) $(SELINUX_LIBS)