From: Hannes Reinecke Date: Mon, 12 Apr 2021 06:11:44 +0000 (+0200) Subject: Fixup libuuid compilation X-Git-Tag: v1.0-rc0~129^2~16 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6c5dac4f4cd0f11ac9f08255fed8e4fa9f08bc5f;p=users%2Fsagi%2Flibnvme.git Fixup libuuid compilation Use correct configure symbol 'CONFIG_LIBUUID' and allow the test program to compile without libuud. Signed-off-by: Hannes Reinecke --- diff --git a/src/nvme/tree.c b/src/nvme/tree.c index f1bd2405..8dd709f1 100644 --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -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); diff --git a/src/nvme/tree.h b/src/nvme/tree.h index 49614aeb..a2842bc2 100644 --- a/src/nvme/tree.h +++ b/src/nvme/tree.h @@ -14,7 +14,7 @@ #include #include -#ifdef CONFIG_UUID +#ifdef CONFIG_LIBUUID #include #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); diff --git a/test/Makefile b/test/Makefile index 16206220..ed050d0b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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 diff --git a/test/test.c b/test/test.c index 851ccb3b..0bc96b0a 100644 --- a/test/test.c +++ b/test/test.c @@ -18,7 +18,9 @@ #include #include #include +#ifdef CONFIG_LIBUUID #include +#endif #include 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)