]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
tree: Remove dead !LIBUUID code
authorDaniel Wagner <dwagner@suse.de>
Tue, 8 Feb 2022 17:40:32 +0000 (18:40 +0100)
committerDaniel Wagner <dwagner@suse.de>
Tue, 8 Feb 2022 17:40:32 +0000 (18:40 +0100)
We have added a hard dependency to libuuid. Remove the ifdefs and the
dead code.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
src/nvme/fabrics.c
src/nvme/private.h
src/nvme/tree.c
src/nvme/tree.h
test/test.c

index 2c05788a7a9b7a74e5575cb1d9601a0c0e7cd0f9..bd97c05f459facc82dfb83c7c6c7db11c211bed7 100644 (file)
@@ -920,23 +920,16 @@ char *nvmf_hostnqn_generate()
        char *hostnqn;
        int ret;
        char uuid_str[UUID_SIZE];
-#ifdef CONFIG_LIBUUID
        uuid_t uuid;
-#endif
 
        ret = uuid_from_dmi(uuid_str);
        if (ret < 0) {
                ret = uuid_from_device_tree(uuid_str);
        }
-#ifdef CONFIG_LIBUUID
        if (ret < 0) {
                uuid_generate_random(uuid);
                uuid_unparse_lower(uuid, uuid_str);
-               ret = 0;
        }
-#endif
-       if (ret < 0)
-               return NULL;
 
        if (asprintf(&hostnqn, "nqn.2014-08.org.nvmexpress:uuid:%s", uuid_str) < 0)
                return NULL;
index 356cae3001a576c660aa84dc11c5d2c923ee716c..c85038d9ef7691a7ad39c6dbb4e34d191d022f34 100644 (file)
@@ -13,9 +13,7 @@
 
 #include "fabrics.h"
 
-#ifdef CONFIG_LIBUUID
 #include <uuid/uuid.h>
-#endif
 
 
 extern const char *nvme_ctrl_sysfs_dir;
@@ -56,11 +54,7 @@ struct nvme_ns {
 
        uint8_t eui64[8];
        uint8_t nguid[16];
-#ifdef CONFIG_LIBUUID
        uuid_t  uuid;
-#else
-       uint8_t uuid[16];
-#endif
        enum nvme_csi csi;
 };
 
index c9a0c42cfffa96c6ccb057d4cc00fe6f9f9a4de3..5f5fa1093a64a31d6637fac0c695887e52cb6287 100644 (file)
@@ -1464,17 +1464,10 @@ const uint8_t *nvme_ns_get_nguid(nvme_ns_t n)
        return n->nguid;
 }
 
-#ifdef CONFIG_LIBUUID
 void nvme_ns_get_uuid(nvme_ns_t n, uuid_t out)
 {
        uuid_copy(out, n->uuid);
 }
-#else
-void nvme_ns_get_uuid(nvme_ns_t n, uint8_t *out)
-{
-       memcpy(out, n, 16);
-}
-#endif
 
 int nvme_ns_identify(nvme_ns_t n, struct nvme_id_ns *ns)
 {
index 306fdfba468c4e3bcc3eedca7fd59fef9594cc30..e41e3d834c33a43b07f6a2d8da98eee2de00aefc 100644 (file)
@@ -15,9 +15,8 @@
 #include <stddef.h>
 
 #include <sys/types.h>
-#ifdef CONFIG_LIBUUID
 #include <uuid/uuid.h>
-#endif
+
 #include "ioctl.h"
 #include "util.h"
 
@@ -484,11 +483,7 @@ const uint8_t *nvme_ns_get_nguid(nvme_ns_t n);
  *
  * Copies the namespace's uuid into @out
  */
-#ifdef CONFIG_LIBUUID
 void nvme_ns_get_uuid(nvme_ns_t n, uuid_t out);
-#else
-void nvme_ns_get_uuid(nvme_ns_t n, uint8_t *out);
-#endif
 
 /**
  * nvme_ns_get_sysfs_dir() - sysfs directory of an nvme_ns_t object
index 2f2e95765661f812f5b1b03a74cf150480587fe7..7238913ec7fe1cbf3c47305f88dc9ee87b55e456 100644 (file)
@@ -19,9 +19,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <inttypes.h>
-#ifdef CONFIG_LIBUUID
 #include <uuid/uuid.h>
-#endif
 #include <libnvme.h>
 
 #include <ccan/endian/endian.h>
@@ -368,10 +366,8 @@ int main(int argc, char **argv)
                                       nvme_ctrl_get_state(c));
 
                                nvme_ctrl_for_each_ns(c, n) {
-#ifdef CONFIG_LIBUUID
                                        char uuid_str[40];
                                        uuid_t uuid;
-#endif
                                        printf("   `- %s lba size:%d lba max:%" PRIu64 "\n",
                                               nvme_ns_get_name(n),
                                               nvme_ns_get_lba_size(n),
@@ -380,12 +376,10 @@ int main(int argc, char **argv)
                                        print_hex(nvme_ns_get_eui64(n), 8);
                                        printf(" nguid:");
                                        print_hex(nvme_ns_get_nguid(n), 16);
-#ifdef CONFIG_LIBUUID
                                        nvme_ns_get_uuid(n, uuid);
                                        uuid_unparse_lower(uuid, uuid_str);
                                        printf(" uuid:%s csi:%d\n", uuid_str,
                                               nvme_ns_get_csi(n));
-#endif
                                }
 
                                nvme_ctrl_for_each_path(c, p)