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


Groups > linux.kernel > #1643848 > unrolled thread

cleanup UUID types V3

Started byChristoph Hellwig <hch@lst.de>
First post2017-05-18 08:30 +0200
Last post2017-05-23 15:20 +0200
Articles 20 on this page of 39 — 7 participants

Back to article view | Back to linux.kernel


Contents

  cleanup UUID types V3 Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
    [PATCH 21/23] nvme: switch to uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
    [PATCH 20/23] sysctl: switch to use uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
    [PATCH 15/23] block: remove blk_part_pack_uuid Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
      Re: [PATCH 15/23] block: remove blk_part_pack_uuid Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-05-19 01:20 +0200
    [PATCH 23/23] uuid: remove uuid_be Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
      Re: [PATCH 23/23] uuid: remove uuid_be Amir Goldstein <amir73il@gmail.com> - 2017-05-18 10:00 +0200
        Re: [PATCH 23/23] uuid: remove uuid_be Christoph Hellwig <hch@lst.de> - 2017-05-18 11:00 +0200
          Re: [PATCH 23/23] uuid: remove uuid_be Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-22 21:00 +0200
    [PATCH 22/23] scsi_debug: switch to uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
    [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
      Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t Brian Foster <bfoster@redhat.com> - 2017-05-18 15:30 +0200
      Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-05-19 01:40 +0200
    [PATCH 05/23] uuid: don't export guid_index and uuid_index Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
    [PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
    [PATCH 14/23] xfs: use the common helper uuid_is_null() Christoph Hellwig <hch@lst.de> - 2017-05-18 08:30 +0200
      Re: [PATCH 14/23] xfs: use the common helper uuid_is_null() Brian Foster <bfoster@redhat.com> - 2017-05-18 15:30 +0200
    [PATCH 19/23] partitions/ldm: switch to use uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
    [PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
    [PATCH 11/23] uuid: remove struct uuid_v1 Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
    [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
      Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type Brian Foster <bfoster@redhat.com> - 2017-05-18 15:30 +0200
      Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-05-19 01:40 +0200
    [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
      Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t Brian Foster <bfoster@redhat.com> - 2017-05-18 15:30 +0200
      Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-05-19 01:40 +0200
    [PATCH 16/23] ima/policy: switch to use uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
      Re: [PATCH 16/23] ima/policy: switch to use uuid_t Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-05-19 01:20 +0200
    [PATCH 06/23] uuid: add the v1 layout to uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
    [PATCH 17/23] fs: switch ->s_uuid to uuid_t Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
      Re: [PATCH 17/23] fs: switch ->s_uuid to uuid_t Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-05-19 01:20 +0200
    [PATCH 13/23] md: namespace private helper names Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
      Re: [PATCH 13/23] md: namespace private helper names Shaohua Li <shli@kernel.org> - 2017-05-18 20:40 +0200
      Re: [PATCH 13/23] md: namespace private helper names Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-22 21:00 +0200
        Re: [PATCH 13/23] md: namespace private helper names Christoph Hellwig <hch@lst.de> - 2017-05-23 10:50 +0200
    [PATCH 10/23] afs: switch to use uuid_t and uuid_gen Christoph Hellwig <hch@lst.de> - 2017-05-18 08:40 +0200
      Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-22 20:50 +0200
        Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen Christoph Hellwig <hch@lst.de> - 2017-05-23 11:00 +0200
          Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-23 15:20 +0200

Page 1 of 2  [1] 2  Next page →


#1643848 — cleanup UUID types V3

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subjectcleanup UUID types V3
Message-ID<tIn6G-68Z-11@gated-at.bofh.it>
Hi all,

this series, which is a combined effort from Amir, Andy and me introduces
new uuid_t and guid_t type names that are less confusing than the existing
types, adds new helpers for them and starts switching the fs code over to
it.  Andy has additional patches on top to convert many of the users
that use char arrays for UUIDs and GUIDs to these (or rather a predecessor
for now until updated).

Changes since V3:
 - stop exposing uuid_be/uuid_t to userspace
 - remove uuid_be entirely

Changes since V2:
 - various cleanups

[toc] | [next] | [standalone]


#1643849 — [PATCH 21/23] nvme: switch to uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 21/23] nvme: switch to uuid_t
Message-ID<tIn6G-68Z-21@gated-at.bofh.it>
In reply to#1643848
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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        | 2 +-
 6 files changed, 9 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 70e689bf1cad..da95e85cadec 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -882,8 +882,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 7cb77ba5993b..204f4066c971 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..d88e925f82ce 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -843,7 +843,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

[toc] | [prev] | [next] | [standalone]


#1643850 — [PATCH 20/23] sysctl: switch to use uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 20/23] sysctl: switch to use uuid_t
Message-ID<tIn6G-68Z-25@gated-at.bofh.it>
In reply to#1643848
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 kernel/sysctl_binary.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index ece4b177052b..1ae520eed53c 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1119,7 +1119,7 @@ static ssize_t bin_uuid(struct file *file,
 	/* Only supports reads */
 	if (oldval && oldlen) {
 		char buf[UUID_STRING_LEN + 1];
-		uuid_be uuid;
+		uuid_t uuid;
 
 		result = kernel_read(file, 0, buf, sizeof(buf) - 1);
 		if (result < 0)
@@ -1128,7 +1128,7 @@ static ssize_t bin_uuid(struct file *file,
 		buf[result] = '\0';
 
 		result = -EIO;
-		if (uuid_be_to_bin(buf, &uuid))
+		if (uuid_to_bin(buf, &uuid))
 			goto out;
 
 		if (oldlen > 16)
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1643851 — [PATCH 15/23] block: remove blk_part_pack_uuid

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 15/23] block: remove blk_part_pack_uuid
Message-ID<tIn6G-68Z-27@gated-at.bofh.it>
In reply to#1643848
This helper was only used by IMA of all things, which would get spurious
errors if CONFIG_BLOCK is disabled.  Just opencode the call there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/genhd.h               | 11 -----------
 security/integrity/ima/ima_policy.c |  3 +--
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index acff9437e5c3..e619fae2f037 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -219,12 +219,6 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part)
 	return NULL;
 }
 
-static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
-{
-	uuid_be_to_bin(uuid_str, (uuid_be *)to);
-	return 0;
-}
-
 static inline int disk_max_parts(struct gendisk *disk)
 {
 	if (disk->flags & GENHD_FL_EXT_DEVT)
@@ -736,11 +730,6 @@ static inline dev_t blk_lookup_devt(const char *name, int partno)
 	dev_t devt = MKDEV(0, 0);
 	return devt;
 }
-
-static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
-{
-	return -EINVAL;
-}
 #endif /* CONFIG_BLOCK */
 
 #endif /* _LINUX_GENHD_H */
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 3ab1067db624..49fbc3e8f012 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -717,8 +717,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 				break;
 			}
 
-			result = blk_part_pack_uuid(args[0].from,
-						    entry->fsuuid);
+			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
 			if (!result)
 				entry->flags |= IMA_FSUUID;
 			break;
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1644951 — Re: [PATCH 15/23] block: remove blk_part_pack_uuid

FromMimi Zohar <zohar@linux.vnet.ibm.com>
Date2017-05-19 01:20 +0200
SubjectRe: [PATCH 15/23] block: remove blk_part_pack_uuid
Message-ID<tICS5-1HW-5@gated-at.bofh.it>
In reply to#1643851
On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> This helper was only used by IMA of all things, which would get spurious
> errors if CONFIG_BLOCK is disabled.  Just opencode the call there.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>

> ---
>  include/linux/genhd.h               | 11 -----------
>  security/integrity/ima/ima_policy.c |  3 +--
>  2 files changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
> index acff9437e5c3..e619fae2f037 100644
> --- a/include/linux/genhd.h
> +++ b/include/linux/genhd.h
> @@ -219,12 +219,6 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part)
>  	return NULL;
>  }
> 
> -static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
> -{
> -	uuid_be_to_bin(uuid_str, (uuid_be *)to);
> -	return 0;
> -}
> -
>  static inline int disk_max_parts(struct gendisk *disk)
>  {
>  	if (disk->flags & GENHD_FL_EXT_DEVT)
> @@ -736,11 +730,6 @@ static inline dev_t blk_lookup_devt(const char *name, int partno)
>  	dev_t devt = MKDEV(0, 0);
>  	return devt;
>  }
> -
> -static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
> -{
> -	return -EINVAL;
> -}
>  #endif /* CONFIG_BLOCK */
> 
>  #endif /* _LINUX_GENHD_H */
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 3ab1067db624..49fbc3e8f012 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -717,8 +717,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>  				break;
>  			}
> 
> -			result = blk_part_pack_uuid(args[0].from,
> -						    entry->fsuuid);
> +			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
>  			if (!result)
>  				entry->flags |= IMA_FSUUID;
>  			break;

[toc] | [prev] | [next] | [standalone]


#1643852 — [PATCH 23/23] uuid: remove uuid_be

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 23/23] uuid: remove uuid_be
Message-ID<tIn6G-68Z-23@gated-at.bofh.it>
In reply to#1643848
Everything uses uuid_t now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/uuid.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index e8a065035113..6b9a05570565 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -111,26 +111,12 @@ int guid_to_bin(const char *uuid, guid_t *u);
 int uuid_to_bin(const char *uuid, uuid_t *u);
 
 /* backwards compatibility, don't use in new code */
