linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: sfrench@us.ibm.com, ffilz@us.ibm.com, agruen@suse.de,
	adilger@sun.com, sandeen@redhat.com, tytso@mit.edu,
	staubach@redhat.com, bfields@citi.umich.edu, jlayton@redhat.com
Cc: aneesh.kumar@linux.vnet.ibm.com, linux-fsdevel@vger.kernel.org,
	nfsv4@linux-nfs.org, linux-ext4@vger.kernel.org
Subject: [PATCH 11/23] richacl: Move the xattr representation to little-endian format
Date: Mon,  1 Feb 2010 11:04:53 +0530	[thread overview]
Message-ID: <1265002505-8387-12-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1265002505-8387-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

Posix acl already use little-endian representation on disk. Move
richacl also to little-endian representation

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/richacl_xattr.c            |   34 +++++++++++++++++-----------------
 include/linux/richacl_xattr.h |   16 ++++++++--------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/fs/richacl_xattr.c b/fs/richacl_xattr.c
index 4c04417..46e966a 100644
--- a/fs/richacl_xattr.c
+++ b/fs/richacl_xattr.c
@@ -34,7 +34,7 @@ richacl_from_xattr(const void *value, size_t size)
 	    (xattr_acl->a_flags & ~ACL4_VALID_FLAGS))
 		return ERR_PTR(-EINVAL);
 
-	count = be16_to_cpu(xattr_acl->a_count);
+	count = le16_to_cpu(xattr_acl->a_count);
 	if (count > ACL4_XATTR_MAX_COUNT)
 		return ERR_PTR(-EINVAL);
 
@@ -43,13 +43,13 @@ richacl_from_xattr(const void *value, size_t size)
 		return ERR_PTR(-ENOMEM);
 
 	acl->a_flags = xattr_acl->a_flags;
-	acl->a_owner_mask = be32_to_cpu(xattr_acl->a_owner_mask);
+	acl->a_owner_mask = le32_to_cpu(xattr_acl->a_owner_mask);
 	if (acl->a_owner_mask & ~ACE4_VALID_MASK)
 		goto fail_einval;
-	acl->a_group_mask = be32_to_cpu(xattr_acl->a_group_mask);
+	acl->a_group_mask = le32_to_cpu(xattr_acl->a_group_mask);
 	if (acl->a_group_mask & ~ACE4_VALID_MASK)
 		goto fail_einval;
-	acl->a_other_mask = be32_to_cpu(xattr_acl->a_other_mask);
+	acl->a_other_mask = le32_to_cpu(xattr_acl->a_other_mask);
 	if (acl->a_other_mask & ~ACE4_VALID_MASK)
 		goto fail_einval;
 
@@ -63,10 +63,10 @@ richacl_from_xattr(const void *value, size_t size)
 		if (!end)
 			goto fail_einval;
 
