aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/acl.c')
-rw-r--r--fs/9p/acl.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 15b679166201..7af425f53bee 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -23,6 +23,7 @@
23#include "acl.h" 23#include "acl.h"
24#include "v9fs.h" 24#include "v9fs.h"
25#include "v9fs_vfs.h" 25#include "v9fs_vfs.h"
26#include "fid.h"
26 27
27static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name) 28static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name)
28{ 29{
@@ -113,16 +114,12 @@ struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
113 114
114} 115}
115 116
116static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl) 117static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
117{ 118{
118 int retval; 119 int retval;
119 char *name; 120 char *name;
120 size_t size; 121 size_t size;
121 void *buffer; 122 void *buffer;
122 struct inode *inode = dentry->d_inode;
123
124 set_cached_acl(inode, type, acl);
125
126 if (!acl) 123 if (!acl)
127 return 0; 124 return 0;
128 125
@@ -144,17 +141,16 @@ static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
144 default: 141 default:
145 BUG(); 142 BUG();
146 } 143 }
147 retval = v9fs_xattr_set(dentry, name, buffer, size, 0); 144 retval = v9fs_fid_xattr_set(fid, name, buffer, size, 0);
148err_free_out: 145err_free_out:
149 kfree(buffer); 146 kfree(buffer);
150 return retval; 147 return retval;
151} 148}
152 149
153int v9fs_acl_chmod(struct dentry *dentry) 150int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
154{ 151{
155 int retval = 0; 152 int retval = 0;
156 struct posix_acl *acl; 153 struct posix_acl *acl;
157 struct inode *inode = dentry->d_inode;
158 154
159 if (S_ISLNK(inode->i_mode)) 155 if (S_ISLNK(inode->i_mode))
160 return -EOPNOTSUPP; 156 return -EOPNOTSUPP;
@@ -163,25 +159,30 @@ int v9fs_acl_chmod(struct dentry *dentry)
163 retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 159 retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
164 if (retval) 160 if (retval)
165 return retval; 161 return retval;
166 retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, acl); 162 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
163 retval = v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
167 posix_acl_release(acl); 164 posix_acl_release(acl);
168 } 165 }
169 return retval; 166 return retval;
170} 167}
171 168
172int v9fs_set_create_acl(struct dentry *dentry, 169int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
173 struct posix_acl **dpacl, struct posix_acl **pacl) 170 struct posix_acl *dacl, struct posix_acl *acl)
174{ 171{
175 if (dentry) { 172 set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl);
176 v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, *dpacl); 173 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
177 v9fs_set_acl(dentry, ACL_TYPE_ACCESS, *pacl); 174 v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl);
178 } 175 v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
179 posix_acl_release(*dpacl);
180 posix_acl_release(*pacl);
181 *dpacl = *pacl = NULL;
182 return 0; 176 return 0;
183} 177}
184 178
179void v9fs_put_acl(struct posix_acl *dacl,
180 struct posix_acl *acl)
181{
182 posix_acl_release(dacl);
183 posix_acl_release(acl);
184}
185
185int v9fs_acl_mode(struct inode *dir, umode_t *modep, 186int v9fs_acl_mode(struct inode *dir, umode_t *modep,
186 struct posix_acl **dpacl, struct posix_acl **pacl) 187 struct posix_acl **dpacl, struct posix_acl **pacl)
187{ 188{