nvme: switch to uuid_t
authorChristoph Hellwig <hch@lst.de>
Wed, 17 May 2017 07:54:27 +0000 (09:54 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 5 Jun 2017 14:59:16 +0000 (16:59 +0200)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/nvme/host/fabrics.c
drivers/nvme/host/fabrics.h
drivers/nvme/host/fc.c
drivers/nvme/target/nvmet.h
include/linux/nvme-fc.h
include/linux/nvme.h

index 990e6fb32a636201078da585372d6ddfed97c9bd..c190d7e36900175f41110e97b8c327f93fc47fdd 100644 (file)
@@ -58,7 +58,7 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
 
        kref_init(&host->ref);
        memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
-       uuid_be_gen(&host->id);
+       uuid_gen(&host->id);
 
        list_add_tail(&host->list, &nvmf_hosts);
 out_unlock:
@@ -75,7 +75,7 @@ static struct nvmf_host *nvmf_host_default(void)
                return NULL;
 
        kref_init(&host->ref);
-       uuid_be_gen(&host->id);
+       uuid_gen(&host->id);
        snprintf(host->nqn, NVMF_NQN_SIZE,
                "nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUb", &host->id);
 
@@ -395,7 +395,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
        if (!data)
                return -ENOMEM;
 
-       memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
+       uuid_copy(&data->hostid, &ctrl->opts->host->id);
        data->cntlid = cpu_to_le16(0xffff);
        strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
        strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
@@ -454,7 +454,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
        if (!data)
                return -ENOMEM;
 
-       memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
+       uuid_copy(&data->hostid, &ctrl->opts->host->id);
        data->cntlid = cpu_to_le16(ctrl->cntlid);
        strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
        strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
index f5a9c1fb186f2d5278ecd72eeaf93b1b7d75e6e8..29be7600689d41ed5549d5fc070c070cb1d8f7ae 100644 (file)
@@ -36,7 +36,7 @@ struct nvmf_host {
        struct kref             ref;
        struct list_head        list;
        char                    nqn[NVMF_NQN_SIZE];
-       uuid_be                 id;
+       uuid_                 id;
 };
 
 /**
index 5b14cbefb7240d5e7d50bb1ade8fd958417282e8..96b983bb44bd166bc3a6406d8d64edc3ac3fd608 100644 (file)
@@ -878,8 +878,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
        assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
        /* Linux supports only Dynamic controllers */
        assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
-       memcpy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id,
-               min_t(size_t, FCNVME_ASSOC_HOSTID_LEN, sizeof(uuid_be)));
+       uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
        strncpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn,
                min(FCNVME_ASSOC_HOSTNQN_LEN, NVMF_NQN_SIZE));
        strncpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn,
index cfc5c7fb0ab78411f8d6e96ab7ffaaad241b6244..8ff6e430b30afe14730355e2ffd029a482aef578 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/percpu-refcount.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
+#include <linux/uuid.h>
 #include <linux/nvme.h>
 #include <linux/configfs.h>
 #include <linux/rcupdate.h>
index e997c4a49a8884e3b1167a830e7fdf0431365a3d..bc711a10be05c2d8354a9ba2eff382bc992314b1 100644 (file)
@@ -177,7 +177,6 @@ struct fcnvme_lsdesc_rjt {
 };
 
 
-#define FCNVME_ASSOC_HOSTID_LEN                16
 #define FCNVME_ASSOC_HOSTNQN_LEN       256
 #define FCNVME_ASSOC_SUBNQN_LEN                256
 
@@ -191,7 +190,7 @@ struct fcnvme_lsdesc_cr_assoc_cmd {
        __be16  cntlid;
        __be16  sqsize;
        __be32  rsvd52;
-       u8      hostid[FCNVME_ASSOC_HOSTID_LEN];
+       uuid_t  hostid;
        u8      hostnqn[FCNVME_ASSOC_HOSTNQN_LEN];
        u8      subnqn[FCNVME_ASSOC_SUBNQN_LEN];
        u8      rsvd632[384];
index b625bacf37efaabd84e8735b2b304401cdb195fd..e400a69fa1d324acf3a2bce7ba25d6c24054b449 100644 (file)
@@ -16,6 +16,7 @@
 #define _LINUX_NVME_H
 
 #include <linux/types.h>
+#include <linux/uuid.h>
 
 /* NQN names in commands fields specified one size */
 #define NVMF_NQN_FIELD_LEN     256
@@ -843,7 +844,7 @@ struct nvmf_connect_command {
 };
 
 struct nvmf_connect_data {
-       __u8            hostid[16];
+       uuid_t          hostid;
        __le16          cntlid;
        char            resv4[238];
        char            subsysnqn[NVMF_NQN_FIELD_LEN];