aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/acl.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-06-08 19:55:12 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-06-24 08:17:05 -0400
commit290c263bf83cd78e53b1aa3b42165f588163f2be (patch)
tree0a3fccfbdd0acf8880aa6df61ead9ce7fe63ecd7 /fs/jffs2/acl.c
parent05fc0790b6c9c611129f2f712d00b6a8a364e8d2 (diff)
switch jffs2 to inode->i_acl
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/jffs2/acl.c')
-rw-r--r--fs/jffs2/acl.c54
1 files changed, 19 insertions, 35 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 043740dde20c..ac16589ebbd1 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -158,10 +158,10 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
158 158
159static struct posix_acl *jffs2_iget_acl(struct inode *inode, struct posix_acl **i_acl) 159static struct posix_acl *jffs2_iget_acl(struct inode *inode, struct posix_acl **i_acl)
160{ 160{
161 struct posix_acl *acl = JFFS2_ACL_NOT_CACHED; 161 struct posix_acl *acl = ACL_NOT_CACHED;
162 162
163 spin_lock(&inode->i_lock); 163 spin_lock(&inode->i_lock);
164 if (*i_acl != JFFS2_ACL_NOT_CACHED) 164 if (*i_acl != ACL_NOT_CACHED)
165 acl = posix_acl_dup(*i_acl); 165 acl = posix_acl_dup(*i_acl);
166 spin_unlock(&inode->i_lock); 166 spin_unlock(&inode->i_lock);
167 return acl; 167 return acl;
@@ -170,7 +170,7 @@ static struct posix_acl *jffs2_iget_acl(struct inode *inode, struct posix_acl **
170static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct posix_acl *acl) 170static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct posix_acl *acl)
171{ 171{
172 spin_lock(&inode->i_lock); 172 spin_lock(&inode->i_lock);
173 if (*i_acl != JFFS2_ACL_NOT_CACHED) 173 if (*i_acl != ACL_NOT_CACHED)
174 posix_acl_release(*i_acl); 174 posix_acl_release(*i_acl);
175 *i_acl = posix_acl_dup(acl); 175 *i_acl = posix_acl_dup(acl);
176 spin_unlock(&inode->i_lock); 176 spin_unlock(&inode->i_lock);
@@ -178,21 +178,20 @@ static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct
178 178
179static struct posix_acl *jffs2_get_acl(struct inode *inode, int type) 179static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
180{ 180{
181 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
182 struct posix_acl *acl; 181 struct posix_acl *acl;
183 char *value = NULL; 182 char *value = NULL;
184 int rc, xprefix; 183 int rc, xprefix;
185 184
186 switch (type) { 185 switch (type) {
187 case ACL_TYPE_ACCESS: 186 case ACL_TYPE_ACCESS:
188 acl = jffs2_iget_acl(inode, &f->i_acl_access); 187 acl = jffs2_iget_acl(inode, &inode->i_acl);
189 if (acl != JFFS2_ACL_NOT_CACHED) 188 if (acl != ACL_NOT_CACHED)
190 return acl; 189 return acl;
191 xprefix = JFFS2_XPREFIX_ACL_ACCESS; 190 xprefix = JFFS2_XPREFIX_ACL_ACCESS;
192 break; 191 break;
193 case ACL_TYPE_DEFAULT: 192 case ACL_TYPE_DEFAULT:
194 acl = jffs2_iget_acl(inode, &f->i_acl_default); 193 acl = jffs2_iget_acl(inode, &inode->i_default_acl);
195 if (acl != JFFS2_ACL_NOT_CACHED) 194 if (acl != ACL_NOT_CACHED)
196 return acl; 195 return acl;
197 xprefix = JFFS2_XPREFIX_ACL_DEFAULT; 196 xprefix = JFFS2_XPREFIX_ACL_DEFAULT;
198 break; 197 break;
@@ -218,10 +217,10 @@ static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
218 if (!IS_ERR(acl)) { 217 if (!IS_ERR(acl)) {
219 switch (type) { 218 switch (type) {
220 case ACL_TYPE_ACCESS: 219 case ACL_TYPE_ACCESS:
221 jffs2_iset_acl(inode, &f->i_acl_access, acl); 220 jffs2_iset_acl(inode, &inode->i_acl, acl);
222 break; 221 break;
223 case ACL_TYPE_DEFAULT: 222 case ACL_TYPE_DEFAULT:
224 jffs2_iset_acl(inode, &f->i_acl_default, acl); 223 jffs2_iset_acl(inode, &inode->i_default_acl, acl);
225 break; 224 break;
226 } 225 }
227 } 226 }
@@ -249,7 +248,6 @@ static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl *a
249 248
250static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) 249static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
251{ 250{
252 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
253 int rc, xprefix; 251 int rc, xprefix;
254 252
255 if (S_ISLNK(inode->i_mode)) 253 if (S_ISLNK(inode->i_mode))
@@ -288,10 +286,10 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
288 if (!rc) { 286 if (!rc) {
289 switch(type) { 287 switch(type) {
290 case ACL_TYPE_ACCESS: 288 case ACL_TYPE_ACCESS:
291 jffs2_iset_acl(inode, &f->i_acl_access, acl); 289 jffs2_iset_acl(inode, &inode->i_acl, acl);
292 break; 290 break;
293 case ACL_TYPE_DEFAULT: 291 case ACL_TYPE_DEFAULT:
294 jffs2_iset_acl(inode, &f->i_acl_default, acl); 292 jffs2_iset_acl(inode, &inode->i_default_acl, acl);
295 break; 293 break;
296 } 294 }
297 } 295 }
@@ -321,12 +319,11 @@ int jffs2_permission(struct inode *inode, int mask)
321 319
322int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode) 320int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
323{ 321{
324 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
325 struct posix_acl *acl, *clone; 322 struct posix_acl *acl, *clone;
326 int rc; 323 int rc;
327 324
328 f->i_acl_default = NULL; 325 inode->i_default_acl = NULL;
329 f->i_acl_access = NULL; 326 inode->i_acl = NULL;
330 327
331 if (S_ISLNK(*i_mode)) 328 if (S_ISLNK(*i_mode))
332 return 0; /* Symlink always has no-ACL */ 329 return 0; /* Symlink always has no-ACL */
@@ -339,7 +336,7 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
339 *i_mode &= ~current_umask(); 336 *i_mode &= ~current_umask();
340 } else { 337 } else {
341 if (S_ISDIR(*i_mode)) 338 if (S_ISDIR(*i_mode))
342 jffs2_iset_acl(inode, &f->i_acl_default, acl); 339 jffs2_iset_acl(inode, &inode->i_default_acl, acl);
343 340
344 clone = posix_acl_clone(acl, GFP_KERNEL); 341 clone = posix_acl_clone(acl, GFP_KERNEL);
345 if (!clone) 342 if (!clone)
@@ -350,7 +347,7 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
350 return rc; 347 return rc;
351 } 348 }
352 if (rc > 0) 349 if (rc > 0)
353 jffs2_iset_acl(inode, &f->i_acl_access, clone); 350 jffs2_iset_acl(inode, &inode->i_acl, clone);
354 351
355 posix_acl_release(clone); 352 posix_acl_release(clone);
356 } 353 }
@@ -359,17 +356,16 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
359 356
360int jffs2_init_acl_post(struct inode *inode) 357int jffs2_init_acl_post(struct inode *inode)
361{ 358{
362 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
363 int rc; 359 int rc;
364 360
365 if (f->i_acl_default) { 361 if (inode->i_default_acl) {
366 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, f->i_acl_default); 362 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, inode->i_default_acl);
367 if (rc) 363 if (rc)
368 return rc; 364 return rc;
369 } 365 }
370 366
371 if (f->i_acl_access) { 367 if (inode->i_acl) {
372 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, f->i_acl_access); 368 rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, inode->i_acl);
373 if (rc) 369 if (rc)
374 return rc; 370 return rc;
375 } 371 }
@@ -377,18 +373,6 @@ int jffs2_init_acl_post(struct inode *inode)
377 return 0; 373 return 0;
378} 374}
379 375
380void jffs2_clear_acl(struct jffs2_inode_info *f)
381{
382 if (f->i_acl_access && f->i_acl_access != JFFS2_ACL_NOT_CACHED) {
383 posix_acl_release(f->i_acl_access);
384 f->i_acl_access = JFFS2_ACL_NOT_CACHED;
385 }
386 if (f->i_acl_default && f->i_acl_default != JFFS2_ACL_NOT_CACHED) {
387 posix_acl_release(f->i_acl_default);
388 f->i_acl_default = JFFS2_ACL_NOT_CACHED;
389 }
390}
391
392int jffs2_acl_chmod(struct inode *inode) 376int jffs2_acl_chmod(struct inode *inode)
393{ 377{
394 struct posix_acl *acl, *clone; 378 struct posix_acl *acl, *clone;