]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: compile when libudev not installed
authorKeith Busch <keith.busch@intel.com>
Thu, 16 Jun 2016 18:32:43 +0000 (12:32 -0600)
committerKeith Busch <keith.busch@intel.com>
Thu, 16 Jun 2016 18:32:43 +0000 (12:32 -0600)
libudev is optional to use this repository. Packages can require it if
desired, but others downloading the repo should still be able to use
most of the functionality this tool provides without it.

Signed-off-by: Keith Busch <keith.busch@intel.com>
fabrics.c

index c8bf2a6e39b32a685b41e253b94327290487cdff..869592c86464a366c071ead56f005d75f6b0611d 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -27,7 +27,9 @@
 #include <stdint.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#ifdef LIBUDEV_EXISTS
 #include <libudev.h>
+#endif
 
 #include <linux/types.h>
 
@@ -570,6 +572,7 @@ int connect(const char *desc, int argc, char **argv)
        return 0;
 }
 
+#ifdef LIBUDEV_EXISTS
 static int disconnect_subsys(struct udev_enumerate *enumerate, char *nqn)
 {
        struct udev_list_entry *list_entry;
@@ -637,6 +640,13 @@ free_udev:
 exit:
        return ret;
 }
+#else
+static int disconnect_by_nqn(char *nqn)
+{
+       fprintf(stderr,"libudev not detected, install and rebuild.\n");
+       return -1;
+}
+#endif
 
 static int disconnect_by_device(char *device)
 {