diff options
Diffstat (limited to 'fs/jffs2/acl.c')
-rw-r--r-- | fs/jffs2/acl.c | 65 |
1 files changed, 22 insertions, 43 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 7edb62e97419..7cdc3196476a 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -350,8 +350,8 @@ int jffs2_acl_chmod(struct inode *inode) | |||
350 | return rc; | 350 | return rc; |
351 | } | 351 | } |
352 | 352 | ||
353 | static size_t jffs2_acl_access_listxattr(struct inode *inode, char *list, size_t list_size, | 353 | static size_t jffs2_acl_access_listxattr(struct dentry *dentry, char *list, |
354 | const char *name, size_t name_len) | 354 | size_t list_size, const char *name, size_t name_len, int type) |
355 | { | 355 | { |
356 | const int retlen = sizeof(POSIX_ACL_XATTR_ACCESS); | 356 | const int retlen = sizeof(POSIX_ACL_XATTR_ACCESS); |
357 | 357 | ||
@@ -360,8 +360,8 @@ static size_t jffs2_acl_access_listxattr(struct inode *inode, char *list, size_t | |||
360 | return retlen; | 360 | return retlen; |
361 | } | 361 | } |
362 | 362 | ||
363 | static size_t jffs2_acl_default_listxattr(struct inode *inode, char *list, size_t list_size, | 363 | static size_t jffs2_acl_default_listxattr(struct dentry *dentry, char *list, |
364 | const char *name, size_t name_len) | 364 | size_t list_size, const char *name, size_t name_len, int type) |
365 | { | 365 | { |
366 | const int retlen = sizeof(POSIX_ACL_XATTR_DEFAULT); | 366 | const int retlen = sizeof(POSIX_ACL_XATTR_DEFAULT); |
367 | 367 | ||
@@ -370,12 +370,16 @@ static size_t jffs2_acl_default_listxattr(struct inode *inode, char *list, size_ | |||
370 | return retlen; | 370 | return retlen; |
371 | } | 371 | } |
372 | 372 | ||
373 | static int jffs2_acl_getxattr(struct inode *inode, int type, void *buffer, size_t size) | 373 | static int jffs2_acl_getxattr(struct dentry *dentry, const char *name, |
374 | void *buffer, size_t size, int type) | ||
374 | { | 375 | { |
375 | struct posix_acl *acl; | 376 | struct posix_acl *acl; |
376 | int rc; | 377 | int rc; |
377 | 378 | ||
378 | acl = jffs2_get_acl(inode, type); | 379 | if (name[0] != '\0') |
380 | return -EINVAL; | ||
381 | |||
382 | acl = jffs2_get_acl(dentry->d_inode, type); | ||
379 | if (IS_ERR(acl)) | 383 | if (IS_ERR(acl)) |
380 | return PTR_ERR(acl); | 384 | return PTR_ERR(acl); |
381 | if (!acl) | 385 | if (!acl) |
@@ -386,26 +390,15 @@ static int jffs2_acl_getxattr(struct inode *inode, int type, void *buffer, size_ | |||
386 | return rc; | 390 | return rc; |
387 | } | 391 | } |
388 | 392 | ||
389 | static int jffs2_acl_access_getxattr(struct inode *inode, const char *name, void *buffer, size_t size) | 393 | static int jffs2_acl_setxattr(struct dentry *dentry, const char *name, |
390 | { | 394 | const void *value, size_t size, int flags, int type) |
391 | if (name[0] != '\0') | ||
392 | return -EINVAL; | ||
393 | return jffs2_acl_getxattr(inode, ACL_TYPE_ACCESS, buffer, size); | ||
394 | } | ||
395 | |||
396 | static int jffs2_acl_default_getxattr(struct inode *inode, const char *name, void *buffer, size_t size) | ||
397 | { | ||
398 | if (name[0] != '\0') | ||
399 | return -EINVAL; | ||
400 | return jffs2_acl_getxattr(inode, ACL_TYPE_DEFAULT, buffer, size); | ||
401 | } | ||
402 | |||
403 | static int jffs2_acl_setxattr(struct inode *inode, int type, const void *value, size_t size) | ||
404 | { | 395 | { |
405 | struct posix_acl *acl; | 396 | struct posix_acl *acl; |
406 | int rc; | 397 | int rc; |
407 | 398 | ||
408 | if (!is_owner_or_cap(inode)) | 399 | if (name[0] != '\0') |
400 | return -EINVAL; | ||
401 | if (!is_owner_or_cap(dentry->d_inode)) | ||
409 | return -EPERM; | 402 | return -EPERM; |
410 | 403 | ||
411 | if (value) { | 404 | if (value) { |
@@ -420,38 +413,24 @@ static int jffs2_acl_setxattr(struct inode *inode, int type, const void *value, | |||
420 | } else { | 413 | } else { |
421 | acl = NULL; | 414 | acl = NULL; |
422 | } | 415 | } |
423 | rc = jffs2_set_acl(inode, type, acl); | 416 | rc = jffs2_set_acl(dentry->d_inode, type, acl); |
424 | out: | 417 | out: |
425 | posix_acl_release(acl); | 418 | posix_acl_release(acl); |
426 | return rc; | 419 | return rc; |
427 | } | 420 | } |
428 | 421 | ||
429 | static int jffs2_acl_access_setxattr(struct inode *inode, const char *name, | ||
430 | const void *buffer, size_t size, int flags) | ||
431 | { | ||
432 | if (name[0] != '\0') | ||
433 | return -EINVAL; | ||
434 | return jffs2_acl_setxattr(inode, ACL_TYPE_ACCESS, buffer, size); | ||
435 | } | ||
436 | |||
437 | static int jffs2_acl_default_setxattr(struct inode *inode, const char *name, | ||
438 | const void *buffer, size_t size, int flags) | ||
439 | { | ||
440 | if (name[0] != '\0') | ||
441 | return -EINVAL; | ||
442 | return jffs2_acl_setxattr(inode, ACL_TYPE_DEFAULT, buffer, size); | ||
443 | } | ||
444 | |||
445 | struct xattr_handler jffs2_acl_access_xattr_handler = { | 422 | struct xattr_handler jffs2_acl_access_xattr_handler = { |
446 | .prefix = POSIX_ACL_XATTR_ACCESS, | 423 | .prefix = POSIX_ACL_XATTR_ACCESS, |
424 | .flags = ACL_TYPE_DEFAULT, | ||
447 | .list = jffs2_acl_access_listxattr, | 425 | .list = jffs2_acl_access_listxattr, |
448 | .get = jffs2_acl_access_getxattr, | 426 | .get = jffs2_acl_getxattr, |
449 | .set = jffs2_acl_access_setxattr, | 427 | .set = jffs2_acl_setxattr, |
450 | }; | 428 | }; |
451 | 429 | ||
452 | struct xattr_handler jffs2_acl_default_xattr_handler = { | 430 | struct xattr_handler jffs2_acl_default_xattr_handler = { |
453 | .prefix = POSIX_ACL_XATTR_DEFAULT, | 431 | .prefix = POSIX_ACL_XATTR_DEFAULT, |
432 | .flags = ACL_TYPE_DEFAULT, | ||
454 | .list = jffs2_acl_default_listxattr, | 433 | .list = jffs2_acl_default_listxattr, |
455 | .get = jffs2_acl_default_getxattr, | 434 | .get = jffs2_acl_getxattr, |
456 | .set = jffs2_acl_default_setxattr, | 435 | .set = jffs2_acl_setxattr, |
457 | }; | 436 | }; |