All of lore.kernel.org
 help / color / mirror / Atom feed
* cleanup UUID types V3
@ 2017-05-18  6:26 ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* cleanup UUID types V3
@ 2017-05-18  6:26 ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* cleanup UUID types V3
@ 2017-05-18  6:26 ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

From: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

uuid_t definition is about to change.

Signed-off-by: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

Use the generic Linux definition to implement our UUID type, this will
allow using more generic infrastructure in the future.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.h      | 4 ----
 fs/xfs/xfs_linux.h | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 104db0f3bed6..4f1441ba4fa5 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -18,10 +18,6 @@
 #ifndef __XFS_SUPPORT_UUID_H__
 #define __XFS_SUPPORT_UUID_H__
 
-typedef struct {
-	unsigned char	__u_bits[16];
-} uuid_t;
-
 extern int uuid_is_nil(uuid_t *uuid);
 extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 044fb0e15390..89ee5ec66837 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -19,6 +19,7 @@
 #define __XFS_LINUX__
 
 #include <linux/types.h>
+#include <linux/uuid.h>
 
 /*
  * Kernel specific type declarations for XFS
@@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
+typedef uuid_be			uuid_t;
+
 #include "xfs_types.h"
 
 #include "kmem.h"
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Use the generic Linux definition to implement our UUID type, this will
allow using more generic infrastructure in the future.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 fs/xfs/uuid.h      | 4 ----
 fs/xfs/xfs_linux.h | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 104db0f3bed6..4f1441ba4fa5 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -18,10 +18,6 @@
 #ifndef __XFS_SUPPORT_UUID_H__
 #define __XFS_SUPPORT_UUID_H__
 
-typedef struct {
-	unsigned char	__u_bits[16];
-} uuid_t;
-
 extern int uuid_is_nil(uuid_t *uuid);
 extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 044fb0e15390..89ee5ec66837 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -19,6 +19,7 @@
 #define __XFS_LINUX__
 
 #include <linux/types.h>
+#include <linux/uuid.h>
 
 /*
  * Kernel specific type declarations for XFS
@@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
+typedef uuid_be			uuid_t;
+
 #include "xfs_types.h"
 
 #include "kmem.h"
-- 
2.11.0

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

* [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Use the generic Linux definition to implement our UUID type, this will
allow using more generic infrastructure in the future.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.h      | 4 ----
 fs/xfs/xfs_linux.h | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 104db0f3bed6..4f1441ba4fa5 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -18,10 +18,6 @@
 #ifndef __XFS_SUPPORT_UUID_H__
 #define __XFS_SUPPORT_UUID_H__
 
-typedef struct {
-	unsigned char	__u_bits[16];
-} uuid_t;
-
 extern int uuid_is_nil(uuid_t *uuid);
 extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 044fb0e15390..89ee5ec66837 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -19,6 +19,7 @@
 #define __XFS_LINUX__
 
 #include <linux/types.h>
+#include <linux/uuid.h>
 
 /*
  * Kernel specific type declarations for XFS
@@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
+typedef uuid_be			uuid_t;
+
 #include "xfs_types.h"
 
 #include "kmem.h"
-- 
2.11.0

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

* [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Use the generic Linux definition to implement our UUID type, this will
allow using more generic infrastructure in the future.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.h      | 4 ----
 fs/xfs/xfs_linux.h | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 104db0f3bed6..4f1441ba4fa5 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -18,10 +18,6 @@
 #ifndef __XFS_SUPPORT_UUID_H__
 #define __XFS_SUPPORT_UUID_H__
 
-typedef struct {
-	unsigned char	__u_bits[16];
-} uuid_t;
-
 extern int uuid_is_nil(uuid_t *uuid);
 extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 044fb0e15390..89ee5ec66837 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -19,6 +19,7 @@
 #define __XFS_LINUX__
 
 #include <linux/types.h>
+#include <linux/uuid.h>
 
 /*
  * Kernel specific type declarations for XFS
@@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
+typedef uuid_be			uuid_t;
+
 #include "xfs_types.h"
 
 #include "kmem.h"
-- 
2.11.0

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

* [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
  2017-05-18  6:26 ` Christoph Hellwig
  (?)
@ 2017-05-18  6:26   ` Christoph Hellwig
  -1 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
them private to the kernel.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/uuid.h      | 15 +++++++++++++++
 include/uapi/linux/uuid.h | 16 ----------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 4dff73a89758..de3aea206562 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,6 +18,21 @@
 
 #include <uapi/linux/uuid.h>
 
+typedef struct {
+	__u8 b[16];
+} uuid_be;
+
+#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
+((uuid_be)								\
+{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((b) >> 8) & 0xff, (b) & 0xff,					\
+   ((c) >> 8) & 0xff, (c) & 0xff,					\
+   (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)
+
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 3738e5fb6a4d..0099756c4bac 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -24,10 +24,6 @@ typedef struct {
 	__u8 b[16];
 } uuid_le;
 
-typedef struct {
-	__u8 b[16];
-} uuid_be;
-
 #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
 ((uuid_le)								\
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
@@ -35,20 +31,8 @@ typedef struct {
    (c) & 0xff, ((c) >> 8) & 0xff,					\
    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_be)								\
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,					\
-   ((c) >> 8) & 0xff, (c) & 0xff,					\
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
 #define NULL_UUID_LE							\
 	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
 		0x00, 0x00, 0x00, 0x00)
 
-#define NULL_UUID_BE							\
-	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-		0x00, 0x00, 0x00, 0x00)
-
-
 #endif /* _UAPI_LINUX_UUID_H_ */
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
them private to the kernel.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/uuid.h      | 15 +++++++++++++++
 include/uapi/linux/uuid.h | 16 ----------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 4dff73a89758..de3aea206562 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,6 +18,21 @@
 
 #include <uapi/linux/uuid.h>
 
+typedef struct {
+	__u8 b[16];
+} uuid_be;
+
+#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
+((uuid_be)								\
+{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((b) >> 8) & 0xff, (b) & 0xff,					\
+   ((c) >> 8) & 0xff, (c) & 0xff,					\
+   (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)
+
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 3738e5fb6a4d..0099756c4bac 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -24,10 +24,6 @@ typedef struct {
 	__u8 b[16];
 } uuid_le;
 
-typedef struct {
-	__u8 b[16];
-} uuid_be;
-
 #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
 ((uuid_le)								\
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
@@ -35,20 +31,8 @@ typedef struct {
    (c) & 0xff, ((c) >> 8) & 0xff,					\
    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_be)								\
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,					\
-   ((c) >> 8) & 0xff, (c) & 0xff,					\
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
 #define NULL_UUID_LE							\
 	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
 		0x00, 0x00, 0x00, 0x00)
 
-#define NULL_UUID_BE							\
-	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-		0x00, 0x00, 0x00, 0x00)
-
-
 #endif /* _UAPI_LINUX_UUID_H_ */
-- 
2.11.0

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

* [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
them private to the kernel.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/uuid.h      | 15 +++++++++++++++
 include/uapi/linux/uuid.h | 16 ----------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 4dff73a89758..de3aea206562 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,6 +18,21 @@
 
 #include <uapi/linux/uuid.h>
 
+typedef struct {
+	__u8 b[16];
+} uuid_be;
+
+#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
+((uuid_be)								\
+{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((b) >> 8) & 0xff, (b) & 0xff,					\
+   ((c) >> 8) & 0xff, (c) & 0xff,					\
+   (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)
+
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 3738e5fb6a4d..0099756c4bac 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -24,10 +24,6 @@ typedef struct {
 	__u8 b[16];
 } uuid_le;
 
-typedef struct {
-	__u8 b[16];
-} uuid_be;
-
 #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
 ((uuid_le)								\
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
@@ -35,20 +31,8 @@ typedef struct {
    (c) & 0xff, ((c) >> 8) & 0xff,					\
    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_be)								\
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,					\
-   ((c) >> 8) & 0xff, (c) & 0xff,					\
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
 #define NULL_UUID_LE							\
 	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
 		0x00, 0x00, 0x00, 0x00)
 
-#define NULL_UUID_BE							\
-	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-		0x00, 0x00, 0x00, 0x00)
-
-
 #endif /* _UAPI_LINUX_UUID_H_ */
-- 
2.11.0

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

* [PATCH 04/23] uuid: rename uuid types
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

Our "little endian" UUID really is a Wintel GUID, so rename it and its
helpers such (guid_t).  The big endian UUID is the only true one, so
give it the name uuid_t.  The uuid_le and uuid_be names are retained for
now, but will hopefully go away soon.  The exception to that are the _cmp
helpers that will be replaced by better primites ASAP and thus don't
get the new names.

Also remove the existing typedef in XFS that's now been superceeded by
the generic type name.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[andy: also update the UUID_LE/UUID_BE macros including fallout]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 fs/xfs/xfs_linux.h        |  2 --
 include/linux/uuid.h      | 55 +++++++++++++++++++++++++++--------------------
 include/uapi/linux/uuid.h | 12 +++++++----
 lib/test_uuid.c           | 32 +++++++++++++--------------
 lib/uuid.c                | 28 ++++++++++++------------
 lib/vsprintf.c            |  4 ++--
 6 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 89ee5ec66837..2c33d915e550 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -39,8 +39,6 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
-typedef uuid_be			uuid_t;
-
 #include "xfs_types.h"
 
 #include "kmem.h"
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index de3aea206562..0410cd002282 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -20,19 +20,15 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_be;
+} uuid_t;
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_be)								\
+#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((uuid_t)								\
 {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
    ((b) >> 8) & 0xff, (b) & 0xff,					\
    ((c) >> 8) & 0xff, (c) & 0xff,					\
    (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)
-
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
@@ -63,27 +59,40 @@ struct uuid_v1 {
  */
 #define	UUID_STRING_LEN		36
 
-static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_le));
-}
-
-static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_be));
-}
-
 void generate_random_uuid(unsigned char uuid[16]);
 
-extern void uuid_le_gen(uuid_le *u);
-extern void uuid_be_gen(uuid_be *u);
+extern void guid_gen(guid_t *u);
+extern void uuid_gen(uuid_t *u);
 
 bool __must_check uuid_is_valid(const char *uuid);
 
-extern const u8 uuid_le_index[16];
-extern const u8 uuid_be_index[16];
+extern const u8 guid_index[16];
+extern const u8 uuid_index[16];
+
+int guid_to_bin(const char *uuid, guid_t *u);
+int uuid_to_bin(const char *uuid, uuid_t *u);
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u);
-int uuid_be_to_bin(const char *uuid, uuid_be *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
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 0099756c4bac..1eeeca973315 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -22,17 +22,21 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_le;
+} guid_t;
 
-#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_le)								\
+#define GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((guid_t)								\
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
    (b) & 0xff, ((b) >> 8) & 0xff,					\
    (c) & 0xff, ((c) >> 8) & 0xff,					\
    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
+/* backwards compatibility, don't use in new code */
+typedef guid_t uuid_le;
+#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
+	GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
 #define NULL_UUID_LE							\
 	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-		0x00, 0x00, 0x00, 0x00)
+	     0x00, 0x00, 0x00, 0x00)
 
 #endif /* _UAPI_LINUX_UUID_H_ */
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 547d3127a3cf..9cad846fd805 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -11,25 +11,25 @@
 
 struct test_uuid_data {
 	const char *uuid;
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 };
 
 static const struct test_uuid_data test_uuid_test_data[] = {
 	{
 		.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
-		.le = UUID_LE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
-		.be = UUID_BE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.le = GUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.be = UUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
 	},
 	{
 		.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
-		.le = UUID_LE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
-		.be = UUID_BE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.le = GUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.be = UUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
 	},
 	{
 		.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
-		.le = UUID_LE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
-		.be = UUID_BE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.le = GUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.be = UUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
 	},
 };
 
@@ -61,13 +61,13 @@ static void __init test_uuid_failed(const char *prefix, bool wrong, bool be,
 
 static void __init test_uuid_test(const struct test_uuid_data *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 	char buf[48];
 
 	/* LE */
 	total_tests++;
-	if (uuid_le_to_bin(data->uuid, &le))
+	if (guid_to_bin(data->uuid, &le))
 		test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
 	total_tests++;
@@ -78,7 +78,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 	/* BE */
 	total_tests++;
-	if (uuid_be_to_bin(data->uuid, &be))
+	if (uuid_to_bin(data->uuid, &be))
 		test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
 	total_tests++;
@@ -90,17 +90,17 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 static void __init test_uuid_wrong(const char *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 
 	/* LE */
 	total_tests++;
-	if (!uuid_le_to_bin(data, &le))
+	if (!guid_to_bin(data, &le))
 		test_uuid_failed("negative", true, false, data, NULL);
 
 	/* BE */
 	total_tests++;
-	if (!uuid_be_to_bin(data, &be))
+	if (!uuid_to_bin(data, &be))
 		test_uuid_failed("negative", true, true, data, NULL);
 }
 
diff --git a/lib/uuid.c b/lib/uuid.c
index 37687af77ff8..f80dc63f6ca8 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -21,10 +21,10 @@
 #include <linux/uuid.h>
 #include <linux/random.h>
 
-const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_le_index);
-const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_be_index);
+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
@@ -53,21 +53,21 @@ static void __uuid_gen_common(__u8 b[16])
 	b[8] = (b[8] & 0x3F) | 0x80;
 }
 
-void uuid_le_gen(uuid_le *lu)
+void guid_gen(guid_t *lu)
 {
 	__uuid_gen_common(lu->b);
 	/* version 4 : random generation */
 	lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_le_gen);
+EXPORT_SYMBOL_GPL(guid_gen);
 
-void uuid_be_gen(uuid_be *bu)
+void uuid_gen(uuid_t *bu)
 {
 	__uuid_gen_common(bu->b);
 	/* version 4 : random generation */
 	bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_be_gen);
+EXPORT_SYMBOL_GPL(uuid_gen);
 
 /**
   * uuid_is_valid - checks if UUID string valid
@@ -115,14 +115,14 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
 	return 0;
 }
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u)
+int guid_to_bin(const char *uuid, guid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_le_index);
+	return __uuid_to_bin(uuid, u->b, guid_index);
 }
-EXPORT_SYMBOL(uuid_le_to_bin);
+EXPORT_SYMBOL(guid_to_bin);
 
-int uuid_be_to_bin(const char *uuid, uuid_be *u)
+int uuid_to_bin(const char *uuid, uuid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_be_index);
+	return __uuid_to_bin(uuid, u->b, uuid_index);
 }
-EXPORT_SYMBOL(uuid_be_to_bin);
+EXPORT_SYMBOL(uuid_to_bin);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2d41de3f98a1..9f37d6208e99 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1308,14 +1308,14 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	char uuid[UUID_STRING_LEN + 1];
 	char *p = uuid;
 	int i;
-	const u8 *index = uuid_be_index;
+	const u8 *index = uuid_index;
 	bool uc = false;
 
 	switch (*(++fmt)) {
 	case 'L':
 		uc = true;		/* fall-through */
 	case 'l':
-		index = uuid_le_index;
+		index = guid_index;
 		break;
 	case 'B':
 		uc = true;
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 04/23] uuid: rename uuid types
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Our "little endian" UUID really is a Wintel GUID, so rename it and its
helpers such (guid_t).  The big endian UUID is the only true one, so
give it the name uuid_t.  The uuid_le and uuid_be names are retained for
now, but will hopefully go away soon.  The exception to that are the _cmp
helpers that will be replaced by better primites ASAP and thus don't
get the new names.

Also remove the existing typedef in XFS that's now been superceeded by
the generic type name.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
[andy: also update the UUID_LE/UUID_BE macros including fallout]
Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 fs/xfs/xfs_linux.h        |  2 --
 include/linux/uuid.h      | 55 +++++++++++++++++++++++++++--------------------
 include/uapi/linux/uuid.h | 12 +++++++----
 lib/test_uuid.c           | 32 +++++++++++++--------------
 lib/uuid.c                | 28 ++++++++++++------------
 lib/vsprintf.c            |  4 ++--
 6 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 89ee5ec66837..2c33d915e550 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -39,8 +39,6 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
-typedef uuid_be			uuid_t;
-
 #include "xfs_types.h"
 
 #include "kmem.h"
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index de3aea206562..0410cd002282 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -20,19 +20,15 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_be;
+} uuid_t;
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_be)								\
+#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((uuid_t)								\
 {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
    ((b) >> 8) & 0xff, (b) & 0xff,					\
    ((c) >> 8) & 0xff, (c) & 0xff,					\
    (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)
-
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
@@ -63,27 +59,40 @@ struct uuid_v1 {
  */
 #define	UUID_STRING_LEN		36
 
-static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_le));
-}
-
-static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_be));
-}
-
 void generate_random_uuid(unsigned char uuid[16]);
 
-extern void uuid_le_gen(uuid_le *u);
-extern void uuid_be_gen(uuid_be *u);
+extern void guid_gen(guid_t *u);
+extern void uuid_gen(uuid_t *u);
 
 bool __must_check uuid_is_valid(const char *uuid);
 
-extern const u8 uuid_le_index[16];
-extern const u8 uuid_be_index[16];
+extern const u8 guid_index[16];
+extern const u8 uuid_index[16];
+
+int guid_to_bin(const char *uuid, guid_t *u);
+int uuid_to_bin(const char *uuid, uuid_t *u);
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u);
-int uuid_be_to_bin(const char *uuid, uuid_be *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
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 0099756c4bac..1eeeca973315 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -22,17 +22,21 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_le;
+} guid_t;
 
-#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_le)								\
+#define GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((guid_t)								\
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
    (b) & 0xff, ((b) >> 8) & 0xff,					\
    (c) & 0xff, ((c) >> 8) & 0xff,					\
    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
+/* backwards compatibility, don't use in new code */
+typedef guid_t uuid_le;
+#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
+	GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
 #define NULL_UUID_LE							\
 	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-		0x00, 0x00, 0x00, 0x00)
+	     0x00, 0x00, 0x00, 0x00)
 
 #endif /* _UAPI_LINUX_UUID_H_ */
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 547d3127a3cf..9cad846fd805 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -11,25 +11,25 @@
 
 struct test_uuid_data {
 	const char *uuid;
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 };
 
 static const struct test_uuid_data test_uuid_test_data[] = {
 	{
 		.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
-		.le = UUID_LE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
-		.be = UUID_BE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.le = GUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.be = UUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
 	},
 	{
 		.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
-		.le = UUID_LE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
-		.be = UUID_BE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.le = GUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.be = UUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
 	},
 	{
 		.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
-		.le = UUID_LE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
-		.be = UUID_BE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.le = GUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.be = UUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
 	},
 };
 
@@ -61,13 +61,13 @@ static void __init test_uuid_failed(const char *prefix, bool wrong, bool be,
 
 static void __init test_uuid_test(const struct test_uuid_data *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 	char buf[48];
 
 	/* LE */
 	total_tests++;
-	if (uuid_le_to_bin(data->uuid, &le))
+	if (guid_to_bin(data->uuid, &le))
 		test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
 	total_tests++;
@@ -78,7 +78,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 	/* BE */
 	total_tests++;
-	if (uuid_be_to_bin(data->uuid, &be))
+	if (uuid_to_bin(data->uuid, &be))
 		test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
 	total_tests++;
@@ -90,17 +90,17 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 static void __init test_uuid_wrong(const char *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 
 	/* LE */
 	total_tests++;
-	if (!uuid_le_to_bin(data, &le))
+	if (!guid_to_bin(data, &le))
 		test_uuid_failed("negative", true, false, data, NULL);
 
 	/* BE */
 	total_tests++;
-	if (!uuid_be_to_bin(data, &be))
+	if (!uuid_to_bin(data, &be))
 		test_uuid_failed("negative", true, true, data, NULL);
 }
 
diff --git a/lib/uuid.c b/lib/uuid.c
index 37687af77ff8..f80dc63f6ca8 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -21,10 +21,10 @@
 #include <linux/uuid.h>
 #include <linux/random.h>
 
-const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_le_index);
-const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_be_index);
+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
@@ -53,21 +53,21 @@ static void __uuid_gen_common(__u8 b[16])
 	b[8] = (b[8] & 0x3F) | 0x80;
 }
 
-void uuid_le_gen(uuid_le *lu)
+void guid_gen(guid_t *lu)
 {
 	__uuid_gen_common(lu->b);
 	/* version 4 : random generation */
 	lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_le_gen);
+EXPORT_SYMBOL_GPL(guid_gen);
 
-void uuid_be_gen(uuid_be *bu)
+void uuid_gen(uuid_t *bu)
 {
 	__uuid_gen_common(bu->b);
 	/* version 4 : random generation */
 	bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_be_gen);
+EXPORT_SYMBOL_GPL(uuid_gen);
 
 /**
   * uuid_is_valid - checks if UUID string valid
@@ -115,14 +115,14 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
 	return 0;
 }
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u)
+int guid_to_bin(const char *uuid, guid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_le_index);
+	return __uuid_to_bin(uuid, u->b, guid_index);
 }
-EXPORT_SYMBOL(uuid_le_to_bin);
+EXPORT_SYMBOL(guid_to_bin);
 
-int uuid_be_to_bin(const char *uuid, uuid_be *u)
+int uuid_to_bin(const char *uuid, uuid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_be_index);
+	return __uuid_to_bin(uuid, u->b, uuid_index);
 }
-EXPORT_SYMBOL(uuid_be_to_bin);
+EXPORT_SYMBOL(uuid_to_bin);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2d41de3f98a1..9f37d6208e99 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1308,14 +1308,14 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	char uuid[UUID_STRING_LEN + 1];
 	char *p = uuid;
 	int i;
-	const u8 *index = uuid_be_index;
+	const u8 *index = uuid_index;
 	bool uc = false;
 
 	switch (*(++fmt)) {
 	case 'L':
 		uc = true;		/* fall-through */
 	case 'l':
-		index = uuid_le_index;
+		index = guid_index;
 		break;
 	case 'B':
 		uc = true;
-- 
2.11.0

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

* [PATCH 04/23] uuid: rename uuid types
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Our "little endian" UUID really is a Wintel GUID, so rename it and its
helpers such (guid_t).  The big endian UUID is the only true one, so
give it the name uuid_t.  The uuid_le and uuid_be names are retained for
now, but will hopefully go away soon.  The exception to that are the _cmp
helpers that will be replaced by better primites ASAP and thus don't
get the new names.

Also remove the existing typedef in XFS that's now been superceeded by
the generic type name.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[andy: also update the UUID_LE/UUID_BE macros including fallout]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 fs/xfs/xfs_linux.h        |  2 --
 include/linux/uuid.h      | 55 +++++++++++++++++++++++++++--------------------
 include/uapi/linux/uuid.h | 12 +++++++----
 lib/test_uuid.c           | 32 +++++++++++++--------------
 lib/uuid.c                | 28 ++++++++++++------------
 lib/vsprintf.c            |  4 ++--
 6 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 89ee5ec66837..2c33d915e550 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -39,8 +39,6 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
-typedef uuid_be			uuid_t;
-
 #include "xfs_types.h"
 
 #include "kmem.h"
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index de3aea206562..0410cd002282 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -20,19 +20,15 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_be;
+} uuid_t;
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_be)								\
+#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((uuid_t)								\
 {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
    ((b) >> 8) & 0xff, (b) & 0xff,					\
    ((c) >> 8) & 0xff, (c) & 0xff,					\
    (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)
-
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
@@ -63,27 +59,40 @@ struct uuid_v1 {
  */
 #define	UUID_STRING_LEN		36
 
-static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_le));
-}
-
-static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_be));
-}
-
 void generate_random_uuid(unsigned char uuid[16]);
 
-extern void uuid_le_gen(uuid_le *u);
-extern void uuid_be_gen(uuid_be *u);
+extern void guid_gen(guid_t *u);
+extern void uuid_gen(uuid_t *u);
 
 bool __must_check uuid_is_valid(const char *uuid);
 
-extern const u8 uuid_le_index[16];
-extern const u8 uuid_be_index[16];
+extern const u8 guid_index[16];
+extern const u8 uuid_index[16];
+
+int guid_to_bin(const char *uuid, guid_t *u);
+int uuid_to_bin(const char *uuid, uuid_t *u);
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u);
-int uuid_be_to_bin(const char *uuid, uuid_be *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
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 0099756c4bac..1eeeca973315 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -22,17 +22,21 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_le;
+} guid_t;
 
-#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_le)								\
+#define GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((guid_t)								\
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
    (b) & 0xff, ((b) >> 8) & 0xff,					\
    (c) & 0xff, ((c) >> 8) & 0xff,					\
    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
+/* backwards compatibility, don't use in new code */
+typedef guid_t uuid_le;
+#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
+	GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
 #define NULL_UUID_LE							\
 	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-		0x00, 0x00, 0x00, 0x00)
+	     0x00, 0x00, 0x00, 0x00)
 
 #endif /* _UAPI_LINUX_UUID_H_ */
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 547d3127a3cf..9cad846fd805 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -11,25 +11,25 @@
 
 struct test_uuid_data {
 	const char *uuid;
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 };
 
 static const struct test_uuid_data test_uuid_test_data[] = {
 	{
 		.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
-		.le = UUID_LE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
-		.be = UUID_BE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.le = GUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.be = UUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
 	},
 	{
 		.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
-		.le = UUID_LE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
-		.be = UUID_BE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.le = GUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.be = UUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
 	},
 	{
 		.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
-		.le = UUID_LE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
-		.be = UUID_BE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.le = GUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.be = UUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
 	},
 };
 
@@ -61,13 +61,13 @@ static void __init test_uuid_failed(const char *prefix, bool wrong, bool be,
 
 static void __init test_uuid_test(const struct test_uuid_data *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 	char buf[48];
 
 	/* LE */
 	total_tests++;
-	if (uuid_le_to_bin(data->uuid, &le))
+	if (guid_to_bin(data->uuid, &le))
 		test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
 	total_tests++;
@@ -78,7 +78,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 	/* BE */
 	total_tests++;
-	if (uuid_be_to_bin(data->uuid, &be))
+	if (uuid_to_bin(data->uuid, &be))
 		test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
 	total_tests++;
@@ -90,17 +90,17 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 static void __init test_uuid_wrong(const char *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 
 	/* LE */
 	total_tests++;
-	if (!uuid_le_to_bin(data, &le))
+	if (!guid_to_bin(data, &le))
 		test_uuid_failed("negative", true, false, data, NULL);
 
 	/* BE */
 	total_tests++;
-	if (!uuid_be_to_bin(data, &be))
+	if (!uuid_to_bin(data, &be))
 		test_uuid_failed("negative", true, true, data, NULL);
 }
 
diff --git a/lib/uuid.c b/lib/uuid.c
index 37687af77ff8..f80dc63f6ca8 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -21,10 +21,10 @@
 #include <linux/uuid.h>
 #include <linux/random.h>
 
-const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_le_index);
-const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_be_index);
+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
@@ -53,21 +53,21 @@ static void __uuid_gen_common(__u8 b[16])
 	b[8] = (b[8] & 0x3F) | 0x80;
 }
 
-void uuid_le_gen(uuid_le *lu)
+void guid_gen(guid_t *lu)
 {
 	__uuid_gen_common(lu->b);
 	/* version 4 : random generation */
 	lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_le_gen);
+EXPORT_SYMBOL_GPL(guid_gen);
 
-void uuid_be_gen(uuid_be *bu)
+void uuid_gen(uuid_t *bu)
 {
 	__uuid_gen_common(bu->b);
 	/* version 4 : random generation */
 	bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_be_gen);
+EXPORT_SYMBOL_GPL(uuid_gen);
 
 /**
   * uuid_is_valid - checks if UUID string valid
@@ -115,14 +115,14 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
 	return 0;
 }
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u)
+int guid_to_bin(const char *uuid, guid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_le_index);
+	return __uuid_to_bin(uuid, u->b, guid_index);
 }
-EXPORT_SYMBOL(uuid_le_to_bin);
+EXPORT_SYMBOL(guid_to_bin);
 
-int uuid_be_to_bin(const char *uuid, uuid_be *u)
+int uuid_to_bin(const char *uuid, uuid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_be_index);
+	return __uuid_to_bin(uuid, u->b, uuid_index);
 }
-EXPORT_SYMBOL(uuid_be_to_bin);
+EXPORT_SYMBOL(uuid_to_bin);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2d41de3f98a1..9f37d6208e99 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1308,14 +1308,14 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	char uuid[UUID_STRING_LEN + 1];
 	char *p = uuid;
 	int i;
-	const u8 *index = uuid_be_index;
+	const u8 *index = uuid_index;
 	bool uc = false;
 
 	switch (*(++fmt)) {
 	case 'L':
 		uc = true;		/* fall-through */
 	case 'l':
-		index = uuid_le_index;
+		index = guid_index;
 		break;
 	case 'B':
 		uc = true;
-- 
2.11.0

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

* [PATCH 04/23] uuid: rename uuid types
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Our "little endian" UUID really is a Wintel GUID, so rename it and its
helpers such (guid_t).  The big endian UUID is the only true one, so
give it the name uuid_t.  The uuid_le and uuid_be names are retained for
now, but will hopefully go away soon.  The exception to that are the _cmp
helpers that will be replaced by better primites ASAP and thus don't
get the new names.

