diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2010-09-27 14:57:39 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-10-28 10:08:46 -0400 |
commit | 7a4566b0b8fa67c7cd7be9f2969a085920356abb (patch) | |
tree | 172736c4b5447ac02653d0597284bbda4b94bda5 /fs/9p | |
parent | 85ff872d3f4a62d076d698bd1fa15ca2a4d7c100 (diff) |
fs/9p: Add xattr callbacks for POSIX ACL
This patch implement fetching POSIX ACL from the server
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/acl.c | 41 | ||||
-rw-r--r-- | fs/9p/xattr.c | 4 | ||||
-rw-r--r-- | fs/9p/xattr.h | 2 |
3 files changed, 47 insertions, 0 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c index a8c013615a22..4293b4599ff6 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c | |||
@@ -94,3 +94,44 @@ int v9fs_check_acl(struct inode *inode, int mask) | |||
94 | } | 94 | } |
95 | return -EAGAIN; | 95 | return -EAGAIN; |
96 | } | 96 | } |
97 | |||
98 | static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, | ||
99 | void *buffer, size_t size, int type) | ||
100 | { | ||
101 | struct posix_acl *acl; | ||
102 | int error; | ||
103 | |||
104 | if (strcmp(name, "") != 0) | ||
105 | return -EINVAL; | ||
106 | |||
107 | acl = v9fs_get_cached_acl(dentry->d_inode, type); | ||
108 | if (IS_ERR(acl)) | ||
109 | return PTR_ERR(acl); | ||
110 | if (acl == NULL) | ||
111 | return -ENODATA; | ||
112 | error = posix_acl_to_xattr(acl, buffer, size); | ||
113 | posix_acl_release(acl); | ||
114 | |||
115 | return error; | ||
116 | } | ||
117 | |||
118 | static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, | ||
119 | const void *value, size_t size, | ||
120 | int flags, int type) | ||
121 | { | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | const struct xattr_handler v9fs_xattr_acl_access_handler = { | ||
126 | .prefix = POSIX_ACL_XATTR_ACCESS, | ||
127 | .flags = ACL_TYPE_ACCESS, | ||
128 | .get = v9fs_xattr_get_acl, | ||
129 | .set = v9fs_xattr_set_acl, | ||
130 | }; | ||
131 | |||
132 | const struct xattr_handler v9fs_xattr_acl_default_handler = { | ||
133 | .prefix = POSIX_ACL_XATTR_DEFAULT, | ||
134 | .flags = ACL_TYPE_DEFAULT, | ||
135 | .get = v9fs_xattr_get_acl, | ||
136 | .set = v9fs_xattr_set_acl, | ||
137 | }; | ||
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c index 67ac6cfc1a07..43ec7df84336 100644 --- a/fs/9p/xattr.c +++ b/fs/9p/xattr.c | |||
@@ -164,5 +164,9 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
164 | 164 | ||
165 | const struct xattr_handler *v9fs_xattr_handlers[] = { | 165 | const struct xattr_handler *v9fs_xattr_handlers[] = { |
166 | &v9fs_xattr_user_handler, | 166 | &v9fs_xattr_user_handler, |
167 | #ifdef CONFIG_9P_FS_POSIX_ACL | ||
168 | &v9fs_xattr_acl_access_handler, | ||
169 | &v9fs_xattr_acl_default_handler, | ||
170 | #endif | ||
167 | NULL | 171 | NULL |
168 | }; | 172 | }; |
diff --git a/fs/9p/xattr.h b/fs/9p/xattr.h index ec908c693342..eaa837c53bd5 100644 --- a/fs/9p/xattr.h +++ b/fs/9p/xattr.h | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | extern const struct xattr_handler *v9fs_xattr_handlers[]; | 21 | extern const struct xattr_handler *v9fs_xattr_handlers[]; |
22 | extern struct xattr_handler v9fs_xattr_user_handler; | 22 | extern struct xattr_handler v9fs_xattr_user_handler; |
23 | extern const struct xattr_handler v9fs_xattr_acl_access_handler; | ||
24 | extern const struct xattr_handler v9fs_xattr_acl_default_handler; | ||
23 | 25 | ||
24 | extern ssize_t v9fs_fid_xattr_get(struct p9_fid *, const char *, | 26 | extern ssize_t v9fs_fid_xattr_get(struct p9_fid *, const char *, |
25 | void *, size_t); | 27 | void *, size_t); |