From: Don Brady Date: Wed, 7 Nov 2018 01:47:52 +0000 (-0700) Subject: Fix libudev dependency in libzutil X-Git-Tag: zfs-0.8.0-rc2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95692927f28479c2d3cf0c1e60ad278c8748377c;p=zfs Fix libudev dependency in libzutil ZFS should be able to build without libudev installed. The recent change for libzutil inadvertently broke that. Make the libudev code conditional in zutil_import.c to resolve the build failure. Reviewed-by: Brian Behlendorf Reviewed-by: Tony Hutter Signed-off-by: Don Brady Closes #8097 --- diff --git a/include/libzutil.h b/include/libzutil.h index 39fc5554b..69d1e6bbd 100644 --- a/include/libzutil.h +++ b/include/libzutil.h @@ -79,10 +79,16 @@ extern const char * const * zpool_default_search_paths(size_t *count); extern int zpool_read_label(int, nvlist_t **, int *); extern int zpool_label_disk_wait(const char *, int); +#ifdef HAVE_LIBUDEV struct udev_device; extern int zfs_device_get_devid(struct udev_device *, char *, size_t); extern int zfs_device_get_physical(struct udev_device *, char *, size_t); +#else +#define zfs_device_get_devid(dev, bufptr, buflen) (ENODATA) +#define zfs_device_get_physical(dev, bufptr, buflen) (ENODATA) +#endif + extern void update_vdev_config_dev_strs(nvlist_t *); /* @@ -108,7 +114,7 @@ extern char *zfs_get_enclosure_sysfs_path(const char *); #ifdef HAVE_LIBUDEV extern boolean_t is_mpath_whole_disk(const char *); #else -#define is_mpath_whole_disk(path) (B_FALSE); +#define is_mpath_whole_disk(path) (B_FALSE) #endif /* diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index f6e56fabf..4284efa75 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -224,6 +224,7 @@ typedef struct vdev_dev_strs { char vds_devphys[128]; } vdev_dev_strs_t; +#ifdef HAVE_LIBUDEV /* * Obtain the persistent device id string (describes what) * @@ -398,6 +399,7 @@ udev_device_is_ready(struct udev_device *dev) return (udev_device_get_property_value(dev, "DEVLINKS") != NULL); #endif } +#endif /* HAVE_LIBUDEV */ /* * Wait up to timeout_ms for udev to set up the device node. The device is