Also remove the existing typedef in XFS that's now been superceeded by
the generic type name.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[andy: also update the UUID_LE/UUID_BE macros including fallout]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 fs/xfs/xfs_linux.h        |  2 --
 include/linux/uuid.h      | 55 +++++++++++++++++++++++++++--------------------
 include/uapi/linux/uuid.h | 12 +++++++----
 lib/test_uuid.c           | 32 +++++++++++++--------------
 lib/uuid.c                | 28 ++++++++++++------------
 lib/vsprintf.c            |  4 ++--
 6 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 89ee5ec66837..2c33d915e550 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -39,8 +39,6 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
 typedef __u32			xfs_dev_t;
 typedef __u32			xfs_nlink_t;
 
-typedef uuid_be			uuid_t;
-
 #include "xfs_types.h"
 
 #include "kmem.h"
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index de3aea206562..0410cd002282 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -20,19 +20,15 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_be;
+} uuid_t;
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_be)								\
+#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((uuid_t)								\
 {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
    ((b) >> 8) & 0xff, (b) & 0xff,					\
    ((c) >> 8) & 0xff, (c) & 0xff,					\
    (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)
-
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
@@ -63,27 +59,40 @@ struct uuid_v1 {
  */
 #define	UUID_STRING_LEN		36
 
-static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_le));
-}
-
-static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_be));
-}
-
 void generate_random_uuid(unsigned char uuid[16]);
 
-extern void uuid_le_gen(uuid_le *u);
-extern void uuid_be_gen(uuid_be *u);
+extern void guid_gen(guid_t *u);
+extern void uuid_gen(uuid_t *u);
 
 bool __must_check uuid_is_valid(const char *uuid);
 
-extern const u8 uuid_le_index[16];
-extern const u8 uuid_be_index[16];
+extern const u8 guid_index[16];
+extern const u8 uuid_index[16];
+
+int guid_to_bin(const char *uuid, guid_t *u);
+int uuid_to_bin(const char *uuid, uuid_t *u);
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u);
-int uuid_be_to_bin(const char *uuid, uuid_be *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
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 0099756c4bac..1eeeca973315 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -22,17 +22,21 @@
 
 typedef struct {
 	__u8 b[16];
-} uuid_le;
+} guid_t;
 
-#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
-((uuid_le)								\
+#define GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+((guid_t)								\
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
    (b) & 0xff, ((b) >> 8) & 0xff,					\
    (c) & 0xff, ((c) >> 8) & 0xff,					\
    (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
+/* backwards compatibility, don't use in new code */
+typedef guid_t uuid_le;
+#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
+	GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
 #define NULL_UUID_LE							\
 	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
-		0x00, 0x00, 0x00, 0x00)
+	     0x00, 0x00, 0x00, 0x00)
 
 #endif /* _UAPI_LINUX_UUID_H_ */
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 547d3127a3cf..9cad846fd805 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -11,25 +11,25 @@
 
 struct test_uuid_data {
 	const char *uuid;
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 };
 
 static const struct test_uuid_data test_uuid_test_data[] = {
 	{
 		.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
-		.le = UUID_LE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
-		.be = UUID_BE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.le = GUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
+		.be = UUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
 	},
 	{
 		.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
-		.le = UUID_LE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
-		.be = UUID_BE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.le = GUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
+		.be = UUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
 	},
 	{
 		.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
-		.le = UUID_LE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
-		.be = UUID_BE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.le = GUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
+		.be = UUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
 	},
 };
 
@@ -61,13 +61,13 @@ static void __init test_uuid_failed(const char *prefix, bool wrong, bool be,
 
 static void __init test_uuid_test(const struct test_uuid_data *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 	char buf[48];
 
 	/* LE */
 	total_tests++;
-	if (uuid_le_to_bin(data->uuid, &le))
+	if (guid_to_bin(data->uuid, &le))
 		test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
 	total_tests++;
@@ -78,7 +78,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 	/* BE */
 	total_tests++;
-	if (uuid_be_to_bin(data->uuid, &be))
+	if (uuid_to_bin(data->uuid, &be))
 		test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
 	total_tests++;
@@ -90,17 +90,17 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 
 static void __init test_uuid_wrong(const char *data)
 {
-	uuid_le le;
-	uuid_be be;
+	guid_t le;
+	uuid_t be;
 
 	/* LE */
 	total_tests++;
-	if (!uuid_le_to_bin(data, &le))
+	if (!guid_to_bin(data, &le))
 		test_uuid_failed("negative", true, false, data, NULL);
 
 	/* BE */
 	total_tests++;
-	if (!uuid_be_to_bin(data, &be))
+	if (!uuid_to_bin(data, &be))
 		test_uuid_failed("negative", true, true, data, NULL);
 }
 
diff --git a/lib/uuid.c b/lib/uuid.c
index 37687af77ff8..f80dc63f6ca8 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -21,10 +21,10 @@
 #include <linux/uuid.h>
 #include <linux/random.h>
 
-const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_le_index);
-const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_be_index);
+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
@@ -53,21 +53,21 @@ static void __uuid_gen_common(__u8 b[16])
 	b[8] = (b[8] & 0x3F) | 0x80;
 }
 
-void uuid_le_gen(uuid_le *lu)
+void guid_gen(guid_t *lu)
 {
 	__uuid_gen_common(lu->b);
 	/* version 4 : random generation */
 	lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_le_gen);
+EXPORT_SYMBOL_GPL(guid_gen);
 
-void uuid_be_gen(uuid_be *bu)
+void uuid_gen(uuid_t *bu)
 {
 	__uuid_gen_common(bu->b);
 	/* version 4 : random generation */
 	bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
 }
-EXPORT_SYMBOL_GPL(uuid_be_gen);
+EXPORT_SYMBOL_GPL(uuid_gen);
 
 /**
   * uuid_is_valid - checks if UUID string valid
@@ -115,14 +115,14 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
 	return 0;
 }
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u)
+int guid_to_bin(const char *uuid, guid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_le_index);
+	return __uuid_to_bin(uuid, u->b, guid_index);
 }
-EXPORT_SYMBOL(uuid_le_to_bin);
+EXPORT_SYMBOL(guid_to_bin);
 
-int uuid_be_to_bin(const char *uuid, uuid_be *u)
+int uuid_to_bin(const char *uuid, uuid_t *u)
 {
-	return __uuid_to_bin(uuid, u->b, uuid_be_index);
+	return __uuid_to_bin(uuid, u->b, uuid_index);
 }
-EXPORT_SYMBOL(uuid_be_to_bin);
+EXPORT_SYMBOL(uuid_to_bin);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2d41de3f98a1..9f37d6208e99 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1308,14 +1308,14 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	char uuid[UUID_STRING_LEN + 1];
 	char *p = uuid;
 	int i;
-	const u8 *index = uuid_be_index;
+	const u8 *index = uuid_index;
 	bool uc = false;
 
 	switch (*(++fmt)) {
 	case 'L':
 		uc = true;		/* fall-through */
 	case 'l':
-		index = uuid_le_index;
+		index = guid_index;
 		break;
 	case 'B':
 		uc = true;
-- 
2.11.0

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

* [PATCH 05/23] uuid: don't export guid_index and uuid_index
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 05/23] uuid: don't export guid_index and uuid_index
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

These are only used in uuid.c and vsprintf.c and aren't something modules
should use directly.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 05/23] uuid: don't export guid_index and uuid_index
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 05/23] uuid: don't export guid_index and uuid_index
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 06/23] uuid: add the v1 layout to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

Turn the content of uuid_t into a union and add the fields for the v1
interpretation to it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
---
 include/linux/uuid.h | 59 ++++++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 0410cd002282..8bd1da4ec95d 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,40 +18,45 @@
 
 #include <uapi/linux/uuid.h>
 
-typedef struct {
-	__u8 b[16];
-} uuid_t;
-
-#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
-((uuid_t)								\
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,					\
-   ((c) >> 8) & 0xff, (c) & 0xff,					\
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
-/*
- * V1 (time-based) UUID definition [RFC 4122].
- * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
- *   increments since midnight 15th October 1582
- *   - add AFS_UUID_TO_UNIX_TIME to convert unix time in 100ns units to UUID
- *     time
- * - the clock sequence is a 14-bit counter to avoid duplicate times
- */
-struct uuid_v1 {
-	__be32		time_low;			/* low part of timestamp */
-	__be16		time_mid;			/* mid part of timestamp */
-	__be16		time_hi_and_version;		/* high part of timestamp and version  */
+/* v1 UUID defintions: */
 #define UUID_TO_UNIX_TIME	0x01b21dd213814000ULL
 #define UUID_TIMEHI_MASK	0x0fff
 #define UUID_VERSION_TIME	0x1000	/* time-based UUID */
 #define UUID_VERSION_NAME	0x3000	/* name-based UUID */
 #define UUID_VERSION_RANDOM	0x4000	/* (pseudo-)random generated UUID */
-	u8		clock_seq_hi_and_reserved;	/* clock seq hi and variant */
 #define UUID_CLOCKHI_MASK	0x3f
 #define UUID_VARIANT_STD	0x80
-	u8		clock_seq_low;			/* clock seq low */
-	u8		node[6];			/* spatially unique node ID (MAC addr) */
-};
+
+typedef struct {
+	union {
+		__u8			b[16];
+
+		/*
+		 * V1 (time-based) UUID definition [RFC 4122]:
+		 * - the timestamp is a 60-bit value, split 32/16/12, and goes
+		 *   in 100ns increments since midnight 15th October 1582
+		 *   - add UUID_TO_UNIX_TIME to convert unix time in 100ns
+		 *     units to UUID time
+		 * - the clock sequence is a 14-bit counter to avoid duplicate
+		 *   times
+		 */
+		struct uuid_v1 {
+			__be32		time_low;
+			__be16		time_mid;
+			__be16		time_hi_and_version;
+			u8		clock_seq_hi_and_reserved;
+			u8		clock_seq_low;
+			u8		node[6];
+		} v1;
+	};
+} uuid_t;
+
+#define UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+{.b = {									\
+   ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((_b) >> 8) & 0xff, (_b) & 0xff,					\
+   ((c) >> 8) & 0xff, (c) & 0xff,					\
+   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}
 
 /*
  * The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 06/23] uuid: add the v1 layout to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Turn the content of uuid_t into a union and add the fields for the v1
interpretation to it.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Reviewed-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 include/linux/uuid.h | 59 ++++++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 0410cd002282..8bd1da4ec95d 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,40 +18,45 @@
 
 #include <uapi/linux/uuid.h>
 
-typedef struct {
-	__u8 b[16];
-} uuid_t;
-
-#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
-((uuid_t)								\
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,					\
-   ((c) >> 8) & 0xff, (c) & 0xff,					\
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
-/*
- * V1 (time-based) UUID definition [RFC 4122].
- * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
- *   increments since midnight 15th October 1582
- *   - add AFS_UUID_TO_UNIX_TIME to convert unix time in 100ns units to UUID
- *     time
- * - the clock sequence is a 14-bit counter to avoid duplicate times
- */
-struct uuid_v1 {
-	__be32		time_low;			/* low part of timestamp */
-	__be16		time_mid;			/* mid part of timestamp */
-	__be16		time_hi_and_version;		/* high part of timestamp and version  */
+/* v1 UUID defintions: */
 #define UUID_TO_UNIX_TIME	0x01b21dd213814000ULL
 #define UUID_TIMEHI_MASK	0x0fff
 #define UUID_VERSION_TIME	0x1000	/* time-based UUID */
 #define UUID_VERSION_NAME	0x3000	/* name-based UUID */
 #define UUID_VERSION_RANDOM	0x4000	/* (pseudo-)random generated UUID */
-	u8		clock_seq_hi_and_reserved;	/* clock seq hi and variant */
 #define UUID_CLOCKHI_MASK	0x3f
 #define UUID_VARIANT_STD	0x80
-	u8		clock_seq_low;			/* clock seq low */
-	u8		node[6];			/* spatially unique node ID (MAC addr) */
-};
+
+typedef struct {
+	union {
+		__u8			b[16];
+
+		/*
+		 * V1 (time-based) UUID definition [RFC 4122]:
+		 * - the timestamp is a 60-bit value, split 32/16/12, and goes
+		 *   in 100ns increments since midnight 15th October 1582
+		 *   - add UUID_TO_UNIX_TIME to convert unix time in 100ns
+		 *     units to UUID time
+		 * - the clock sequence is a 14-bit counter to avoid duplicate
+		 *   times
+		 */
+		struct uuid_v1 {
+			__be32		time_low;
+			__be16		time_mid;
+			__be16		time_hi_and_version;
+			u8		clock_seq_hi_and_reserved;
+			u8		clock_seq_low;
+			u8		node[6];
+		} v1;
+	};
+} uuid_t;
+
+#define UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+{.b = {									\
+   ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((_b) >> 8) & 0xff, (_b) & 0xff,					\
+   ((c) >> 8) & 0xff, (c) & 0xff,					\
+   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}
 
 /*
  * The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
-- 
2.11.0

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

* [PATCH 06/23] uuid: add the v1 layout to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Turn the content of uuid_t into a union and add the fields for the v1
interpretation to it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
---
 include/linux/uuid.h | 59 ++++++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 0410cd002282..8bd1da4ec95d 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,40 +18,45 @@
 
 #include <uapi/linux/uuid.h>
 
-typedef struct {
-	__u8 b[16];
-} uuid_t;
-
-#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
-((uuid_t)								\
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,					\
-   ((c) >> 8) & 0xff, (c) & 0xff,					\
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
-/*
- * V1 (time-based) UUID definition [RFC 4122].
- * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
- *   increments since midnight 15th October 1582
- *   - add AFS_UUID_TO_UNIX_TIME to convert unix time in 100ns units to UUID
- *     time
- * - the clock sequence is a 14-bit counter to avoid duplicate times
- */
-struct uuid_v1 {
-	__be32		time_low;			/* low part of timestamp */
-	__be16		time_mid;			/* mid part of timestamp */
-	__be16		time_hi_and_version;		/* high part of timestamp and version  */
+/* v1 UUID defintions: */
 #define UUID_TO_UNIX_TIME	0x01b21dd213814000ULL
 #define UUID_TIMEHI_MASK	0x0fff
 #define UUID_VERSION_TIME	0x1000	/* time-based UUID */
 #define UUID_VERSION_NAME	0x3000	/* name-based UUID */
 #define UUID_VERSION_RANDOM	0x4000	/* (pseudo-)random generated UUID */
-	u8		clock_seq_hi_and_reserved;	/* clock seq hi and variant */
 #define UUID_CLOCKHI_MASK	0x3f
 #define UUID_VARIANT_STD	0x80
-	u8		clock_seq_low;			/* clock seq low */
-	u8		node[6];			/* spatially unique node ID (MAC addr) */
-};
+
+typedef struct {
+	union {
+		__u8			b[16];
+
+		/*
+		 * V1 (time-based) UUID definition [RFC 4122]:
+		 * - the timestamp is a 60-bit value, split 32/16/12, and goes
+		 *   in 100ns increments since midnight 15th October 1582
+		 *   - add UUID_TO_UNIX_TIME to convert unix time in 100ns
+		 *     units to UUID time
+		 * - the clock sequence is a 14-bit counter to avoid duplicate
+		 *   times
+		 */
+		struct uuid_v1 {
+			__be32		time_low;
+			__be16		time_mid;
+			__be16		time_hi_and_version;
+			u8		clock_seq_hi_and_reserved;
+			u8		clock_seq_low;
+			u8		node[6];
+		} v1;
+	};
+} uuid_t;
+
+#define UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+{.b = {									\
+   ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((_b) >> 8) & 0xff, (_b) & 0xff,					\
+   ((c) >> 8) & 0xff, (c) & 0xff,					\
+   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}
 
 /*
  * The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
-- 
2.11.0

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

* [PATCH 06/23] uuid: add the v1 layout to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Turn the content of uuid_t into a union and add the fields for the v1
interpretation to it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
---
 include/linux/uuid.h | 59 ++++++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 0410cd002282..8bd1da4ec95d 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,40 +18,45 @@
 
 #include <uapi/linux/uuid.h>
 
-typedef struct {
-	__u8 b[16];
-} uuid_t;
-
-#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
-((uuid_t)								\
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,					\
-   ((c) >> 8) & 0xff, (c) & 0xff,					\
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
-/*
- * V1 (time-based) UUID definition [RFC 4122].
- * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
- *   increments since midnight 15th October 1582
- *   - add AFS_UUID_TO_UNIX_TIME to convert unix time in 100ns units to UUID
- *     time
- * - the clock sequence is a 14-bit counter to avoid duplicate times
- */
-struct uuid_v1 {
-	__be32		time_low;			/* low part of timestamp */
-	__be16		time_mid;			/* mid part of timestamp */
-	__be16		time_hi_and_version;		/* high part of timestamp and version  */
+/* v1 UUID defintions: */
 #define UUID_TO_UNIX_TIME	0x01b21dd213814000ULL
 #define UUID_TIMEHI_MASK	0x0fff
 #define UUID_VERSION_TIME	0x1000	/* time-based UUID */
 #define UUID_VERSION_NAME	0x3000	/* name-based UUID */
 #define UUID_VERSION_RANDOM	0x4000	/* (pseudo-)random generated UUID */
-	u8		clock_seq_hi_and_reserved;	/* clock seq hi and variant */
 #define UUID_CLOCKHI_MASK	0x3f
 #define UUID_VARIANT_STD	0x80
-	u8		clock_seq_low;			/* clock seq low */
-	u8		node[6];			/* spatially unique node ID (MAC addr) */
-};
+
+typedef struct {
+	union {
+		__u8			b[16];
+
+		/*
+		 * V1 (time-based) UUID definition [RFC 4122]:
+		 * - the timestamp is a 60-bit value, split 32/16/12, and goes
+		 *   in 100ns increments since midnight 15th October 1582
+		 *   - add UUID_TO_UNIX_TIME to convert unix time in 100ns
+		 *     units to UUID time
+		 * - the clock sequence is a 14-bit counter to avoid duplicate
+		 *   times
+		 */
+		struct uuid_v1 {
+			__be32		time_low;
+			__be16		time_mid;
+			__be16		time_hi_and_version;
+			u8		clock_seq_hi_and_reserved;
+			u8		clock_seq_low;
+			u8		node[6];
+		} v1;
+	};
+} uuid_t;
+
+#define UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
+{.b = {									\
+   ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((_b) >> 8) & 0xff, (_b) & 0xff,					\
+   ((c) >> 8) & 0xff, (c) & 0xff,					\
+   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}
 
 /*
  * The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
-- 
2.11.0

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

* [PATCH 07/23] uuid: hoist helpers uuid_equal() and uuid_copy() from xfs
  2017-05-18  6:26 ` Christoph Hellwig
  (?)
@ 2017-05-18  6:26   ` Christoph Hellwig
  -1 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

These helper are used to compare and copy two uuid_t type objects.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[hch: also provide the respective guid_ versions]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.c        |  6 ------
 fs/xfs/uuid.h        |  7 -------
 include/linux/uuid.h | 20 ++++++++++++++++++++
 lib/test_uuid.c      |  4 ++--
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index b83f76b6d410..29ed78c8637b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -55,9 +55,3 @@ uuid_is_nil(uuid_t *uuid)
 		if (*cp++) return 0;	/* not nil */
 	return 1;	/* is nil */
 }
-
-int
-uuid_equal(uuid_t *uuid1, uuid_t *uuid2)
-{
-	return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? 0 : 1;
-}
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 4f1441ba4fa5..86bbed071e79 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,13 +19,6 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
-static inline void
-uuid_copy(uuid_t *dst, uuid_t *src)
-{
-	memcpy(dst, src, sizeof(uuid_t));
-}
-
 #endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 8bd1da4ec95d..7aff929007dd 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -64,6 +64,26 @@ typedef struct {
  */
 #define	UUID_STRING_LEN		36
 
+static inline bool guid_equal(const guid_t *u1, const guid_t *u2)
+{
+	return memcmp(u1, u2, sizeof(guid_t)) == 0;
+}
+
+static inline void guid_copy(guid_t *dst, const guid_t *src)
+{
+	memcpy(dst, src, sizeof(guid_t));
+}
+
+static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
+{
+	return memcmp(u1, u2, sizeof(uuid_t)) == 0;
+}
+
+static inline void uuid_copy(uuid_t *dst, const uuid_t *src)
+{
+	memcpy(dst, src, sizeof(uuid_t));
+}
+
 void generate_random_uuid(unsigned char uuid[16]);
 
 extern void guid_gen(guid_t *u);
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 9cad846fd805..4d05189e5f87 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -71,7 +71,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 		test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
 	total_tests++;
-	if (uuid_le_cmp(data->le, le)) {
+	if (!guid_equal(&data->le, &le)) {
 		sprintf(buf, "%pUl", &le);
 		test_uuid_failed("cmp", false, false, data->uuid, buf);
 	}
@@ -82,7 +82,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 		test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
 	total_tests++;
-	if (uuid_be_cmp(data->be, be)) {
+	if (uuid_equal(&data->be, &be)) {
 		sprintf(buf, "%pUb", &be);
 		test_uuid_failed("cmp", false, true, data->uuid, buf);
 	}
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 07/23] uuid: hoist helpers uuid_equal() and uuid_copy() from xfs
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

These helper are used to compare and copy two uuid_t type objects.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[hch: also provide the respective guid_ versions]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.c        |  6 ------
 fs/xfs/uuid.h        |  7 -------
 include/linux/uuid.h | 20 ++++++++++++++++++++
 lib/test_uuid.c      |  4 ++--
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index b83f76b6d410..29ed78c8637b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -55,9 +55,3 @@ uuid_is_nil(uuid_t *uuid)
 		if (*cp++) return 0;	/* not nil */
 	return 1;	/* is nil */
 }
-
-int
-uuid_equal(uuid_t *uuid1, uuid_t *uuid2)
-{
-	return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? 0 : 1;
-}
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 4f1441ba4fa5..86bbed071e79 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,13 +19,6 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
-static inline void
-uuid_copy(uuid_t *dst, uuid_t *src)
-{
-	memcpy(dst, src, sizeof(uuid_t));
-}
-
 #endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 8bd1da4ec95d..7aff929007dd 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -64,6 +64,26 @@ typedef struct {
  */
 #define	UUID_STRING_LEN		36
 
+static inline bool guid_equal(const guid_t *u1, const guid_t *u2)
+{
+	return memcmp(u1, u2, sizeof(guid_t)) == 0;
+}
+
+static inline void guid_copy(guid_t *dst, const guid_t *src)
+{
+	memcpy(dst, src, sizeof(guid_t));
+}
+
+static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
+{
+	return memcmp(u1, u2, sizeof(uuid_t)) == 0;
+}
+
+static inline void uuid_copy(uuid_t *dst, const uuid_t *src)
+{
+	memcpy(dst, src, sizeof(uuid_t));
+}
+
 void generate_random_uuid(unsigned char uuid[16]);
 
 extern void guid_gen(guid_t *u);
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 9cad846fd805..4d05189e5f87 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -71,7 +71,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 		test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
 	total_tests++;
-	if (uuid_le_cmp(data->le, le)) {
+	if (!guid_equal(&data->le, &le)) {
 		sprintf(buf, "%pUl", &le);
 		test_uuid_failed("cmp", false, false, data->uuid, buf);
 	}
@@ -82,7 +82,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 		test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
 	total_tests++;
-	if (uuid_be_cmp(data->be, be)) {
+	if (uuid_equal(&data->be, &be)) {
 		sprintf(buf, "%pUb", &be);
 		test_uuid_failed("cmp", false, true, data->uuid, buf);
 	}
-- 
2.11.0


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

* [PATCH 07/23] uuid: hoist helpers uuid_equal() and uuid_copy() from xfs
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

These helper are used to compare and copy two uuid_t type objects.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[hch: also provide the respective guid_ versions]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.c        |  6 ------
 fs/xfs/uuid.h        |  7 -------
 include/linux/uuid.h | 20 ++++++++++++++++++++
 lib/test_uuid.c      |  4 ++--
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index b83f76b6d410..29ed78c8637b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -55,9 +55,3 @@ uuid_is_nil(uuid_t *uuid)
 		if (*cp++) return 0;	/* not nil */
 	return 1;	/* is nil */
 }
-
-int
-uuid_equal(uuid_t *uuid1, uuid_t *uuid2)
-{
-	return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? 0 : 1;
-}
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 4f1441ba4fa5..86bbed071e79 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,13 +19,6 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
-static inline void
-uuid_copy(uuid_t *dst, uuid_t *src)
-{
-	memcpy(dst, src, sizeof(uuid_t));
-}
-
 #endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 8bd1da4ec95d..7aff929007dd 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -64,6 +64,26 @@ typedef struct {
  */
 #define	UUID_STRING_LEN		36
 
+static inline bool guid_equal(const guid_t *u1, const guid_t *u2)
+{
+	return memcmp(u1, u2, sizeof(guid_t)) == 0;
+}
+
+static inline void guid_copy(guid_t *dst, const guid_t *src)
+{
+	memcpy(dst, src, sizeof(guid_t));
+}
+
+static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
+{
+	return memcmp(u1, u2, sizeof(uuid_t)) == 0;
+}
+
+static inline void uuid_copy(uuid_t *dst, const uuid_t *src)
+{
+	memcpy(dst, src, sizeof(uuid_t));
+}
+
 void generate_random_uuid(unsigned char uuid[16]);
 
 extern void guid_gen(guid_t *u);
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 9cad846fd805..4d05189e5f87 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -71,7 +71,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 		test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
 	total_tests++;
-	if (uuid_le_cmp(data->le, le)) {
+	if (!guid_equal(&data->le, &le)) {
 		sprintf(buf, "%pUl", &le);
 		test_uuid_failed("cmp", false, false, data->uuid, buf);
 	}
@@ -82,7 +82,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
 		test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
 	total_tests++;
-	if (uuid_be_cmp(data->be, be)) {
+	if (uuid_equal(&data->be, &be)) {
 		sprintf(buf, "%pUb", &be);
 		test_uuid_failed("cmp", false, true, data->uuid, buf);
 	}
-- 
2.11.0

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

* [PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

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-jcswGhMUV9g@public.gmane.org>
Cc: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[hch: added guid_is_null]
Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Acked-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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

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

* [PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

.. 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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

.. and switch to use uuid_t instead of the old uuid_be type while we're
at it.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

.. 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

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

* [PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

.. 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

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

* [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
---
 fs/afs/cmservice.c | 46 +++++++++++++++++++++++-----------------------
 fs/afs/internal.h  |  2 +-
 fs/afs/main.c      |  4 ++--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 3062cceb5c2a..d4e77d12570c 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -350,7 +350,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 {
 	struct sockaddr_rxrpc srx;
 	struct afs_server *server;
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -380,20 +380,20 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call *call)
 static void SRXAFSCB_ProbeUuid(struct work_struct *work)
 {
 	struct afs_call *call = container_of(work, struct afs_call, work);
-	struct uuid_v1 *r = call->request;
+	uuid_t *r = call->request;
 
 	struct {
 		__be32	match;
@@ -476,7 +476,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
  */
 static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 {
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -502,20 +502,20 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -568,13 +568,13 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
 	memset(&reply, 0, sizeof(reply));
 	reply.ia.nifs = htonl(nifs);
 
-	reply.ia.uuid[0] = afs_uuid.time_low;
-	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.time_mid));
-	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.time_hi_and_version));
-	reply.ia.uuid[3] = htonl((s8) afs_uuid.clock_seq_hi_and_reserved);
-	reply.ia.uuid[4] = htonl((s8) afs_uuid.clock_seq_low);
+	reply.ia.uuid[0] = afs_uuid.v1.time_low;
+	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.v1.time_mid));
+	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.v1.time_hi_and_version));
+	reply.ia.uuid[3] = htonl((s8) afs_uuid.v1.clock_seq_hi_and_reserved);
+	reply.ia.uuid[4] = htonl((s8) afs_uuid.v1.clock_seq_low);
 	for (loop = 0; loop < 6; loop++)
-		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.node[loop]);
+		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.v1.node[loop]);
 
 	if (ifs) {
 		for (loop = 0; loop < nifs; loop++) {
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 393672997cc2..7de45c8686a2 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -544,7 +544,7 @@ extern int afs_drop_inode(struct inode *);
  * main.c
  */
 extern struct workqueue_struct *afs_wq;
-extern struct uuid_v1 afs_uuid;
+extern uuid_t afs_uuid;
 
 /*
  * misc.c
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 51d7d17bca57..75b3d3a8b1ba 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -31,7 +31,7 @@ static char *rootcell;
 module_param(rootcell, charp, 0);
 MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
 
-struct uuid_v1 afs_uuid;
+uuid_t afs_uuid;
 struct workqueue_struct *afs_wq;
 
 /*
@@ -43,7 +43,7 @@ static int __init afs_init(void)
 
 	printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 registering.\n");
 
-	generate_random_uuid((unsigned char *)&afs_uuid);
+	uuid_gen(&afs_uuid);
 
 	/* create workqueue */
 	ret = -ENOMEM;
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Reviewed-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/afs/cmservice.c | 46 +++++++++++++++++++++++-----------------------
 fs/afs/internal.h  |  2 +-
 fs/afs/main.c      |  4 ++--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 3062cceb5c2a..d4e77d12570c 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -350,7 +350,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 {
 	struct sockaddr_rxrpc srx;
 	struct afs_server *server;
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -380,20 +380,20 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call *call)
 static void SRXAFSCB_ProbeUuid(struct work_struct *work)
 {
 	struct afs_call *call = container_of(work, struct afs_call, work);
-	struct uuid_v1 *r = call->request;
+	uuid_t *r = call->request;
 
 	struct {
 		__be32	match;
@@ -476,7 +476,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
  */
 static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 {
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -502,20 +502,20 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -568,13 +568,13 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
 	memset(&reply, 0, sizeof(reply));
 	reply.ia.nifs = htonl(nifs);
 
-	reply.ia.uuid[0] = afs_uuid.time_low;
-	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.time_mid));
-	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.time_hi_and_version));
-	reply.ia.uuid[3] = htonl((s8) afs_uuid.clock_seq_hi_and_reserved);
-	reply.ia.uuid[4] = htonl((s8) afs_uuid.clock_seq_low);
+	reply.ia.uuid[0] = afs_uuid.v1.time_low;
+	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.v1.time_mid));
+	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.v1.time_hi_and_version));
+	reply.ia.uuid[3] = htonl((s8) afs_uuid.v1.clock_seq_hi_and_reserved);
+	reply.ia.uuid[4] = htonl((s8) afs_uuid.v1.clock_seq_low);
 	for (loop = 0; loop < 6; loop++)
