]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/reiserfs/xattr_user.c
[GFS2] Use ->page_mkwrite() for mmap()
[mirror_ubuntu-bionic-kernel.git] / fs / reiserfs / xattr_user.c
CommitLineData
1da177e4
LT
1#include <linux/reiserfs_fs.h>
2#include <linux/errno.h>
3#include <linux/fs.h>
4#include <linux/pagemap.h>
5#include <linux/xattr.h>
6#include <linux/reiserfs_xattr.h>
7#include <asm/uaccess.h>
8
9#ifdef CONFIG_REISERFS_FS_POSIX_ACL
10# include <linux/reiserfs_acl.h>
11#endif
12
13#define XATTR_USER_PREFIX "user."
14
15static int
bd4c625c 16user_get(struct inode *inode, const char *name, void *buffer, size_t size)
1da177e4
LT
17{
18
bd4c625c
LT
19 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
20 return -EINVAL;
bd4c625c
LT
21 if (!reiserfs_xattrs_user(inode->i_sb))
22 return -EOPNOTSUPP;
bd4c625c 23 return reiserfs_xattr_get(inode, name, buffer, size);
1da177e4
LT
24}
25
26static int
bd4c625c
LT
27user_set(struct inode *inode, const char *name, const void *buffer,
28 size_t size, int flags)
1da177e4
LT
29{
30
bd4c625c
LT
31 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
32 return -EINVAL;
1da177e4 33
bd4c625c
LT
34 if (!reiserfs_xattrs_user(inode->i_sb))
35 return -EOPNOTSUPP;
bd4c625c 36 return reiserfs_xattr_set(inode, name, buffer, size, flags);
1da177e4
LT
37}
38
bd4c625c 39static int user_del(struct inode *inode, const char *name)
1da177e4 40{
bd4c625c
LT
41 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
42 return -EINVAL;
1da177e4 43
bd4c625c
LT
44 if (!reiserfs_xattrs_user(inode->i_sb))
45 return -EOPNOTSUPP;
bd4c625c 46 return 0;
1da177e4
LT
47}
48
49static int
bd4c625c 50user_list(struct inode *inode, const char *name, int namelen, char *out)
1da177e4 51{
bd4c625c
LT
52 int len = namelen;
53 if (!reiserfs_xattrs_user(inode->i_sb))
54 return 0;
1da177e4 55
bd4c625c
LT
56 if (out)
57 memcpy(out, name, len);
1da177e4 58
bd4c625c 59 return len;
1da177e4
LT
60}
61
62struct reiserfs_xattr_handler user_handler = {
63 .prefix = XATTR_USER_PREFIX,
64 .get = user_get,
65 .set = user_set,
66 .del = user_del,
67 .list = user_list,
68};