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


Groups > linux.kernel > #1643848 > unrolled thread

cleanup UUID types V3

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

Back to article view | Back to linux.kernel


Contents

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

Page 2 of 2 — ← Prev page 1 [2]


#1643864 — [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
Message-ID<tIngm-6dz-21@gated-at.bofh.it>
In reply to#1643848
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

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


#1644512 — Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type

FromBrian Foster <bfoster@redhat.com>
Date2017-05-18 15:30 +0200
SubjectRe: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
Message-ID<tItF8-37o-33@gated-at.bofh.it>
In reply to#1643864
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

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


#1644956 — Re: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type

From"Darrick J. Wong" <darrick.wong@oracle.com>
Date2017-05-19 01:40 +0200
SubjectRe: [PATCH 02/23] xfs: use uuid_be to implement the uuid_t type
Message-ID<tIDbs-1ON-1@gated-at.bofh.it>
In reply to#1643864
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

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


#1643866 — [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
Message-ID<tIngm-6dz-23@gated-at.bofh.it>
In reply to#1643848
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

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


#1644513 — Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t

FromBrian Foster <bfoster@redhat.com>
Date2017-05-18 15:30 +0200
SubjectRe: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
Message-ID<tItF8-37o-35@gated-at.bofh.it>
In reply to#1643866
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

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


#1644957 — Re: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t

From"Darrick J. Wong" <darrick.wong@oracle.com>
Date2017-05-19 01:40 +0200
SubjectRe: [PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t
Message-ID<tIDbs-1ON-5@gated-at.bofh.it>
In reply to#1643866
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

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


#1643868 — [PATCH 16/23] ima/policy: switch to use uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 16/23] ima/policy: switch to use uuid_t
Message-ID<tIngm-6dz-29@gated-at.bofh.it>
In reply to#1643848
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

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


#1644949 — Re: [PATCH 16/23] ima/policy: switch to use uuid_t

FromMimi Zohar <zohar@linux.vnet.ibm.com>
Date2017-05-19 01:20 +0200
SubjectRe: [PATCH 16/23] ima/policy: switch to use uuid_t
Message-ID<tICS5-1HW-1@gated-at.bofh.it>
In reply to#1643868
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, " ");
>  	}
> 

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


#1643869 — [PATCH 06/23] uuid: add the v1 layout to uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 06/23] uuid: add the v1 layout to uuid_t
Message-ID<tIngm-6dz-35@gated-at.bofh.it>
In reply to#1643848
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

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


#1643871 — [PATCH 17/23] fs: switch ->s_uuid to uuid_t

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 17/23] fs: switch ->s_uuid to uuid_t
Message-ID<tIngm-6dz-17@gated-at.bofh.it>
In reply to#1643848
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

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


#1644950 — Re: [PATCH 17/23] fs: switch ->s_uuid to uuid_t

FromMimi Zohar <zohar@linux.vnet.ibm.com>
Date2017-05-19 01:20 +0200
SubjectRe: [PATCH 17/23] fs: switch ->s_uuid to uuid_t
Message-ID<tICS5-1HW-3@gated-at.bofh.it>
In reply to#1643871
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;

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


#1643872 — [PATCH 13/23] md: namespace private helper names

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 13/23] md: namespace private helper names
Message-ID<tIngm-6dz-37@gated-at.bofh.it>
In reply to#1643848
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

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


#1644828 — Re: [PATCH 13/23] md: namespace private helper names

FromShaohua Li <shli@kernel.org>
Date2017-05-18 20:40 +0200
SubjectRe: [PATCH 13/23] md: namespace private helper names
Message-ID<tIyv7-6vH-1@gated-at.bofh.it>
In reply to#1643872
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>

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


#1647268 — Re: [PATCH 13/23] md: namespace private helper names

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-05-22 21:00 +0200
SubjectRe: [PATCH 13/23] md: namespace private helper names
Message-ID<tK0IG-R8-13@gated-at.bofh.it>
In reply to#1643872
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

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


#1647815 — Re: [PATCH 13/23] md: namespace private helper names

FromChristoph Hellwig <hch@lst.de>
Date2017-05-23 10:50 +0200
SubjectRe: [PATCH 13/23] md: namespace private helper names
Message-ID<tKdFU-Jg-31@gated-at.bofh.it>
In reply to#1647268
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.

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


#1643873 — [PATCH 10/23] afs: switch to use uuid_t and uuid_gen

FromChristoph Hellwig <hch@lst.de>
Date2017-05-18 08:40 +0200
Subject[PATCH 10/23] afs: switch to use uuid_t and uuid_gen
Message-ID<tIngm-6dz-33@gated-at.bofh.it>
In reply to#1643848
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

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


#1647262 — Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-05-22 20:50 +0200
SubjectRe: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
Message-ID<tK0yZ-NW-15@gated-at.bofh.it>
In reply to#1643873
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

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


#1647853 — Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen

FromChristoph Hellwig <hch@lst.de>
Date2017-05-23 11:00 +0200
SubjectRe: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
Message-ID<tKdPC-N6-69@gated-at.bofh.it>
In reply to#1647262
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?

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


#1648023 — Re: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-05-23 15:20 +0200
SubjectRe: [PATCH 10/23] afs: switch to use uuid_t and uuid_gen
Message-ID<tKhTc-3GR-15@gated-at.bofh.it>
In reply to#1647853
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

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web