-		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.node[loop]);
+		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.v1.node[loop]);
 
 	if (ifs) {
 		for (loop = 0; loop < nifs; loop++) {
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 393672997cc2..7de45c8686a2 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -544,7 +544,7 @@ extern int afs_drop_inode(struct inode *);
  * main.c
  */
 extern struct workqueue_struct *afs_wq;
-extern struct uuid_v1 afs_uuid;
+extern uuid_t afs_uuid;
 
 /*
  * misc.c
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 51d7d17bca57..75b3d3a8b1ba 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -31,7 +31,7 @@ static char *rootcell;
 module_param(rootcell, charp, 0);
 MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
 
-struct uuid_v1 afs_uuid;
+uuid_t afs_uuid;
 struct workqueue_struct *afs_wq;
 
 /*
@@ -43,7 +43,7 @@ static int __init afs_init(void)
 
 	printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 registering.\n");
 
-	generate_random_uuid((unsigned char *)&afs_uuid);
+	uuid_gen(&afs_uuid);
 
 	/* create workqueue */
 	ret = -ENOMEM;
-- 
2.11.0

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

* [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
---
 fs/afs/cmservice.c | 46 +++++++++++++++++++++++-----------------------
 fs/afs/internal.h  |  2 +-
 fs/afs/main.c      |  4 ++--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 3062cceb5c2a..d4e77d12570c 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -350,7 +350,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 {
 	struct sockaddr_rxrpc srx;
 	struct afs_server *server;
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -380,20 +380,20 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call *call)
 static void SRXAFSCB_ProbeUuid(struct work_struct *work)
 {
 	struct afs_call *call = container_of(work, struct afs_call, work);
-	struct uuid_v1 *r = call->request;
+	uuid_t *r = call->request;
 
 	struct {
 		__be32	match;
@@ -476,7 +476,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
  */
 static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 {
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -502,20 +502,20 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -568,13 +568,13 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
 	memset(&reply, 0, sizeof(reply));
 	reply.ia.nifs = htonl(nifs);
 
-	reply.ia.uuid[0] = afs_uuid.time_low;
-	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.time_mid));
-	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.time_hi_and_version));
-	reply.ia.uuid[3] = htonl((s8) afs_uuid.clock_seq_hi_and_reserved);
-	reply.ia.uuid[4] = htonl((s8) afs_uuid.clock_seq_low);
+	reply.ia.uuid[0] = afs_uuid.v1.time_low;
+	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.v1.time_mid));
+	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.v1.time_hi_and_version));
+	reply.ia.uuid[3] = htonl((s8) afs_uuid.v1.clock_seq_hi_and_reserved);
+	reply.ia.uuid[4] = htonl((s8) afs_uuid.v1.clock_seq_low);
 	for (loop = 0; loop < 6; loop++)
-		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.node[loop]);
+		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.v1.node[loop]);
 
 	if (ifs) {
 		for (loop = 0; loop < nifs; loop++) {
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 393672997cc2..7de45c8686a2 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -544,7 +544,7 @@ extern int afs_drop_inode(struct inode *);
  * main.c
  */
 extern struct workqueue_struct *afs_wq;
-extern struct uuid_v1 afs_uuid;
+extern uuid_t afs_uuid;
 
 /*
  * misc.c
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 51d7d17bca57..75b3d3a8b1ba 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -31,7 +31,7 @@ static char *rootcell;
 module_param(rootcell, charp, 0);
 MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
 
-struct uuid_v1 afs_uuid;
+uuid_t afs_uuid;
 struct workqueue_struct *afs_wq;
 
 /*
@@ -43,7 +43,7 @@ static int __init afs_init(void)
 
 	printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 registering.\n");
 
-	generate_random_uuid((unsigned char *)&afs_uuid);
+	uuid_gen(&afs_uuid);
 
 	/* create workqueue */
 	ret = -ENOMEM;
-- 
2.11.0

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

* [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
---
 fs/afs/cmservice.c | 46 +++++++++++++++++++++++-----------------------
 fs/afs/internal.h  |  2 +-
 fs/afs/main.c      |  4 ++--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 3062cceb5c2a..d4e77d12570c 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -350,7 +350,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 {
 	struct sockaddr_rxrpc srx;
 	struct afs_server *server;
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -380,20 +380,20 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call *call)
 static void SRXAFSCB_ProbeUuid(struct work_struct *work)
 {
 	struct afs_call *call = container_of(work, struct afs_call, work);
-	struct uuid_v1 *r = call->request;
+	uuid_t *r = call->request;
 
 	struct {
 		__be32	match;
@@ -476,7 +476,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
  */
 static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 {
-	struct uuid_v1 *r;
+	uuid_t *r;
 	unsigned loop;
 	__be32 *b;
 	int ret;
@@ -502,20 +502,20 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 		}
 
 		_debug("unmarshall UUID");
-		call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+		call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
 		if (!call->request)
 			return -ENOMEM;
 
 		b = call->buffer;
 		r = call->request;
-		r->time_low			= b[0];
-		r->time_mid			= htons(ntohl(b[1]));
-		r->time_hi_and_version		= htons(ntohl(b[2]));
-		r->clock_seq_hi_and_reserved 	= ntohl(b[3]);
-		r->clock_seq_low		= ntohl(b[4]);
+		r->v1.time_low			= b[0];
+		r->v1.time_mid			= htons(ntohl(b[1]));
+		r->v1.time_hi_and_version	= htons(ntohl(b[2]));
+		r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+		r->v1.clock_seq_low		= ntohl(b[4]);
 
 		for (loop = 0; loop < 6; loop++)
-			r->node[loop] = ntohl(b[loop + 5]);
+			r->v1.node[loop] = ntohl(b[loop + 5]);
 
 		call->offset = 0;
 		call->unmarshall++;
@@ -568,13 +568,13 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
 	memset(&reply, 0, sizeof(reply));
 	reply.ia.nifs = htonl(nifs);
 
-	reply.ia.uuid[0] = afs_uuid.time_low;
-	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.time_mid));
-	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.time_hi_and_version));
-	reply.ia.uuid[3] = htonl((s8) afs_uuid.clock_seq_hi_and_reserved);
-	reply.ia.uuid[4] = htonl((s8) afs_uuid.clock_seq_low);
+	reply.ia.uuid[0] = afs_uuid.v1.time_low;
+	reply.ia.uuid[1] = htonl(ntohs(afs_uuid.v1.time_mid));
+	reply.ia.uuid[2] = htonl(ntohs(afs_uuid.v1.time_hi_and_version));
+	reply.ia.uuid[3] = htonl((s8) afs_uuid.v1.clock_seq_hi_and_reserved);
+	reply.ia.uuid[4] = htonl((s8) afs_uuid.v1.clock_seq_low);
 	for (loop = 0; loop < 6; loop++)
-		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.node[loop]);
+		reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.v1.node[loop]);
 
 	if (ifs) {
 		for (loop = 0; loop < nifs; loop++) {
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 393672997cc2..7de45c8686a2 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -544,7 +544,7 @@ extern int afs_drop_inode(struct inode *);
  * main.c
  */
 extern struct workqueue_struct *afs_wq;
-extern struct uuid_v1 afs_uuid;
+extern uuid_t afs_uuid;
 
 /*
  * misc.c
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 51d7d17bca57..75b3d3a8b1ba 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -31,7 +31,7 @@ static char *rootcell;
 module_param(rootcell, charp, 0);
 MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
 
-struct uuid_v1 afs_uuid;
+uuid_t afs_uuid;
 struct workqueue_struct *afs_wq;
 
 /*
@@ -43,7 +43,7 @@ static int __init afs_init(void)
 
 	printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 registering.\n");
 
-	generate_random_uuid((unsigned char *)&afs_uuid);
+	uuid_gen(&afs_uuid);
 
 	/* create workqueue */
 	ret = -ENOMEM;
-- 
2.11.0

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

* [PATCH 11/23] uuid: remove struct uuid_v1
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 11/23] uuid: remove struct uuid_v1
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Unused now.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 11/23] uuid: remove struct uuid_v1
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 11/23] uuid: remove struct uuid_v1
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

Directly use the v1 intepretation of uuid_t instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.c      | 25 -------------------------
 fs/xfs/uuid.h      |  1 -
 fs/xfs/xfs_mount.c |  6 +++++-
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index 29ed78c8637b..737c186ea98b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -17,31 +17,6 @@
  */
 #include <xfs.h>
 
