diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 19 | ||||
-rw-r--r-- | mm/shmem_acl.c | 78 |
2 files changed, 30 insertions, 67 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index adf8033afd52..3cd32c2ea0a0 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2042,27 +2042,28 @@ static const struct inode_operations shmem_symlink_inode_operations = { | |||
2042 | * filesystem level, though. | 2042 | * filesystem level, though. |
2043 | */ | 2043 | */ |
2044 | 2044 | ||
2045 | static size_t shmem_xattr_security_list(struct inode *inode, char *list, | 2045 | static size_t shmem_xattr_security_list(struct dentry *dentry, char *list, |
2046 | size_t list_len, const char *name, | 2046 | size_t list_len, const char *name, |
2047 | size_t name_len) | 2047 | size_t name_len, int handler_flags) |
2048 | { | 2048 | { |
2049 | return security_inode_listsecurity(inode, list, list_len); | 2049 | return security_inode_listsecurity(dentry->d_inode, list, list_len); |
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | static int shmem_xattr_security_get(struct inode *inode, const char *name, | 2052 | static int shmem_xattr_security_get(struct dentry *dentry, const char *name, |
2053 | void *buffer, size_t size) | 2053 | void *buffer, size_t size, int handler_flags) |
2054 | { | 2054 | { |
2055 | if (strcmp(name, "") == 0) | 2055 | if (strcmp(name, "") == 0) |
2056 | return -EINVAL; | 2056 | return -EINVAL; |
2057 | return xattr_getsecurity(inode, name, buffer, size); | 2057 | return xattr_getsecurity(dentry->d_inode, name, buffer, size); |
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | static int shmem_xattr_security_set(struct inode *inode, const char *name, | 2060 | static int shmem_xattr_security_set(struct dentry *dentry, const char *name, |
2061 | const void *value, size_t size, int flags) | 2061 | const void *value, size_t size, int flags, int handler_flags) |
2062 | { | 2062 | { |
2063 | if (strcmp(name, "") == 0) | 2063 | if (strcmp(name, "") == 0) |
2064 | return -EINVAL; | 2064 | return -EINVAL; |
2065 | return security_inode_setsecurity(inode, name, value, size, flags); | 2065 | return security_inode_setsecurity(dentry->d_inode, name, value, |
2066 | size, flags); | ||
2066 | } | 2067 | } |
2067 | 2068 | ||
2068 | static struct xattr_handler shmem_xattr_security_handler = { | 2069 | static struct xattr_handler shmem_xattr_security_handler = { |
diff --git a/mm/shmem_acl.c b/mm/shmem_acl.c index df2c87fdae50..f8d5330ec0d7 100644 --- a/mm/shmem_acl.c +++ b/mm/shmem_acl.c | |||
@@ -63,86 +63,48 @@ struct generic_acl_operations shmem_acl_ops = { | |||
63 | .setacl = shmem_set_acl, | 63 | .setacl = shmem_set_acl, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | /** | ||
67 | * shmem_list_acl_access, shmem_get_acl_access, shmem_set_acl_access, | ||
68 | * shmem_xattr_acl_access_handler - plumbing code to implement the | ||
69 | * system.posix_acl_access xattr using the generic acl functions. | ||
70 | */ | ||
71 | |||
72 | static size_t | 66 | static size_t |
73 | shmem_list_acl_access(struct inode *inode, char *list, size_t list_size, | 67 | shmem_xattr_list_acl(struct dentry *dentry, char *list, size_t list_size, |
74 | const char *name, size_t name_len) | 68 | const char *name, size_t name_len, int type) |
75 | { | 69 | { |
76 | return generic_acl_list(inode, &shmem_acl_ops, ACL_TYPE_ACCESS, | 70 | return generic_acl_list(dentry->d_inode, &shmem_acl_ops, |
77 | list, list_size); | 71 | type, list, list_size); |
78 | } | 72 | } |
79 | 73 | ||
80 | static int | 74 | static int |
81 | shmem_get_acl_access(struct inode *inode, const char *name, void *buffer, | 75 | shmem_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer, |
82 | size_t size) | 76 | size_t size, int type) |
83 | { | 77 | { |
84 | if (strcmp(name, "") != 0) | 78 | if (strcmp(name, "") != 0) |
85 | return -EINVAL; | 79 | return -EINVAL; |
86 | return generic_acl_get(inode, &shmem_acl_ops, ACL_TYPE_ACCESS, buffer, | 80 | return generic_acl_get(dentry->d_inode, &shmem_acl_ops, type, |
87 | size); | 81 | buffer, size); |
88 | } | 82 | } |
89 | 83 | ||
90 | static int | 84 | static int |
91 | shmem_set_acl_access(struct inode *inode, const char *name, const void *value, | 85 | shmem_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, |
92 | size_t size, int flags) | 86 | size_t size, int flags, int type) |
93 | { | 87 | { |
94 | if (strcmp(name, "") != 0) | 88 | if (strcmp(name, "") != 0) |
95 | return -EINVAL; | 89 | return -EINVAL; |
96 | return generic_acl_set(inode, &shmem_acl_ops, ACL_TYPE_ACCESS, value, | 90 | return generic_acl_set(dentry->d_inode, &shmem_acl_ops, type, |
97 | size); | 91 | value, size); |
98 | } | 92 | } |
99 | 93 | ||
100 | struct xattr_handler shmem_xattr_acl_access_handler = { | 94 | struct xattr_handler shmem_xattr_acl_access_handler = { |
101 | .prefix = POSIX_ACL_XATTR_ACCESS, | 95 | .prefix = POSIX_ACL_XATTR_ACCESS, |
102 | .list = shmem_list_acl_access, | 96 | .flags = ACL_TYPE_ACCESS, |
103 | .get = shmem_get_acl_access, | 97 | .list = shmem_xattr_list_acl, |
104 | .set = shmem_set_acl_access, | 98 | .get = shmem_xattr_get_acl, |
99 | .set = shmem_xattr_set_acl, | ||
105 | }; | 100 | }; |
106 | 101 | ||
107 | /** | ||
108 | * shmem_list_acl_default, shmem_get_acl_default, shmem_set_acl_default, | ||
109 | * shmem_xattr_acl_default_handler - plumbing code to implement the | ||
110 | * system.posix_acl_default xattr using the generic acl functions. | ||
111 | */ | ||
112 | |||
113 | static size_t | ||
114 | shmem_list_acl_default(struct inode *inode, char *list, size_t list_size, | ||
115 | const char *name, size_t name_len) | ||
116 | { | ||
117 | return generic_acl_list(inode, &shmem_acl_ops, ACL_TYPE_DEFAULT, | ||
118 | list, list_size); | ||
119 | } | ||
120 | |||
121 | static int | ||
122 | shmem_get_acl_default(struct inode *inode, const char *name, void *buffer, | ||
123 | size_t size) | ||
124 | { | ||
125 | if (strcmp(name, "") != 0) | ||
126 | return -EINVAL; | ||
127 | return generic_acl_get(inode, &shmem_acl_ops, ACL_TYPE_DEFAULT, buffer, | ||
128 | size); | ||
129 | } | ||
130 | |||
131 | static int | ||
132 | shmem_set_acl_default(struct inode *inode, const char *name, const void *value, | ||
133 | size_t size, int flags) | ||
134 | { | ||
135 | if (strcmp(name, "") != 0) | ||
136 | return -EINVAL; | ||
137 | return generic_acl_set(inode, &shmem_acl_ops, ACL_TYPE_DEFAULT, value, | ||
138 | size); | ||
139 | } | ||
140 | |||
141 | struct xattr_handler shmem_xattr_acl_default_handler = { | 102 | struct xattr_handler shmem_xattr_acl_default_handler = { |
142 | .prefix = POSIX_ACL_XATTR_DEFAULT, | 103 | .prefix = POSIX_ACL_XATTR_DEFAULT, |
143 | .list = shmem_list_acl_default, | 104 | .flags = ACL_TYPE_DEFAULT, |
144 | .get = shmem_get_acl_default, | 105 | .list = shmem_xattr_list_acl, |
145 | .set = shmem_set_acl_default, | 106 | .get = shmem_xattr_get_acl, |
107 | .set = shmem_xattr_set_acl, | ||
146 | }; | 108 | }; |
147 | 109 | ||
148 | /** | 110 | /** |