Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1654431

[PATCH 21/24] nvme: switch to uuid_t

From Christoph Hellwig <hch@lst.de>
Newsgroups linux.kernel
Subject [PATCH 21/24] nvme: switch to uuid_t
Date 2017-05-31 18:30 +0200
Message-ID <tNeFt-7az-39@gated-at.bofh.it> (permalink)
References <tNevL-77a-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 | 8 ++++----
 drivers/nvme/host/fabrics.h | 2 +-
 drivers/nvme/host/fc.c      | 3 +--
 drivers/nvme/target/nvmet.h | 1 +
 include/linux/nvme-fc.h     | 3 +--
 include/linux/nvme.h        | 3 ++-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 990e6fb32a63..c190d7e36900 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -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);
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index f5a9c1fb186f..29be7600689d 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -36,7 +36,7 @@ struct nvmf_host {
 	struct kref		ref;
 	struct list_head	list;
 	char			nqn[NVMF_NQN_SIZE];
-	uuid_be			id;
+	uuid_t			id;
 };
 
 /**
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 5b14cbefb724..96b983bb44bd 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -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,
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index cfc5c7fb0ab7..8ff6e430b30a 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -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>
diff --git a/include/linux/nvme-fc.h b/include/linux/nvme-fc.h
index e997c4a49a88..bc711a10be05 100644
--- a/include/linux/nvme-fc.h
+++ b/include/linux/nvme-fc.h
@@ -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];
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index b625bacf37ef..e400a69fa1d3 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -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];
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

cleanup UUID types V6 Christoph Hellwig <hch@lst.de> - 2017-05-31 18:20 +0200
  [PATCH 02/24] xfs: use uuid_copy() helper to abstract uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:20 +0200
  [PATCH 07/24] nfsd: namespace-prefix uuid_parse Christoph Hellwig <hch@lst.de> - 2017-05-31 18:20 +0200
  [PATCH 01/24] uuid,afs: move struct uuid_v1 back into afs Christoph Hellwig <hch@lst.de> - 2017-05-31 18:20 +0200
    Re: [PATCH 01/24] uuid,afs: move struct uuid_v1 back into afs David Howells <dhowells@redhat.com> - 2017-05-31 20:30 +0200
  [PATCH 06/24] uuid: rename uuid types Christoph Hellwig <hch@lst.de> - 2017-05-31 18:20 +0200
  [PATCH 09/24] uuid: don't export guid_index and uuid_index Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 10/24] uuid: hoist helpers uuid_equal() and uuid_copy() from xfs Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 18/24] overlayfs: use uuid_t instead of uuid_be Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 12/24] S390/sysinfo: use uuid_is_null instead of opencoding it Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 11/24] uuid: hoist uuid_is_null() helper from libnvdimm Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 16/24] ima/policy: switch to use uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 24/24] MAINTAINERS: add uuid entry Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 19/24] partitions/ldm: switch to use uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 15/24] block: remove blk_part_pack_uuid Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
    Re: [PATCH 15/24] block: remove blk_part_pack_uuid Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-31 20:20 +0200
      Re: [PATCH 15/24] block: remove blk_part_pack_uuid Christoph Hellwig <hch@lst.de> - 2017-05-31 21:40 +0200
  [PATCH 23/24] tmpfs: generate random sb->s_uuid Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 17/24] fs: switch ->s_uuid to uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 13/24] xfs: remove uuid_getnodeuniq and xfs_uu_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 21/24] nvme: switch to uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 14/24] xfs: use the common helper uuid_is_null() Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 20/24] sysctl: switch to use uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 08/24] uuid: rename uuid_to_bin to uuid_parse Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
    Re: [PATCH 08/24] uuid: rename uuid_to_bin to uuid_parse Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-31 20:20 +0200
      Re: [PATCH 08/24] uuid: rename uuid_to_bin to uuid_parse Christoph Hellwig <hch@lst.de> - 2017-05-31 21:50 +0200
  [PATCH 22/24] scsi_debug: switch to uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200
  [PATCH 05/24] uuid: remove uuid_be defintions from the uapi header Christoph Hellwig <hch@lst.de> - 2017-05-31 18:30 +0200

csiph-web