-/* IRIX interpretation of an uuid_t */
-typedef struct {
-	__be32	uu_timelow;
-	__be16	uu_timemid;
-	__be16	uu_timehi;
-	__be16	uu_clockseq;
-	__be16	uu_node[3];
-} xfs_uu_t;
-
-/*
- * uuid_getnodeuniq - obtain the node unique fields of a UUID.
- *
- * This is not in any way a standard or condoned UUID function;
- * it just something that's needed for user-level file handles.
- */
-void
-uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
-{
-	xfs_uu_t *uup = (xfs_uu_t *)uuid;
-
-	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
-		   be16_to_cpu(uup->uu_timemid);
-	fsid[1] = be32_to_cpu(uup->uu_timelow);
-}
-
 int
 uuid_is_nil(uuid_t *uuid)
 {
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 86bbed071e79..5aea49bf0963 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,6 +19,5 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
 #endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2eaf81859166..742e4a61c0bc 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -793,7 +793,11 @@ xfs_mountfs(
 	 *  Copies the low order bits of the timestamp and the randomly
 	 *  set "sequence" number out of a UUID.
 	 */
-	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
+	mp->m_fixedfsid[0] =
+		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
+		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
+		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
+	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
 
 	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
 
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Directly use the v1 intepretation of uuid_t instead.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 fs/xfs/uuid.c      | 25 -------------------------
 fs/xfs/uuid.h      |  1 -
 fs/xfs/xfs_mount.c |  6 +++++-
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index 29ed78c8637b..737c186ea98b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -17,31 +17,6 @@
  */
 #include <xfs.h>
 
-/* IRIX interpretation of an uuid_t */
-typedef struct {
-	__be32	uu_timelow;
-	__be16	uu_timemid;
-	__be16	uu_timehi;
-	__be16	uu_clockseq;
-	__be16	uu_node[3];
-} xfs_uu_t;
-
-/*
- * uuid_getnodeuniq - obtain the node unique fields of a UUID.
- *
- * This is not in any way a standard or condoned UUID function;
- * it just something that's needed for user-level file handles.
- */
-void
-uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
-{
-	xfs_uu_t *uup = (xfs_uu_t *)uuid;
-
-	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
-		   be16_to_cpu(uup->uu_timemid);
-	fsid[1] = be32_to_cpu(uup->uu_timelow);
-}
-
 int
 uuid_is_nil(uuid_t *uuid)
 {
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 86bbed071e79..5aea49bf0963 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,6 +19,5 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
 #endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2eaf81859166..742e4a61c0bc 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -793,7 +793,11 @@ xfs_mountfs(
 	 *  Copies the low order bits of the timestamp and the randomly
 	 *  set "sequence" number out of a UUID.
 	 */
-	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
+	mp->m_fixedfsid[0] =
+		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
+		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
+		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
+	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
 
 	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
 
-- 
2.11.0

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

* [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Directly use the v1 intepretation of uuid_t instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.c      | 25 -------------------------
 fs/xfs/uuid.h      |  1 -
 fs/xfs/xfs_mount.c |  6 +++++-
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index 29ed78c8637b..737c186ea98b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -17,31 +17,6 @@
  */
 #include <xfs.h>
 
-/* IRIX interpretation of an uuid_t */
-typedef struct {
-	__be32	uu_timelow;
-	__be16	uu_timemid;
-	__be16	uu_timehi;
-	__be16	uu_clockseq;
-	__be16	uu_node[3];
-} xfs_uu_t;
-
-/*
- * uuid_getnodeuniq - obtain the node unique fields of a UUID.
- *
- * This is not in any way a standard or condoned UUID function;
- * it just something that's needed for user-level file handles.
- */
-void
-uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
-{
-	xfs_uu_t *uup = (xfs_uu_t *)uuid;
-
-	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
-		   be16_to_cpu(uup->uu_timemid);
-	fsid[1] = be32_to_cpu(uup->uu_timelow);
-}
-
 int
 uuid_is_nil(uuid_t *uuid)
 {
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 86bbed071e79..5aea49bf0963 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,6 +19,5 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
 #endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2eaf81859166..742e4a61c0bc 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -793,7 +793,11 @@ xfs_mountfs(
 	 *  Copies the low order bits of the timestamp and the randomly
 	 *  set "sequence" number out of a UUID.
 	 */
-	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
+	mp->m_fixedfsid[0] =
+		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
+		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
+		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
+	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
 
 	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
 
-- 
2.11.0

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

* [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Directly use the v1 intepretation of uuid_t instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/uuid.c      | 25 -------------------------
 fs/xfs/uuid.h      |  1 -
 fs/xfs/xfs_mount.c |  6 +++++-
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index 29ed78c8637b..737c186ea98b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -17,31 +17,6 @@
  */
 #include <xfs.h>
 
-/* IRIX interpretation of an uuid_t */
-typedef struct {
-	__be32	uu_timelow;
-	__be16	uu_timemid;
-	__be16	uu_timehi;
-	__be16	uu_clockseq;
-	__be16	uu_node[3];
-} xfs_uu_t;
-
-/*
- * uuid_getnodeuniq - obtain the node unique fields of a UUID.
- *
- * This is not in any way a standard or condoned UUID function;
- * it just something that's needed for user-level file handles.
- */
-void
-uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
-{
-	xfs_uu_t *uup = (xfs_uu_t *)uuid;
-
-	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
-		   be16_to_cpu(uup->uu_timemid);
-	fsid[1] = be32_to_cpu(uup->uu_timelow);
-}
-
 int
 uuid_is_nil(uuid_t *uuid)
 {
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 86bbed071e79..5aea49bf0963 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,6 +19,5 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
 #endif	/* __XFS_SUPPORT_UUID_H__ */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2eaf81859166..742e4a61c0bc 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -793,7 +793,11 @@ xfs_mountfs(
 	 *  Copies the low order bits of the timestamp and the randomly
 	 *  set "sequence" number out of a UUID.
 	 */
-	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
+	mp->m_fixedfsid[0] =
+		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
+		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
+		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
+	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
 
 	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
 
-- 
2.11.0

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

* [PATCH 13/23] md: namespace private helper names
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

From: Amir Goldstein <amir73il@gmail.com>

The md private helper uuid_equal() collides with a generic helper
of the same name.

Rename the md private helper to md_uuid_equal() and do the same for
md_sb_equal().

Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/md.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 82f798be964f..65795cc4cb7d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int size)
 	return -EINVAL;
 }
 
-static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	return	sb1->set_uuid0 == sb2->set_uuid0 &&
 		sb1->set_uuid1 == sb2->set_uuid1 &&
@@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 		sb1->set_uuid3 == sb2->set_uuid3;
 }
 
-static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	int ret;
 	mdp_super_t *tmp1, *tmp2;
@@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
 	} else {
 		__u64 ev1, ev2;
 		mdp_super_t *refsb = page_address(refdev->sb_page);
-		if (!uuid_equal(refsb, sb)) {
+		if (!md_uuid_equal(refsb, sb)) {
 			pr_warn("md: %s has different UUID to %s\n",
 				b, bdevname(refdev->bdev,b2));
 			goto abort;
 		}
-		if (!sb_equal(refsb, sb)) {
+		if (!md_sb_equal(refsb, sb)) {
 			pr_warn("md: %s has same UUID but different superblock to %s\n",
 				b, bdevname(refdev->bdev, b2));
 			goto abort;
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 13/23] md: namespace private helper names
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

From: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

The md private helper uuid_equal() collides with a generic helper
of the same name.

Rename the md private helper to md_uuid_equal() and do the same for
md_sb_equal().

Cc: Shaohua Li <shli-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 drivers/md/md.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 82f798be964f..65795cc4cb7d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int size)
 	return -EINVAL;
 }
 
-static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	return	sb1->set_uuid0 == sb2->set_uuid0 &&
 		sb1->set_uuid1 == sb2->set_uuid1 &&
@@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 		sb1->set_uuid3 == sb2->set_uuid3;
 }
 
-static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	int ret;
 	mdp_super_t *tmp1, *tmp2;
@@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
 	} else {
 		__u64 ev1, ev2;
 		mdp_super_t *refsb = page_address(refdev->sb_page);
-		if (!uuid_equal(refsb, sb)) {
+		if (!md_uuid_equal(refsb, sb)) {
 			pr_warn("md: %s has different UUID to %s\n",
 				b, bdevname(refdev->bdev,b2));
 			goto abort;
 		}
-		if (!sb_equal(refsb, sb)) {
+		if (!md_sb_equal(refsb, sb)) {
 			pr_warn("md: %s has same UUID but different superblock to %s\n",
 				b, bdevname(refdev->bdev, b2));
 			goto abort;
-- 
2.11.0

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

* [PATCH 13/23] md: namespace private helper names
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

From: Amir Goldstein <amir73il@gmail.com>

The md private helper uuid_equal() collides with a generic helper
of the same name.

Rename the md private helper to md_uuid_equal() and do the same for
md_sb_equal().

Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/md.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 82f798be964f..65795cc4cb7d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int size)
 	return -EINVAL;
 }
 
-static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	return	sb1->set_uuid0 == sb2->set_uuid0 &&
 		sb1->set_uuid1 == sb2->set_uuid1 &&
@@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 		sb1->set_uuid3 == sb2->set_uuid3;
 }
 
-static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	int ret;
 	mdp_super_t *tmp1, *tmp2;
@@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
 	} else {
 		__u64 ev1, ev2;
 		mdp_super_t *refsb = page_address(refdev->sb_page);
-		if (!uuid_equal(refsb, sb)) {
+		if (!md_uuid_equal(refsb, sb)) {
 			pr_warn("md: %s has different UUID to %s\n",
 				b, bdevname(refdev->bdev,b2));
 			goto abort;
 		}
-		if (!sb_equal(refsb, sb)) {
+		if (!md_sb_equal(refsb, sb)) {
 			pr_warn("md: %s has same UUID but different superblock to %s\n",
 				b, bdevname(refdev->bdev, b2));
 			goto abort;
-- 
2.11.0

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

* [PATCH 13/23] md: namespace private helper names
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

From: Amir Goldstein <amir73il@gmail.com>

The md private helper uuid_equal() collides with a generic helper
of the same name.

Rename the md private helper to md_uuid_equal() and do the same for
md_sb_equal().

Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/md.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 82f798be964f..65795cc4cb7d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int size)
 	return -EINVAL;
 }
 
-static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	return	sb1->set_uuid0 == sb2->set_uuid0 &&
 		sb1->set_uuid1 == sb2->set_uuid1 &&
@@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 		sb1->set_uuid3 == sb2->set_uuid3;
 }
 
-static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
 	int ret;
 	mdp_super_t *tmp1, *tmp2;
@@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
 	} else {
 		__u64 ev1, ev2;
 		mdp_super_t *refsb = page_address(refdev->sb_page);
-		if (!uuid_equal(refsb, sb)) {
+		if (!md_uuid_equal(refsb, sb)) {
 			pr_warn("md: %s has different UUID to %s\n",
 				b, bdevname(refdev->bdev,b2));
 			goto abort;
 		}
-		if (!sb_equal(refsb, sb)) {
+		if (!md_sb_equal(refsb, sb)) {
 			pr_warn("md: %s has same UUID but different superblock to %s\n",
 				b, bdevname(refdev->bdev, b2));
 			goto abort;
-- 
2.11.0

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

* [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

From: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[hch: remove now unused uuid.[ch]]
Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

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-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 security/integrity/ima/ima_policy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 49fbc3e8f012..da3e7d50e0d7 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -61,7 +61,7 @@ struct ima_rule_entry {
 	enum ima_hooks func;
 	int mask;
 	unsigned long fsmagic;
-	u8 fsuuid[16];
+	uuid_t fsuuid;
 	kuid_t uid;
 	kuid_t fowner;
 	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
@@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 		case Opt_fsuuid:
 			ima_log_string(ab, "fsuuid", args[0].from);
 
-			if (memchr_inv(entry->fsuuid, 0x00,
-				       sizeof(entry->fsuuid))) {
+			if (uuid_is_null(&entry->fsuuid)) {
 				result = -EINVAL;
 				break;
 			}
 
-			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
+			result = uuid_to_bin(args[0].from, &entry->fsuuid);
 			if (!result)
 				entry->flags |= IMA_FSUUID;
 			break;
@@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
 	}
 
 	if (entry->flags & IMA_FSUUID) {
-		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
+		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
 		seq_puts(m, " ");
 	}
 
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 security/integrity/ima/ima_policy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 49fbc3e8f012..da3e7d50e0d7 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -61,7 +61,7 @@ struct ima_rule_entry {
 	enum ima_hooks func;
 	int mask;
 	unsigned long fsmagic;
-	u8 fsuuid[16];
+	uuid_t fsuuid;
 	kuid_t uid;
 	kuid_t fowner;
 	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
@@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 		case Opt_fsuuid:
 			ima_log_string(ab, "fsuuid", args[0].from);
 
-			if (memchr_inv(entry->fsuuid, 0x00,
-				       sizeof(entry->fsuuid))) {
+			if (uuid_is_null(&entry->fsuuid)) {
 				result = -EINVAL;
 				break;
 			}
 
-			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
+			result = uuid_to_bin(args[0].from, &entry->fsuuid);
 			if (!result)
 				entry->flags |= IMA_FSUUID;
 			break;
@@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
 	}
 
 	if (entry->flags & IMA_FSUUID) {
-		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
+		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
 		seq_puts(m, " ");
 	}
 
-- 
2.11.0

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

* [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 security/integrity/ima/ima_policy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 49fbc3e8f012..da3e7d50e0d7 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -61,7 +61,7 @@ struct ima_rule_entry {
 	enum ima_hooks func;
 	int mask;
 	unsigned long fsmagic;
-	u8 fsuuid[16];
+	uuid_t fsuuid;
 	kuid_t uid;
 	kuid_t fowner;
 	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
@@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 		case Opt_fsuuid:
 			ima_log_string(ab, "fsuuid", args[0].from);
 
-			if (memchr_inv(entry->fsuuid, 0x00,
-				       sizeof(entry->fsuuid))) {
+			if (uuid_is_null(&entry->fsuuid)) {
 				result = -EINVAL;
 				break;
 			}
 
-			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
+			result = uuid_to_bin(args[0].from, &entry->fsuuid);
 			if (!result)
 				entry->flags |= IMA_FSUUID;
 			break;
@@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
 	}
 
 	if (entry->flags & IMA_FSUUID) {
-		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
+		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
 		seq_puts(m, " ");
 	}
 
-- 
2.11.0

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

* [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 security/integrity/ima/ima_policy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 49fbc3e8f012..da3e7d50e0d7 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -61,7 +61,7 @@ struct ima_rule_entry {
 	enum ima_hooks func;
 	int mask;
 	unsigned long fsmagic;
-	u8 fsuuid[16];
+	uuid_t fsuuid;
 	kuid_t uid;
 	kuid_t fowner;
 	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
@@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 		case Opt_fsuuid:
 			ima_log_string(ab, "fsuuid", args[0].from);
 
-			if (memchr_inv(entry->fsuuid, 0x00,
-				       sizeof(entry->fsuuid))) {
+			if (uuid_is_null(&entry->fsuuid)) {
 				result = -EINVAL;
 				break;
 			}
 
-			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
+			result = uuid_to_bin(args[0].from, &entry->fsuuid);
 			if (!result)
 				entry->flags |= IMA_FSUUID;
 			break;
@@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
 	}
 
 	if (entry->flags & IMA_FSUUID) {
-		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
+		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
 		seq_puts(m, " ");
 	}
 
-- 
2.11.0

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

* [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

For some file systems we still memcpy into it, but in various places this
already allows us to use the proper uuid helpers.  More to come..

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/xen/tmem.c                  |  6 +++---
 fs/ext4/super.c                     |  2 +-
 fs/f2fs/super.c                     |  2 +-
 fs/gfs2/ops_fstype.c                |  2 +-
 fs/gfs2/sys.c                       | 22 +++++-----------------
 fs/ocfs2/super.c                    |  2 +-
 fs/overlayfs/copy_up.c              |  5 ++---
 fs/overlayfs/namei.c                |  2 +-
 fs/xfs/xfs_mount.c                  |  3 +--
 include/linux/cleancache.h          |  2 +-
 include/linux/fs.h                  |  5 +++--
 mm/cleancache.c                     |  2 +-
 security/integrity/evm/evm_crypto.c |  2 +-
 security/integrity/ima/ima_policy.c |  2 +-
 14 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 4ac2ca8a7656..bf13d1ec51f3 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
 	return xen_tmem_new_pool(uuid_private, 0, pagesize);
 }
 
-static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
+static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
 {
 	struct tmem_pool_uuid shared_uuid;
 
-	shared_uuid.uuid_lo = *(u64 *)uuid;
-	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
+	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
+	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
 	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
 }
 
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b177da9ea82..6e3b4186a22f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_operations;
 	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 #endif
-	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
+	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 83355ec4a92c..0b89b0b7b9f7 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_time_gran = 1;
 	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
 		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
-	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 
 	/* init f2fs-specific super block info */
 	sbi->valid_super_block = valid_super_block;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ed67548b286c..b92135c202c2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
 
 	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
 	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
-	memcpy(s->s_uuid, str->sb_uuid, 16);
+	memcpy(&s->s_uuid, str->sb_uuid, 16);
 }
 
 /**
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 7a515345610c..e77bc52b468f 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
 	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
 }
 
-static int gfs2_uuid_valid(const u8 *uuid)
-{
-	int i;
-
-	for (i = 0; i < 16; i++) {
-		if (uuid[i])
-			return 1;
-	}
-	return 0;
-}
-
 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
 {
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
+
 	buf[0] = '\0';
-	if (!gfs2_uuid_valid(uuid))
+	if (uuid_is_null(&s->s_uuid))
 		return 0;
-	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
+	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
 }
 
 static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 {
 	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
 
 	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
 	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
 	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
 		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
-	if (gfs2_uuid_valid(uuid))
-		add_uevent_var(env, "UUID=%pUB", uuid);
+	if (!uuid_is_null(&s->s_uuid))
+		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
 	return 0;
 }
 
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ca1646fbcaef..83005f486451 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
 	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
 	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
-	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
+	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
 	       sizeof(di->id2.i_super.s_uuid));
 
 	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 9008ab9fbd2e..5b795873f7fa 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 			  struct dentry *upper)
 {
 	struct super_block *sb = lower->d_sb;
-	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
 	const struct ovl_fh *fh = NULL;
 	int err;
 
@@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 	 * up and a pure upper inode.
 	 */
 	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
-	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
-		fh = ovl_encode_fh(lower, uuid);
+	    !uuid_is_null(&sb->s_uuid)) {
+		fh = ovl_encode_fh(lower, &sb->s_uuid);
 		if (IS_ERR(fh))
 			return PTR_ERR(fh);
 	}
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index bad0f665a635..6709f27c6876 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
 	 * Make sure that the stored uuid matches the uuid of the lower
 	 * layer where file handle will be decoded.
 	 */
-	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
+	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
 		goto out;
 
 	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 682b336a7a6a..6a18ae407713 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -74,8 +74,7 @@ xfs_uuid_mount(
 	int			hole, i;
 
 	/* Publish UUID in struct super_block */
-	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
-	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
+	uuid_copy(&mp->m_super->s_uuid, uuid);
 
 	if (mp->m_flags & XFS_MOUNT_NOUUID)
 		return 0;
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index fccf7f44139d..bbb3712dd892 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -27,7 +27,7 @@ struct cleancache_filekey {
 
 struct cleancache_ops {
 	int (*init_fs)(size_t);
-	int (*init_shared_fs)(char *uuid, size_t);
+	int (*init_shared_fs)(uuid_t *uuid, size_t);
 	int (*get_page)(int, struct cleancache_filekey,
 			pgoff_t, struct page *);
 	void (*put_page)(int, struct cleancache_filekey,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 803e5a9b2654..3e68cabb8457 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -30,6 +30,7 @@
 #include <linux/percpu-rwsem.h>
 #include <linux/workqueue.h>
 #include <linux/delayed_call.h>
+#include <linux/uuid.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -1328,8 +1329,8 @@ struct super_block {
 
 	struct sb_writers	s_writers;
 
-	char s_id[32];				/* Informational name */
-	u8 s_uuid[16];				/* UUID */
+	char			s_id[32];	/* Informational name */
+	uuid_t			s_uuid;		/* UUID */
 
 	void 			*s_fs_info;	/* Filesystem private info */
 	unsigned int		s_max_links;
diff --git a/mm/cleancache.c b/mm/cleancache.c
index ba5d8f3e6d68..f7b9fdc79d97 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
 	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
 
 	if (cleancache_ops) {
-		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
+		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
 		if (pool_id < 0)
 			pool_id = CLEANCACHE_NO_POOL;
 	}
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index d7f282d75cc1..1d32cd20009a 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
 	hmac_misc.mode = inode->i_mode;
 	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
 	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
-		crypto_shash_update(desc, inode->i_sb->s_uuid,
+		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
 				    sizeof(inode->i_sb->s_uuid));
 	crypto_shash_final(desc, digest);
 }
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index da3e7d50e0d7..659dbcc83d2f 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

For some file systems we still memcpy into it, but in various places this
already allows us to use the proper uuid helpers.  More to come..

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 drivers/xen/tmem.c                  |  6 +++---
 fs/ext4/super.c                     |  2 +-
 fs/f2fs/super.c                     |  2 +-
 fs/gfs2/ops_fstype.c                |  2 +-
 fs/gfs2/sys.c                       | 22 +++++-----------------
 fs/ocfs2/super.c                    |  2 +-
 fs/overlayfs/copy_up.c              |  5 ++---
 fs/overlayfs/namei.c                |  2 +-
 fs/xfs/xfs_mount.c                  |  3 +--
 include/linux/cleancache.h          |  2 +-
 include/linux/fs.h                  |  5 +++--
 mm/cleancache.c                     |  2 +-
 security/integrity/evm/evm_crypto.c |  2 +-
 security/integrity/ima/ima_policy.c |  2 +-
 14 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 4ac2ca8a7656..bf13d1ec51f3 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
 	return xen_tmem_new_pool(uuid_private, 0, pagesize);
 }
 
-static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
+static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
 {
 	struct tmem_pool_uuid shared_uuid;
 
-	shared_uuid.uuid_lo = *(u64 *)uuid;
-	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
+	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
+	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
 	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
 }
 
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b177da9ea82..6e3b4186a22f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_operations;
 	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 #endif
-	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
+	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 83355ec4a92c..0b89b0b7b9f7 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_time_gran = 1;
 	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
 		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
-	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 
 	/* init f2fs-specific super block info */
 	sbi->valid_super_block = valid_super_block;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ed67548b286c..b92135c202c2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
 
 	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
 	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
-	memcpy(s->s_uuid, str->sb_uuid, 16);
+	memcpy(&s->s_uuid, str->sb_uuid, 16);
 }
 
 /**
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 7a515345610c..e77bc52b468f 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
 	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
 }
 
-static int gfs2_uuid_valid(const u8 *uuid)
-{
-	int i;
-
-	for (i = 0; i < 16; i++) {
-		if (uuid[i])
-			return 1;
-	}
-	return 0;
-}
-
 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
 {
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
+
 	buf[0] = '\0';
-	if (!gfs2_uuid_valid(uuid))
+	if (uuid_is_null(&s->s_uuid))
 		return 0;
-	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
+	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
 }
 
 static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 {
 	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
 
 	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
 	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
 	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
 		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
-	if (gfs2_uuid_valid(uuid))
-		add_uevent_var(env, "UUID=%pUB", uuid);
+	if (!uuid_is_null(&s->s_uuid))
+		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
 	return 0;
 }
 
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ca1646fbcaef..83005f486451 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
 	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
 	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
-	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
+	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
 	       sizeof(di->id2.i_super.s_uuid));
 
 	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 9008ab9fbd2e..5b795873f7fa 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 			  struct dentry *upper)
 {
 	struct super_block *sb = lower->d_sb;
-	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
 	const struct ovl_fh *fh = NULL;
 	int err;
 
@@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 	 * up and a pure upper inode.
 	 */
 	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
-	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
-		fh = ovl_encode_fh(lower, uuid);
+	    !uuid_is_null(&sb->s_uuid)) {
+		fh = ovl_encode_fh(lower, &sb->s_uuid);
 		if (IS_ERR(fh))
 			return PTR_ERR(fh);
 	}
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index bad0f665a635..6709f27c6876 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
 	 * Make sure that the stored uuid matches the uuid of the lower
 	 * layer where file handle will be decoded.
 	 */
-	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
+	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
 		goto out;
 
 	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 682b336a7a6a..6a18ae407713 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -74,8 +74,7 @@ xfs_uuid_mount(
 	int			hole, i;
 
 	/* Publish UUID in struct super_block */
-	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
-	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
+	uuid_copy(&mp->m_super->s_uuid, uuid);
 
 	if (mp->m_flags & XFS_MOUNT_NOUUID)
 		return 0;
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index fccf7f44139d..bbb3712dd892 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -27,7 +27,7 @@ struct cleancache_filekey {
 
 struct cleancache_ops {
 	int (*init_fs)(size_t);
-	int (*init_shared_fs)(char *uuid, size_t);
+	int (*init_shared_fs)(uuid_t *uuid, size_t);
 	int (*get_page)(int, struct cleancache_filekey,
 			pgoff_t, struct page *);
 	void (*put_page)(int, struct cleancache_filekey,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 803e5a9b2654..3e68cabb8457 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -30,6 +30,7 @@
 #include <linux/percpu-rwsem.h>
 #include <linux/workqueue.h>
 #include <linux/delayed_call.h>
+#include <linux/uuid.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -1328,8 +1329,8 @@ struct super_block {
 
 	struct sb_writers	s_writers;
 
-	char s_id[32];				/* Informational name */
-	u8 s_uuid[16];				/* UUID */
+	char			s_id[32];	/* Informational name */
+	uuid_t			s_uuid;		/* UUID */
 
 	void 			*s_fs_info;	/* Filesystem private info */
 	unsigned int		s_max_links;
diff --git a/mm/cleancache.c b/mm/cleancache.c
index ba5d8f3e6d68..f7b9fdc79d97 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
 	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
 
 	if (cleancache_ops) {
-		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
+		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
 		if (pool_id < 0)
 			pool_id = CLEANCACHE_NO_POOL;
 	}
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index d7f282d75cc1..1d32cd20009a 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
 	hmac_misc.mode = inode->i_mode;
 	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
 	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
-		crypto_shash_update(desc, inode->i_sb->s_uuid,
+		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
 				    sizeof(inode->i_sb->s_uuid));
 	crypto_shash_final(desc, digest);
 }
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index da3e7d50e0d7..659dbcc83d2f 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
-- 
2.11.0

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

* [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

For some file systems we still memcpy into it, but in various places this
already allows us to use the proper uuid helpers.  More to come..

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/xen/tmem.c                  |  6 +++---
 fs/ext4/super.c                     |  2 +-
 fs/f2fs/super.c                     |  2 +-
 fs/gfs2/ops_fstype.c                |  2 +-
 fs/gfs2/sys.c                       | 22 +++++-----------------
 fs/ocfs2/super.c                    |  2 +-
 fs/overlayfs/copy_up.c              |  5 ++---
 fs/overlayfs/namei.c                |  2 +-
 fs/xfs/xfs_mount.c                  |  3 +--
 include/linux/cleancache.h          |  2 +-
 include/linux/fs.h                  |  5 +++--
 mm/cleancache.c                     |  2 +-
 security/integrity/evm/evm_crypto.c |  2 +-
 security/integrity/ima/ima_policy.c |  2 +-
 14 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 4ac2ca8a7656..bf13d1ec51f3 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
 	return xen_tmem_new_pool(uuid_private, 0, pagesize);
 }
 
-static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
+static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
 {
 	struct tmem_pool_uuid shared_uuid;
 
-	shared_uuid.uuid_lo = *(u64 *)uuid;
-	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
+	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
+	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
 	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
 }
 
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b177da9ea82..6e3b4186a22f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_operations;
 	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 #endif
-	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
+	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 83355ec4a92c..0b89b0b7b9f7 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_time_gran = 1;
 	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
 		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
-	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 
 	/* init f2fs-specific super block info */
 	sbi->valid_super_block = valid_super_block;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ed67548b286c..b92135c202c2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
 
 	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
 	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
-	memcpy(s->s_uuid, str->sb_uuid, 16);
+	memcpy(&s->s_uuid, str->sb_uuid, 16);
 }
 
 /**
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 7a515345610c..e77bc52b468f 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
 	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
 }
 
-static int gfs2_uuid_valid(const u8 *uuid)
-{
-	int i;
-
-	for (i = 0; i < 16; i++) {
-		if (uuid[i])
-			return 1;
-	}
-	return 0;
-}
-
 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
 {
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
+
 	buf[0] = '\0';
-	if (!gfs2_uuid_valid(uuid))
+	if (uuid_is_null(&s->s_uuid))
 		return 0;
-	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
+	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
 }
 
 static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 {
 	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
 
 	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
 	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
 	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
 		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
-	if (gfs2_uuid_valid(uuid))
-		add_uevent_var(env, "UUID=%pUB", uuid);
+	if (!uuid_is_null(&s->s_uuid))
+		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
 	return 0;
 }
 
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ca1646fbcaef..83005f486451 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
 	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
 	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
-	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
+	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
 	       sizeof(di->id2.i_super.s_uuid));
 
 	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 9008ab9fbd2e..5b795873f7fa 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 			  struct dentry *upper)
 {
 	struct super_block *sb = lower->d_sb;
-	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
 	const struct ovl_fh *fh = NULL;
 	int err;
 
@@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 	 * up and a pure upper inode.
 	 */
 	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
-	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
-		fh = ovl_encode_fh(lower, uuid);
+	    !uuid_is_null(&sb->s_uuid)) {
+		fh = ovl_encode_fh(lower, &sb->s_uuid);
 		if (IS_ERR(fh))
 			return PTR_ERR(fh);
 	}
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index bad0f665a635..6709f27c6876 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
 	 * Make sure that the stored uuid matches the uuid of the lower
 	 * layer where file handle will be decoded.
 	 */
-	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
+	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
 		goto out;
 
 	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 682b336a7a6a..6a18ae407713 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -74,8 +74,7 @@ xfs_uuid_mount(
 	int			hole, i;
 
 	/* Publish UUID in struct super_block */
-	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
-	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
+	uuid_copy(&mp->m_super->s_uuid, uuid);
 
 	if (mp->m_flags & XFS_MOUNT_NOUUID)
 		return 0;
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index fccf7f44139d..bbb3712dd892 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -27,7 +27,7 @@ struct cleancache_filekey {
 
 struct cleancache_ops {
 	int (*init_fs)(size_t);
-	int (*init_shared_fs)(char *uuid, size_t);
+	int (*init_shared_fs)(uuid_t *uuid, size_t);
 	int (*get_page)(int, struct cleancache_filekey,
 			pgoff_t, struct page *);
 	void (*put_page)(int, struct cleancache_filekey,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 803e5a9b2654..3e68cabb8457 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -30,6 +30,7 @@
 #include <linux/percpu-rwsem.h>
 #include <linux/workqueue.h>
 #include <linux/delayed_call.h>
+#include <linux/uuid.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -1328,8 +1329,8 @@ struct super_block {
 
 	struct sb_writers	s_writers;
 
-	char s_id[32];				/* Informational name */
-	u8 s_uuid[16];				/* UUID */
+	char			s_id[32];	/* Informational name */
+	uuid_t			s_uuid;		/* UUID */
 
 	void 			*s_fs_info;	/* Filesystem private info */
 	unsigned int		s_max_links;
diff --git a/mm/cleancache.c b/mm/cleancache.c
index ba5d8f3e6d68..f7b9fdc79d97 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
 	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
 
 	if (cleancache_ops) {
-		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
+		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
 		if (pool_id < 0)
 			pool_id = CLEANCACHE_NO_POOL;
 	}
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index d7f282d75cc1..1d32cd20009a 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
 	hmac_misc.mode = inode->i_mode;
 	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
 	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
-		crypto_shash_update(desc, inode->i_sb->s_uuid,
+		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
 				    sizeof(inode->i_sb->s_uuid));
 	crypto_shash_final(desc, digest);
 }
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index da3e7d50e0d7..659dbcc83d2f 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
-- 
2.11.0

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

* [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18  6:26   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:26 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

For some file systems we still memcpy into it, but in various places this
already allows us to use the proper uuid helpers.  More to come..

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/xen/tmem.c                  |  6 +++---
 fs/ext4/super.c                     |  2 +-
 fs/f2fs/super.c                     |  2 +-
 fs/gfs2/ops_fstype.c                |  2 +-
 fs/gfs2/sys.c                       | 22 +++++-----------------
 fs/ocfs2/super.c                    |  2 +-
 fs/overlayfs/copy_up.c              |  5 ++---
 fs/overlayfs/namei.c                |  2 +-
 fs/xfs/xfs_mount.c                  |  3 +--
 include/linux/cleancache.h          |  2 +-
 include/linux/fs.h                  |  5 +++--
 mm/cleancache.c                     |  2 +-
 security/integrity/evm/evm_crypto.c |  2 +-
 security/integrity/ima/ima_policy.c |  2 +-
 14 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 4ac2ca8a7656..bf13d1ec51f3 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
 	return xen_tmem_new_pool(uuid_private, 0, pagesize);
 }
 
-static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
+static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
 {
 	struct tmem_pool_uuid shared_uuid;
 
-	shared_uuid.uuid_lo = *(u64 *)uuid;
-	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
+	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
+	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
 	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
 }
 
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b177da9ea82..6e3b4186a22f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		sb->s_qcop = &ext4_qctl_operations;
 	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 #endif
-	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
+	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
 	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
 	mutex_init(&sbi->s_orphan_lock);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 83355ec4a92c..0b89b0b7b9f7 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_time_gran = 1;
 	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
 		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
-	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 
 	/* init f2fs-specific super block info */
 	sbi->valid_super_block = valid_super_block;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ed67548b286c..b92135c202c2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
 
 	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
 	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
-	memcpy(s->s_uuid, str->sb_uuid, 16);
+	memcpy(&s->s_uuid, str->sb_uuid, 16);
 }
 
 /**
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 7a515345610c..e77bc52b468f 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
 	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
 }
 
-static int gfs2_uuid_valid(const u8 *uuid)
-{
-	int i;
-
-	for (i = 0; i < 16; i++) {
-		if (uuid[i])
-			return 1;
-	}
-	return 0;
-}
-
 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
 {
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
+
 	buf[0] = '\0';
-	if (!gfs2_uuid_valid(uuid))
+	if (uuid_is_null(&s->s_uuid))
 		return 0;
-	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
+	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
 }
 
 static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 {
 	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
 	struct super_block *s = sdp->sd_vfs;
-	const u8 *uuid = s->s_uuid;
 
 	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
 	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
 	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
 		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
-	if (gfs2_uuid_valid(uuid))
-		add_uevent_var(env, "UUID=%pUB", uuid);
+	if (!uuid_is_null(&s->s_uuid))
+		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
 	return 0;
 }
 
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ca1646fbcaef..83005f486451 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
 	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
 	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
-	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
+	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
 	       sizeof(di->id2.i_super.s_uuid));
 
 	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 9008ab9fbd2e..5b795873f7fa 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 			  struct dentry *upper)
 {
 	struct super_block *sb = lower->d_sb;
-	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
 	const struct ovl_fh *fh = NULL;
 	int err;
 
@@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
 	 * up and a pure upper inode.
 	 */
 	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
-	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
-		fh = ovl_encode_fh(lower, uuid);
+	    !uuid_is_null(&sb->s_uuid)) {
+		fh = ovl_encode_fh(lower, &sb->s_uuid);
 		if (IS_ERR(fh))
 			return PTR_ERR(fh);
 	}
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index bad0f665a635..6709f27c6876 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
 	 * Make sure that the stored uuid matches the uuid of the lower
 	 * layer where file handle will be decoded.
 	 */
-	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
+	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
 		goto out;
 
 	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 682b336a7a6a..6a18ae407713 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -74,8 +74,7 @@ xfs_uuid_mount(
 	int			hole, i;
 
 	/* Publish UUID in struct super_block */
-	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
-	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
+	uuid_copy(&mp->m_super->s_uuid, uuid);
 
 	if (mp->m_flags & XFS_MOUNT_NOUUID)
 		return 0;
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index fccf7f44139d..bbb3712dd892 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -27,7 +27,7 @@ struct cleancache_filekey {
 
 struct cleancache_ops {
 	int (*init_fs)(size_t);
-	int (*init_shared_fs)(char *uuid, size_t);
+	int (*init_shared_fs)(uuid_t *uuid, size_t);
 	int (*get_page)(int, struct cleancache_filekey,
 			pgoff_t, struct page *);
 	void (*put_page)(int, struct cleancache_filekey,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 803e5a9b2654..3e68cabb8457 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -30,6 +30,7 @@
 #include <linux/percpu-rwsem.h>
 #include <linux/workqueue.h>
 #include <linux/delayed_call.h>
+#include <linux/uuid.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -1328,8 +1329,8 @@ struct super_block {
 
 	struct sb_writers	s_writers;
 
-	char s_id[32];				/* Informational name */
-	u8 s_uuid[16];				/* UUID */
+	char			s_id[32];	/* Informational name */
+	uuid_t			s_uuid;		/* UUID */
 
 	void 			*s_fs_info;	/* Filesystem private info */
 	unsigned int		s_max_links;
diff --git a/mm/cleancache.c b/mm/cleancache.c
index ba5d8f3e6d68..f7b9fdc79d97 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
 	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
 
 	if (cleancache_ops) {
-		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
+		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
 		if (pool_id < 0)
 			pool_id = CLEANCACHE_NO_POOL;
 	}
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index d7f282d75cc1..1d32cd20009a 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
 	hmac_misc.mode = inode->i_mode;
 	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
 	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
-		crypto_shash_update(desc, inode->i_sb->s_uuid,
+		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
 				    sizeof(inode->i_sb->s_uuid));
 	crypto_shash_final(desc, digest);
 }
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index da3e7d50e0d7..659dbcc83d2f 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
 	    && rule->fsmagic != inode->i_sb->s_magic)
 		return false;
 	if ((rule->flags & IMA_FSUUID) &&
-	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
 		return false;
 	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
 		return false;
-- 
2.11.0

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

* [PATCH 18/23] overlayfs: use uuid_t instead of uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/overlayfs/copy_up.c   | 2 +-
 fs/overlayfs/overlayfs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 5b795873f7fa..2a67e8c13098 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -233,7 +233,7 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat)
 	return err;
 }
 
-static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_be *uuid)
+static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_t *uuid)
 {
 	struct ovl_fh *fh;
 	int fh_type, fh_len, dwords;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index caa36cb9c46d..cb0fc450419b 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -55,7 +55,7 @@ struct ovl_fh {
 	u8 len;		/* size of this header + size of fid */
 	u8 flags;	/* OVL_FH_FLAG_* */
 	u8 type;	/* fid_type of fid */
-	uuid_be uuid;	/* uuid of filesystem */
+	uuid_t uuid;	/* uuid of filesystem */
 	u8 fid[0];	/* file identifier */
 } __packed;
 
-- 
2.11.0

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 18/23] overlayfs: use uuid_t instead of uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 fs/overlayfs/copy_up.c   | 2 +-
 fs/overlayfs/overlayfs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 5b795873f7fa..2a67e8c13098 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -233,7 +233,7 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat)
 	return err;
 }
 
-static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_be *uuid)
+static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_t *uuid)
 {
 	struct ovl_fh *fh;
 	int fh_type, fh_len, dwords;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index caa36cb9c46d..cb0fc450419b 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -55,7 +55,7 @@ struct ovl_fh {
 	u8 len;		/* size of this header + size of fid */
 	u8 flags;	/* OVL_FH_FLAG_* */
 	u8 type;	/* fid_type of fid */
-	uuid_be uuid;	/* uuid of filesystem */
+	uuid_t uuid;	/* uuid of filesystem */
 	u8 fid[0];	/* file identifier */
 } __packed;
 
-- 
2.11.0

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

* [PATCH 18/23] overlayfs: use uuid_t instead of uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/overlayfs/copy_up.c   | 2 +-
 fs/overlayfs/overlayfs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 5b795873f7fa..2a67e8c13098 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -233,7 +233,7 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat)
 	return err;
 }
 
-static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_be *uuid)
+static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_t *uuid)
 {
 	struct ovl_fh *fh;
 	int fh_type, fh_len, dwords;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index caa36cb9c46d..cb0fc450419b 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -55,7 +55,7 @@ struct ovl_fh {
 	u8 len;		/* size of this header + size of fid */
 	u8 flags;	/* OVL_FH_FLAG_* */
 	u8 type;	/* fid_type of fid */
-	uuid_be uuid;	/* uuid of filesystem */
+	uuid_t uuid;	/* uuid of filesystem */
 	u8 fid[0];	/* file identifier */
 } __packed;
 
-- 
2.11.0

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

* [PATCH 18/23] overlayfs: use uuid_t instead of uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/overlayfs/copy_up.c   | 2 +-
 fs/overlayfs/overlayfs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 5b795873f7fa..2a67e8c13098 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -233,7 +233,7 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat)
 	return err;
 }
 
-static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_be *uuid)
+static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_t *uuid)
 {
 	struct ovl_fh *fh;
 	int fh_type, fh_len, dwords;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index caa36cb9c46d..cb0fc450419b 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -55,7 +55,7 @@ struct ovl_fh {
 	u8 len;		/* size of this header + size of fid */
 	u8 flags;	/* OVL_FH_FLAG_* */
 	u8 type;	/* fid_type of fid */
-	uuid_be uuid;	/* uuid of filesystem */
+	uuid_t uuid;	/* uuid of filesystem */
 	u8 fid[0];	/* file identifier */
 } __packed;
 
-- 
2.11.0

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

* [PATCH 19/23] partitions/ldm: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 19/23] partitions/ldm: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

And the uuid helpers.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 19/23] partitions/ldm: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 19/23] partitions/ldm: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 20/23] sysctl: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 20/23] sysctl: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 20/23] sysctl: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 20/23] sysctl: switch to use uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 21/23] nvme: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 21/23] nvme: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 21/23] nvme: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 21/23] nvme: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 22/23] scsi_debug: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 22/23] scsi_debug: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 22/23] scsi_debug: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 22/23] scsi_debug: switch to uuid_t
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

Everything uses uuid_t now.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 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

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