-typedef uuid_t uuid_be;
-#define UUID_BE(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
-	UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)
-#define NULL_UUID_BE 							\
-	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-	     0x00, 0x00, 0x00, 0x00)
-
 #define uuid_le_gen(u)		guid_gen(u)
-#define uuid_be_gen(u)		uuid_gen(u)
 #define uuid_le_to_bin(guid, u)	guid_to_bin(guid, u)
-#define uuid_be_to_bin(uuid, u)	uuid_to_bin(uuid, u)
 
 static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
 {
 	return memcmp(&u1, &u2, sizeof(guid_t));
 }
 
-static inline int uuid_be_cmp(const uuid_t u1, const uuid_t u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_t));
-}
-
 #endif
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1643923 — Re: [PATCH 23/23] uuid: remove uuid_be

FromAmir Goldstein <amir73il@gmail.com>
Date2017-05-18 10:00 +0200
SubjectRe: [PATCH 23/23] uuid: remove uuid_be
Message-ID<tIovM-7em-15@gated-at.bofh.it>
In reply to#1643852
On Thu, May 18, 2017 at 9:27 AM, Christoph Hellwig <hch@lst.de> wrote:
> Everything uses uuid_t now.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Excellent!
I reviewed the entire series. You may add
Reviewed-by: Amir Goldstein <amir73il@gmail.com>

