xattr.c (39f60c1ccee72caa0104145b5dbf5d37cce1ea39) xattr.c (facd61053cff100973921d4d45d47cf53c747ec6)
1/*
2 * FUSE: Filesystem in Userspace
3 * Copyright (C) 2001-2016 Miklos Szeredi <miklos@szeredi.hu>
4 *
5 * This program can be distributed under the terms of the GNU GPL.
6 * See the file COPYING.
7 */
8

--- 175 unchanged lines hidden (view full) ---

184{
185 if (fuse_is_bad(inode))
186 return -EIO;
187
188 return fuse_getxattr(inode, name, value, size);
189}
190
191static int fuse_xattr_set(const struct xattr_handler *handler,
1/*
2 * FUSE: Filesystem in Userspace
3 * Copyright (C) 2001-2016 Miklos Szeredi <miklos@szeredi.hu>
4 *
5 * This program can be distributed under the terms of the GNU GPL.
6 * See the file COPYING.
7 */
8

--- 175 unchanged lines hidden (view full) ---

184{
185 if (fuse_is_bad(inode))
186 return -EIO;
187
188 return fuse_getxattr(inode, name, value, size);
189}
190
191static int fuse_xattr_set(const struct xattr_handler *handler,
192 struct mnt_idmap *idmap,
192 struct user_namespace *mnt_userns,
193 struct dentry *dentry, struct inode *inode,
194 const char *name, const void *value, size_t size,
195 int flags)
196{
197 if (fuse_is_bad(inode))
198 return -EIO;
199
200 if (!value)
201 return fuse_removexattr(inode, name);
202
203 return fuse_setxattr(inode, name, value, size, flags, 0);
204}
205
193 struct dentry *dentry, struct inode *inode,
194 const char *name, const void *value, size_t size,
195 int flags)
196{
197 if (fuse_is_bad(inode))
198 return -EIO;
199
200 if (!value)
201 return fuse_removexattr(inode, name);
202
203 return fuse_setxattr(inode, name, value, size, flags, 0);
204}
205
206static bool no_xattr_list(struct dentry *dentry)
207{
208 return false;
209}
210
211static int no_xattr_get(const struct xattr_handler *handler,
212 struct dentry *dentry, struct inode *inode,
213 const char *name, void *value, size_t size)
214{
215 return -EOPNOTSUPP;
216}
217
218static int no_xattr_set(const struct xattr_handler *handler,
219 struct mnt_idmap *idmap,
220 struct dentry *dentry, struct inode *nodee,
221 const char *name, const void *value,
222 size_t size, int flags)
223{
224 return -EOPNOTSUPP;
225}
226
227static const struct xattr_handler fuse_xattr_handler = {
228 .prefix = "",
229 .get = fuse_xattr_get,
230 .set = fuse_xattr_set,
231};
232
233const struct xattr_handler *fuse_xattr_handlers[] = {
234 &fuse_xattr_handler,
235 NULL
236};
206static const struct xattr_handler fuse_xattr_handler = {
207 .prefix = "",
208 .get = fuse_xattr_get,
209 .set = fuse_xattr_set,
210};
211
212const struct xattr_handler *fuse_xattr_handlers[] = {
213 &fuse_xattr_handler,
214 NULL
215};
237
238const struct xattr_handler *fuse_acl_xattr_handlers[] = {
239 &posix_acl_access_xattr_handler,
240 &posix_acl_default_xattr_handler,
241 &fuse_xattr_handler,
242 NULL
243};
244
245static const struct xattr_handler fuse_no_acl_access_xattr_handler = {
246 .name = XATTR_NAME_POSIX_ACL_ACCESS,
247 .flags = ACL_TYPE_ACCESS,
248 .list = no_xattr_list,
249 .get = no_xattr_get,
250 .set = no_xattr_set,
251};
252
253static const struct xattr_handler fuse_no_acl_default_xattr_handler = {
254 .name = XATTR_NAME_POSIX_ACL_DEFAULT,
255 .flags = ACL_TYPE_ACCESS,
256 .list = no_xattr_list,
257 .get = no_xattr_get,
258 .set = no_xattr_set,
259};
260
261const struct xattr_handler *fuse_no_acl_xattr_handlers[] = {
262 &fuse_no_acl_access_xattr_handler,
263 &fuse_no_acl_default_xattr_handler,
264 &fuse_xattr_handler,
265 NULL
266};