From: Keith Busch Date: Thu, 16 Jun 2016 18:32:43 +0000 (-0600) Subject: fabrics: compile when libudev not installed X-Git-Tag: v0.8~6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4a0549d99f16317f81731cc63515c3de4b5bea33;p=users%2Fsagi%2Fnvme-cli.git fabrics: compile when libudev not installed 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 --- diff --git a/fabrics.c b/fabrics.c index c8bf2a6e..869592c8 100644 --- a/fabrics.c +++ b/fabrics.c @@ -27,7 +27,9 @@ #include #include #include +#ifdef LIBUDEV_EXISTS #include +#endif #include @@ -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) {