to any of the patches as you see fit.

Now let's talk about how this is going to be merged.
Do you intend to send Linus a pull request?
Get those patches merged via someone else's tree?
Is this branch listed for linux-next build?

The reason I am asking is because this last removal patch should probably
be applied near the end of the merge window (?).
Because maintainers cannot apply patches with code that uses the new
uuid_t to linux-next branches and we don't want linux-next build to fail
with new code that uses uuid_be...

More to the point, I would like to re-post the patch
("tmpfs: generate random sb->s_uuid") using uuid_gen()
instead of generate_random_uuid() as you proposed.
Hugh has already acked the intent "once fs is agreed on the way to go"
When and how would I have this patch applied?
Obvious solution.. can you apply this patch to your branch?
Do you need me to re-post it?

Thanks for working on this!
Amir.

[toc] | [prev] | [next] | [standalone]


#1643985 — Re: [PATCH 23/23] uuid: remove uuid_be

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 11:00 +0200
SubjectRe: [PATCH 23/23] uuid: remove uuid_be
Message-ID<tIprP-7UI-5@gated-at.bofh.it>
In reply to#1643923
On Thu, May 18, 2017 at 10:57:24AM +0300, Amir Goldstein wrote:
> I reviewed the entire series. You may add
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> 
> to any of the patches as you see fit.

Thanks, done!

> Now let's talk about how this is going to be merged.
> Do you intend to send Linus a pull request?

Yes, that might be the best idea.  I'm also contemplating listing
me plus anyone volunteering (you?, Andy) as maintaines for the uuid
code.

But first I'll need a few more reviews, at least for the XFS bits.

> Get those patches merged via someone else's tree?
> Is this branch listed for linux-next build?

Not yet.

> The reason I am asking is because this last removal patch should probably
> be applied near the end of the merge window (?).
> Because maintainers cannot apply patches with code that uses the new
> uuid_t to linux-next branches and we don't want linux-next build to fail
> with new code that uses uuid_be...

Yeah, we can probably defer that one for now.

> More to the point, I would like to re-post the patch
> ("tmpfs: generate random sb->s_uuid") using uuid_gen()
> instead of generate_random_uuid() as you proposed.
> Hugh has already acked the intent "once fs is agreed on the way to go"
> When and how would I have this patch applied?
> Obvious solution.. can you apply this patch to your branch?

Yes.

> Do you need me to re-post it?

Please do.

[toc] | [prev] | [next] | [standalone]


#1647267 — Re: [PATCH 23/23] uuid: remove uuid_be

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-05-22 21:00 +0200
SubjectRe: [PATCH 23/23] uuid: remove uuid_be
Message-ID<tK0IF-R8-11@gated-at.bofh.it>
In reply to#1643985
On Thu, 2017-05-18 at 10:56 +0200, Christoph Hellwig wrote:
> On Thu, May 18, 2017 at 10:57:24AM +0300, Amir Goldstein wrote:
> > I reviewed the entire series. You may add
> > Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> > 
> > to any of the patches as you see fit.
> 
> Thanks, done!

Similar from my side, FWIW:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> > Now let's talk about how this is going to be merged.
> > Do you intend to send Linus a pull request?
> 
> Yes, that might be the best idea.  I'm also contemplating listing
> me plus anyone volunteering (you?, Andy) as maintaines for the uuid
> code.

I would agree to be a designated reviewer for now (too many stuff to
follow as a (co-)maintainer).

> > The reason I am asking is because this last removal patch should
> > probably
> > be applied near the end of the merge window (?).
> > Because maintainers cannot apply patches with code that uses the new
> > uuid_t to linux-next branches and we don't want linux-next build to
> > fail
> > with new code that uses uuid_be...
> 
> Yeah, we can probably defer that one for now.

I would also like to append some of patches from my side, though they
are WIP.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [next] | [standalone]


#1643854 — [PATCH 22/23] scsi_debug: switch to uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 22/23] scsi_debug: switch to uuid_t
Message-ID<tIn6H-68Z-33@gated-at.bofh.it>
In reply to#1643848
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/scsi_debug.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 17249c3650fe..35ee09644cfb 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -245,7 +245,7 @@ struct sdebug_dev_info {
 	unsigned int channel;
 	unsigned int target;
 	u64 lun;
-	uuid_be lu_name;
+	uuid_t lu_name;
 	struct sdebug_host_info *sdbg_host;
 	unsigned long uas_bm[1];
 	atomic_t num_in_q;
@@ -965,7 +965,7 @@ static const u64 naa3_comp_c = 0x3111111000000000ULL;
 static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
 			  int target_dev_id, int dev_id_num,
 			  const char *dev_id_str, int dev_id_str_len,
-			  const uuid_be *lu_name)
+			  const uuid_t *lu_name)
 {
 	int num, port_a;
 	char b[32];
@@ -3568,7 +3568,7 @@ static void sdebug_q_cmd_wq_complete(struct work_struct *work)
 }
 
 static bool got_shared_uuid;
-static uuid_be shared_uuid;
+static uuid_t shared_uuid;
 
 static struct sdebug_dev_info *sdebug_device_create(
 			struct sdebug_host_info *sdbg_host, gfp_t flags)
