Skip to content

Commit 984f9ae

Browse files
authored
Merge pull request #227 from igaw/cleanup-libuuid-dep
tree: Remove dead !LIBUUID code
2 parents ec03db7 + c1c5dcf commit 984f9ae

5 files changed

Lines changed: 1 addition & 32 deletions

File tree

src/nvme/fabrics.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -920,23 +920,16 @@ char *nvmf_hostnqn_generate()
920920
char *hostnqn;
921921
int ret;
922922
char uuid_str[UUID_SIZE];
923-
#ifdef CONFIG_LIBUUID
924923
uuid_t uuid;
925-
#endif
926924

927925
ret = uuid_from_dmi(uuid_str);
928926
if (ret < 0) {
929927
ret = uuid_from_device_tree(uuid_str);
930928
}
931-
#ifdef CONFIG_LIBUUID
932929
if (ret < 0) {
933930
uuid_generate_random(uuid);
934931
uuid_unparse_lower(uuid, uuid_str);
935-
ret = 0;
936932
}
937-
#endif
938-
if (ret < 0)
939-
return NULL;
940933

941934
if (asprintf(&hostnqn, "nqn.2014-08.org.nvmexpress:uuid:%s", uuid_str) < 0)
942935
return NULL;

src/nvme/private.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313

1414
#include "fabrics.h"
1515

16-
#ifdef CONFIG_LIBUUID
1716
#include <uuid/uuid.h>
18-
#endif
1917

2018

2119
extern const char *nvme_ctrl_sysfs_dir;
@@ -56,11 +54,7 @@ struct nvme_ns {
5654

5755
uint8_t eui64[8];
5856
uint8_t nguid[16];
59-
#ifdef CONFIG_LIBUUID
6057
uuid_t uuid;
61-
#else
62-
uint8_t uuid[16];
63-
#endif
6458
enum nvme_csi csi;
6559
};
6660

src/nvme/tree.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,17 +1464,10 @@ const uint8_t *nvme_ns_get_nguid(nvme_ns_t n)
14641464
return n->nguid;
14651465
}
14661466

1467-
#ifdef CONFIG_LIBUUID
14681467
void nvme_ns_get_uuid(nvme_ns_t n, uuid_t out)
14691468
{
14701469
uuid_copy(out, n->uuid);
14711470
}
1472-
#else
1473-
void nvme_ns_get_uuid(nvme_ns_t n, uint8_t *out)
1474-
{
1475-
memcpy(out, n, 16);
1476-
}
1477-
#endif
14781471

14791472
int nvme_ns_identify(nvme_ns_t n, struct nvme_id_ns *ns)
14801473
{

src/nvme/tree.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
#include <stddef.h>
1616

1717
#include <sys/types.h>
18-
#ifdef CONFIG_LIBUUID
1918
#include <uuid/uuid.h>
20-
#endif
19+
2120
#include "ioctl.h"
2221
#include "util.h"
2322

@@ -484,11 +483,7 @@ const uint8_t *nvme_ns_get_nguid(nvme_ns_t n);
484483
*
485484
* Copies the namespace's uuid into @out
486485
*/
487-
#ifdef CONFIG_LIBUUID
488486
void nvme_ns_get_uuid(nvme_ns_t n, uuid_t out);
489-
#else
490-
void nvme_ns_get_uuid(nvme_ns_t n, uint8_t *out);
491-
#endif
492487

493488
/**
494489
* nvme_ns_get_sysfs_dir() - sysfs directory of an nvme_ns_t object

test/test.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
#include <string.h>
2020
#include <stdbool.h>
2121
#include <inttypes.h>
22-
#ifdef CONFIG_LIBUUID
2322
#include <uuid/uuid.h>
24-
#endif
2523
#include <libnvme.h>
2624

2725
#include <ccan/endian/endian.h>
@@ -368,10 +366,8 @@ int main(int argc, char **argv)
368366
nvme_ctrl_get_state(c));
369367

370368
nvme_ctrl_for_each_ns(c, n) {
371-
#ifdef CONFIG_LIBUUID
372369
char uuid_str[40];
373370
uuid_t uuid;
374-
#endif
375371
printf(" `- %s lba size:%d lba max:%" PRIu64 "\n",
376372
nvme_ns_get_name(n),
377373
nvme_ns_get_lba_size(n),
@@ -380,12 +376,10 @@ int main(int argc, char **argv)
380376
print_hex(nvme_ns_get_eui64(n), 8);
381377
printf(" nguid:");
382378
print_hex(nvme_ns_get_nguid(n), 16);
383-
#ifdef CONFIG_LIBUUID
384379
nvme_ns_get_uuid(n, uuid);
385380
uuid_unparse_lower(uuid, uuid_str);
386381
printf(" uuid:%s csi:%d\n", uuid_str,
387382
nvme_ns_get_csi(n));
388-
#endif
389383
}
390384

391385
nvme_ctrl_for_each_path(c, p)

0 commit comments

Comments
 (0)