diff options
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/acl.c | 65 | ||||
-rw-r--r-- | fs/jffs2/security.c | 18 | ||||
-rw-r--r-- | fs/jffs2/xattr.c | 6 | ||||
-rw-r--r-- | fs/jffs2/xattr_trusted.c | 18 | ||||
-rw-r--r-- | fs/jffs2/xattr_user.c | 18 |
5 files changed, 56 insertions, 69 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 | }; |
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c index 02c39c64ecb3..eaccee058583 100644 --- a/fs/jffs2/security.c +++ b/fs/jffs2/security.c | |||
@@ -44,26 +44,28 @@ int jffs2_init_security(struct inode *inode, struct inode *dir) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | /* ---- XATTR Handler for "security.*" ----------------- */ | 46 | /* ---- XATTR Handler for "security.*" ----------------- */ |
47 | static int jffs2_security_getxattr(struct inode *inode, const char *name, | 47 | static int jffs2_security_getxattr(struct dentry *dentry, const char *name, |
48 | void *buffer, size_t size) | 48 | void *buffer, size_t size, int type) |
49 | { | 49 | { |
50 | if (!strcmp(name, "")) | 50 | if (!strcmp(name, "")) |
51 | return -EINVAL; | 51 | return -EINVAL; |
52 | 52 | ||
53 | return do_jffs2_getxattr(inode, JFFS2_XPREFIX_SECURITY, name, buffer, size); | 53 | return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_SECURITY, |
54 | name, buffer, size); | ||
54 | } | 55 | } |
55 | 56 | ||
56 | static int jffs2_security_setxattr(struct inode *inode, const char *name, const void *buffer, | 57 | static int jffs2_security_setxattr(struct dentry *dentry, const char *name, |
57 | size_t size, int flags) | 58 | const void *buffer, size_t size, int flags, int type) |
58 | { | 59 | { |
59 | if (!strcmp(name, "")) | 60 | if (!strcmp(name, "")) |
60 | return -EINVAL; | 61 | return -EINVAL; |
61 | 62 | ||
62 | return do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY, name, buffer, size, flags); | 63 | return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_SECURITY, |
64 | name, buffer, size, flags); | ||
63 | } | 65 | } |
64 | 66 | ||
65 | static size_t jffs2_security_listxattr(struct inode *inode, char *list, size_t list_size, | 67 | static size_t jffs2_security_listxattr(struct dentry *dentry, char *list, |
66 | const char *name, size_t name_len) | 68 | size_t list_size, const char *name, size_t name_len, int type) |
67 | { | 69 | { |
68 | size_t retlen = XATTR_SECURITY_PREFIX_LEN + name_len + 1; | 70 | size_t retlen = XATTR_SECURITY_PREFIX_LEN + name_len + 1; |
69 | 71 | ||
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 4b107881acd5..9e75c62c85d6 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
@@ -990,9 +990,11 @@ ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
990 | if (!xhandle) | 990 | if (!xhandle) |
991 | continue; | 991 | continue; |
992 | if (buffer) { | 992 | if (buffer) { |
993 | rc = xhandle->list(inode, buffer+len, size-len, xd->xname, xd->name_len); | 993 | rc = xhandle->list(dentry, buffer+len, size-len, |
994 | xd->xname, xd->name_len, xd->flags); | ||
994 | } else { | 995 | } else { |
995 | rc = xhandle->list(inode, NULL, 0, xd->xname, xd->name_len); | 996 | rc = xhandle->list(dentry, NULL, 0, xd->xname, |
997 | xd->name_len, xd->flags); | ||
996 | } | 998 | } |
997 | if (rc < 0) | 999 | if (rc < 0) |
998 | goto out; | 1000 | goto out; |
diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c index 8ec5765ef348..3e5a5e356e05 100644 --- a/fs/jffs2/xattr_trusted.c +++ b/fs/jffs2/xattr_trusted.c | |||
@@ -16,24 +16,26 @@ | |||
16 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
17 | #include "nodelist.h" | 17 | #include "nodelist.h" |
18 | 18 | ||
19 | static int jffs2_trusted_getxattr(struct inode *inode, const char *name, | 19 | static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, |
20 | void *buffer, size_t size) | 20 | void *buffer, size_t size, int type) |
21 | { | 21 | { |
22 | if (!strcmp(name, "")) | 22 | if (!strcmp(name, "")) |
23 | return -EINVAL; | 23 | return -EINVAL; |
24 | return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED, name, buffer, size); | 24 | return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED, |
25 | name, buffer, size); | ||
25 | } | 26 | } |
26 | 27 | ||
27 | static int jffs2_trusted_setxattr(struct inode *inode, const char *name, const void *buffer, | 28 | static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name, |
28 | size_t size, int flags) | 29 | const void *buffer, size_t size, int flags, int type) |
29 | { | 30 | { |
30 | if (!strcmp(name, "")) | 31 | if (!strcmp(name, "")) |
31 | return -EINVAL; | 32 | return -EINVAL; |
32 | return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED, name, buffer, size, flags); | 33 | return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED, |
34 | name, buffer, size, flags); | ||
33 | } | 35 | } |
34 | 36 | ||
35 | static size_t jffs2_trusted_listxattr(struct inode *inode, char *list, size_t list_size, | 37 | static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list, |
36 | const char *name, size_t name_len) | 38 | size_t list_size, const char *name, size_t name_len, int type) |
37 | { | 39 | { |
38 | size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1; | 40 | size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1; |
39 | 41 | ||
diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c index 8bbeab90ada1..8544af67dffe 100644 --- a/fs/jffs2/xattr_user.c +++ b/fs/jffs2/xattr_user.c | |||
@@ -16,24 +16,26 @@ | |||
16 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
17 | #include "nodelist.h" | 17 | #include "nodelist.h" |
18 | 18 | ||
19 | static int jffs2_user_getxattr(struct inode *inode, const char *name, | 19 | static int jffs2_user_getxattr(struct dentry *dentry, const char *name, |
20 | void *buffer, size_t size) | 20 | void *buffer, size_t size, int type) |
21 | { | 21 | { |
22 | if (!strcmp(name, "")) | 22 | if (!strcmp(name, "")) |
23 | return -EINVAL; | 23 | return -EINVAL; |
24 | return do_jffs2_getxattr(inode, JFFS2_XPREFIX_USER, name, buffer, size); | 24 | return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_USER, |
25 | name, buffer, size); | ||
25 | } | 26 | } |
26 | 27 | ||
27 | static int jffs2_user_setxattr(struct inode *inode, const char *name, const void *buffer, | 28 | static int jffs2_user_setxattr(struct dentry *dentry, const char *name, |
28 | size_t size, int flags) | 29 | const void *buffer, size_t size, int flags, int type) |
29 | { | 30 | { |
30 | if (!strcmp(name, "")) | 31 | if (!strcmp(name, "")) |
31 | return -EINVAL; | 32 | return -EINVAL; |
32 | return do_jffs2_setxattr(inode, JFFS2_XPREFIX_USER, name, buffer, size, flags); | 33 | return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_USER, |
34 | name, buffer, size, flags); | ||
33 | } | 35 | } |
34 | 36 | ||
35 | static size_t jffs2_user_listxattr(struct inode *inode, char *list, size_t list_size, | 37 | static size_t jffs2_user_listxattr(struct dentry *dentry, char *list, |
36 | const char *name, size_t name_len) | 38 | size_t list_size, const char *name, size_t name_len, int type) |
37 | { | 39 | { |
38 | size_t retlen = XATTR_USER_PREFIX_LEN + name_len + 1; | 40 | size_t retlen = XATTR_USER_PREFIX_LEN + name_len + 1; |
39 | 41 | ||