* [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  6:27   ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  6:27 UTC (permalink / raw)
  To: Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:12     ` Joe Perches
  0 siblings, 0 replies; 188+ messages in thread
From: Joe Perches @ 2017-05-18  7:12 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> them private to the kernel.

On the assumption that no user program uses them?
Is that a safe assumption?

> diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
> index 3738e5fb6a4d..0099756c4bac 100644
> --- a/include/uapi/linux/uuid.h
> +++ b/include/uapi/linux/uuid.h
> @@ -24,10 +24,6 @@ typedef struct {
>  	__u8 b[16];
>  } uuid_le;
>  
> -typedef struct {
> -	__u8 b[16];
> -} uuid_be;
> -
>  #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
>  ((uuid_le)								\
>  {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
> @@ -35,20 +31,8 @@ typedef struct {
>     (c) & 0xff, ((c) >> 8) & 0xff,					\
>     (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
>  
> -#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_be)								\
> -{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
> -   ((b) >> 8) & 0xff, (b) & 0xff,					\
> -   ((c) >> 8) & 0xff, (c) & 0xff,					\
> -   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
> -
>  #define NULL_UUID_LE							\
>  	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
>  		0x00, 0x00, 0x00, 0x00)
>  
> -#define NULL_UUID_BE							\
> -	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
> -		0x00, 0x00, 0x00, 0x00)
> -
> -
>  #endif /* _UAPI_LINUX_UUID_H_ */
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:12     ` Joe Perches
  0 siblings, 0 replies; 188+ messages in thread
From: Joe Perches @ 2017-05-18  7:12 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> them private to the kernel.

On the assumption that no user program uses them?
Is that a safe assumption?

> diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
> index 3738e5fb6a4d..0099756c4bac 100644
> --- a/include/uapi/linux/uuid.h
> +++ b/include/uapi/linux/uuid.h
> @@ -24,10 +24,6 @@ typedef struct {
>  	__u8 b[16];
>  } uuid_le;
>  
> -typedef struct {
> -	__u8 b[16];
> -} uuid_be;
> -
>  #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
>  ((uuid_le)								\
>  {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
> @@ -35,20 +31,8 @@ typedef struct {
>     (c) & 0xff, ((c) >> 8) & 0xff,					\
>     (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
>  
> -#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_be)								\
> -{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
> -   ((b) >> 8) & 0xff, (b) & 0xff,					\
> -   ((c) >> 8) & 0xff, (c) & 0xff,					\
> -   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
> -
>  #define NULL_UUID_LE							\
>  	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
>  		0x00, 0x00, 0x00, 0x00)
>  
> -#define NULL_UUID_BE							\
> -	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
> -		0x00, 0x00, 0x00, 0x00)
> -
> -
>  #endif /* _UAPI_LINUX_UUID_H_ */

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:12     ` Joe Perches
  0 siblings, 0 replies; 188+ messages in thread
From: Joe Perches @ 2017-05-18  7:12 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> them private to the kernel.

On the assumption that no user program uses them?
Is that a safe assumption?

> diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
> index 3738e5fb6a4d..0099756c4bac 100644
> --- a/include/uapi/linux/uuid.h
> +++ b/include/uapi/linux/uuid.h
> @@ -24,10 +24,6 @@ typedef struct {
>  	__u8 b[16];
>  } uuid_le;
>  
> -typedef struct {
> -	__u8 b[16];
> -} uuid_be;
> -
>  #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
>  ((uuid_le)								\
>  {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
> @@ -35,20 +31,8 @@ typedef struct {
>     (c) & 0xff, ((c) >> 8) & 0xff,					\
>     (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
>  
> -#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_be)								\
> -{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
> -   ((b) >> 8) & 0xff, (b) & 0xff,					\
> -   ((c) >> 8) & 0xff, (c) & 0xff,					\
> -   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
> -
>  #define NULL_UUID_LE							\
>  	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
>  		0x00, 0x00, 0x00, 0x00)
>  
> -#define NULL_UUID_BE							\
> -	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
> -		0x00, 0x00, 0x00, 0x00)
> -
> -
>  #endif /* _UAPI_LINUX_UUID_H_ */

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:12     ` Joe Perches
  0 siblings, 0 replies; 188+ messages in thread
From: Joe Perches @ 2017-05-18  7:12 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> them private to the kernel.

On the assumption that no user program uses them?
Is that a safe assumption?

> diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
> index 3738e5fb6a4d..0099756c4bac 100644
> --- a/include/uapi/linux/uuid.h
> +++ b/include/uapi/linux/uuid.h
> @@ -24,10 +24,6 @@ typedef struct {
>  	__u8 b[16];
>  } uuid_le;
>  
> -typedef struct {
> -	__u8 b[16];
> -} uuid_be;
> -
>  #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
>  ((uuid_le)								\
>  {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
> @@ -35,20 +31,8 @@ typedef struct {
>     (c) & 0xff, ((c) >> 8) & 0xff,					\
>     (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
>  
> -#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_be)								\
> -{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
> -   ((b) >> 8) & 0xff, (b) & 0xff,					\
> -   ((c) >> 8) & 0xff, (c) & 0xff,					\
> -   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
> -
>  #define NULL_UUID_LE							\
>  	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
>  		0x00, 0x00, 0x00, 0x00)
>  
> -#define NULL_UUID_BE							\
> -	UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
> -		0x00, 0x00, 0x00, 0x00)
> -
> -
>  #endif /* _UAPI_LINUX_UUID_H_ */

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:13       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  7:13 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, Steven Whitehouse, David Howells, linux-fsdevel,
	Andy Shevchenko, Shaohua Li, Christoph Hellwig

On Thu, May 18, 2017 at 12:12:45AM -0700, Joe Perches wrote:
> On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> > We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> > them private to the kernel.
> 
> On the assumption that no user program uses them?
> Is that a safe assumption?

It's not a userspace ABI, so by defintion it does not break an
existing user program.  If someone was using it they should be using
uuid_t from libuuid instead, as that gives them the routines to deal
with it.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:13       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  7:13 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Steven Whitehouse,
	David Howells, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	Andy Shevchenko, Shaohua Li, Christoph Hellwig

On Thu, May 18, 2017 at 12:12:45AM -0700, Joe Perches wrote:
> On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> > We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> > them private to the kernel.
> 
> On the assumption that no user program uses them?
> Is that a safe assumption?

It's not a userspace ABI, so by defintion it does not break an
existing user program.  If someone was using it they should be using
uuid_t from libuuid instead, as that gives them the routines to deal
with it.

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:13       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  7:13 UTC (permalink / raw)
  To: Joe Perches
  Cc: Christoph Hellwig, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel, Shaohua Li, Dan Williams, David Howells,
	Steven Whitehouse, Mimi Zohar, linux-xfs, linux-raid,
	linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 12:12:45AM -0700, Joe Perches wrote:
> On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> > We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> > them private to the kernel.
> 
> On the assumption that no user program uses them?
> Is that a safe assumption?

It's not a userspace ABI, so by defintion it does not break an
existing user program.  If someone was using it they should be using
uuid_t from libuuid instead, as that gives them the routines to deal
with it.

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-18  7:13       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  7:13 UTC (permalink / raw)
  To: Joe Perches
  Cc: Christoph Hellwig, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel, Shaohua Li, Dan Williams, David Howells,
	Steven Whitehouse, Mimi Zohar, linux-xfs, linux-raid,
	linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 12:12:45AM -0700, Joe Perches wrote:
> On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> > We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
> > them private to the kernel.
> 
> On the assumption that no user program uses them?
> Is that a safe assumption?

It's not a userspace ABI, so by defintion it does not break an
existing user program.  If someone was using it they should be using
uuid_t from libuuid instead, as that gives them the routines to deal
with it.

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  7:57     ` Amir Goldstein
  0 siblings, 0 replies; 188+ messages in thread
From: Amir Goldstein @ 2017-05-18  7:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Hugh Dickins,
	linux-kernel, David Howells, linux-fsdevel, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

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.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  7:57     ` Amir Goldstein
  0 siblings, 0 replies; 188+ messages in thread
From: Amir Goldstein @ 2017-05-18  7:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Hugh Dickins,
	linux-kernel, David Howells, linux-fsdevel, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 9:27 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
> Everything uses uuid_t now.
>
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> ---

Excellent!
I reviewed the entire series. You may add
Reviewed-by: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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.

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  7:57     ` Amir Goldstein
  0 siblings, 0 replies; 188+ messages in thread
From: Amir Goldstein @ 2017-05-18  7:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, linux-fsdevel, Shaohua Li, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel, Hugh Dickins

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.

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  7:57     ` Amir Goldstein
  0 siblings, 0 replies; 188+ messages in thread
From: Amir Goldstein @ 2017-05-18  7:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, linux-fsdevel, Shaohua Li, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel, Hugh Dickins

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.

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  8:56       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  8:56 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Hugh Dickins,
	linux-kernel, Steven Whitehouse, David Howells, linux-fsdevel,
	Andy Shevchenko, Shaohua Li, Christoph Hellwig

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.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  8:56       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  8:56 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: linux-xfs, linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Hugh Dickins,
	linux-kernel, Steven Whitehouse, David Howells, linux-fsdevel,
	Andy Shevchenko, Shaohua Li, Christoph Hellwig

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> 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.

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  8:56       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  8:56 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Christoph Hellwig, Andy Shevchenko, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel, Hugh Dickins

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.

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-18  8:56       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-18  8:56 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Christoph Hellwig, Andy Shevchenko, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel, Hugh Dickins

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.

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

* Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
       [not found]   ` <20170518062705.25902-2-hch-jcswGhMUV9g@public.gmane.org>
  2017-05-18 23:32       ` Darrick J. Wong
  (?)
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, David Howells, linux-fsdevel, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

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
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:43AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> uuid_t definition is about to change.
> 
> Signed-off-by: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> ---

Reviewed-by: Brian Foster <bfoster-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

>  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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
       [not found]   ` <20170518062705.25902-3-hch-jcswGhMUV9g@public.gmane.org>
  2017-05-18 23:34       ` Darrick J. Wong
  (?)
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, David Howells, linux-fsdevel, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:44AM +0200, Christoph Hellwig wrote:
> Use the generic Linux definition to implement our UUID type, this will
> allow using more generic infrastructure in the future.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

>  fs/xfs/uuid.h      | 4 ----
>  fs/xfs/xfs_linux.h | 3 +++
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 104db0f3bed6..4f1441ba4fa5 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -18,10 +18,6 @@
>  #ifndef __XFS_SUPPORT_UUID_H__
>  #define __XFS_SUPPORT_UUID_H__
>  
> -typedef struct {
> -	unsigned char	__u_bits[16];
> -} uuid_t;
> -
>  extern int uuid_is_nil(uuid_t *uuid);
>  extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
>  extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 044fb0e15390..89ee5ec66837 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -19,6 +19,7 @@
>  #define __XFS_LINUX__
>  
>  #include <linux/types.h>
> +#include <linux/uuid.h>
>  
>  /*
>   * Kernel specific type declarations for XFS
> @@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> +typedef uuid_be			uuid_t;
> +
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> -- 
> 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
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:44AM +0200, Christoph Hellwig wrote:
> Use the generic Linux definition to implement our UUID type, this will
> allow using more generic infrastructure in the future.
> 
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> ---

Reviewed-by: Brian Foster <bfoster-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

>  fs/xfs/uuid.h      | 4 ----
>  fs/xfs/xfs_linux.h | 3 +++
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 104db0f3bed6..4f1441ba4fa5 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -18,10 +18,6 @@
>  #ifndef __XFS_SUPPORT_UUID_H__
>  #define __XFS_SUPPORT_UUID_H__
>  
> -typedef struct {
> -	unsigned char	__u_bits[16];
> -} uuid_t;
> -
>  extern int uuid_is_nil(uuid_t *uuid);
>  extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
>  extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 044fb0e15390..89ee5ec66837 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -19,6 +19,7 @@
>  #define __XFS_LINUX__
>  
>  #include <linux/types.h>
> +#include <linux/uuid.h>
>  
>  /*
>   * Kernel specific type declarations for XFS
> @@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> +typedef uuid_be			uuid_t;
> +
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:44AM +0200, Christoph Hellwig wrote:
> Use the generic Linux definition to implement our UUID type, this will
> allow using more generic infrastructure in the future.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

>  fs/xfs/uuid.h      | 4 ----
>  fs/xfs/xfs_linux.h | 3 +++
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 104db0f3bed6..4f1441ba4fa5 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -18,10 +18,6 @@
>  #ifndef __XFS_SUPPORT_UUID_H__
>  #define __XFS_SUPPORT_UUID_H__
>  
> -typedef struct {
> -	unsigned char	__u_bits[16];
> -} uuid_t;
> -
>  extern int uuid_is_nil(uuid_t *uuid);
>  extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
>  extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 044fb0e15390..89ee5ec66837 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -19,6 +19,7 @@
>  #define __XFS_LINUX__
>  
>  #include <linux/types.h>
> +#include <linux/uuid.h>
>  
>  /*
>   * Kernel specific type declarations for XFS
> @@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> +typedef uuid_be			uuid_t;
> +
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> -- 
> 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

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

* Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:44AM +0200, Christoph Hellwig wrote:
> Use the generic Linux definition to implement our UUID type, this will
> allow using more generic infrastructure in the future.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

>  fs/xfs/uuid.h      | 4 ----
>  fs/xfs/xfs_linux.h | 3 +++
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 104db0f3bed6..4f1441ba4fa5 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -18,10 +18,6 @@
>  #ifndef __XFS_SUPPORT_UUID_H__
>  #define __XFS_SUPPORT_UUID_H__
>  
> -typedef struct {
> -	unsigned char	__u_bits[16];
> -} uuid_t;
> -
>  extern int uuid_is_nil(uuid_t *uuid);
>  extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
>  extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 044fb0e15390..89ee5ec66837 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -19,6 +19,7 @@
>  #define __XFS_LINUX__
>  
>  #include <linux/types.h>
> +#include <linux/uuid.h>
>  
>  /*
>   * Kernel specific type declarations for XFS
> @@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> +typedef uuid_be			uuid_t;
> +
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> -- 
> 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

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

* Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
       [not found]   ` <20170518062705.25902-13-hch-jcswGhMUV9g@public.gmane.org>
  2017-05-18 23:35       ` Darrick J. Wong
  (?)
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, David Howells, linux-fsdevel, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:54AM +0200, Christoph Hellwig wrote:
> Directly use the v1 intepretation of uuid_t instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

>  fs/xfs/uuid.c      | 25 -------------------------
>  fs/xfs/uuid.h      |  1 -
>  fs/xfs/xfs_mount.c |  6 +++++-
>  3 files changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
> index 29ed78c8637b..737c186ea98b 100644
> --- a/fs/xfs/uuid.c
> +++ b/fs/xfs/uuid.c
> @@ -17,31 +17,6 @@
>   */
>  #include <xfs.h>
>  
> -/* IRIX interpretation of an uuid_t */
> -typedef struct {
> -	__be32	uu_timelow;
> -	__be16	uu_timemid;
> -	__be16	uu_timehi;
> -	__be16	uu_clockseq;
> -	__be16	uu_node[3];
> -} xfs_uu_t;
> -
> -/*
> - * uuid_getnodeuniq - obtain the node unique fields of a UUID.
> - *
> - * This is not in any way a standard or condoned UUID function;
> - * it just something that's needed for user-level file handles.
> - */
> -void
> -uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
> -{
> -	xfs_uu_t *uup = (xfs_uu_t *)uuid;
> -
> -	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
> -		   be16_to_cpu(uup->uu_timemid);
> -	fsid[1] = be32_to_cpu(uup->uu_timelow);
> -}
> -
>  int
>  uuid_is_nil(uuid_t *uuid)
>  {
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 86bbed071e79..5aea49bf0963 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -19,6 +19,5 @@
>  #define __XFS_SUPPORT_UUID_H__
>  
>  extern int uuid_is_nil(uuid_t *uuid);
> -extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
>  
>  #endif	/* __XFS_SUPPORT_UUID_H__ */
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 2eaf81859166..742e4a61c0bc 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -793,7 +793,11 @@ xfs_mountfs(
>  	 *  Copies the low order bits of the timestamp and the randomly
>  	 *  set "sequence" number out of a UUID.
>  	 */
> -	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
> +	mp->m_fixedfsid[0] =
> +		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
> +		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
> +		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
> +	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
>  
>  	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
>  
> -- 
> 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
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:54AM +0200, Christoph Hellwig wrote:
> Directly use the v1 intepretation of uuid_t instead.
> 
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> ---

Reviewed-by: Brian Foster <bfoster-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

>  fs/xfs/uuid.c      | 25 -------------------------
>  fs/xfs/uuid.h      |  1 -
>  fs/xfs/xfs_mount.c |  6 +++++-
>  3 files changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
> index 29ed78c8637b..737c186ea98b 100644
> --- a/fs/xfs/uuid.c
> +++ b/fs/xfs/uuid.c
> @@ -17,31 +17,6 @@
>   */
>  #include <xfs.h>
>  
> -/* IRIX interpretation of an uuid_t */
> -typedef struct {
> -	__be32	uu_timelow;
> -	__be16	uu_timemid;
> -	__be16	uu_timehi;
> -	__be16	uu_clockseq;
> -	__be16	uu_node[3];
> -} xfs_uu_t;
> -
> -/*
> - * uuid_getnodeuniq - obtain the node unique fields of a UUID.
> - *
> - * This is not in any way a standard or condoned UUID function;
> - * it just something that's needed for user-level file handles.
> - */
> -void
> -uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
> -{
> -	xfs_uu_t *uup = (xfs_uu_t *)uuid;
> -
> -	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
> -		   be16_to_cpu(uup->uu_timemid);
> -	fsid[1] = be32_to_cpu(uup->uu_timelow);
> -}
> -
>  int
>  uuid_is_nil(uuid_t *uuid)
>  {
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 86bbed071e79..5aea49bf0963 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -19,6 +19,5 @@
>  #define __XFS_SUPPORT_UUID_H__
>  
>  extern int uuid_is_nil(uuid_t *uuid);
> -extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
>  
>  #endif	/* __XFS_SUPPORT_UUID_H__ */
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 2eaf81859166..742e4a61c0bc 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -793,7 +793,11 @@ xfs_mountfs(
>  	 *  Copies the low order bits of the timestamp and the randomly
>  	 *  set "sequence" number out of a UUID.
>  	 */
> -	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
> +	mp->m_fixedfsid[0] =
> +		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
> +		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
> +		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
> +	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
>  
>  	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
>  
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:54AM +0200, Christoph Hellwig wrote:
> Directly use the v1 intepretation of uuid_t instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

>  fs/xfs/uuid.c      | 25 -------------------------
>  fs/xfs/uuid.h      |  1 -
>  fs/xfs/xfs_mount.c |  6 +++++-
>  3 files changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
> index 29ed78c8637b..737c186ea98b 100644
> --- a/fs/xfs/uuid.c
> +++ b/fs/xfs/uuid.c
> @@ -17,31 +17,6 @@
>   */
>  #include <xfs.h>
>  
> -/* IRIX interpretation of an uuid_t */
> -typedef struct {
> -	__be32	uu_timelow;
> -	__be16	uu_timemid;
> -	__be16	uu_timehi;
> -	__be16	uu_clockseq;
> -	__be16	uu_node[3];
> -} xfs_uu_t;
> -
> -/*
> - * uuid_getnodeuniq - obtain the node unique fields of a UUID.
> - *
> - * This is not in any way a standard or condoned UUID function;
> - * it just something that's needed for user-level file handles.
> - */
> -void
> -uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
> -{
> -	xfs_uu_t *uup = (xfs_uu_t *)uuid;
> -
> -	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
> -		   be16_to_cpu(uup->uu_timemid);
> -	fsid[1] = be32_to_cpu(uup->uu_timelow);
> -}
> -
>  int
>  uuid_is_nil(uuid_t *uuid)
>  {
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 86bbed071e79..5aea49bf0963 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -19,6 +19,5 @@
>  #define __XFS_SUPPORT_UUID_H__
>  
>  extern int uuid_is_nil(uuid_t *uuid);
> -extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
>  
>  #endif	/* __XFS_SUPPORT_UUID_H__ */
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 2eaf81859166..742e4a61c0bc 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -793,7 +793,11 @@ xfs_mountfs(
>  	 *  Copies the low order bits of the timestamp and the randomly
>  	 *  set "sequence" number out of a UUID.
>  	 */
> -	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
> +	mp->m_fixedfsid[0] =
> +		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
> +		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
> +		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
> +	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
>  
>  	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
>  
> -- 
> 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

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

* Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:54AM +0200, Christoph Hellwig wrote:
> Directly use the v1 intepretation of uuid_t instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

>  fs/xfs/uuid.c      | 25 -------------------------
>  fs/xfs/uuid.h      |  1 -
>  fs/xfs/xfs_mount.c |  6 +++++-
>  3 files changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
> index 29ed78c8637b..737c186ea98b 100644
> --- a/fs/xfs/uuid.c
> +++ b/fs/xfs/uuid.c
> @@ -17,31 +17,6 @@
>   */
>  #include <xfs.h>
>  
> -/* IRIX interpretation of an uuid_t */
> -typedef struct {
> -	__be32	uu_timelow;
> -	__be16	uu_timemid;
> -	__be16	uu_timehi;
> -	__be16	uu_clockseq;
> -	__be16	uu_node[3];
> -} xfs_uu_t;
> -
> -/*
> - * uuid_getnodeuniq - obtain the node unique fields of a UUID.
> - *
> - * This is not in any way a standard or condoned UUID function;
> - * it just something that's needed for user-level file handles.
> - */
> -void
> -uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
> -{
> -	xfs_uu_t *uup = (xfs_uu_t *)uuid;
> -
> -	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
> -		   be16_to_cpu(uup->uu_timemid);
> -	fsid[1] = be32_to_cpu(uup->uu_timelow);
> -}
> -
>  int
>  uuid_is_nil(uuid_t *uuid)
>  {
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 86bbed071e79..5aea49bf0963 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -19,6 +19,5 @@
>  #define __XFS_SUPPORT_UUID_H__
>  
>  extern int uuid_is_nil(uuid_t *uuid);
> -extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
>  
>  #endif	/* __XFS_SUPPORT_UUID_H__ */
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 2eaf81859166..742e4a61c0bc 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -793,7 +793,11 @@ xfs_mountfs(
>  	 *  Copies the low order bits of the timestamp and the randomly
>  	 *  set "sequence" number out of a UUID.
>  	 */
> -	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
> +	mp->m_fixedfsid[0] =
> +		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
> +		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
> +		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
> +	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
>  
>  	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
>  
> -- 
> 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

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

* Re: [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, David Howells, linux-fsdevel, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

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
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:56AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> [hch: remove now unused uuid.[ch]]
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> ---

Reviewed-by: Brian Foster <bfoster-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

>  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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* Re: [PATCH 14/23] xfs: use the common helper uuid_is_null()
@ 2017-05-18 13:27     ` Brian Foster
  0 siblings, 0 replies; 188+ messages in thread
From: Brian Foster @ 2017-05-18 13:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* Re: [PATCH 04/23] uuid: rename uuid types
  2017-05-18  6:26   ` Christoph Hellwig
@ 2017-05-18 17:42       ` Darrick J. Wong
  -1 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 17:42 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-nvdimm-y27Ovi1pjclAfugRpC6u6w,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:46AM +0200, Christoph Hellwig wrote:
> Our "little endian" UUID really is a Wintel GUID, so rename it and its
> helpers such (guid_t).  The big endian UUID is the only true one, so
> give it the name uuid_t.  The uuid_le and uuid_be names are retained for
> now, but will hopefully go away soon.  The exception to that are the _cmp
> helpers that will be replaced by better primites ASAP and thus don't

I misread that as "better primates ASAP" :)

(Assuming you meant 'primitives'?)

Other than that,
Reviewed-by: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

--D

> get the new names.
> 
> Also remove the existing typedef in XFS that's now been superceeded by
> the generic type name.
> 
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> [andy: also update the UUID_LE/UUID_BE macros including fallout]
> Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>  fs/xfs/xfs_linux.h        |  2 --
>  include/linux/uuid.h      | 55 +++++++++++++++++++++++++++--------------------
>  include/uapi/linux/uuid.h | 12 +++++++----
>  lib/test_uuid.c           | 32 +++++++++++++--------------
>  lib/uuid.c                | 28 ++++++++++++------------
>  lib/vsprintf.c            |  4 ++--
>  6 files changed, 72 insertions(+), 61 deletions(-)
> 
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 89ee5ec66837..2c33d915e550 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -39,8 +39,6 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> -typedef uuid_be			uuid_t;
> -
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> diff --git a/include/linux/uuid.h b/include/linux/uuid.h
> index de3aea206562..0410cd002282 100644
> --- a/include/linux/uuid.h
> +++ b/include/linux/uuid.h
> @@ -20,19 +20,15 @@
>  
>  typedef struct {
>  	__u8 b[16];
> -} uuid_be;
> +} uuid_t;
>  
> -#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_be)								\
> +#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
> +((uuid_t)								\
>  {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
>     ((b) >> 8) & 0xff, (b) & 0xff,					\
>     ((c) >> 8) & 0xff, (c) & 0xff,					\
>     (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)
> -
>  /*
>   * V1 (time-based) UUID definition [RFC 4122].
>   * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
> @@ -63,27 +59,40 @@ struct uuid_v1 {
>   */
>  #define	UUID_STRING_LEN		36
>  
> -static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
> -{
> -	return memcmp(&u1, &u2, sizeof(uuid_le));
> -}
> -
> -static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
> -{
> -	return memcmp(&u1, &u2, sizeof(uuid_be));
> -}
> -
>  void generate_random_uuid(unsigned char uuid[16]);
>  
> -extern void uuid_le_gen(uuid_le *u);
> -extern void uuid_be_gen(uuid_be *u);
> +extern void guid_gen(guid_t *u);
> +extern void uuid_gen(uuid_t *u);
>  
>  bool __must_check uuid_is_valid(const char *uuid);
>  
> -extern const u8 uuid_le_index[16];
> -extern const u8 uuid_be_index[16];
> +extern const u8 guid_index[16];
> +extern const u8 uuid_index[16];
> +
> +int guid_to_bin(const char *uuid, guid_t *u);
> +int uuid_to_bin(const char *uuid, uuid_t *u);
>  
> -int uuid_le_to_bin(const char *uuid, uuid_le *u);
> -int uuid_be_to_bin(const char *uuid, uuid_be *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
> diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
> index 0099756c4bac..1eeeca973315 100644
> --- a/include/uapi/linux/uuid.h
> +++ b/include/uapi/linux/uuid.h
> @@ -22,17 +22,21 @@
>  
>  typedef struct {
>  	__u8 b[16];
> -} uuid_le;
> +} guid_t;
>  
> -#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_le)								\
> +#define GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
> +((guid_t)								\
>  {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
>     (b) & 0xff, ((b) >> 8) & 0xff,					\
>     (c) & 0xff, ((c) >> 8) & 0xff,					\
>     (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
>  
> +/* backwards compatibility, don't use in new code */
> +typedef guid_t uuid_le;
> +#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> +	GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
>  #define NULL_UUID_LE							\
>  	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
> -		0x00, 0x00, 0x00, 0x00)
> +	     0x00, 0x00, 0x00, 0x00)
>  
>  #endif /* _UAPI_LINUX_UUID_H_ */
> diff --git a/lib/test_uuid.c b/lib/test_uuid.c
> index 547d3127a3cf..9cad846fd805 100644
> --- a/lib/test_uuid.c
> +++ b/lib/test_uuid.c
> @@ -11,25 +11,25 @@
>  
>  struct test_uuid_data {
>  	const char *uuid;
> -	uuid_le le;
> -	uuid_be be;
> +	guid_t le;
> +	uuid_t be;
>  };
>  
>  static const struct test_uuid_data test_uuid_test_data[] = {
>  	{
>  		.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
> -		.le = UUID_LE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
> -		.be = UUID_BE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
> +		.le = GUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
> +		.be = UUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
>  	},
>  	{
>  		.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
> -		.le = UUID_LE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
> -		.be = UUID_BE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
> +		.le = GUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
> +		.be = UUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
>  	},
>  	{
>  		.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
> -		.le = UUID_LE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
> -		.be = UUID_BE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
> +		.le = GUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
> +		.be = UUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
>  	},
>  };
>  
> @@ -61,13 +61,13 @@ static void __init test_uuid_failed(const char *prefix, bool wrong, bool be,
>  
>  static void __init test_uuid_test(const struct test_uuid_data *data)
>  {
> -	uuid_le le;
> -	uuid_be be;
> +	guid_t le;
> +	uuid_t be;
>  	char buf[48];
>  
>  	/* LE */
>  	total_tests++;
> -	if (uuid_le_to_bin(data->uuid, &le))
> +	if (guid_to_bin(data->uuid, &le))
>  		test_uuid_failed("conversion", false, false, data->uuid, NULL);
>  
>  	total_tests++;
> @@ -78,7 +78,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
>  
>  	/* BE */
>  	total_tests++;
> -	if (uuid_be_to_bin(data->uuid, &be))
> +	if (uuid_to_bin(data->uuid, &be))
>  		test_uuid_failed("conversion", false, true, data->uuid, NULL);
>  
>  	total_tests++;
> @@ -90,17 +90,17 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
>  
>  static void __init test_uuid_wrong(const char *data)
>  {
> -	uuid_le le;
> -	uuid_be be;
> +	guid_t le;
> +	uuid_t be;
>  
>  	/* LE */
>  	total_tests++;
> -	if (!uuid_le_to_bin(data, &le))
> +	if (!guid_to_bin(data, &le))
>  		test_uuid_failed("negative", true, false, data, NULL);
>  
>  	/* BE */
>  	total_tests++;
> -	if (!uuid_be_to_bin(data, &be))
> +	if (!uuid_to_bin(data, &be))
>  		test_uuid_failed("negative", true, true, data, NULL);
>  }
>  
> diff --git a/lib/uuid.c b/lib/uuid.c
> index 37687af77ff8..f80dc63f6ca8 100644
> --- a/lib/uuid.c
> +++ b/lib/uuid.c
> @@ -21,10 +21,10 @@
>  #include <linux/uuid.h>
>  #include <linux/random.h>
>  
> -const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
> -EXPORT_SYMBOL(uuid_le_index);
> -const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
> -EXPORT_SYMBOL(uuid_be_index);
> +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
> @@ -53,21 +53,21 @@ static void __uuid_gen_common(__u8 b[16])
>  	b[8] = (b[8] & 0x3F) | 0x80;
>  }
>  
> -void uuid_le_gen(uuid_le *lu)
> +void guid_gen(guid_t *lu)
>  {
>  	__uuid_gen_common(lu->b);
>  	/* version 4 : random generation */
>  	lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
>  }
> -EXPORT_SYMBOL_GPL(uuid_le_gen);
> +EXPORT_SYMBOL_GPL(guid_gen);
>  
> -void uuid_be_gen(uuid_be *bu)
> +void uuid_gen(uuid_t *bu)
>  {
>  	__uuid_gen_common(bu->b);
>  	/* version 4 : random generation */
>  	bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
>  }
> -EXPORT_SYMBOL_GPL(uuid_be_gen);
> +EXPORT_SYMBOL_GPL(uuid_gen);
>  
>  /**
>    * uuid_is_valid - checks if UUID string valid
> @@ -115,14 +115,14 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
>  	return 0;
>  }
>  
> -int uuid_le_to_bin(const char *uuid, uuid_le *u)
> +int guid_to_bin(const char *uuid, guid_t *u)
>  {
> -	return __uuid_to_bin(uuid, u->b, uuid_le_index);
> +	return __uuid_to_bin(uuid, u->b, guid_index);
>  }
> -EXPORT_SYMBOL(uuid_le_to_bin);
> +EXPORT_SYMBOL(guid_to_bin);
>  
> -int uuid_be_to_bin(const char *uuid, uuid_be *u)
> +int uuid_to_bin(const char *uuid, uuid_t *u)
>  {
> -	return __uuid_to_bin(uuid, u->b, uuid_be_index);
> +	return __uuid_to_bin(uuid, u->b, uuid_index);
>  }
> -EXPORT_SYMBOL(uuid_be_to_bin);
> +EXPORT_SYMBOL(uuid_to_bin);
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 2d41de3f98a1..9f37d6208e99 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1308,14 +1308,14 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
>  	char uuid[UUID_STRING_LEN + 1];
>  	char *p = uuid;
>  	int i;
> -	const u8 *index = uuid_be_index;
> +	const u8 *index = uuid_index;
>  	bool uc = false;
>  
>  	switch (*(++fmt)) {
>  	case 'L':
>  		uc = true;		/* fall-through */
>  	case 'l':
> -		index = uuid_le_index;
> +		index = guid_index;
>  		break;
>  	case 'B':
>  		uc = true;
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 04/23] uuid: rename uuid types
@ 2017-05-18 17:42       ` Darrick J. Wong
  0 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 17:42 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:46AM +0200, Christoph Hellwig wrote:
> Our "little endian" UUID really is a Wintel GUID, so rename it and its
> helpers such (guid_t).  The big endian UUID is the only true one, so
> give it the name uuid_t.  The uuid_le and uuid_be names are retained for
> now, but will hopefully go away soon.  The exception to that are the _cmp
> helpers that will be replaced by better primites ASAP and thus don't

I misread that as "better primates ASAP" :)

(Assuming you meant 'primitives'?)

Other than that,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> get the new names.
> 
> Also remove the existing typedef in XFS that's now been superceeded by
> the generic type name.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> [andy: also update the UUID_LE/UUID_BE macros including fallout]
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  fs/xfs/xfs_linux.h        |  2 --
>  include/linux/uuid.h      | 55 +++++++++++++++++++++++++++--------------------
>  include/uapi/linux/uuid.h | 12 +++++++----
>  lib/test_uuid.c           | 32 +++++++++++++--------------
>  lib/uuid.c                | 28 ++++++++++++------------
>  lib/vsprintf.c            |  4 ++--
>  6 files changed, 72 insertions(+), 61 deletions(-)
> 
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 89ee5ec66837..2c33d915e550 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -39,8 +39,6 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> -typedef uuid_be			uuid_t;
> -
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> diff --git a/include/linux/uuid.h b/include/linux/uuid.h
> index de3aea206562..0410cd002282 100644
> --- a/include/linux/uuid.h
> +++ b/include/linux/uuid.h
> @@ -20,19 +20,15 @@
>  
>  typedef struct {
>  	__u8 b[16];
> -} uuid_be;
> +} uuid_t;
>  
> -#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_be)								\
> +#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
> +((uuid_t)								\
>  {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
>     ((b) >> 8) & 0xff, (b) & 0xff,					\
>     ((c) >> 8) & 0xff, (c) & 0xff,					\
>     (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)
> -
>  /*
>   * V1 (time-based) UUID definition [RFC 4122].
>   * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
> @@ -63,27 +59,40 @@ struct uuid_v1 {
>   */
>  #define	UUID_STRING_LEN		36
>  
> -static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
> -{
> -	return memcmp(&u1, &u2, sizeof(uuid_le));
> -}
> -
> -static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
> -{
> -	return memcmp(&u1, &u2, sizeof(uuid_be));
> -}
> -
>  void generate_random_uuid(unsigned char uuid[16]);
>  
> -extern void uuid_le_gen(uuid_le *u);
> -extern void uuid_be_gen(uuid_be *u);
> +extern void guid_gen(guid_t *u);
> +extern void uuid_gen(uuid_t *u);
>  
>  bool __must_check uuid_is_valid(const char *uuid);
>  
> -extern const u8 uuid_le_index[16];
> -extern const u8 uuid_be_index[16];
> +extern const u8 guid_index[16];
> +extern const u8 uuid_index[16];
> +
> +int guid_to_bin(const char *uuid, guid_t *u);
> +int uuid_to_bin(const char *uuid, uuid_t *u);
>  
> -int uuid_le_to_bin(const char *uuid, uuid_le *u);
> -int uuid_be_to_bin(const char *uuid, uuid_be *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
> diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
> index 0099756c4bac..1eeeca973315 100644
> --- a/include/uapi/linux/uuid.h
> +++ b/include/uapi/linux/uuid.h
> @@ -22,17 +22,21 @@
>  
>  typedef struct {
>  	__u8 b[16];
> -} uuid_le;
> +} guid_t;
>  
> -#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> -((uuid_le)								\
> +#define GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)			\
> +((guid_t)								\
>  {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
>     (b) & 0xff, ((b) >> 8) & 0xff,					\
>     (c) & 0xff, ((c) >> 8) & 0xff,					\
>     (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
>  
> +/* backwards compatibility, don't use in new code */
> +typedef guid_t uuid_le;
> +#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)		\
> +	GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
>  #define NULL_UUID_LE							\
>  	UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,	\
> -		0x00, 0x00, 0x00, 0x00)
> +	     0x00, 0x00, 0x00, 0x00)
>  
>  #endif /* _UAPI_LINUX_UUID_H_ */
> diff --git a/lib/test_uuid.c b/lib/test_uuid.c
> index 547d3127a3cf..9cad846fd805 100644
> --- a/lib/test_uuid.c
> +++ b/lib/test_uuid.c
> @@ -11,25 +11,25 @@
>  
>  struct test_uuid_data {
>  	const char *uuid;
> -	uuid_le le;
> -	uuid_be be;
> +	guid_t le;
> +	uuid_t be;
>  };
>  
>  static const struct test_uuid_data test_uuid_test_data[] = {
>  	{
>  		.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
> -		.le = UUID_LE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
> -		.be = UUID_BE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
> +		.le = GUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
> +		.be = UUID(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
>  	},
>  	{
>  		.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
> -		.le = UUID_LE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
> -		.be = UUID_BE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
> +		.le = GUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
> +		.be = UUID(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
>  	},
>  	{
>  		.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
> -		.le = UUID_LE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
> -		.be = UUID_BE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
> +		.le = GUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
> +		.be = UUID(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
>  	},
>  };
>  
> @@ -61,13 +61,13 @@ static void __init test_uuid_failed(const char *prefix, bool wrong, bool be,
>  
>  static void __init test_uuid_test(const struct test_uuid_data *data)
>  {
> -	uuid_le le;
> -	uuid_be be;
> +	guid_t le;
> +	uuid_t be;
>  	char buf[48];
>  
>  	/* LE */
>  	total_tests++;
> -	if (uuid_le_to_bin(data->uuid, &le))
> +	if (guid_to_bin(data->uuid, &le))
>  		test_uuid_failed("conversion", false, false, data->uuid, NULL);
>  
>  	total_tests++;
> @@ -78,7 +78,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
>  
>  	/* BE */
>  	total_tests++;
> -	if (uuid_be_to_bin(data->uuid, &be))
> +	if (uuid_to_bin(data->uuid, &be))
>  		test_uuid_failed("conversion", false, true, data->uuid, NULL);
>  
>  	total_tests++;
> @@ -90,17 +90,17 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
>  
>  static void __init test_uuid_wrong(const char *data)
>  {
> -	uuid_le le;
> -	uuid_be be;
> +	guid_t le;
> +	uuid_t be;
>  
>  	/* LE */
>  	total_tests++;
> -	if (!uuid_le_to_bin(data, &le))
> +	if (!guid_to_bin(data, &le))
>  		test_uuid_failed("negative", true, false, data, NULL);
>  
>  	/* BE */
>  	total_tests++;
> -	if (!uuid_be_to_bin(data, &be))
> +	if (!uuid_to_bin(data, &be))
>  		test_uuid_failed("negative", true, true, data, NULL);
>  }
>  
> diff --git a/lib/uuid.c b/lib/uuid.c
> index 37687af77ff8..f80dc63f6ca8 100644
> --- a/lib/uuid.c
> +++ b/lib/uuid.c
> @@ -21,10 +21,10 @@
>  #include <linux/uuid.h>
>  #include <linux/random.h>
>  
> -const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
> -EXPORT_SYMBOL(uuid_le_index);
> -const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
> -EXPORT_SYMBOL(uuid_be_index);
> +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
> @@ -53,21 +53,21 @@ static void __uuid_gen_common(__u8 b[16])
>  	b[8] = (b[8] & 0x3F) | 0x80;
>  }
>  
> -void uuid_le_gen(uuid_le *lu)
> +void guid_gen(guid_t *lu)
>  {
>  	__uuid_gen_common(lu->b);
>  	/* version 4 : random generation */
>  	lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
>  }
> -EXPORT_SYMBOL_GPL(uuid_le_gen);
> +EXPORT_SYMBOL_GPL(guid_gen);
>  
> -void uuid_be_gen(uuid_be *bu)
> +void uuid_gen(uuid_t *bu)
>  {
>  	__uuid_gen_common(bu->b);
>  	/* version 4 : random generation */
>  	bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
>  }
> -EXPORT_SYMBOL_GPL(uuid_be_gen);
> +EXPORT_SYMBOL_GPL(uuid_gen);
>  
>  /**
>    * uuid_is_valid - checks if UUID string valid
> @@ -115,14 +115,14 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
>  	return 0;
>  }
>  
> -int uuid_le_to_bin(const char *uuid, uuid_le *u)
> +int guid_to_bin(const char *uuid, guid_t *u)
>  {
> -	return __uuid_to_bin(uuid, u->b, uuid_le_index);
> +	return __uuid_to_bin(uuid, u->b, guid_index);
>  }
> -EXPORT_SYMBOL(uuid_le_to_bin);
> +EXPORT_SYMBOL(guid_to_bin);
>  
> -int uuid_be_to_bin(const char *uuid, uuid_be *u)
> +int uuid_to_bin(const char *uuid, uuid_t *u)
>  {
> -	return __uuid_to_bin(uuid, u->b, uuid_be_index);
> +	return __uuid_to_bin(uuid, u->b, uuid_index);
>  }
> -EXPORT_SYMBOL(uuid_be_to_bin);
> +EXPORT_SYMBOL(uuid_to_bin);
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 2d41de3f98a1..9f37d6208e99 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1308,14 +1308,14 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
>  	char uuid[UUID_STRING_LEN + 1];
>  	char *p = uuid;
>  	int i;
> -	const u8 *index = uuid_be_index;
> +	const u8 *index = uuid_index;
>  	bool uc = false;
>  
>  	switch (*(++fmt)) {
>  	case 'L':
>  		uc = true;		/* fall-through */
>  	case 'l':
> -		index = uuid_le_index;
> +		index = guid_index;
>  		break;
>  	case 'B':
>  		uc = true;
> -- 
> 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

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-18 18:32     ` Shaohua Li
  0 siblings, 0 replies; 188+ messages in thread
From: Shaohua Li @ 2017-05-18 18:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Amir Goldstein,
	linux-kernel, David Howells, linux-fsdevel, Andy Shevchenko,
	Mimi Zohar, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:55AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Shaohua Li <shli@kernel.org>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-18 18:32     ` Shaohua Li
  0 siblings, 0 replies; 188+ messages in thread
From: Shaohua Li @ 2017-05-18 18:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Mimi Zohar, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:55AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 
> Signed-off-by: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>

Reviewed-by: Shaohua Li <shli-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-18 18:32     ` Shaohua Li
  0 siblings, 0 replies; 188+ messages in thread
From: Shaohua Li @ 2017-05-18 18:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:55AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Shaohua Li <shli@kernel.org>

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-18 18:32     ` Shaohua Li
  0 siblings, 0 replies; 188+ messages in thread
From: Shaohua Li @ 2017-05-18 18:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:55AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Shaohua Li <shli@kernel.org>

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

* Re: [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18 23:15     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:15 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, linux-kernel, David Howells,
	Shaohua Li, Steven Whitehouse

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;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18 23:15     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:15 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Shaohua Li,
	Steven Whitehouse

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-jcswGhMUV9g@public.gmane.org>

Acked-by: Mimi Zohar <zohar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

> ---
>  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;

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

* Re: [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18 23:15     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:15 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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;

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

* Re: [PATCH 15/23] block: remove blk_part_pack_uuid
@ 2017-05-18 23:15     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:15 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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;

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

* Re: [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18 23:16     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:16 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, linux-kernel, David Howells,
	Shaohua Li, Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

> ---
>  security/integrity/ima/ima_policy.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 49fbc3e8f012..da3e7d50e0d7 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -61,7 +61,7 @@ struct ima_rule_entry {
>  	enum ima_hooks func;
>  	int mask;
>  	unsigned long fsmagic;
> -	u8 fsuuid[16];
> +	uuid_t fsuuid;
>  	kuid_t uid;
>  	kuid_t fowner;
>  	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;
> @@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>  		case Opt_fsuuid:
>  			ima_log_string(ab, "fsuuid", args[0].from);
> 
> -			if (memchr_inv(entry->fsuuid, 0x00,
> -				       sizeof(entry->fsuuid))) {
> +			if (uuid_is_null(&entry->fsuuid)) {
>  				result = -EINVAL;
>  				break;
>  			}
> 
> -			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
> +			result = uuid_to_bin(args[0].from, &entry->fsuuid);
>  			if (!result)
>  				entry->flags |= IMA_FSUUID;
>  			break;
> @@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
>  	}
> 
>  	if (entry->flags & IMA_FSUUID) {
> -		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
> +		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
>  		seq_puts(m, " ");
>  	}
> 

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18 23:16     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:16 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Shaohua Li,
	Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>

Thanks!
Acked-by: Mimi Zohar <zohar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

> ---
>  security/integrity/ima/ima_policy.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 49fbc3e8f012..da3e7d50e0d7 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -61,7 +61,7 @@ struct ima_rule_entry {
>  	enum ima_hooks func;
>  	int mask;
>  	unsigned long fsmagic;
> -	u8 fsuuid[16];
> +	uuid_t fsuuid;
>  	kuid_t uid;
>  	kuid_t fowner;
>  	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;
> @@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>  		case Opt_fsuuid:
>  			ima_log_string(ab, "fsuuid", args[0].from);
> 
> -			if (memchr_inv(entry->fsuuid, 0x00,
> -				       sizeof(entry->fsuuid))) {
> +			if (uuid_is_null(&entry->fsuuid)) {
>  				result = -EINVAL;
>  				break;
>  			}
> 
> -			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
> +			result = uuid_to_bin(args[0].from, &entry->fsuuid);
>  			if (!result)
>  				entry->flags |= IMA_FSUUID;
>  			break;
> @@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
>  	}
> 
>  	if (entry->flags & IMA_FSUUID) {
> -		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
> +		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
>  		seq_puts(m, " ");
>  	}
> 

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

* Re: [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18 23:16     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:16 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

> ---
>  security/integrity/ima/ima_policy.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 49fbc3e8f012..da3e7d50e0d7 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -61,7 +61,7 @@ struct ima_rule_entry {
>  	enum ima_hooks func;
>  	int mask;
>  	unsigned long fsmagic;
> -	u8 fsuuid[16];
> +	uuid_t fsuuid;
>  	kuid_t uid;
>  	kuid_t fowner;
>  	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;
> @@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>  		case Opt_fsuuid:
>  			ima_log_string(ab, "fsuuid", args[0].from);
> 
> -			if (memchr_inv(entry->fsuuid, 0x00,
> -				       sizeof(entry->fsuuid))) {
> +			if (uuid_is_null(&entry->fsuuid)) {
>  				result = -EINVAL;
>  				break;
>  			}
> 
> -			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
> +			result = uuid_to_bin(args[0].from, &entry->fsuuid);
>  			if (!result)
>  				entry->flags |= IMA_FSUUID;
>  			break;
> @@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
>  	}
> 
>  	if (entry->flags & IMA_FSUUID) {
> -		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
> +		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
>  		seq_puts(m, " ");
>  	}
> 

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

* Re: [PATCH 16/23] ima/policy: switch to use uuid_t
@ 2017-05-18 23:16     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:16 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

> ---
>  security/integrity/ima/ima_policy.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 49fbc3e8f012..da3e7d50e0d7 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -61,7 +61,7 @@ struct ima_rule_entry {
>  	enum ima_hooks func;
>  	int mask;
>  	unsigned long fsmagic;
> -	u8 fsuuid[16];
> +	uuid_t fsuuid;
>  	kuid_t uid;
>  	kuid_t fowner;
>  	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;
> @@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>  		case Opt_fsuuid:
>  			ima_log_string(ab, "fsuuid", args[0].from);
> 
> -			if (memchr_inv(entry->fsuuid, 0x00,
> -				       sizeof(entry->fsuuid))) {
> +			if (uuid_is_null(&entry->fsuuid)) {
>  				result = -EINVAL;
>  				break;
>  			}
> 
> -			result = uuid_to_bin(args[0].from, (uuid_t *)&entry->fsuuid);
> +			result = uuid_to_bin(args[0].from, &entry->fsuuid);
>  			if (!result)
>  				entry->flags |= IMA_FSUUID;
>  			break;
> @@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
>  	}
> 
>  	if (entry->flags & IMA_FSUUID) {
> -		seq_printf(m, "fsuuid=%pU", entry->fsuuid);
> +		seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
>  		seq_puts(m, " ");
>  	}
> 

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

* Re: [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18 23:17     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:17 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, linux-kernel, David Howells,
	Shaohua Li, Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> For some file systems we still memcpy into it, but in various places this
> already allows us to use the proper uuid helpers.  More to come..
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> (Changes to IMA/EVM)

> ---
>  drivers/xen/tmem.c                  |  6 +++---
>  fs/ext4/super.c                     |  2 +-
>  fs/f2fs/super.c                     |  2 +-
>  fs/gfs2/ops_fstype.c                |  2 +-
>  fs/gfs2/sys.c                       | 22 +++++-----------------
>  fs/ocfs2/super.c                    |  2 +-
>  fs/overlayfs/copy_up.c              |  5 ++---
>  fs/overlayfs/namei.c                |  2 +-
>  fs/xfs/xfs_mount.c                  |  3 +--
>  include/linux/cleancache.h          |  2 +-
>  include/linux/fs.h                  |  5 +++--
>  mm/cleancache.c                     |  2 +-
>  security/integrity/evm/evm_crypto.c |  2 +-
>  security/integrity/ima/ima_policy.c |  2 +-
>  14 files changed, 23 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
> index 4ac2ca8a7656..bf13d1ec51f3 100644
> --- a/drivers/xen/tmem.c
> +++ b/drivers/xen/tmem.c
> @@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
>  	return xen_tmem_new_pool(uuid_private, 0, pagesize);
>  }
> 
> -static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
> +static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
>  {
>  	struct tmem_pool_uuid shared_uuid;
> 
> -	shared_uuid.uuid_lo = *(u64 *)uuid;
> -	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
> +	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
> +	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
>  	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
>  }
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 0b177da9ea82..6e3b4186a22f 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  		sb->s_qcop = &ext4_qctl_operations;
>  	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
>  #endif
> -	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> +	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> 
>  	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
>  	mutex_init(&sbi->s_orphan_lock);
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 83355ec4a92c..0b89b0b7b9f7 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>  	sb->s_time_gran = 1;
>  	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
>  		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
> -	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> +	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> 
>  	/* init f2fs-specific super block info */
>  	sbi->valid_super_block = valid_super_block;
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index ed67548b286c..b92135c202c2 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
> 
>  	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
>  	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
> -	memcpy(s->s_uuid, str->sb_uuid, 16);
> +	memcpy(&s->s_uuid, str->sb_uuid, 16);
>  }
> 
>  /**
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index 7a515345610c..e77bc52b468f 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
>  	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
>  }
> 
> -static int gfs2_uuid_valid(const u8 *uuid)
> -{
> -	int i;
> -
> -	for (i = 0; i < 16; i++) {
> -		if (uuid[i])
> -			return 1;
> -	}
> -	return 0;
> -}
> -
>  static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
>  {
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> +
>  	buf[0] = '\0';
> -	if (!gfs2_uuid_valid(uuid))
> +	if (uuid_is_null(&s->s_uuid))
>  		return 0;
> -	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
> +	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
>  }
> 
>  static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
> @@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
>  {
>  	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> 
>  	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
>  	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
>  	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
>  		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
> -	if (gfs2_uuid_valid(uuid))
> -		add_uevent_var(env, "UUID=%pUB", uuid);
> +	if (!uuid_is_null(&s->s_uuid))
> +		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
>  	return 0;
>  }
> 
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index ca1646fbcaef..83005f486451 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
>  	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
>  	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
>  	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
> -	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
> +	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
>  	       sizeof(di->id2.i_super.s_uuid));
> 
>  	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index 9008ab9fbd2e..5b795873f7fa 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  			  struct dentry *upper)
>  {
>  	struct super_block *sb = lower->d_sb;
> -	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
>  	const struct ovl_fh *fh = NULL;
>  	int err;
> 
> @@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  	 * up and a pure upper inode.
>  	 */
>  	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
> -	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
> -		fh = ovl_encode_fh(lower, uuid);
> +	    !uuid_is_null(&sb->s_uuid)) {
> +		fh = ovl_encode_fh(lower, &sb->s_uuid);
>  		if (IS_ERR(fh))
>  			return PTR_ERR(fh);
>  	}
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index bad0f665a635..6709f27c6876 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
>  	 * Make sure that the stored uuid matches the uuid of the lower
>  	 * layer where file handle will be decoded.
>  	 */
> -	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
> +	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
>  		goto out;
> 
>  	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 682b336a7a6a..6a18ae407713 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -74,8 +74,7 @@ xfs_uuid_mount(
>  	int			hole, i;
> 
>  	/* Publish UUID in struct super_block */
> -	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
> -	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
> +	uuid_copy(&mp->m_super->s_uuid, uuid);
> 
>  	if (mp->m_flags & XFS_MOUNT_NOUUID)
>  		return 0;
> diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
> index fccf7f44139d..bbb3712dd892 100644
> --- a/include/linux/cleancache.h
> +++ b/include/linux/cleancache.h
> @@ -27,7 +27,7 @@ struct cleancache_filekey {
> 
>  struct cleancache_ops {
>  	int (*init_fs)(size_t);
> -	int (*init_shared_fs)(char *uuid, size_t);
> +	int (*init_shared_fs)(uuid_t *uuid, size_t);
>  	int (*get_page)(int, struct cleancache_filekey,
>  			pgoff_t, struct page *);
>  	void (*put_page)(int, struct cleancache_filekey,
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 803e5a9b2654..3e68cabb8457 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -30,6 +30,7 @@
>  #include <linux/percpu-rwsem.h>
>  #include <linux/workqueue.h>
>  #include <linux/delayed_call.h>
> +#include <linux/uuid.h>
> 
>  #include <asm/byteorder.h>
>  #include <uapi/linux/fs.h>
> @@ -1328,8 +1329,8 @@ struct super_block {
> 
>  	struct sb_writers	s_writers;
> 
> -	char s_id[32];				/* Informational name */
> -	u8 s_uuid[16];				/* UUID */
> +	char			s_id[32];	/* Informational name */
> +	uuid_t			s_uuid;		/* UUID */
> 
>  	void 			*s_fs_info;	/* Filesystem private info */
>  	unsigned int		s_max_links;
> diff --git a/mm/cleancache.c b/mm/cleancache.c
> index ba5d8f3e6d68..f7b9fdc79d97 100644
> --- a/mm/cleancache.c
> +++ b/mm/cleancache.c
> @@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
>  	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
> 
>  	if (cleancache_ops) {
> -		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
> +		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
>  		if (pool_id < 0)
>  			pool_id = CLEANCACHE_NO_POOL;
>  	}
> diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
> index d7f282d75cc1..1d32cd20009a 100644
> --- a/security/integrity/evm/evm_crypto.c
> +++ b/security/integrity/evm/evm_crypto.c
> @@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
>  	hmac_misc.mode = inode->i_mode;
>  	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
>  	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
> -		crypto_shash_update(desc, inode->i_sb->s_uuid,
> +		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
>  				    sizeof(inode->i_sb->s_uuid));
>  	crypto_shash_final(desc, digest);
>  }
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index da3e7d50e0d7..659dbcc83d2f 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18 23:17     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:17 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Shaohua Li,
	Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> For some file systems we still memcpy into it, but in various places this
> already allows us to use the proper uuid helpers.  More to come..
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> (Changes to IMA/EVM)

> ---
>  drivers/xen/tmem.c                  |  6 +++---
>  fs/ext4/super.c                     |  2 +-
>  fs/f2fs/super.c                     |  2 +-
>  fs/gfs2/ops_fstype.c                |  2 +-
>  fs/gfs2/sys.c                       | 22 +++++-----------------
>  fs/ocfs2/super.c                    |  2 +-
>  fs/overlayfs/copy_up.c              |  5 ++---
>  fs/overlayfs/namei.c                |  2 +-
>  fs/xfs/xfs_mount.c                  |  3 +--
>  include/linux/cleancache.h          |  2 +-
>  include/linux/fs.h                  |  5 +++--
>  mm/cleancache.c                     |  2 +-
>  security/integrity/evm/evm_crypto.c |  2 +-
>  security/integrity/ima/ima_policy.c |  2 +-
>  14 files changed, 23 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
> index 4ac2ca8a7656..bf13d1ec51f3 100644
> --- a/drivers/xen/tmem.c
> +++ b/drivers/xen/tmem.c
> @@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
>  	return xen_tmem_new_pool(uuid_private, 0, pagesize);
>  }
> 
> -static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
> +static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
>  {
>  	struct tmem_pool_uuid shared_uuid;
> 
> -	shared_uuid.uuid_lo = *(u64 *)uuid;
> -	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
> +	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
> +	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
>  	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
>  }
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 0b177da9ea82..6e3b4186a22f 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  		sb->s_qcop = &ext4_qctl_operations;
>  	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
>  #endif
> -	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> +	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> 
>  	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
>  	mutex_init(&sbi->s_orphan_lock);
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 83355ec4a92c..0b89b0b7b9f7 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>  	sb->s_time_gran = 1;
>  	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
>  		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
> -	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> +	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> 
>  	/* init f2fs-specific super block info */
>  	sbi->valid_super_block = valid_super_block;
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index ed67548b286c..b92135c202c2 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
> 
>  	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
>  	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
> -	memcpy(s->s_uuid, str->sb_uuid, 16);
> +	memcpy(&s->s_uuid, str->sb_uuid, 16);
>  }
> 
>  /**
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index 7a515345610c..e77bc52b468f 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
>  	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
>  }
> 
> -static int gfs2_uuid_valid(const u8 *uuid)
> -{
> -	int i;
> -
> -	for (i = 0; i < 16; i++) {
> -		if (uuid[i])
> -			return 1;
> -	}
> -	return 0;
> -}
> -
>  static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
>  {
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> +
>  	buf[0] = '\0';
> -	if (!gfs2_uuid_valid(uuid))
> +	if (uuid_is_null(&s->s_uuid))
>  		return 0;
> -	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
> +	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
>  }
> 
>  static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
> @@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
>  {
>  	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> 
>  	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
>  	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
>  	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
>  		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
> -	if (gfs2_uuid_valid(uuid))
> -		add_uevent_var(env, "UUID=%pUB", uuid);
> +	if (!uuid_is_null(&s->s_uuid))
> +		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
>  	return 0;
>  }
> 
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index ca1646fbcaef..83005f486451 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
>  	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
>  	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
>  	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
> -	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
> +	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
>  	       sizeof(di->id2.i_super.s_uuid));
> 
>  	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index 9008ab9fbd2e..5b795873f7fa 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  			  struct dentry *upper)
>  {
>  	struct super_block *sb = lower->d_sb;
> -	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
>  	const struct ovl_fh *fh = NULL;
>  	int err;
> 
> @@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  	 * up and a pure upper inode.
>  	 */
>  	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
> -	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
> -		fh = ovl_encode_fh(lower, uuid);
> +	    !uuid_is_null(&sb->s_uuid)) {
> +		fh = ovl_encode_fh(lower, &sb->s_uuid);
>  		if (IS_ERR(fh))
>  			return PTR_ERR(fh);
>  	}
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index bad0f665a635..6709f27c6876 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
>  	 * Make sure that the stored uuid matches the uuid of the lower
>  	 * layer where file handle will be decoded.
>  	 */
> -	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
> +	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
>  		goto out;
> 
>  	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 682b336a7a6a..6a18ae407713 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -74,8 +74,7 @@ xfs_uuid_mount(
>  	int			hole, i;
> 
>  	/* Publish UUID in struct super_block */
> -	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
> -	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
> +	uuid_copy(&mp->m_super->s_uuid, uuid);
> 
>  	if (mp->m_flags & XFS_MOUNT_NOUUID)
>  		return 0;
> diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
> index fccf7f44139d..bbb3712dd892 100644
> --- a/include/linux/cleancache.h
> +++ b/include/linux/cleancache.h
> @@ -27,7 +27,7 @@ struct cleancache_filekey {
> 
>  struct cleancache_ops {
>  	int (*init_fs)(size_t);
> -	int (*init_shared_fs)(char *uuid, size_t);
> +	int (*init_shared_fs)(uuid_t *uuid, size_t);
>  	int (*get_page)(int, struct cleancache_filekey,
>  			pgoff_t, struct page *);
>  	void (*put_page)(int, struct cleancache_filekey,
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 803e5a9b2654..3e68cabb8457 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -30,6 +30,7 @@
>  #include <linux/percpu-rwsem.h>
>  #include <linux/workqueue.h>
>  #include <linux/delayed_call.h>
> +#include <linux/uuid.h>
> 
>  #include <asm/byteorder.h>
>  #include <uapi/linux/fs.h>
> @@ -1328,8 +1329,8 @@ struct super_block {
> 
>  	struct sb_writers	s_writers;
> 
> -	char s_id[32];				/* Informational name */
> -	u8 s_uuid[16];				/* UUID */
> +	char			s_id[32];	/* Informational name */
> +	uuid_t			s_uuid;		/* UUID */
> 
>  	void 			*s_fs_info;	/* Filesystem private info */
>  	unsigned int		s_max_links;
> diff --git a/mm/cleancache.c b/mm/cleancache.c
> index ba5d8f3e6d68..f7b9fdc79d97 100644
> --- a/mm/cleancache.c
> +++ b/mm/cleancache.c
> @@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
>  	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
> 
>  	if (cleancache_ops) {
> -		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
> +		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
>  		if (pool_id < 0)
>  			pool_id = CLEANCACHE_NO_POOL;
>  	}
> diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
> index d7f282d75cc1..1d32cd20009a 100644
> --- a/security/integrity/evm/evm_crypto.c
> +++ b/security/integrity/evm/evm_crypto.c
> @@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
>  	hmac_misc.mode = inode->i_mode;
>  	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
>  	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
> -		crypto_shash_update(desc, inode->i_sb->s_uuid,
> +		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
>  				    sizeof(inode->i_sb->s_uuid));
>  	crypto_shash_final(desc, digest);
>  }
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index da3e7d50e0d7..659dbcc83d2f 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18 23:17     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:17 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> For some file systems we still memcpy into it, but in various places this
> already allows us to use the proper uuid helpers.  More to come..
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> (Changes to IMA/EVM)

> ---
>  drivers/xen/tmem.c                  |  6 +++---
>  fs/ext4/super.c                     |  2 +-
>  fs/f2fs/super.c                     |  2 +-
>  fs/gfs2/ops_fstype.c                |  2 +-
>  fs/gfs2/sys.c                       | 22 +++++-----------------
>  fs/ocfs2/super.c                    |  2 +-
>  fs/overlayfs/copy_up.c              |  5 ++---
>  fs/overlayfs/namei.c                |  2 +-
>  fs/xfs/xfs_mount.c                  |  3 +--
>  include/linux/cleancache.h          |  2 +-
>  include/linux/fs.h                  |  5 +++--
>  mm/cleancache.c                     |  2 +-
>  security/integrity/evm/evm_crypto.c |  2 +-
>  security/integrity/ima/ima_policy.c |  2 +-
>  14 files changed, 23 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
> index 4ac2ca8a7656..bf13d1ec51f3 100644
> --- a/drivers/xen/tmem.c
> +++ b/drivers/xen/tmem.c
> @@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
>  	return xen_tmem_new_pool(uuid_private, 0, pagesize);
>  }
> 
> -static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
> +static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
>  {
>  	struct tmem_pool_uuid shared_uuid;
> 
> -	shared_uuid.uuid_lo = *(u64 *)uuid;
> -	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
> +	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
> +	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
>  	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
>  }
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 0b177da9ea82..6e3b4186a22f 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  		sb->s_qcop = &ext4_qctl_operations;
>  	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
>  #endif
> -	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> +	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> 
>  	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
>  	mutex_init(&sbi->s_orphan_lock);
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 83355ec4a92c..0b89b0b7b9f7 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>  	sb->s_time_gran = 1;
>  	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
>  		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
> -	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> +	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> 
>  	/* init f2fs-specific super block info */
>  	sbi->valid_super_block = valid_super_block;
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index ed67548b286c..b92135c202c2 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
> 
>  	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
>  	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
> -	memcpy(s->s_uuid, str->sb_uuid, 16);
> +	memcpy(&s->s_uuid, str->sb_uuid, 16);
>  }
> 
>  /**
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index 7a515345610c..e77bc52b468f 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
>  	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
>  }
> 
> -static int gfs2_uuid_valid(const u8 *uuid)
> -{
> -	int i;
> -
> -	for (i = 0; i < 16; i++) {
> -		if (uuid[i])
> -			return 1;
> -	}
> -	return 0;
> -}
> -
>  static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
>  {
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> +
>  	buf[0] = '\0';
> -	if (!gfs2_uuid_valid(uuid))
> +	if (uuid_is_null(&s->s_uuid))
>  		return 0;
> -	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
> +	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
>  }
> 
>  static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
> @@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
>  {
>  	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> 
>  	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
>  	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
>  	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
>  		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
> -	if (gfs2_uuid_valid(uuid))
> -		add_uevent_var(env, "UUID=%pUB", uuid);
> +	if (!uuid_is_null(&s->s_uuid))
> +		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
>  	return 0;
>  }
> 
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index ca1646fbcaef..83005f486451 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
>  	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
>  	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
>  	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
> -	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
> +	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
>  	       sizeof(di->id2.i_super.s_uuid));
> 
>  	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index 9008ab9fbd2e..5b795873f7fa 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  			  struct dentry *upper)
>  {
>  	struct super_block *sb = lower->d_sb;
> -	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
>  	const struct ovl_fh *fh = NULL;
>  	int err;
> 
> @@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  	 * up and a pure upper inode.
>  	 */
>  	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
> -	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
> -		fh = ovl_encode_fh(lower, uuid);
> +	    !uuid_is_null(&sb->s_uuid)) {
> +		fh = ovl_encode_fh(lower, &sb->s_uuid);
>  		if (IS_ERR(fh))
>  			return PTR_ERR(fh);
>  	}
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index bad0f665a635..6709f27c6876 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
>  	 * Make sure that the stored uuid matches the uuid of the lower
>  	 * layer where file handle will be decoded.
>  	 */
> -	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
> +	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
>  		goto out;
> 
>  	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 682b336a7a6a..6a18ae407713 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -74,8 +74,7 @@ xfs_uuid_mount(
>  	int			hole, i;
> 
>  	/* Publish UUID in struct super_block */
> -	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
> -	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
> +	uuid_copy(&mp->m_super->s_uuid, uuid);
> 
>  	if (mp->m_flags & XFS_MOUNT_NOUUID)
>  		return 0;
> diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
> index fccf7f44139d..bbb3712dd892 100644
> --- a/include/linux/cleancache.h
> +++ b/include/linux/cleancache.h
> @@ -27,7 +27,7 @@ struct cleancache_filekey {
> 
>  struct cleancache_ops {
>  	int (*init_fs)(size_t);
> -	int (*init_shared_fs)(char *uuid, size_t);
> +	int (*init_shared_fs)(uuid_t *uuid, size_t);
>  	int (*get_page)(int, struct cleancache_filekey,
>  			pgoff_t, struct page *);
>  	void (*put_page)(int, struct cleancache_filekey,
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 803e5a9b2654..3e68cabb8457 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -30,6 +30,7 @@
>  #include <linux/percpu-rwsem.h>
>  #include <linux/workqueue.h>
>  #include <linux/delayed_call.h>
> +#include <linux/uuid.h>
> 
>  #include <asm/byteorder.h>
>  #include <uapi/linux/fs.h>
> @@ -1328,8 +1329,8 @@ struct super_block {
> 
>  	struct sb_writers	s_writers;
> 
> -	char s_id[32];				/* Informational name */
> -	u8 s_uuid[16];				/* UUID */
> +	char			s_id[32];	/* Informational name */
> +	uuid_t			s_uuid;		/* UUID */
> 
>  	void 			*s_fs_info;	/* Filesystem private info */
>  	unsigned int		s_max_links;
> diff --git a/mm/cleancache.c b/mm/cleancache.c
> index ba5d8f3e6d68..f7b9fdc79d97 100644
> --- a/mm/cleancache.c
> +++ b/mm/cleancache.c
> @@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
>  	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
> 
>  	if (cleancache_ops) {
> -		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
> +		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
>  		if (pool_id < 0)
>  			pool_id = CLEANCACHE_NO_POOL;
>  	}
> diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
> index d7f282d75cc1..1d32cd20009a 100644
> --- a/security/integrity/evm/evm_crypto.c
> +++ b/security/integrity/evm/evm_crypto.c
> @@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
>  	hmac_misc.mode = inode->i_mode;
>  	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
>  	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
> -		crypto_shash_update(desc, inode->i_sb->s_uuid,
> +		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
>  				    sizeof(inode->i_sb->s_uuid));
>  	crypto_shash_final(desc, digest);
>  }
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index da3e7d50e0d7..659dbcc83d2f 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;

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

* Re: [PATCH 17/23] fs: switch ->s_uuid to uuid_t
@ 2017-05-18 23:17     ` Mimi Zohar
  0 siblings, 0 replies; 188+ messages in thread
From: Mimi Zohar @ 2017-05-18 23:17 UTC (permalink / raw)
  To: Christoph Hellwig, Andy Shevchenko, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> For some file systems we still memcpy into it, but in various places this
> already allows us to use the proper uuid helpers.  More to come..
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> (Changes to IMA/EVM)

> ---
>  drivers/xen/tmem.c                  |  6 +++---
>  fs/ext4/super.c                     |  2 +-
>  fs/f2fs/super.c                     |  2 +-
>  fs/gfs2/ops_fstype.c                |  2 +-
>  fs/gfs2/sys.c                       | 22 +++++-----------------
>  fs/ocfs2/super.c                    |  2 +-
>  fs/overlayfs/copy_up.c              |  5 ++---
>  fs/overlayfs/namei.c                |  2 +-
>  fs/xfs/xfs_mount.c                  |  3 +--
>  include/linux/cleancache.h          |  2 +-
>  include/linux/fs.h                  |  5 +++--
>  mm/cleancache.c                     |  2 +-
>  security/integrity/evm/evm_crypto.c |  2 +-
>  security/integrity/ima/ima_policy.c |  2 +-
>  14 files changed, 23 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
> index 4ac2ca8a7656..bf13d1ec51f3 100644
> --- a/drivers/xen/tmem.c
> +++ b/drivers/xen/tmem.c
> @@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
>  	return xen_tmem_new_pool(uuid_private, 0, pagesize);
>  }
> 
> -static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
> +static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
>  {
>  	struct tmem_pool_uuid shared_uuid;
> 
> -	shared_uuid.uuid_lo = *(u64 *)uuid;
> -	shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
> +	shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
> +	shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
>  	return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
>  }
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 0b177da9ea82..6e3b4186a22f 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  		sb->s_qcop = &ext4_qctl_operations;
>  	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
>  #endif
> -	memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> +	memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
> 
>  	INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
>  	mutex_init(&sbi->s_orphan_lock);
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 83355ec4a92c..0b89b0b7b9f7 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>  	sb->s_time_gran = 1;
>  	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
>  		(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
> -	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> +	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
> 
>  	/* init f2fs-specific super block info */
>  	sbi->valid_super_block = valid_super_block;
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index ed67548b286c..b92135c202c2 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
> 
>  	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
>  	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
> -	memcpy(s->s_uuid, str->sb_uuid, 16);
> +	memcpy(&s->s_uuid, str->sb_uuid, 16);
>  }
> 
>  /**
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index 7a515345610c..e77bc52b468f 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
>  	return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
>  }
> 
> -static int gfs2_uuid_valid(const u8 *uuid)
> -{
> -	int i;
> -
> -	for (i = 0; i < 16; i++) {
> -		if (uuid[i])
> -			return 1;
> -	}
> -	return 0;
> -}
> -
>  static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
>  {
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> +
>  	buf[0] = '\0';
> -	if (!gfs2_uuid_valid(uuid))
> +	if (uuid_is_null(&s->s_uuid))
>  		return 0;
> -	return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
> +	return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
>  }
> 
>  static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
> @@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
>  {
>  	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
>  	struct super_block *s = sdp->sd_vfs;
> -	const u8 *uuid = s->s_uuid;
> 
>  	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
>  	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
>  	if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
>  		add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
> -	if (gfs2_uuid_valid(uuid))
> -		add_uevent_var(env, "UUID=%pUB", uuid);
> +	if (!uuid_is_null(&s->s_uuid))
> +		add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
>  	return 0;
>  }
> 
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index ca1646fbcaef..83005f486451 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
>  	cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
>  	bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
>  	sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
> -	memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
> +	memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
>  	       sizeof(di->id2.i_super.s_uuid));
> 
>  	osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index 9008ab9fbd2e..5b795873f7fa 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  			  struct dentry *upper)
>  {
>  	struct super_block *sb = lower->d_sb;
> -	uuid_be *uuid = (uuid_be *) &sb->s_uuid;
>  	const struct ovl_fh *fh = NULL;
>  	int err;
> 
> @@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
>  	 * up and a pure upper inode.
>  	 */
>  	if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
> -	    uuid_be_cmp(*uuid, NULL_UUID_BE)) {
> -		fh = ovl_encode_fh(lower, uuid);
> +	    !uuid_is_null(&sb->s_uuid)) {
> +		fh = ovl_encode_fh(lower, &sb->s_uuid);
>  		if (IS_ERR(fh))
>  			return PTR_ERR(fh);
>  	}
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index bad0f665a635..6709f27c6876 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
>  	 * Make sure that the stored uuid matches the uuid of the lower
>  	 * layer where file handle will be decoded.
>  	 */
> -	if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
> +	if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
>  		goto out;
> 
>  	origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 682b336a7a6a..6a18ae407713 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -74,8 +74,7 @@ xfs_uuid_mount(
>  	int			hole, i;
> 
>  	/* Publish UUID in struct super_block */
> -	BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
> -	memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
> +	uuid_copy(&mp->m_super->s_uuid, uuid);
> 
>  	if (mp->m_flags & XFS_MOUNT_NOUUID)
>  		return 0;
> diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
> index fccf7f44139d..bbb3712dd892 100644
> --- a/include/linux/cleancache.h
> +++ b/include/linux/cleancache.h
> @@ -27,7 +27,7 @@ struct cleancache_filekey {
> 
>  struct cleancache_ops {
>  	int (*init_fs)(size_t);
> -	int (*init_shared_fs)(char *uuid, size_t);
> +	int (*init_shared_fs)(uuid_t *uuid, size_t);
>  	int (*get_page)(int, struct cleancache_filekey,
>  			pgoff_t, struct page *);
>  	void (*put_page)(int, struct cleancache_filekey,
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 803e5a9b2654..3e68cabb8457 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -30,6 +30,7 @@
>  #include <linux/percpu-rwsem.h>
>  #include <linux/workqueue.h>
>  #include <linux/delayed_call.h>
> +#include <linux/uuid.h>
> 
>  #include <asm/byteorder.h>
>  #include <uapi/linux/fs.h>
> @@ -1328,8 +1329,8 @@ struct super_block {
> 
>  	struct sb_writers	s_writers;
> 
> -	char s_id[32];				/* Informational name */
> -	u8 s_uuid[16];				/* UUID */
> +	char			s_id[32];	/* Informational name */
> +	uuid_t			s_uuid;		/* UUID */
> 
>  	void 			*s_fs_info;	/* Filesystem private info */
>  	unsigned int		s_max_links;
> diff --git a/mm/cleancache.c b/mm/cleancache.c
> index ba5d8f3e6d68..f7b9fdc79d97 100644
> --- a/mm/cleancache.c
> +++ b/mm/cleancache.c
> @@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
>  	int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
> 
>  	if (cleancache_ops) {
> -		pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
> +		pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
>  		if (pool_id < 0)
>  			pool_id = CLEANCACHE_NO_POOL;
>  	}
> diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
> index d7f282d75cc1..1d32cd20009a 100644
> --- a/security/integrity/evm/evm_crypto.c
> +++ b/security/integrity/evm/evm_crypto.c
> @@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
>  	hmac_misc.mode = inode->i_mode;
>  	crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
>  	if (evm_hmac_attrs & EVM_ATTR_FSUUID)
> -		crypto_shash_update(desc, inode->i_sb->s_uuid,
> +		crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
>  				    sizeof(inode->i_sb->s_uuid));
>  	crypto_shash_final(desc, digest);
>  }
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index da3e7d50e0d7..659dbcc83d2f 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
>  	    && rule->fsmagic != inode->i_sb->s_magic)
>  		return false;
>  	if ((rule->flags & IMA_FSUUID) &&
> -	    memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
> +	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
>  		return false;
>  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
>  		return false;

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

* Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
  2017-05-18  6:26   ` Christoph Hellwig
@ 2017-05-18 23:32       ` Darrick J. Wong
  -1 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 23:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-nvdimm-y27Ovi1pjclAfugRpC6u6w,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:43AM +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> uuid_t definition is about to change.
> 
> Signed-off-by: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>

Reviewed-by: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

> ---
>  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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t
@ 2017-05-18 23:32       ` Darrick J. Wong
  0 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 23:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

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

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

* Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
  2017-05-18  6:26   ` Christoph Hellwig
@ 2017-05-18 23:34       ` Darrick J. Wong
  -1 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 23:34 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-nvdimm-y27Ovi1pjclAfugRpC6u6w,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:44AM +0200, Christoph Hellwig wrote:
> Use the generic Linux definition to implement our UUID type, this will
> allow using more generic infrastructure in the future.
> 
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>

Reviewed-by: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

--D

> ---
>  fs/xfs/uuid.h      | 4 ----
>  fs/xfs/xfs_linux.h | 3 +++
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 104db0f3bed6..4f1441ba4fa5 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -18,10 +18,6 @@
>  #ifndef __XFS_SUPPORT_UUID_H__
>  #define __XFS_SUPPORT_UUID_H__
>  
> -typedef struct {
> -	unsigned char	__u_bits[16];
> -} uuid_t;
> -
>  extern int uuid_is_nil(uuid_t *uuid);
>  extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
>  extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 044fb0e15390..89ee5ec66837 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -19,6 +19,7 @@
>  #define __XFS_LINUX__
>  
>  #include <linux/types.h>
> +#include <linux/uuid.h>
>  
>  /*
>   * Kernel specific type declarations for XFS
> @@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> +typedef uuid_be			uuid_t;
> +
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
@ 2017-05-18 23:34       ` Darrick J. Wong
  0 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 23:34 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:44AM +0200, Christoph Hellwig wrote:
> Use the generic Linux definition to implement our UUID type, this will
> allow using more generic infrastructure in the future.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

--D

> ---
>  fs/xfs/uuid.h      | 4 ----
>  fs/xfs/xfs_linux.h | 3 +++
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 104db0f3bed6..4f1441ba4fa5 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -18,10 +18,6 @@
>  #ifndef __XFS_SUPPORT_UUID_H__
>  #define __XFS_SUPPORT_UUID_H__
>  
> -typedef struct {
> -	unsigned char	__u_bits[16];
> -} uuid_t;
> -
>  extern int uuid_is_nil(uuid_t *uuid);
>  extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
>  extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 044fb0e15390..89ee5ec66837 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -19,6 +19,7 @@
>  #define __XFS_LINUX__
>  
>  #include <linux/types.h>
> +#include <linux/uuid.h>
>  
>  /*
>   * Kernel specific type declarations for XFS
> @@ -38,6 +39,8 @@ typedef __s64			xfs_daddr_t;	/* <disk address> type */
>  typedef __u32			xfs_dev_t;
>  typedef __u32			xfs_nlink_t;
>  
> +typedef uuid_be			uuid_t;
> +
>  #include "xfs_types.h"
>  
>  #include "kmem.h"
> -- 
> 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

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

* Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
  2017-05-18  6:26   ` Christoph Hellwig
@ 2017-05-18 23:35       ` Darrick J. Wong
  -1 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 23:35 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-nvdimm-y27Ovi1pjclAfugRpC6u6w,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

On Thu, May 18, 2017 at 08:26:54AM +0200, Christoph Hellwig wrote:
> Directly use the v1 intepretation of uuid_t instead.
> 
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>

Reviewed-by: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

--D

> ---
>  fs/xfs/uuid.c      | 25 -------------------------
>  fs/xfs/uuid.h      |  1 -
>  fs/xfs/xfs_mount.c |  6 +++++-
>  3 files changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
> index 29ed78c8637b..737c186ea98b 100644
> --- a/fs/xfs/uuid.c
> +++ b/fs/xfs/uuid.c
> @@ -17,31 +17,6 @@
>   */
>  #include <xfs.h>
>  
> -/* IRIX interpretation of an uuid_t */
> -typedef struct {
> -	__be32	uu_timelow;
> -	__be16	uu_timemid;
> -	__be16	uu_timehi;
> -	__be16	uu_clockseq;
> -	__be16	uu_node[3];
> -} xfs_uu_t;
> -
> -/*
> - * uuid_getnodeuniq - obtain the node unique fields of a UUID.
> - *
> - * This is not in any way a standard or condoned UUID function;
> - * it just something that's needed for user-level file handles.
> - */
> -void
> -uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
> -{
> -	xfs_uu_t *uup = (xfs_uu_t *)uuid;
> -
> -	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
> -		   be16_to_cpu(uup->uu_timemid);
> -	fsid[1] = be32_to_cpu(uup->uu_timelow);
> -}
> -
>  int
>  uuid_is_nil(uuid_t *uuid)
>  {
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 86bbed071e79..5aea49bf0963 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -19,6 +19,5 @@
>  #define __XFS_SUPPORT_UUID_H__
>  
>  extern int uuid_is_nil(uuid_t *uuid);
> -extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
>  
>  #endif	/* __XFS_SUPPORT_UUID_H__ */
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 2eaf81859166..742e4a61c0bc 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -793,7 +793,11 @@ xfs_mountfs(
>  	 *  Copies the low order bits of the timestamp and the randomly
>  	 *  set "sequence" number out of a UUID.
>  	 */
> -	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
> +	mp->m_fixedfsid[0] =
> +		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
> +		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
> +		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
> +	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
>  
>  	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
>  
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
@ 2017-05-18 23:35       ` Darrick J. Wong
  0 siblings, 0 replies; 188+ messages in thread
From: Darrick J. Wong @ 2017-05-18 23:35 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andy Shevchenko, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, May 18, 2017 at 08:26:54AM +0200, Christoph Hellwig wrote:
> Directly use the v1 intepretation of uuid_t instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

--D

> ---
>  fs/xfs/uuid.c      | 25 -------------------------
>  fs/xfs/uuid.h      |  1 -
>  fs/xfs/xfs_mount.c |  6 +++++-
>  3 files changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
> index 29ed78c8637b..737c186ea98b 100644
> --- a/fs/xfs/uuid.c
> +++ b/fs/xfs/uuid.c
> @@ -17,31 +17,6 @@
>   */
>  #include <xfs.h>
>  
> -/* IRIX interpretation of an uuid_t */
> -typedef struct {
> -	__be32	uu_timelow;
> -	__be16	uu_timemid;
> -	__be16	uu_timehi;
> -	__be16	uu_clockseq;
> -	__be16	uu_node[3];
> -} xfs_uu_t;
> -
> -/*
> - * uuid_getnodeuniq - obtain the node unique fields of a UUID.
> - *
> - * This is not in any way a standard or condoned UUID function;
> - * it just something that's needed for user-level file handles.
> - */
> -void
> -uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
> -{
> -	xfs_uu_t *uup = (xfs_uu_t *)uuid;
> -
> -	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
> -		   be16_to_cpu(uup->uu_timemid);
> -	fsid[1] = be32_to_cpu(uup->uu_timelow);
> -}
> -
>  int
>  uuid_is_nil(uuid_t *uuid)
>  {
> diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
> index 86bbed071e79..5aea49bf0963 100644
> --- a/fs/xfs/uuid.h
> +++ b/fs/xfs/uuid.h
> @@ -19,6 +19,5 @@
>  #define __XFS_SUPPORT_UUID_H__
>  
>  extern int uuid_is_nil(uuid_t *uuid);
> -extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
>  
>  #endif	/* __XFS_SUPPORT_UUID_H__ */
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 2eaf81859166..742e4a61c0bc 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -793,7 +793,11 @@ xfs_mountfs(
>  	 *  Copies the low order bits of the timestamp and the randomly
>  	 *  set "sequence" number out of a UUID.
>  	 */
> -	uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
> +	mp->m_fixedfsid[0] =
> +		((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
> +		((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
> +		 be16_to_cpu(sbp->sb_uuid.v1.time_mid);
> +	mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
>  
>  	mp->m_dmevmask = 0;	/* not persistent; set after each mount */
>  
> -- 
> 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

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-19 10:58       ` David Howells
  0 siblings, 0 replies; 188+ messages in thread
From: David Howells @ 2017-05-19 10:58 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, dhowells, linux-fsdevel, linux-api, Joe Perches,
	Andy Shevchenko, Shaohua Li, Steven Whitehouse

Christoph Hellwig <hch@lst.de> wrote:

> It's not a userspace ABI, so by defintion it does not break an
> existing user program.

That's an invalid assumption.  It is a de facto userspace ABI as it has been
exposed in /usr/include/linux/uuid.h for some time.

> If someone was using it they should be using uuid_t from libuuid instead, as
> that gives them the routines to deal with it.

Yes, they should - but that doesn't mean they do.

David
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-19 10:58       ` David Howells
  0 siblings, 0 replies; 188+ messages in thread
From: David Howells @ 2017-05-19 10:58 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Joe Perches, Andy Shevchenko,
	Shaohua Li, Steven Whitehouse

Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:

> It's not a userspace ABI, so by defintion it does not break an
> existing user program.

That's an invalid assumption.  It is a de facto userspace ABI as it has been
exposed in /usr/include/linux/uuid.h for some time.

> If someone was using it they should be using uuid_t from libuuid instead, as
> that gives them the routines to deal with it.

Yes, they should - but that doesn't mean they do.

David

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-19 10:58       ` David Howells
  0 siblings, 0 replies; 188+ messages in thread
From: David Howells @ 2017-05-19 10:58 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dhowells, Joe Perches, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel, Shaohua Li, Dan Williams, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel,
	linux-api

Christoph Hellwig <hch@lst.de> wrote:

> It's not a userspace ABI, so by defintion it does not break an
> existing user program.

That's an invalid assumption.  It is a de facto userspace ABI as it has been
exposed in /usr/include/linux/uuid.h for some time.

> If someone was using it they should be using uuid_t from libuuid instead, as
> that gives them the routines to deal with it.

Yes, they should - but that doesn't mean they do.

David

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-19 10:58       ` David Howells
  0 siblings, 0 replies; 188+ messages in thread
From: David Howells @ 2017-05-19 10:58 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dhowells, Joe Perches, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel, Shaohua Li, Dan Williams, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel,
	linux-api

Christoph Hellwig <hch@lst.de> wrote:

> It's not a userspace ABI, so by defintion it does not break an
> existing user program.

That's an invalid assumption.  It is a de facto userspace ABI as it has been
exposed in /usr/include/linux/uuid.h for some time.

> If someone was using it they should be using uuid_t from libuuid instead, as
> that gives them the routines to deal with it.

Yes, they should - but that doesn't mean they do.

David

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-21  6:55         ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-21  6:55 UTC (permalink / raw)
  To: David Howells
  Cc: linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, Steven Whitehouse, linux-xfs, linux-fsdevel,
	linux-api, Joe Perches, Andy Shevchenko, Shaohua Li,
	Christoph Hellwig

On Fri, May 19, 2017 at 11:58:41AM +0100, David Howells wrote:
> Christoph Hellwig <hch@lst.de> wrote:
> 
> > It's not a userspace ABI, so by defintion it does not break an
> > existing user program.
> 
> That's an invalid assumption.  It is a de facto userspace ABI as it has been
> exposed in /usr/include/linux/uuid.h for some time.

It is never passed through any kernel interface, which by defintion does
not make it an ABI.  And even if it was we are not going to change the
ABI for a uuid_t ever.  We're just changing the internal name, and stop
exposing the old name which was never used in an ABI to userspace.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-21  6:55         ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-21  6:55 UTC (permalink / raw)
  To: David Howells
  Cc: linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Steven Whitehouse,
	linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Joe Perches, Andy Shevchenko,
	Shaohua Li, Christoph Hellwig

On Fri, May 19, 2017 at 11:58:41AM +0100, David Howells wrote:
> Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
> 
> > It's not a userspace ABI, so by defintion it does not break an
> > existing user program.
> 
> That's an invalid assumption.  It is a de facto userspace ABI as it has been
> exposed in /usr/include/linux/uuid.h for some time.

It is never passed through any kernel interface, which by defintion does
not make it an ABI.  And even if it was we are not going to change the
ABI for a uuid_t ever.  We're just changing the internal name, and stop
exposing the old name which was never used in an ABI to userspace.

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-21  6:55         ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-21  6:55 UTC (permalink / raw)
  To: David Howells
  Cc: Christoph Hellwig, Joe Perches, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel, Shaohua Li, Dan Williams, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel,
	linux-api

On Fri, May 19, 2017 at 11:58:41AM +0100, David Howells wrote:
> Christoph Hellwig <hch@lst.de> wrote:
> 
> > It's not a userspace ABI, so by defintion it does not break an
> > existing user program.
> 
> That's an invalid assumption.  It is a de facto userspace ABI as it has been
> exposed in /usr/include/linux/uuid.h for some time.

It is never passed through any kernel interface, which by defintion does
not make it an ABI.  And even if it was we are not going to change the
ABI for a uuid_t ever.  We're just changing the internal name, and stop
exposing the old name which was never used in an ABI to userspace.

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

* Re: [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header
@ 2017-05-21  6:55         ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-21  6:55 UTC (permalink / raw)
  To: David Howells
  Cc: Christoph Hellwig, Joe Perches, Andy Shevchenko, Amir Goldstein,
	linux-fsdevel, Shaohua Li, Dan Williams, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel,
	linux-api

On Fri, May 19, 2017 at 11:58:41AM +0100, David Howells wrote:
> Christoph Hellwig <hch@lst.de> wrote:
> 
> > It's not a userspace ABI, so by defintion it does not break an
> > existing user program.
> 
> That's an invalid assumption.  It is a de facto userspace ABI as it has been
> exposed in /usr/include/linux/uuid.h for some time.

It is never passed through any kernel interface, which by defintion does
not make it an ABI.  And even if it was we are not going to change the
ABI for a uuid_t ever.  We're just changing the internal name, and stop
exposing the old name which was never used in an ABI to userspace.

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
  2017-05-18  6:26   ` Christoph Hellwig
  (?)
@ 2017-05-22 18:49     ` Andy Shevchenko
  -1 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:49 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:

Changelog?

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: David Howells <dhowells@redhat.com>

> @@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call
> *call)
>  static void SRXAFSCB_ProbeUuid(struct work_struct *work)
>  {
>  	struct afs_call *call = container_of(work, struct afs_call,
> work);
> -	struct uuid_v1 *r = call->request;
> +	uuid_t *r = call->request;
>  
>  	struct {
>  		__be32	match;
> 

Just to double check that this doesn't create a union aliasing.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-22 18:49     ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:49 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:

Changelog?

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: David Howells <dhowells@redhat.com>

> @@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call
> *call)
>  static void SRXAFSCB_ProbeUuid(struct work_struct *work)
>  {
>  	struct afs_call *call = container_of(work, struct afs_call,
> work);
> -	struct uuid_v1 *r = call->request;
> +	uuid_t *r = call->request;
>  
>  	struct {
>  		__be32	match;
> 

Just to double check that this doesn't create a union aliasing.

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

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-22 18:49     ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:49 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:

Changelog?

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: David Howells <dhowells@redhat.com>

> @@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call
> *call)
>  static void SRXAFSCB_ProbeUuid(struct work_struct *work)
>  {
>  	struct afs_call *call = container_of(work, struct afs_call,
> work);
> -	struct uuid_v1 *r = call->request;
> +	uuid_t *r = call->request;
>  
>  	struct {
>  		__be32	match;
> 

Just to double check that this doesn't create a union aliasing.

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

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-22 18:52     ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:52 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein, linux-fsdevel
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, linux-kernel,
	David Howells, Mimi Zohar, Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 

While patch is good, shouldn't it go before we introduce those helpers?

> Cc: Shaohua Li <shli@kernel.org>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/md.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 82f798be964f..65795cc4cb7d 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int
> size)
>  	return -EINVAL;
>  }
>  
> -static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	return	sb1->set_uuid0 == sb2->set_uuid0 &&
>  		sb1->set_uuid1 == sb2->set_uuid1 &&
> @@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1,
> mdp_super_t *sb2)
>  		sb1->set_uuid3 == sb2->set_uuid3;
>  }
>  
> -static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	int ret;
>  	mdp_super_t *tmp1, *tmp2;
> @@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev,
> struct md_rdev *refdev, int minor
>  	} else {
>  		__u64 ev1, ev2;
>  		mdp_super_t *refsb = page_address(refdev->sb_page);
> -		if (!uuid_equal(refsb, sb)) {
> +		if (!md_uuid_equal(refsb, sb)) {
>  			pr_warn("md: %s has different UUID to %s\n",
>  				b, bdevname(refdev->bdev,b2));
>  			goto abort;
>  		}
> -		if (!sb_equal(refsb, sb)) {
> +		if (!md_sb_equal(refsb, sb)) {
>  			pr_warn("md: %s has same UUID but different
> superblock to %s\n",
>  				b, bdevname(refdev->bdev, b2));
>  			goto abort;

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-22 18:52     ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:52 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells, Mimi Zohar,
	Steven Whitehouse

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 

While patch is good, shouldn't it go before we introduce those helpers?

> Cc: Shaohua Li <shli@kernel.org>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/md.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 82f798be964f..65795cc4cb7d 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int
> size)
>  	return -EINVAL;
>  }
>  
> -static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	return	sb1->set_uuid0 == sb2->set_uuid0 &&
>  		sb1->set_uuid1 == sb2->set_uuid1 &&
> @@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1,
> mdp_super_t *sb2)
>  		sb1->set_uuid3 == sb2->set_uuid3;
>  }
>  
> -static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	int ret;
>  	mdp_super_t *tmp1, *tmp2;
> @@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev,
> struct md_rdev *refdev, int minor
>  	} else {
>  		__u64 ev1, ev2;
>  		mdp_super_t *refsb = page_address(refdev->sb_page);
> -		if (!uuid_equal(refsb, sb)) {
> +		if (!md_uuid_equal(refsb, sb)) {
>  			pr_warn("md: %s has different UUID to %s\n",
>  				b, bdevname(refdev->bdev,b2));
>  			goto abort;
>  		}
> -		if (!sb_equal(refsb, sb)) {
> +		if (!md_sb_equal(refsb, sb)) {
>  			pr_warn("md: %s has same UUID but different
> superblock to %s\n",
>  				b, bdevname(refdev->bdev, b2));
>  			goto abort;

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-22 18:52     ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:52 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 

While patch is good, shouldn't it go before we introduce those helpers?

> Cc: Shaohua Li <shli@kernel.org>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/md.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 82f798be964f..65795cc4cb7d 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int
> size)
>  	return -EINVAL;
>  }
>  
> -static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	return	sb1->set_uuid0 == sb2->set_uuid0 &&
>  		sb1->set_uuid1 == sb2->set_uuid1 &&
> @@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1,
> mdp_super_t *sb2)
>  		sb1->set_uuid3 == sb2->set_uuid3;
>  }
>  
> -static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	int ret;
>  	mdp_super_t *tmp1, *tmp2;
> @@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev,
> struct md_rdev *refdev, int minor
>  	} else {
>  		__u64 ev1, ev2;
>  		mdp_super_t *refsb = page_address(refdev->sb_page);
> -		if (!uuid_equal(refsb, sb)) {
> +		if (!md_uuid_equal(refsb, sb)) {
>  			pr_warn("md: %s has different UUID to %s\n",
>  				b, bdevname(refdev->bdev,b2));
>  			goto abort;
>  		}
> -		if (!sb_equal(refsb, sb)) {
> +		if (!md_sb_equal(refsb, sb)) {
>  			pr_warn("md: %s has same UUID but different
> superblock to %s\n",
>  				b, bdevname(refdev->bdev, b2));
>  			goto abort;

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

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-22 18:52     ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:52 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein, linux-fsdevel
  Cc: Shaohua Li, Dan Williams, David Howells, Steven Whitehouse,
	Mimi Zohar, linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> From: Amir Goldstein <amir73il@gmail.com>
> 
> The md private helper uuid_equal() collides with a generic helper
> of the same name.
> 
> Rename the md private helper to md_uuid_equal() and do the same for
> md_sb_equal().
> 

While patch is good, shouldn't it go before we introduce those helpers?

> Cc: Shaohua Li <shli@kernel.org>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/md.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 82f798be964f..65795cc4cb7d 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int
> size)
>  	return -EINVAL;
>  }
>  
> -static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	return	sb1->set_uuid0 == sb2->set_uuid0 &&
>  		sb1->set_uuid1 == sb2->set_uuid1 &&
> @@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1,
> mdp_super_t *sb2)
>  		sb1->set_uuid3 == sb2->set_uuid3;
>  }
>  
> -static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
> +static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
>  {
>  	int ret;
>  	mdp_super_t *tmp1, *tmp2;
> @@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev,
> struct md_rdev *refdev, int minor
>  	} else {
>  		__u64 ev1, ev2;
>  		mdp_super_t *refsb = page_address(refdev->sb_page);
> -		if (!uuid_equal(refsb, sb)) {
> +		if (!md_uuid_equal(refsb, sb)) {
>  			pr_warn("md: %s has different UUID to %s\n",
>  				b, bdevname(refdev->bdev,b2));
>  			goto abort;
>  		}
> -		if (!sb_equal(refsb, sb)) {
> +		if (!md_sb_equal(refsb, sb)) {
>  			pr_warn("md: %s has same UUID but different
> superblock to %s\n",
>  				b, bdevname(refdev->bdev, b2));
>  			goto abort;

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

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-22 18:59         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:59 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein
  Cc: linux-xfs, linux-raid, linux-nvdimm, Shaohua Li, Hugh Dickins,
	linux-kernel, David Howells, linux-fsdevel, Mimi Zohar,
	Steven Whitehouse

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
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-22 18:59         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:59 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein
  Cc: linux-xfs, linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Shaohua Li, Hugh Dickins,
	linux-kernel, David Howells, linux-fsdevel, Mimi Zohar,
	Steven Whitehouse

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
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-22 18:59         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:59 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein
  Cc: linux-fsdevel, Shaohua Li, Dan Williams, David Howells,
	Steven Whitehouse, Mimi Zohar, linux-xfs, linux-raid,
	linux-nvdimm, linux-kernel, Hugh Dickins

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

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

* Re: [PATCH 23/23] uuid: remove uuid_be
@ 2017-05-22 18:59         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-22 18:59 UTC (permalink / raw)
  To: Christoph Hellwig, Amir Goldstein
  Cc: linux-fsdevel, Shaohua Li, Dan Williams, David Howells,
	Steven Whitehouse, Mimi Zohar, linux-xfs, linux-raid,
	linux-nvdimm, linux-kernel, Hugh Dickins

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

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

* Re: [PATCH 13/23] md: namespace private helper names
  2017-05-22 18:52     ` Andy Shevchenko
  (?)
@ 2017-05-23  8:41       ` Christoph Hellwig
  -1 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, Steven Whitehouse, David Howells, linux-fsdevel,
	Shaohua Li, Christoph Hellwig

On Mon, May 22, 2017 at 09:52:27PM +0300, Andy Shevchenko wrote:
> On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> > From: Amir Goldstein <amir73il@gmail.com>
> > 
> > The md private helper uuid_equal() collides with a generic helper
> > of the same name.
> > 
> > Rename the md private helper to md_uuid_equal() and do the same for
> > md_sb_equal().
> > 
> 
> While patch is good, shouldn't it go before we introduce those helpers?

Yes, I'll move it to the beginning of the series.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-23  8:41       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Mon, May 22, 2017 at 09:52:27PM +0300, Andy Shevchenko wrote:
> On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> > From: Amir Goldstein <amir73il@gmail.com>
> > 
> > The md private helper uuid_equal() collides with a generic helper
> > of the same name.
> > 
> > Rename the md private helper to md_uuid_equal() and do the same for
> > md_sb_equal().
> > 
> 
> While patch is good, shouldn't it go before we introduce those helpers?

Yes, I'll move it to the beginning of the series.

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

* Re: [PATCH 13/23] md: namespace private helper names
@ 2017-05-23  8:41       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Mon, May 22, 2017 at 09:52:27PM +0300, Andy Shevchenko wrote:
> On Thu, 2017-05-18 at 08:26 +0200, Christoph Hellwig wrote:
> > From: Amir Goldstein <amir73il@gmail.com>
> > 
> > The md private helper uuid_equal() collides with a generic helper
> > of the same name.
> > 
> > Rename the md private helper to md_uuid_equal() and do the same for
> > md_sb_equal().
> > 
> 
> While patch is good, shouldn't it go before we introduce those helpers?

Yes, I'll move it to the beginning of the series.

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23  8:49       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, Steven Whitehouse, David Howells, linux-fsdevel,
	Shaohua Li, Christoph Hellwig

On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> >  	struct afs_call *call = container_of(work, struct afs_call,
> > work);
> > -	struct uuid_v1 *r = call->request;
> > +	uuid_t *r = call->request;
> >  
> >  	struct {
> >  		__be32	match;
> > 
> 
> Just to double check that this doesn't create a union aliasing.

What do you mean with that?
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23  8:49       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Steven Whitehouse,
	David Howells, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Shaohua Li,
	Christoph Hellwig

On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> >  	struct afs_call *call = container_of(work, struct afs_call,
> > work);
> > -	struct uuid_v1 *r = call->request;
> > +	uuid_t *r = call->request;
> >  
> >  	struct {
> >  		__be32	match;
> > 
> 
> Just to double check that this doesn't create a union aliasing.

What do you mean with that?

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23  8:49       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> >  	struct afs_call *call = container_of(work, struct afs_call,
> > work);
> > -	struct uuid_v1 *r = call->request;
> > +	uuid_t *r = call->request;
> >  
> >  	struct {
> >  		__be32	match;
> > 
> 
> Just to double check that this doesn't create a union aliasing.

What do you mean with that?

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23  8:49       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> > �	struct afs_call *call = container_of(work, struct afs_call,
> > work);
> > -	struct uuid_v1 *r = call->request;
> > +	uuid_t *r = call->request;
> > �
> > �	struct {
> > �		__be32	match;
> > 
> 
> Just to double check that this doesn't create a union aliasing.

What do you mean with that?

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23  8:49       ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-23  8:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> >  	struct afs_call *call = container_of(work, struct afs_call,
> > work);
> > -	struct uuid_v1 *r = call->request;
> > +	uuid_t *r = call->request;
> >  
> >  	struct {
> >  		__be32	match;
> > 
> 
> Just to double check that this doesn't create a union aliasing.

What do you mean with that?

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23 13:11         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-23 13:11 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, David Howells, linux-fsdevel, Shaohua Li,
	Steven Whitehouse

On Tue, 2017-05-23 at 10:49 +0200, Christoph Hellwig wrote:
> On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> > >  	struct afs_call *call = container_of(work, struct
> > > afs_call,
> > > work);
> > > -	struct uuid_v1 *r = call->request;
> > > +	uuid_t *r = call->request;
> > >  
> > >  	struct {
> > >  		__be32	match;
> > > 
> > 
> > Just to double check that this doesn't create a union aliasing.
> 
> What do you mean with that?

Since we introduced a union it's possible that we might access the
member which wasn't last modified one. So, my comment is to give an
attention on such possibility and avoid if there is an aliasing
happened.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23 13:11         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-23 13:11 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Shaohua Li,
	Steven Whitehouse

On Tue, 2017-05-23 at 10:49 +0200, Christoph Hellwig wrote:
> On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> > >  	struct afs_call *call = container_of(work, struct
> > > afs_call,
> > > work);
> > > -	struct uuid_v1 *r = call->request;
> > > +	uuid_t *r = call->request;
> > >  
> > >  	struct {
> > >  		__be32	match;
> > > 
> > 
> > Just to double check that this doesn't create a union aliasing.
> 
> What do you mean with that?

Since we introduced a union it's possible that we might access the
member which wasn't last modified one. So, my comment is to give an
attention on such possibility and avoid if there is an aliasing
happened.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23 13:11         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-23 13:11 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Amir Goldstein, linux-fsdevel, Shaohua Li, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel

On Tue, 2017-05-23 at 10:49 +0200, Christoph Hellwig wrote:
> On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> > >  	struct afs_call *call = container_of(work, struct
> > > afs_call,
> > > work);
> > > -	struct uuid_v1 *r = call->request;
> > > +	uuid_t *r = call->request;
> > >  
> > >  	struct {
> > >  		__be32	match;
> > > 
> > 
> > Just to double check that this doesn't create a union aliasing.
> 
> What do you mean with that?

Since we introduced a union it's possible that we might access the
member which wasn't last modified one. So, my comment is to give an
attention on such possibility and avoid if there is an aliasing
happened.

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

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-23 13:11         ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-23 13:11 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Amir Goldstein, linux-fsdevel, Shaohua Li, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel

On Tue, 2017-05-23 at 10:49 +0200, Christoph Hellwig wrote:
> On Mon, May 22, 2017 at 09:49:17PM +0300, Andy Shevchenko wrote:
> > >  	struct afs_call *call = container_of(work, struct
> > > afs_call,
> > > work);
> > > -	struct uuid_v1 *r = call->request;
> > > +	uuid_t *r = call->request;
> > >  
> > >  	struct {
> > >  		__be32	match;
> > > 
> > 
> > Just to double check that this doesn't create a union aliasing.
> 
> What do you mean with that?

Since we introduced a union it's possible that we might access the
member which wasn't last modified one. So, my comment is to give an
attention on such possibility and avoid if there is an aliasing
happened.

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

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:00           ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-25 13:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, Steven Whitehouse, David Howells, linux-fsdevel,
	Shaohua Li, Christoph Hellwig

On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> Since we introduced a union it's possible that we might access the
> member which wasn't last modified one. So, my comment is to give an
> attention on such possibility and avoid if there is an aliasing
> happened.

We do for AFS (and XFS for fs fsid).  My preference would be to
not have the v1 struct defintion but instead provide a few
helpers in uuid.h that use get_unaligned_be* if needed:

	uuid_v1_time_low()
	uuid_v1_time_mid()
	uuid_v1_time_time_hi_and_version()..

>From his previously reply it seems like Dave doesn't like that idea
too much, in which case I suspect moving struct uuid_v1 back into
afs and living with cast in it is the way to go.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:00           ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-25 13:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Steven Whitehouse,
	David Howells, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Shaohua Li,
	Christoph Hellwig

On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> Since we introduced a union it's possible that we might access the
> member which wasn't last modified one. So, my comment is to give an
> attention on such possibility and avoid if there is an aliasing
> happened.

We do for AFS (and XFS for fs fsid).  My preference would be to
not have the v1 struct defintion but instead provide a few
helpers in uuid.h that use get_unaligned_be* if needed:

	uuid_v1_time_low()
	uuid_v1_time_mid()
	uuid_v1_time_time_hi_and_version()..

From his previously reply it seems like Dave doesn't like that idea
too much, in which case I suspect moving struct uuid_v1 back into
afs and living with cast in it is the way to go.

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:00           ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-25 13:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> Since we introduced a union it's possible that we might access the
> member which wasn't last modified one. So, my comment is to give an
> attention on such possibility and avoid if there is an aliasing
> happened.

We do for AFS (and XFS for fs fsid).  My preference would be to
not have the v1 struct defintion but instead provide a few
helpers in uuid.h that use get_unaligned_be* if needed:

	uuid_v1_time_low()
	uuid_v1_time_mid()
	uuid_v1_time_time_hi_and_version()..

>From his previously reply it seems like Dave doesn't like that idea
too much, in which case I suspect moving struct uuid_v1 back into
afs and living with cast in it is the way to go.

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:00           ` Christoph Hellwig
  0 siblings, 0 replies; 188+ messages in thread
From: Christoph Hellwig @ 2017-05-25 13:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Amir Goldstein, linux-fsdevel, Shaohua Li,
	Dan Williams, David Howells, Steven Whitehouse, Mimi Zohar,
	linux-xfs, linux-raid, linux-nvdimm, linux-kernel

On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> Since we introduced a union it's possible that we might access the
> member which wasn't last modified one. So, my comment is to give an
> attention on such possibility and avoid if there is an aliasing
> happened.

We do for AFS (and XFS for fs fsid).  My preference would be to
not have the v1 struct defintion but instead provide a few
helpers in uuid.h that use get_unaligned_be* if needed:

	uuid_v1_time_low()
	uuid_v1_time_mid()
	uuid_v1_time_time_hi_and_version()..

>From his previously reply it seems like Dave doesn't like that idea
too much, in which case I suspect moving struct uuid_v1 back into
afs and living with cast in it is the way to go.

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:29             ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-25 13:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs, linux-raid, linux-nvdimm, Mimi Zohar, Amir Goldstein,
	linux-kernel, David Howells, linux-fsdevel, Shaohua Li,
	Steven Whitehouse

On Thu, 2017-05-25 at 15:00 +0200, Christoph Hellwig wrote:
> On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> > Since we introduced a union it's possible that we might access the
> > member which wasn't last modified one. So, my comment is to give an
> > attention on such possibility and avoid if there is an aliasing
> > happened.
> 
> We do for AFS (and XFS for fs fsid).  My preference would be to
> not have the v1 struct defintion but instead provide a few
> helpers in uuid.h that use get_unaligned_be* if needed:
> 
> 	uuid_v1_time_low()
> 	uuid_v1_time_mid()
> 	uuid_v1_time_time_hi_and_version()..
> 
> From his previously reply it seems like Dave doesn't like that idea
> too much, in which case I suspect moving struct uuid_v1 back into
> afs and living with cast in it is the way to go.

Personally I don't like that union stuff, so, definitely my vote to get
rid of AFS stuff in generic helpers.

OTOH if there will be more users of such API then something like you
proposed would be sufficient without introducing a union.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:29             ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-25 13:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Mimi Zohar, Amir Goldstein,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Howells,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Shaohua Li,
	Steven Whitehouse

On Thu, 2017-05-25 at 15:00 +0200, Christoph Hellwig wrote:
> On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> > Since we introduced a union it's possible that we might access the
> > member which wasn't last modified one. So, my comment is to give an
> > attention on such possibility and avoid if there is an aliasing
> > happened.
> 
> We do for AFS (and XFS for fs fsid).  My preference would be to
> not have the v1 struct defintion but instead provide a few
> helpers in uuid.h that use get_unaligned_be* if needed:
> 
> 	uuid_v1_time_low()
> 	uuid_v1_time_mid()
> 	uuid_v1_time_time_hi_and_version()..
> 
> From his previously reply it seems like Dave doesn't like that idea
> too much, in which case I suspect moving struct uuid_v1 back into
> afs and living with cast in it is the way to go.

Personally I don't like that union stuff, so, definitely my vote to get
rid of AFS stuff in generic helpers.

OTOH if there will be more users of such API then something like you
proposed would be sufficient without introducing a union.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:29             ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-25 13:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Amir Goldstein, linux-fsdevel, Shaohua Li, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-25 at 15:00 +0200, Christoph Hellwig wrote:
> On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> > Since we introduced a union it's possible that we might access the
> > member which wasn't last modified one. So, my comment is to give an
> > attention on such possibility and avoid if there is an aliasing
> > happened.
> 
> We do for AFS (and XFS for fs fsid).  My preference would be to
> not have the v1 struct defintion but instead provide a few
> helpers in uuid.h that use get_unaligned_be* if needed:
> 
> 	uuid_v1_time_low()
> 	uuid_v1_time_mid()
> 	uuid_v1_time_time_hi_and_version()..
> 
> From his previously reply it seems like Dave doesn't like that idea
> too much, in which case I suspect moving struct uuid_v1 back into
> afs and living with cast in it is the way to go.

Personally I don't like that union stuff, so, definitely my vote to get
rid of AFS stuff in generic helpers.

OTOH if there will be more users of such API then something like you
proposed would be sufficient without introducing a union.

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

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

* Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
@ 2017-05-25 13:29             ` Andy Shevchenko
  0 siblings, 0 replies; 188+ messages in thread
From: Andy Shevchenko @ 2017-05-25 13:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Amir Goldstein, linux-fsdevel, Shaohua Li, Dan Williams,
	David Howells, Steven Whitehouse, Mimi Zohar, linux-xfs,
	linux-raid, linux-nvdimm, linux-kernel

On Thu, 2017-05-25 at 15:00 +0200, Christoph Hellwig wrote:
> On Tue, May 23, 2017 at 04:11:39PM +0300, Andy Shevchenko wrote:
> > Since we introduced a union it's possible that we might access the
> > member which wasn't last modified one. So, my comment is to give an
> > attention on such possibility and avoid if there is an aliasing
> > happened.
> 
> We do for AFS (and XFS for fs fsid).  My preference would be to
> not have the v1 struct defintion but instead provide a few
> helpers in uuid.h that use get_unaligned_be* if needed:
> 
> 	uuid_v1_time_low()
> 	uuid_v1_time_mid()
> 	uuid_v1_time_time_hi_and_version()..
> 
> From his previously reply it seems like Dave doesn't like that idea
> too much, in which case I suspect moving struct uuid_v1 back into
> afs and living with cast in it is the way to go.

Personally I don't like that union stuff, so, definitely my vote to get
rid of AFS stuff in generic helpers.

OTOH if there will be more users of such API then something like you
proposed would be sufficient without introducing a union.

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

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

end of thread, other threads:[~2017-05-25 13:31 UTC | newest]

Thread overview: 188+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18  6:26 cleanup UUID types V3 Christoph Hellwig
2017-05-18  6:26 ` Christoph Hellwig
2017-05-18  6:26 ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 13:27   ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
     [not found]   ` <20170518062705.25902-2-hch-jcswGhMUV9g@public.gmane.org>
2017-05-18 23:32     ` Darrick J. Wong
2017-05-18 23:32       ` Darrick J. Wong
2017-05-18  6:26 ` [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 13:27   ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
     [not found]   ` <20170518062705.25902-3-hch-jcswGhMUV9g@public.gmane.org>
2017-05-18 23:34     ` Darrick J. Wong
2017-05-18 23:34       ` Darrick J. Wong
2017-05-18  6:26 ` [PATCH 03/23] uuid: remove uuid_be defintions from the uapi header Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  7:12   ` Joe Perches
2017-05-18  7:12     ` Joe Perches
2017-05-18  7:12     ` Joe Perches
2017-05-18  7:12     ` Joe Perches
2017-05-18  7:13     ` Christoph Hellwig
2017-05-18  7:13       ` Christoph Hellwig
2017-05-18  7:13       ` Christoph Hellwig
2017-05-18  7:13       ` Christoph Hellwig
2017-05-19 10:58     ` David Howells
2017-05-19 10:58       ` David Howells
2017-05-19 10:58       ` David Howells
2017-05-19 10:58       ` David Howells
2017-05-21  6:55       ` Christoph Hellwig
2017-05-21  6:55         ` Christoph Hellwig
2017-05-21  6:55         ` Christoph Hellwig
2017-05-21  6:55         ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 04/23] uuid: rename uuid types Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
     [not found]   ` <20170518062705.25902-5-hch-jcswGhMUV9g@public.gmane.org>
2017-05-18 17:42     ` Darrick J. Wong
2017-05-18 17:42       ` Darrick J. Wong
2017-05-18  6:26 ` [PATCH 05/23] uuid: don't export guid_index and uuid_index Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 06/23] uuid: add the v1 layout to uuid_t Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 07/23] uuid: hoist helpers uuid_equal() and uuid_copy() from xfs Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 10/23] afs: switch to use uuid_t and uuid_gen Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-22 18:49   ` Andy Shevchenko
2017-05-22 18:49     ` Andy Shevchenko
2017-05-22 18:49     ` Andy Shevchenko
2017-05-23  8:49     ` Christoph Hellwig
2017-05-23  8:49       ` Christoph Hellwig
2017-05-23  8:49       ` Christoph Hellwig
2017-05-23  8:49       ` Christoph Hellwig
2017-05-23  8:49       ` Christoph Hellwig
2017-05-23 13:11       ` Andy Shevchenko
2017-05-23 13:11         ` Andy Shevchenko
2017-05-23 13:11         ` Andy Shevchenko
2017-05-23 13:11         ` Andy Shevchenko
2017-05-25 13:00         ` Christoph Hellwig
2017-05-25 13:00           ` Christoph Hellwig
2017-05-25 13:00           ` Christoph Hellwig
2017-05-25 13:00           ` Christoph Hellwig
2017-05-25 13:29           ` Andy Shevchenko
2017-05-25 13:29             ` Andy Shevchenko
2017-05-25 13:29             ` Andy Shevchenko
2017-05-25 13:29             ` Andy Shevchenko
2017-05-18  6:26 ` [PATCH 11/23] uuid: remove struct uuid_v1 Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 13:27   ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
     [not found]   ` <20170518062705.25902-13-hch-jcswGhMUV9g@public.gmane.org>
2017-05-18 23:35     ` Darrick J. Wong
2017-05-18 23:35       ` Darrick J. Wong
2017-05-18  6:26 ` [PATCH 13/23] md: namespace private helper names Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 18:32   ` Shaohua Li
2017-05-18 18:32     ` Shaohua Li
2017-05-18 18:32     ` Shaohua Li
2017-05-18 18:32     ` Shaohua Li
2017-05-22 18:52   ` Andy Shevchenko
2017-05-22 18:52     ` Andy Shevchenko
2017-05-22 18:52     ` Andy Shevchenko
2017-05-22 18:52     ` Andy Shevchenko
2017-05-23  8:41     ` Christoph Hellwig
2017-05-23  8:41       ` Christoph Hellwig
2017-05-23  8:41       ` Christoph Hellwig
2017-05-18  6:26 ` [PATCH 14/23] xfs: use the common helper uuid_is_null() Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 13:27   ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18 13:27     ` Brian Foster
2017-05-18  6:26 ` [PATCH 15/23] block: remove blk_part_pack_uuid Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 23:15   ` Mimi Zohar
2017-05-18 23:15     ` Mimi Zohar
2017-05-18 23:15     ` Mimi Zohar
2017-05-18 23:15     ` Mimi Zohar
2017-05-18  6:26 ` [PATCH 16/23] ima/policy: switch to use uuid_t Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 23:16   ` Mimi Zohar
2017-05-18 23:16     ` Mimi Zohar
2017-05-18 23:16     ` Mimi Zohar
2017-05-18 23:16     ` Mimi Zohar
2017-05-18  6:26 ` [PATCH 17/23] fs: switch ->s_uuid to uuid_t Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18  6:26   ` Christoph Hellwig
2017-05-18 23:17   ` Mimi Zohar
2017-05-18 23:17     ` Mimi Zohar
2017-05-18 23:17     ` Mimi Zohar
2017-05-18 23:17     ` Mimi Zohar
2017-05-18  6:27 ` [PATCH 18/23] overlayfs: use uuid_t instead of uuid_be Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27 ` [PATCH 19/23] partitions/ldm: switch to use uuid_t Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27 ` [PATCH 20/23] sysctl: " Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27 ` [PATCH 21/23] nvme: switch to uuid_t Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27 ` [PATCH 22/23] scsi_debug: " Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27 ` [PATCH 23/23] uuid: remove uuid_be Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  6:27   ` Christoph Hellwig
2017-05-18  7:57   ` Amir Goldstein
2017-05-18  7:57     ` Amir Goldstein
2017-05-18  7:57     ` Amir Goldstein
2017-05-18  7:57     ` Amir Goldstein
2017-05-18  8:56     ` Christoph Hellwig
2017-05-18  8:56       ` Christoph Hellwig
2017-05-18  8:56       ` Christoph Hellwig
2017-05-18  8:56       ` Christoph Hellwig
2017-05-22 18:59       ` Andy Shevchenko
2017-05-22 18:59         ` Andy Shevchenko
2017-05-22 18:59         ` Andy Shevchenko
2017-05-22 18:59         ` 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.