Commit 290c263bf83cd78e53b1aa3b42165f588163f2be

Authored by Al Viro
1 parent 05fc0790b6

switch jffs2 to inode->i_acl

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 5 changed files with 19 additions and 48 deletions Side-by-side Diff

... ... @@ -158,10 +158,10 @@
158 158  
159 159 static 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 163 spin_lock(&inode->i_lock);
164   - if (*i_acl != JFFS2_ACL_NOT_CACHED)
  164 + if (*i_acl != ACL_NOT_CACHED)
165 165 acl = posix_acl_dup(*i_acl);
166 166 spin_unlock(&inode->i_lock);
167 167 return acl;
... ... @@ -170,7 +170,7 @@
170 170 static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct posix_acl *acl)
171 171 {
172 172 spin_lock(&inode->i_lock);
173   - if (*i_acl != JFFS2_ACL_NOT_CACHED)
  173 + if (*i_acl != ACL_NOT_CACHED)
174 174 posix_acl_release(*i_acl);
175 175 *i_acl = posix_acl_dup(acl);
176 176 spin_unlock(&inode->i_lock);
177 177  
178 178  
... ... @@ -178,21 +178,20 @@
178 178  
179 179 static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
180 180 {
181   - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
182 181 struct posix_acl *acl;
183 182 char *value = NULL;
184 183 int rc, xprefix;
185 184  
186 185 switch (type) {
187 186 case ACL_TYPE_ACCESS:
188   - acl = jffs2_iget_acl(inode, &f->i_acl_access);
189   - if (acl != JFFS2_ACL_NOT_CACHED)
  187 + acl = jffs2_iget_acl(inode, &inode->i_acl);
  188 + if (acl != ACL_NOT_CACHED)
190 189 return acl;
191 190 xprefix = JFFS2_XPREFIX_ACL_ACCESS;
192 191 break;
193 192 case ACL_TYPE_DEFAULT:
194   - acl = jffs2_iget_acl(inode, &f->i_acl_default);
195   - if (acl != JFFS2_ACL_NOT_CACHED)
  193 + acl = jffs2_iget_acl(inode, &inode->i_default_acl);
  194 + if (acl != ACL_NOT_CACHED)
196 195 return acl;
197 196 xprefix = JFFS2_XPREFIX_ACL_DEFAULT;
198 197 break;
199 198  
... ... @@ -218,10 +217,10 @@
218 217 if (!IS_ERR(acl)) {
219 218 switch (type) {
220 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 221 break;
223 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 224 break;
226 225 }
227 226 }
... ... @@ -249,7 +248,6 @@
249 248  
250 249 static 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 251 int rc, xprefix;
254 252  
255 253 if (S_ISLNK(inode->i_mode))
256 254  
... ... @@ -288,10 +286,10 @@
288 286 if (!rc) {
289 287 switch(type) {
290 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 290 break;
293 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 293 break;
296 294 }
297 295 }
298 296  
... ... @@ -321,12 +319,11 @@
321 319  
322 320 int 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 322 struct posix_acl *acl, *clone;
326 323 int rc;
327 324  
328   - f->i_acl_default = NULL;
329   - f->i_acl_access = NULL;
  325 + inode->i_default_acl = NULL;
  326 + inode->i_acl = NULL;
330 327  
331 328 if (S_ISLNK(*i_mode))
332 329 return 0; /* Symlink always has no-ACL */
... ... @@ -339,7 +336,7 @@
339 336 *i_mode &= ~current_umask();
340 337 } else {
341 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 341 clone = posix_acl_clone(acl, GFP_KERNEL);
345 342 if (!clone)
... ... @@ -350,7 +347,7 @@
350 347 return rc;
351 348 }
352 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 352 posix_acl_release(clone);
356 353 }
357 354  
358 355  
359 356  
... ... @@ -359,34 +356,21 @@
359 356  
360 357 int jffs2_init_acl_post(struct inode *inode)
361 358 {
362   - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
363 359 int rc;
364 360  
365   - if (f->i_acl_default) {
366   - rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, f->i_acl_default);
  361 + if (inode->i_default_acl) {
  362 + rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, inode->i_default_acl);
367 363 if (rc)
368 364 return rc;
369 365 }
370 366  
371   - if (f->i_acl_access) {
372   - rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, f->i_acl_access);
  367 + if (inode->i_acl) {
  368 + rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, inode->i_acl);
373 369 if (rc)
374 370 return rc;
375 371 }
376 372  
377 373 return 0;
378   -}
379   -
380   -void 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 374 }
391 375  
392 376 int jffs2_acl_chmod(struct inode *inode)
... ... @@ -26,13 +26,10 @@
26 26  
27 27 #ifdef CONFIG_JFFS2_FS_POSIX_ACL
28 28  
29   -#define JFFS2_ACL_NOT_CACHED ((void *)-1)
30   -
31 29 extern int jffs2_permission(struct inode *, int);
32 30 extern int jffs2_acl_chmod(struct inode *);
33 31 extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *);
34 32 extern int jffs2_init_acl_post(struct inode *);
35   -extern void jffs2_clear_acl(struct jffs2_inode_info *);
36 33  
37 34 extern struct xattr_handler jffs2_acl_access_xattr_handler;
38 35 extern struct xattr_handler jffs2_acl_default_xattr_handler;
... ... @@ -43,7 +40,6 @@
43 40 #define jffs2_acl_chmod(inode) (0)
44 41 #define jffs2_init_acl_pre(dir_i,inode,mode) (0)
45 42 #define jffs2_init_acl_post(inode) (0)
46   -#define jffs2_clear_acl(f)
47 43  
48 44 #endif /* CONFIG_JFFS2_FS_POSIX_ACL */
fs/jffs2/jffs2_fs_i.h
... ... @@ -50,10 +50,6 @@
50 50 uint16_t flags;
51 51 uint8_t usercompr;
52 52 struct inode vfs_inode;
53   -#ifdef CONFIG_JFFS2_FS_POSIX_ACL
54   - struct posix_acl *i_acl_access;
55   - struct posix_acl *i_acl_default;
56   -#endif
57 53 };
58 54  
59 55 #endif /* _JFFS2_FS_I */
... ... @@ -56,10 +56,6 @@
56 56 f->target = NULL;
57 57 f->flags = 0;
58 58 f->usercompr = 0;
59   -#ifdef CONFIG_JFFS2_FS_POSIX_ACL
60   - f->i_acl_access = JFFS2_ACL_NOT_CACHED;
61   - f->i_acl_default = JFFS2_ACL_NOT_CACHED;
62   -#endif
63 59 }
64 60  
65 61  
fs/jffs2/readinode.c
... ... @@ -1424,7 +1424,6 @@
1424 1424 struct jffs2_full_dirent *fd, *fds;
1425 1425 int deleted;
1426 1426  
1427   - jffs2_clear_acl(f);
1428 1427 jffs2_xattr_delete_inode(c, f->inocache);
1429 1428 mutex_lock(&f->sem);
1430 1429 deleted = f->inocache && !f->inocache->pino_nlink;