All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: use uuid_t in nvme_ns
@ 2017-06-10 13:03 ` Johannes Thumshirn
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-06-10 13:03 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Linux NVMe Mailinglist, Linux Kernel Mailinglist, Johannes Thumshirn

struct nvme_ns still uses u u8 uuid[16], change it to using uuid_t.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/host/core.c | 8 ++++----
 drivers/nvme/host/nvme.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c427a7fc31ae..ef8213ab0f7d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -699,7 +699,7 @@ static int nvme_identify_ns_descs(struct nvme_ns *ns, unsigned nsid)
 				goto free_data;
 			}
 			len = NVME_NIDT_UUID_LEN;
-			memcpy(ns->uuid, data + pos + sizeof(*cur), len);
+			memcpy(&ns->uuid, data + pos + sizeof(*cur), len);
 			break;
 		default:
 			/* Skip unnkown types */
@@ -1895,12 +1895,12 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr,
 	/* For backward compatibility expose the NGUID to userspace if
 	 * we have no UUID set
 	 */
-	if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid))) {
+	if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) {
 		printk_ratelimited(KERN_WARNING
 				   "No UUID available providing old NGUID\n");
 		return sprintf(buf, "%pU\n", ns->nguid);
 	}
-	return sprintf(buf, "%pU\n", ns->uuid);
+	return sprintf(buf, "%pU\n", &ns->uuid);
 }
 static DEVICE_ATTR(uuid, S_IRUGO, uuid_show, NULL);
 
@@ -1936,7 +1936,7 @@ static umode_t nvme_ns_attrs_are_visible(struct kobject *kobj,
 	struct nvme_ns *ns = nvme_get_ns_from_dev(dev);
 
 	if (a == &dev_attr_uuid.attr) {
-		if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid)) ||
+		if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid)) ||
 		    !memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
 			return 0;
 	}
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 7007521e8194..8ac225882097 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -190,7 +190,7 @@ struct nvme_ns {
 
 	u8 eui[8];
 	u8 nguid[16];
-	u8 uuid[16];
+	uuid_t uuid;
 
 	unsigned ns_id;
 	int lba_shift;
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] nvme: use uuid_t in nvme_ns
@ 2017-06-10 13:03 ` Johannes Thumshirn
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-06-10 13:03 UTC (permalink / raw)


struct nvme_ns still uses u u8 uuid[16], change it to using uuid_t.

Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
---
 drivers/nvme/host/core.c | 8 ++++----
 drivers/nvme/host/nvme.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c427a7fc31ae..ef8213ab0f7d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -699,7 +699,7 @@ static int nvme_identify_ns_descs(struct nvme_ns *ns, unsigned nsid)
 				goto free_data;
 			}
 			len = NVME_NIDT_UUID_LEN;
-			memcpy(ns->uuid, data + pos + sizeof(*cur), len);
+			memcpy(&ns->uuid, data + pos + sizeof(*cur), len);
 			break;
 		default:
 			/* Skip unnkown types */
@@ -1895,12 +1895,12 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr,
 	/* For backward compatibility expose the NGUID to userspace if
 	 * we have no UUID set
 	 */
-	if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid))) {
+	if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) {
 		printk_ratelimited(KERN_WARNING
 				   "No UUID available providing old NGUID\n");
 		return sprintf(buf, "%pU\n", ns->nguid);
 	}
-	return sprintf(buf, "%pU\n", ns->uuid);
+	return sprintf(buf, "%pU\n", &ns->uuid);
 }
 static DEVICE_ATTR(uuid, S_IRUGO, uuid_show, NULL);
 
@@ -1936,7 +1936,7 @@ static umode_t nvme_ns_attrs_are_visible(struct kobject *kobj,
 	struct nvme_ns *ns = nvme_get_ns_from_dev(dev);
 
 	if (a == &dev_attr_uuid.attr) {
-		if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid)) ||
+		if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid)) ||
 		    !memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
 			return 0;
 	}
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 7007521e8194..8ac225882097 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -190,7 +190,7 @@ struct nvme_ns {
 
 	u8 eui[8];
 	u8 nguid[16];
-	u8 uuid[16];
+	uuid_t uuid;
 
 	unsigned ns_id;
 	int lba_shift;
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: use uuid_t in nvme_ns
  2017-06-10 13:03 ` Johannes Thumshirn
@ 2017-06-10 15:40   ` Andy Shevchenko
  -1 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2017-06-10 15:40 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Christoph Hellwig, Linux NVMe Mailinglist, Linux Kernel Mailinglist

On Sat, Jun 10, 2017 at 4:03 PM, Johannes Thumshirn <jthumshirn@suse.de> wrote:

> struct nvme_ns still uses u u8 uuid[16], change it to using uuid_t.

...and we can convert to use UUID API.

> -                       memcpy(ns->uuid, data + pos + sizeof(*cur), len);
> +                       memcpy(&ns->uuid, data + pos + sizeof(*cur), len);

uuid_copy()

> -       if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid))) {
> +       if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) {

uuid_is_null()

> -               if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid)) ||
> +               if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid)) ||

Ditto.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] nvme: use uuid_t in nvme_ns
@ 2017-06-10 15:40   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2017-06-10 15:40 UTC (permalink / raw)


On Sat, Jun 10, 2017@4:03 PM, Johannes Thumshirn <jthumshirn@suse.de> wrote:

> struct nvme_ns still uses u u8 uuid[16], change it to using uuid_t.

...and we can convert to use UUID API.

> -                       memcpy(ns->uuid, data + pos + sizeof(*cur), len);
> +                       memcpy(&ns->uuid, data + pos + sizeof(*cur), len);

uuid_copy()

> -       if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid))) {
> +       if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) {

uuid_is_null()

> -               if (!memchr_inv(ns->uuid, 0, sizeof(ns->uuid)) ||
> +               if (!memchr_inv(&ns->uuid, 0, sizeof(ns->uuid)) ||

Ditto.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-10 15:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-10 13:03 [PATCH] nvme: use uuid_t in nvme_ns Johannes Thumshirn
2017-06-10 13:03 ` Johannes Thumshirn
2017-06-10 15:40 ` Andy Shevchenko
2017-06-10 15:40   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.