[RFC PATCH 7/8] nfsv4: Implement getfacl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
---
 fs/nfs/nfs4pacl.c |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4pacl.c b/fs/nfs/nfs4pacl.c
index 162f4c5..a13a833 100644
--- a/fs/nfs/nfs4pacl.c
+++ b/fs/nfs/nfs4pacl.c
@@ -138,7 +138,22 @@ static size_t nfs4_xattr_list_pacl_default(struct inode *inode, char *list,
 static int nfs4_xattr_get_pacl_default(struct inode *inode, const char *key,
 				void *buf, size_t buflen)
 {
-	return -EOPNOTSUPP;
+	int error = 0;
+	struct posix_acl *acl;
+
+	acl = nfs4_proc_getacl(inode, ACL_TYPE_DEFAULT);
+	if (IS_ERR(acl))
+		return PTR_ERR(acl);
+	else if (acl) {
+		if (acl->a_count == 0)
+			error = -ENODATA;
+		else
+			error = posix_acl_to_xattr(acl, buf, buflen);
+		posix_acl_release(acl);
+	} else
+		error = -ENODATA;
+
+	return error;
 }
 
 static int nfs4_xattr_set_pacl_default(struct inode *inode, const char *key,
@@ -179,7 +194,19 @@ static size_t nfs4_xattr_list_pacl_access(struct inode *inode, char *list,
 static int nfs4_xattr_get_pacl_access(struct inode *inode, const char *key,
 				void *buf, size_t buflen)
 {
-	return -EOPNOTSUPP;
+	int error = 0;
+	struct posix_acl *acl;
+
+	acl = nfs4_proc_getacl(inode, ACL_TYPE_ACCESS);
+	if (IS_ERR(acl))
+		return PTR_ERR(acl);
+	else if (acl) {
+		error = posix_acl_to_xattr(acl, buf, buflen);
+		posix_acl_release(acl);
+	} else
+		error = -ENODATA;
+
+	return error;
 }
 
 static int nfs4_xattr_set_pacl_access(struct inode *inode, const char *key,
-- 
1.6.4.2.253.g0b1fac

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux