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;
#include "fabrics.h"
-#ifdef CONFIG_LIBUUID
#include <uuid/uuid.h>
-#endif
extern const char *nvme_ctrl_sysfs_dir;
uint8_t eui64[8];
uint8_t nguid[16];
-#ifdef CONFIG_LIBUUID
uuid_t uuid;
-#else
- uint8_t uuid[16];
-#endif
enum nvme_csi csi;
};
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)
{
#include <stddef.h>
#include <sys/types.h>
-#ifdef CONFIG_LIBUUID
#include <uuid/uuid.h>
-#endif
+
#include "ioctl.h"
#include "util.h"
*
* 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
#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>
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),
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)