@@ -3578,12 +3578,12 @@ static struct sdebug_dev_info *sdebug_device_create(
 	devip = kzalloc(sizeof(*devip), flags);
 	if (devip) {
 		if (sdebug_uuid_ctl == 1)
-			uuid_be_gen(&devip->lu_name);
+			uuid_gen(&devip->lu_name);
 		else if (sdebug_uuid_ctl == 2) {
 			if (got_shared_uuid)
 				devip->lu_name = shared_uuid;
 			else {
-				uuid_be_gen(&shared_uuid);
+				uuid_gen(&shared_uuid);
 				got_shared_uuid = true;
 				devip->lu_name = shared_uuid;
 			}
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1643855 — [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
Message-ID<tIn6H-68Z-37@gated-at.bofh.it>
In reply to#1643848
From: Amir Goldstein <amir73il@gmail.com>

uuid_t definition is about to change.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_inode_item.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 08cb7d1a4a3a..013cc78d7daf 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -834,9 +834,7 @@ xfs_inode_item_format_convert(
 		in_f->ilf_dsize = in_f32->ilf_dsize;
 		in_f->ilf_ino = in_f32->ilf_ino;
 		/* copy biggest field of ilf_u */
-		memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
-		       in_f32->ilf_u.ilfu_uuid.__u_bits,
-		       sizeof(uuid_t));
+		uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f32->ilf_u.ilfu_uuid);
 		in_f->ilf_blkno = in_f32->ilf_blkno;
 		in_f->ilf_len = in_f32->ilf_len;
 		in_f->ilf_boffset = in_f32->ilf_boffset;
@@ -851,9 +849,7 @@ xfs_inode_item_format_convert(
 		in_f->ilf_dsize = in_f64->ilf_dsize;
 		in_f->ilf_ino = in_f64->ilf_ino;
 		/* copy biggest field of ilf_u */
-		memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
-		       in_f64->ilf_u.ilfu_uuid.__u_bits,
-		       sizeof(uuid_t));
+		uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f64->ilf_u.ilfu_uuid);
 		in_f->ilf_blkno = in_f64->ilf_blkno;
 		in_f->ilf_len = in_f64->ilf_len;
 		in_f->ilf_boffset = in_f64->ilf_boffset;
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1644503 — Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t

FromBrian Foster <bfoster@redhat.com>
Date2017-05-18 15:30 +0200
SubjectRe: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
Message-ID<tItF7-37o-13@gated-at.bofh.it>
In reply to#1643855
On Thu, May 18, 2017 at 08:26:43AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> uuid_t definition is about to change.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_inode_item.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
> index 08cb7d1a4a3a..013cc78d7daf 100644
> --- a/fs/xfs/xfs_inode_item.c
> +++ b/fs/xfs/xfs_inode_item.c
> @@ -834,9 +834,7 @@ xfs_inode_item_format_convert(
>  		in_f->ilf_dsize = in_f32->ilf_dsize;
>  		in_f->ilf_ino = in_f32->ilf_ino;
>  		/* copy biggest field of ilf_u */
> -		memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
> -		       in_f32->ilf_u.ilfu_uuid.__u_bits,
> -		       sizeof(uuid_t));
> +		uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f32->ilf_u.ilfu_uuid);
>  		in_f->ilf_blkno = in_f32->ilf_blkno;
>  		in_f->ilf_len = in_f32->ilf_len;
>  		in_f->ilf_boffset = in_f32->ilf_boffset;
> @@ -851,9 +849,7 @@ xfs_inode_item_format_convert(
>  		in_f->ilf_dsize = in_f64->ilf_dsize;
>  		in_f->ilf_ino = in_f64->ilf_ino;
>  		/* copy biggest field of ilf_u */
> -		memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
> -		       in_f64->ilf_u.ilfu_uuid.__u_bits,
> -		       sizeof(uuid_t));
> +		uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f64->ilf_u.ilfu_uuid);
>  		in_f->ilf_blkno = in_f64->ilf_blkno;
>  		in_f->ilf_len = in_f64->ilf_len;
>  		in_f->ilf_boffset = in_f64->ilf_boffset;
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1644959 — Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t

From"Darrick J. Wong" <darrick.wong@oracle.com>
Date2017-05-19 01:40 +0200
SubjectRe: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
Message-ID<tIDbs-1ON-9@gated-at.bofh.it>
In reply to#1643855
On Thu, May 18, 2017 at 08:26:43AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> uuid_t definition is about to change.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

