]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
Fixup libuuid compilation
authorHannes Reinecke <hare@suse.de>
Mon, 12 Apr 2021 06:11:44 +0000 (08:11 +0200)
committerHannes Reinecke <hare@suse.de>
Fri, 11 Jun 2021 08:46:58 +0000 (10:46 +0200)
Use correct configure symbol 'CONFIG_LIBUUID' and allow the test
program to compile without libuud.

Signed-off-by: Hannes Reinecke <hare@suse.de>
src/nvme/tree.c
src/nvme/tree.h
test/Makefile
test/test.c

index f1bd2405a4fb25a98430bfddd8b8b9edf34b8b9b..8dd709f1aff448bdb7e7ae1d0f2ee822eabb5c6a 100644 (file)
@@ -66,7 +66,7 @@ struct nvme_ns {
 
        uint8_t eui64[8];
        uint8_t nguid[16];
-#ifdef CONFIG_UUID
+#ifdef CONFIG_LIBUUID
        uuid_t  uuid;
 #else
        uint8_t uuid[16];
@@ -785,7 +785,7 @@ const uint8_t *nvme_ns_get_nguid(nvme_ns_t n)
        return n->nguid;
 }
 
-#ifdef CONFIG_UUID
+#ifdef CONFIG_LIBUUID
 void nvme_ns_get_uuid(nvme_ns_t n, uuid_t out)
 {
        uuid_copy(out, n->uuid);
index 49614aebf815a2efcd832fae3f6589abb2cd65c1..a2842bc22cf1c5c1d22f523a8e2a1a2306f50964 100644 (file)
@@ -14,7 +14,7 @@
 #include <stddef.h>
 
 #include <sys/types.h>
-#ifdef CONFIG_UUID
+#ifdef CONFIG_LIBUUID
 #include <uuid/uuid.h>
 #endif
 #include "ioctl.h"
@@ -298,7 +298,7 @@ const uint8_t *nvme_ns_get_nguid(nvme_ns_t n);
  *
  * Copies the namespace's uuid to the destination buffer
  */
-#ifdef CONFIG_UUID
+#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);
index 16206220ed64ee3e1638b8f9946acd070f02de2d..ed050d0bd68e9b65d64011699838c55d8d7f0e63 100644 (file)
@@ -1,5 +1,5 @@
 CFLAGS ?= -g -O2
-override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ -I../src/ -luuid
+override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ -I../src/
 
 include ../Makefile.quiet
 
index 851ccb3b50b4ed0294fa37edc4bfa845a1a72410..0bc96b0a941912152e3b9673333a0f0741f1b6b9 100644 (file)
@@ -18,7 +18,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdbool.h>
+#ifdef CONFIG_LIBUUID
 #include <uuid/uuid.h>
+#endif
 #include <libnvme.h>
 
 static char *nqn_match;
@@ -348,9 +350,10 @@ int main()
                                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:%lu\n",
                                        nvme_ns_get_name(n), nvme_ns_get_lba_size(n),
                                        nvme_ns_get_lba_count(n));
@@ -358,9 +361,11 @@ int main()
                                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)