-		ace->e_type = be16_to_cpu(xattr_ace->e_type);
-		ace->e_flags = be16_to_cpu(xattr_ace->e_flags);
-		ace->e_mask = be32_to_cpu(xattr_ace->e_mask);
-		ace->u.e_id = be32_to_cpu(xattr_ace->e_id);
+		ace->e_type = le16_to_cpu(xattr_ace->e_type);
+		ace->e_flags = le16_to_cpu(xattr_ace->e_flags);
+		ace->e_mask = le32_to_cpu(xattr_ace->e_mask);
+		ace->u.e_id = le32_to_cpu(xattr_ace->e_id);
 
 		if (ace->e_flags & ~ACE4_VALID_FLAGS) {
 			memset(ace, 0, sizeof(struct richace));
@@ -117,26 +117,26 @@ richacl_to_xattr(const struct richacl *acl, void *buffer)
 
 	xattr_acl->a_version = ACL4_XATTR_VERSION;
 	xattr_acl->a_flags = acl->a_flags;
-	xattr_acl->a_count = cpu_to_be16(acl->a_count);
+	xattr_acl->a_count = cpu_to_le16(acl->a_count);
 
-	xattr_acl->a_owner_mask = cpu_to_be32(acl->a_owner_mask);
-	xattr_acl->a_group_mask = cpu_to_be32(acl->a_group_mask);
-	xattr_acl->a_other_mask = cpu_to_be32(acl->a_other_mask);
+	xattr_acl->a_owner_mask = cpu_to_le32(acl->a_owner_mask);
+	xattr_acl->a_group_mask = cpu_to_le32(acl->a_group_mask);
+	xattr_acl->a_other_mask = cpu_to_le32(acl->a_other_mask);
 
 	xattr_ace = (void *)(xattr_acl + 1);
 	richacl_for_each_entry(ace, acl) {
-		xattr_ace->e_type = cpu_to_be16(ace->e_type);
-		xattr_ace->e_flags = cpu_to_be16(ace->e_flags &
+		xattr_ace->e_type = cpu_to_le16(ace->e_type);
+		xattr_ace->e_flags = cpu_to_le16(ace->e_flags &
 			ACE4_VALID_FLAGS);
-		xattr_ace->e_mask = cpu_to_be32(ace->e_mask);
+		xattr_ace->e_mask = cpu_to_le32(ace->e_mask);
 		if (richace_is_unix_id(ace)) {
-			xattr_ace->e_id = cpu_to_be32(ace->u.e_id);
+			xattr_ace->e_id = cpu_to_le32(ace->u.e_id);
 			memset(xattr_ace->e_who, 0, 4);
 			xattr_ace = (void *)xattr_ace->e_who + 4;
 		} else {
 			int sz = ALIGN(strlen(ace->u.e_who) + 1, 4);
 
-			xattr_ace->e_id = cpu_to_be32(-1);
+			xattr_ace->e_id = cpu_to_le32(-1);
 			memset(xattr_ace->e_who + sz - 4, 0, 4);
 			strcpy(xattr_ace->e_who, ace->u.e_who);
 			xattr_ace = (void *)xattr_ace->e_who + sz;
diff --git a/include/linux/richacl_xattr.h b/include/linux/richacl_xattr.h
index 5a75284..de7acf7 100644
--- a/include/linux/richacl_xattr.h
+++ b/include/linux/richacl_xattr.h
@@ -6,20 +6,20 @@
 #define RICHACL_XATTR "system.richacl"
 
 struct richace_xattr {
-	__be16		e_type;
-	__be16		e_flags;
-	__be32		e_mask;
-	__be32		e_id;
+	__le16		e_type;
+	__le16		e_flags;
+	__le32		e_mask;
+	__le32		e_id;
 	char		e_who[0];
 };
 
 struct richacl_xattr {
 	unsigned char	a_version;
 	unsigned char	a_flags;
-	__be16		a_count;
-	__be32		a_owner_mask;
-	__be32		a_group_mask;
-	__be32		a_other_mask;
+	__le16		a_count;
+	__le32		a_owner_mask;
+	__le32		a_group_mask;
+	__le32		a_other_mask;
 };
 
 #define ACL4_XATTR_VERSION	0
-- 
1.7.0.rc0.48.gdace5


  parent reply	other threads:[~2010-02-01  5:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01  5:34 [RFC PATCH] New ACL format for better NFSv4 acl interoperability Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 01/23] vfs: VFS hooks for per-filesystem permission models Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 02/23] vfs: Check for create permission during rename Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 03/23] vfs: rich ACL in-memory representation and manipulation Aneesh Kumar K.V
2010-02-01  7:28   ` Brad Boyer
2010-02-01 18:02     ` Aneesh Kumar K. V
2010-02-01 23:06       ` J. Bruce Fields
2010-02-01 23:21   ` J. Bruce Fields
2010-02-01  5:34 ` [PATCH 04/23] richacl: Add write retention and retention hold access mask Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 05/23] ext4: Implement rich acl for ext4 Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 06/23] vfs: Implement those parts of Automatic Inheritance (AI) which are safe under POSIX Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 07/23] vfs: Add Posix acl to rich acl mapping helpers Aneesh Kumar K.V
2010-02-01 23:18   ` J. Bruce Fields
2010-02-02  5:22     ` Aneesh Kumar K. V
2010-02-01  5:34 ` [PATCH 08/23] vfs: Add a flag to denote posix mapped richacl Aneesh Kumar K.V
2010-02-01 23:18   ` J. Bruce Fields
2010-02-02  5:33     ` Aneesh Kumar K. V
2010-02-02 15:18       ` J. Bruce Fields
2010-02-01  5:34 ` [PATCH 09/23] ext4: Add posix acl to rich acl mapping Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 10/23] richacl: Add separate file and dir acl masks Aneesh Kumar K.V
2010-02-01  5:34 ` Aneesh Kumar K.V [this message]
2010-02-01 23:34   ` [PATCH 11/23] richacl: Move the xattr representation to little-endian format J. Bruce Fields
2010-02-02  5:35     ` Aneesh Kumar K. V
2010-02-01  5:34 ` [PATCH 12/23] richacl: Use directory specific mask values for operation on directories Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 13/23] richacl: Follow nfs4 acl delete definition Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 14/23] richacl: Disable automatic inheritance with posix mapped acls Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 15/23] richacl: Delete posix acl if present on richacl set Aneesh Kumar K.V
2010-02-01  5:34 ` [PATCH 16/23] ext4: Update richacl incompat flag value Aneesh Kumar K.V
2010-02-01 23:41   ` J. Bruce Fields
2010-02-01  5:34 ` [PATCH 17/23] vfs: Add new MS_ACL and MS_RICHACL flag Aneesh Kumar K.V
2010-02-01  5:35 ` [PATCH 18/23] richacl: Add helper function for creating richacl from mode values Aneesh Kumar K.V
2010-02-01  5:35 ` [PATCH 19/23] fs: Use the correct MS_*ACL flags in file system code Aneesh Kumar K.V
2010-02-01  5:35 ` [PATCH 20/23] nfsd: Apply NFSv4acl to posix acl mapping only if MS_POSIXACL is set Aneesh Kumar K.V
2010-02-01  5:35 ` [PATCH 21/23] richacl: Add helpers for NFSv4 acl to richacl conversion Aneesh Kumar K.V
2010-02-01  5:35 ` [PATCH 22/23] nfsd: Add support for reading rich acl from file system Aneesh Kumar K.V
2010-02-01  5:35 ` [PATCH 23/23] nfsd: Add support for saving richacl Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1265002505-8387-12-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=adilger@sun.com \
    --cc=agruen@suse.de \
    --cc=bfields@citi.umich.edu \
    --cc=ffilz@us.ibm.com \
    --cc=jlayton@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=nfsv4@linux-nfs.org \
    --cc=sandeen@redhat.com \
    --cc=sfrench@us.ibm.com \
    --cc=staubach@redhat.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).