> ---
>  fs/xfs/xfs_inode_item.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
> index 08cb7d1a4a3a..013cc78d7daf 100644
> --- a/fs/xfs/xfs_inode_item.c
> +++ b/fs/xfs/xfs_inode_item.c
> @@ -834,9 +834,7 @@ xfs_inode_item_format_convert(
>  		in_f->ilf_dsize = in_f32->ilf_dsize;
>  		in_f->ilf_ino = in_f32->ilf_ino;
>  		/* copy biggest field of ilf_u */
> -		memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
> -		       in_f32->ilf_u.ilfu_uuid.__u_bits,
> -		       sizeof(uuid_t));
> +		uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f32->ilf_u.ilfu_uuid);
>  		in_f->ilf_blkno = in_f32->ilf_blkno;
>  		in_f->ilf_len = in_f32->ilf_len;
>  		in_f->ilf_boffset = in_f32->ilf_boffset;
> @@ -851,9 +849,7 @@ xfs_inode_item_format_convert(
>  		in_f->ilf_dsize = in_f64->ilf_dsize;
>  		in_f->ilf_ino = in_f64->ilf_ino;
>  		/* copy biggest field of ilf_u */
> -		memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
> -		       in_f64->ilf_u.ilfu_uuid.__u_bits,
> -		       sizeof(uuid_t));
> +		uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f64->ilf_u.ilfu_uuid);
>  		in_f->ilf_blkno = in_f64->ilf_blkno;
>  		in_f->ilf_len = in_f64->ilf_len;
>  		in_f->ilf_boffset = in_f64->ilf_boffset;
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1643856 — [PATCH 05/23] uuid: don't export guid_index and uuid_index

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 05/23] uuid: don't export guid_index and uuid_index
Message-ID<tIn6H-68Z-39@gated-at.bofh.it>
In reply to#1643848
These are only used in uuid.c and vsprintf.c and aren't something modules
should use directly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/uuid.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/uuid.c b/lib/uuid.c
index f80dc63f6ca8..003bf6823003 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -22,9 +22,7 @@
 #include <linux/random.h>
 
 const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(guid_index);
 const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_index);
 
 /***************************************************************
  * Random UUID interface
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1643857 — [PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it
Message-ID<tIn6H-68Z-41@gated-at.bofh.it>
In reply to#1643848
.. and switch to use uuid_t instead of the old uuid_be type while we're
at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/s390/include/asm/sysinfo.h | 4 ++--
 arch/s390/kernel/sysinfo.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
index 73bff45ced55..e7f8e1b77d92 100644
--- a/arch/s390/include/asm/sysinfo.h
+++ b/arch/s390/include/asm/sysinfo.h
@@ -109,7 +109,7 @@ struct sysinfo_2_2_2 {
 	unsigned short cpus_shared;
 	char reserved_4[3];
 	unsigned char vsne;
-	uuid_be uuid;
+	uuid_t uuid;
 	char reserved_5[160];
 	char ext_name[256];
 };
@@ -134,7 +134,7 @@ struct sysinfo_3_2_2 {
 		char reserved_1[3];
 		unsigned char evmne;
 		unsigned int reserved_2;
-		uuid_be uuid;
+		uuid_t uuid;
 	} vm[8];
 	char reserved_3[1504];
 	char ext_names[8][256];
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index eefcb54872a5..fb869b103825 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -242,7 +242,7 @@ static void print_ext_name(struct seq_file *m, int lvl,
 
 static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info)
 {
-	if (!memcmp(&info->vm[i].uuid, &NULL_UUID_BE, sizeof(uuid_be)))
+	if (uuid_is_null(&info->vm[i].uuid))
 		return;
 	seq_printf(m, "VM%02d UUID:            %pUb\n", i, &info->vm[i].uuid);
 }
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1643858 — [PATCH 14/23] xfs: use the common helper uuid_is_null()

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:30 +0200
Subject[PATCH 14/23] xfs: use the common helper uuid_is_null()
Message-ID<tIn6H-68Z-35@gated-at.bofh.it>
In reply to#1643848
From: Amir Goldstein <amir73il@gmail.com>

Use the common helper uuid_is_null() and remove the xfs specific
helper uuid_is_nil().

The common helper does not check for the NULL pointer value as
xfs helper did, but xfs code never calls the helper with a pointer
that can be NULL.

Conform comments and warning strings to use the term 'null uuid'
instead of 'nil uuid', because this is the terminology used by
lib/uuid.c and its users. It is also the terminology used in
userspace by libuuid and xfsprogs.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[hch: remove now unused uuid.[ch]]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/Makefile          |  3 +--
 fs/xfs/uuid.c            | 32 --------------------------------
 fs/xfs/uuid.h            | 23 -----------------------
 fs/xfs/xfs_linux.h       |  1 -
 fs/xfs/xfs_log_recover.c |  6 +++---
 fs/xfs/xfs_mount.c       |  8 ++++----
 6 files changed, 8 insertions(+), 65 deletions(-)
 delete mode 100644 fs/xfs/uuid.c
 delete mode 100644 fs/xfs/uuid.h

diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 5c90f82b8f6b..a6e955bfead8 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -98,8 +98,7 @@ xfs-y				+= xfs_aops.o \
 				   xfs_sysfs.o \
 				   xfs_trans.o \
 				   xfs_xattr.o \
-				   kmem.o \
-				   uuid.o
+				   kmem.o
 
 # low-level transaction/log code
 xfs-y				+= xfs_log.o \
diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
deleted file mode 100644
index 737c186ea98b..000000000000
--- a/fs/xfs/uuid.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#include <xfs.h>
-
-int
-uuid_is_nil(uuid_t *uuid)
-{
-	int	i;
-	char	*cp = (char *)uuid;
-
-	if (uuid == NULL)
-		return 0;
-	/* implied check of version number here... */
-	for (i = 0; i < sizeof *uuid; i++)
-		if (*cp++) return 0;	/* not nil */
-	return 1;	/* is nil */
-}
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
deleted file mode 100644
index 5aea49bf0963..000000000000
--- a/fs/xfs/uuid.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef __XFS_SUPPORT_UUID_H__
-#define __XFS_SUPPORT_UUID_H__
-
-extern int uuid_is_nil(uuid_t *uuid);
-
-#endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 2c33d915e550..2d167fe643ec 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -43,7 +43,6 @@ typedef __u32			xfs_nlink_t;
 
 #include "kmem.h"
 #include "mrlock.h"
-#include "uuid.h"
 
 #include <linux/semaphore.h>
 #include <linux/mm.h>
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index cd0b077deb35..8cec1e5505a4 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -352,13 +352,13 @@ xlog_header_check_mount(
 {
 	ASSERT(head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM));
 
-	if (uuid_is_nil(&head->h_fs_uuid)) {
+	if (uuid_is_null(&head->h_fs_uuid)) {
 		/*
 		 * IRIX doesn't write the h_fs_uuid or h_fmt fields. If
-		 * h_fs_uuid is nil, we assume this log was last mounted
+		 * h_fs_uuid is null, we assume this log was last mounted
 		 * by IRIX and continue.
 		 */
-		xfs_warn(mp, "nil uuid in log - IRIX style log");
+		xfs_warn(mp, "null uuid in log - IRIX style log");
 	} else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
 		xfs_warn(mp, "log has mismatched uuid - can't recover");
 		xlog_header_check_dump(mp, head);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 742e4a61c0bc..682b336a7a6a 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -80,14 +80,14 @@ xfs_uuid_mount(
 	if (mp->m_flags & XFS_MOUNT_NOUUID)
 		return 0;
 
-	if (uuid_is_nil(uuid)) {
-		xfs_warn(mp, "Filesystem has nil UUID - can't mount");
+	if (uuid_is_null(uuid)) {
+		xfs_warn(mp, "Filesystem has null UUID - can't mount");
 		return -EINVAL;
 	}
 
 	mutex_lock(&xfs_uuid_table_mutex);
 	for (i = 0, hole = -1; i < xfs_uuid_table_size; i++) {
-		if (uuid_is_nil(&xfs_uuid_table[i])) {
+		if (uuid_is_null(&xfs_uuid_table[i])) {
 			hole = i;
 			continue;
 		}
@@ -124,7 +124,7 @@ xfs_uuid_unmount(
 
 	mutex_lock(&xfs_uuid_table_mutex);
 	for (i = 0; i < xfs_uuid_table_size; i++) {
-		if (uuid_is_nil(&xfs_uuid_table[i]))
+		if (uuid_is_null(&xfs_uuid_table[i]))
 			continue;
 		if (!uuid_equal(uuid, &xfs_uuid_table[i]))
 			continue;
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1644514 — Re: [PATCH 14/23] xfs: use the common helper uuid_is_null()

FromBrian Foster <bfoster@redhat.com>
Date2017-05-18 15:30 +0200
SubjectRe: [PATCH 14/23] xfs: use the common helper uuid_is_null()
Message-ID<tItF8-37o-37@gated-at.bofh.it>
In reply to#1643858
On Thu, May 18, 2017 at 08:26:56AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> Use the common helper uuid_is_null() and remove the xfs specific
> helper uuid_is_nil().
> 
> The common helper does not check for the NULL pointer value as
> xfs helper did, but xfs code never calls the helper with a pointer
> that can be NULL.
> 
> Conform comments and warning strings to use the term 'null uuid'
> instead of 'nil uuid', because this is the terminology used by
> lib/uuid.c and its users. It is also the terminology used in
> userspace by libuuid and xfsprogs.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> [hch: remove now unused uuid.[ch]]
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/Makefile          |  3 +--
>  fs/xfs/uuid.c            | 32 --------------------------------
>  fs/xfs/uuid.h            | 23 -----------------------
>  fs/xfs/xfs_linux.h       |  1 -
>  fs/xfs/xfs_log_recover.c |  6 +++---
>  fs/xfs/xfs_mount.c       |  8 ++++----
>  6 files changed, 8 insertions(+), 65 deletions(-)
>  delete mode 100644 fs/xfs/uuid.c
>  delete mode 100644 fs/xfs/uuid.h
> 
> diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
> index 5c90f82b8f6b..a6e955bfead8 100644
> --- a/fs/xfs/Makefile
> +++ b/fs/xfs/Makefile
> @@ -98,8 +98,7 @@ xfs-y				+= xfs_aops.o \
>  				   xfs_sysfs.o \
>  				   xfs_trans.o \
>  				   xfs_xattr.o \
> -				   kmem.o \
> -				   uuid.o
> +				   kmem.o
>  
>  # low-level transaction/log code
>  xfs-y				+= xfs_log.o \
> diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
> deleted file mode 100644
> index 737c186ea98b..000000000000
> --- a/fs/xfs/uuid.c
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -/*
> - * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
> - * All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it would be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write the Free Software Foundation,
> - * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> - */
> -#include <xfs.h>
> -
> -int
> -uuid_is_nil(uuid_t *uuid)
> -{
> -	int	i;
> -	char	*cp = (char *)uuid;
> -
> -	if (uuid == NULL)
> -		return 0;
> -	/* implied check of version number here... */
> -	for (i = 0; i < sizeof *uuid; i++)
> -		if (*cp++) return 0;	/* not nil */
> -	return 1;	/* is nil */
> -}
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> deleted file mode 100644
> index 5aea49bf0963..000000000000
> --- a/fs/xfs/uuid.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/*
> - * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
> - * All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it would be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write the Free Software Foundation,
> - * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> - */
> -#ifndef __XFS_SUPPORT_UUID_H__
> -#define __XFS_SUPPORT_UUID_H__
> -
> -extern int uuid_is_nil(uuid_t *uuid);
> -
> -#endif	/* __XFS_SUPPORT_UUID_H__ */
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 2c33d915e550..2d167fe643ec 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -43,7 +43,6 @@ typedef __u32			xfs_nlink_t;
>  
>  #include "kmem.h"
>  #include "mrlock.h"
> -#include "uuid.h"
>  
>  #include <linux/semaphore.h>
>  #include <linux/mm.h>
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index cd0b077deb35..8cec1e5505a4 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -352,13 +352,13 @@ xlog_header_check_mount(
>  {
>  	ASSERT(head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM));
>  
> -	if (uuid_is_nil(&head->h_fs_uuid)) {
> +	if (uuid_is_null(&head->h_fs_uuid)) {
>  		/*
>  		 * IRIX doesn't write the h_fs_uuid or h_fmt fields. If
> -		 * h_fs_uuid is nil, we assume this log was last mounted
> +		 * h_fs_uuid is null, we assume this log was last mounted
>  		 * by IRIX and continue.
>  		 */
> -		xfs_warn(mp, "nil uuid in log - IRIX style log");
> +		xfs_warn(mp, "null uuid in log - IRIX style log");
>  	} else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
>  		xfs_warn(mp, "log has mismatched uuid - can't recover");
>  		xlog_header_check_dump(mp, head);
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 742e4a61c0bc..682b336a7a6a 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -80,14 +80,14 @@ xfs_uuid_mount(
>  	if (mp->m_flags & XFS_MOUNT_NOUUID)
>  		return 0;
>  
> -	if (uuid_is_nil(uuid)) {
> -		xfs_warn(mp, "Filesystem has nil UUID - can't mount");
> +	if (uuid_is_null(uuid)) {
> +		xfs_warn(mp, "Filesystem has null UUID - can't mount");
>  		return -EINVAL;
>  	}
>  
>  	mutex_lock(&xfs_uuid_table_mutex);
>  	for (i = 0, hole = -1; i < xfs_uuid_table_size; i++) {
> -		if (uuid_is_nil(&xfs_uuid_table[i])) {
> +		if (uuid_is_null(&xfs_uuid_table[i])) {
>  			hole = i;
>  			continue;
>  		}
> @@ -124,7 +124,7 @@ xfs_uuid_unmount(
>  
>  	mutex_lock(&xfs_uuid_table_mutex);
>  	for (i = 0; i < xfs_uuid_table_size; i++) {
> -		if (uuid_is_nil(&xfs_uuid_table[i]))
> +		if (uuid_is_null(&xfs_uuid_table[i]))
>  			continue;
>  		if (!uuid_equal(uuid, &xfs_uuid_table[i]))
>  			continue;
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1643859 — [PATCH 19/23] partitions/ldm: switch to use uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 19/23] partitions/ldm: switch to use uuid_t
Message-ID<tIngl-6dz-5@gated-at.bofh.it>
In reply to#1643848
And the uuid helpers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/partitions/ldm.c | 10 +++++-----
 block/partitions/ldm.h |  6 ++----
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
index edcea70674c9..bbf929e80b94 100644
--- a/block/partitions/ldm.c
+++ b/block/partitions/ldm.c
@@ -115,7 +115,7 @@ static bool ldm_parse_privhead(const u8 *data, struct privhead *ph)
 		ldm_error("PRIVHEAD disk size doesn't match real disk size");
 		return false;
 	}
-	if (uuid_be_to_bin(data + 0x0030, (uuid_be *)ph->disk_id)) {
+	if (uuid_to_bin(data + 0x0030, &ph->disk_id)) {
 		ldm_error("PRIVHEAD contains an invalid GUID.");
 		return false;
 	}
@@ -234,7 +234,7 @@ static bool ldm_compare_privheads (const struct privhead *ph1,
 		(ph1->logical_disk_size  == ph2->logical_disk_size)	&&
 		(ph1->config_start       == ph2->config_start)		&&
 		(ph1->config_size        == ph2->config_size)		&&
-		!memcmp (ph1->disk_id, ph2->disk_id, GUID_SIZE));
+		uuid_equal(&ph1->disk_id, &ph2->disk_id));
 }
 
 /**
@@ -557,7 +557,7 @@ static struct vblk * ldm_get_disk_objid (const struct ldmdb *ldb)
 
 	list_for_each (item, &ldb->v_disk) {
 		struct vblk *v = list_entry (item, struct vblk, list);
-		if (!memcmp (v->vblk.disk.disk_id, ldb->ph.disk_id, GUID_SIZE))
+		if (uuid_equal(&v->vblk.disk.disk_id, &ldb->ph.disk_id))
 			return v;
 	}
 
@@ -892,7 +892,7 @@ static bool ldm_parse_dsk3 (const u8 *buffer, int buflen, struct vblk *vb)
 	disk = &vb->vblk.disk;
 	ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name,
 		sizeof (disk->alt_name));
-	if (uuid_be_to_bin(buffer + 0x19 + r_name, (uuid_be *)disk->disk_id))
+	if (uuid_to_bin(buffer + 0x19 + r_name, &disk->disk_id))
 		return false;
 
 	return true;
@@ -927,7 +927,7 @@ static bool ldm_parse_dsk4 (const u8 *buffer, int buflen, struct vblk *vb)
 		return false;
 
 	disk = &vb->vblk.disk;
-	memcpy (disk->disk_id, buffer + 0x18 + r_name, GUID_SIZE);
+	uuid_copy(&disk->disk_id, (uuid_t *)(buffer + 0x18 + r_name));
 	return true;
 }
 
diff --git a/block/partitions/ldm.h b/block/partitions/ldm.h
index 374242c0971a..f4c6055df956 100644
--- a/block/partitions/ldm.h
+++ b/block/partitions/ldm.h
@@ -112,8 +112,6 @@ struct frag {				/* VBLK Fragment handling */
 
 /* In memory LDM database structures. */
 
-#define GUID_SIZE		16
-
 struct privhead {			/* Offsets and sizes are in sectors. */
 	u16	ver_major;
 	u16	ver_minor;
@@ -121,7 +119,7 @@ struct privhead {			/* Offsets and sizes are in sectors. */
 	u64	logical_disk_size;
 	u64	config_start;
 	u64	config_size;
-	u8	disk_id[GUID_SIZE];
+	uuid_t	disk_id;
 };
 
 struct tocblock {			/* We have exactly two bitmaps. */
@@ -154,7 +152,7 @@ struct vblk_dgrp {			/* VBLK Disk Group */
 };
 
 struct vblk_disk {			/* VBLK Disk */
-	u8	disk_id[GUID_SIZE];
+	uuid_t	disk_id;
 	u8	alt_name[128];
 };
 
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1643860 — [PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm
Message-ID<tIngl-6dz-7@gated-at.bofh.it>
In reply to#1643848
Hoist the libnvdimm helper as an inline helper to linux/uuid.h
using an auxiliary const variable uuid_null in lib/uuid.c.

[hch: also add the guid variant.  Both do the same but I'd like
to keep casts to a minimum]

The common helper uses the new abstract type uuid_t * instead of
u8 *.

Suggested-by: Christoph Hellwig <hch@lst.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[hch: added guid_is_null]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/btt_devs.c |  9 +--------
 include/linux/uuid.h      | 13 +++++++++++++
 lib/uuid.c                |  5 +++++
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
index ae00dc0d9791..4c989bb9a8a0 100644
--- a/drivers/nvdimm/btt_devs.c
+++ b/drivers/nvdimm/btt_devs.c
@@ -222,13 +222,6 @@ struct device *nd_btt_create(struct nd_region *nd_region)
 	return dev;
 }
 
-static bool uuid_is_null(u8 *uuid)
-{
-	static const u8 null_uuid[16];
-
-	return (memcmp(uuid, null_uuid, 16) == 0);
-}
-
 /**
  * nd_btt_arena_is_valid - check if the metadata layout is valid
  * @nd_btt:	device with BTT geometry and backing device info
@@ -249,7 +242,7 @@ bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super)
 	if (memcmp(super->signature, BTT_SIG, BTT_SIG_LEN) != 0)
 		return false;
 
-	if (!uuid_is_null(super->parent_uuid))
+	if (!guid_is_null((guid_t *)&super->parent_uuid))
 		if (memcmp(super->parent_uuid, parent_uuid, 16) != 0)
 			return false;
 
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 7aff929007dd..47ca06d846d4 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -64,6 +64,9 @@ typedef struct {
  */
 #define	UUID_STRING_LEN		36
 
+extern const guid_t guid_null;
+extern const uuid_t uuid_null;
+
 static inline bool guid_equal(const guid_t *u1, const guid_t *u2)
 {
 	return memcmp(u1, u2, sizeof(guid_t)) == 0;
@@ -74,6 +77,11 @@ static inline void guid_copy(guid_t *dst, const guid_t *src)
 	memcpy(dst, src, sizeof(guid_t));
 }
 
+static inline bool guid_is_null(guid_t *guid)
+{
+	return guid_equal(guid, &guid_null);
+}
+
 static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
 {
 	return memcmp(u1, u2, sizeof(uuid_t)) == 0;
@@ -84,6 +92,11 @@ static inline void uuid_copy(uuid_t *dst, const uuid_t *src)
 	memcpy(dst, src, sizeof(uuid_t));
 }
 
+static inline bool uuid_is_null(uuid_t *uuid)
+{
+	return uuid_equal(uuid, &uuid_null);
+}
+
 void generate_random_uuid(unsigned char uuid[16]);
 
 extern void guid_gen(guid_t *u);
diff --git a/lib/uuid.c b/lib/uuid.c
index 003bf6823003..25145bfb0eaa 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -21,6 +21,11 @@
 #include <linux/uuid.h>
 #include <linux/random.h>
 
+const guid_t guid_null;
+EXPORT_SYMBOL(guid_null);
+const uuid_t uuid_null;
+EXPORT_SYMBOL(uuid_null);
+
 const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
 const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
 
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1643861 — [PATCH 11/23] uuid: remove struct uuid_v1

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 11/23] uuid: remove struct uuid_v1
Message-ID<tIngl-6dz-9@gated-at.bofh.it>
In reply to#1643848
Unused now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/uuid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 47ca06d846d4..e8a065035113 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -40,7 +40,7 @@ typedef struct {
 		 * - the clock sequence is a 14-bit counter to avoid duplicate
 		 *   times
 		 */
-		struct uuid_v1 {
+		struct {
 			__be32		time_low;
 			__be16		time_mid;
 			__be16		time_hi_and_version;
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web