]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - fs/reiserfs/xattr_user.c
libfs: move EXPORT_SYMBOL for d_alloc_name
[mirror_ubuntu-zesty-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
1da177e4 9static int
bd4c625c 10user_get(struct inode *inode, const char *name, void *buffer, size_t size)
1da177e4
LT
11{
12
bd4c625c
LT
13 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
14 return -EINVAL;
bd4c625c
LT
15 if (!reiserfs_xattrs_user(inode->i_sb))
16 return -EOPNOTSUPP;
bd4c625c 17 return reiserfs_xattr_get(inode, name, buffer, size);
1da177e4
LT
18}
19
20static int
bd4c625c
LT
21user_set(struct inode *inode, const char *name, const void *buffer,
22 size_t size, int flags)
1da177e4 23{
bd4c625c
LT
24 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
25 return -EINVAL;
1da177e4 26
bd4c625c
LT
27 if (!reiserfs_xattrs_user(inode->i_sb))
28 return -EOPNOTSUPP;
bd4c625c 29 return reiserfs_xattr_set(inode, name, buffer, size, flags);
1da177e4
LT
30}
31
48b32a35
JM
32static size_t user_list(struct inode *inode, char *list, size_t list_size,
33 const char *name, size_t name_len)
1da177e4 34{
48b32a35 35 const size_t len = name_len + 1;
1da177e4 36
bd4c625c
LT
37 if (!reiserfs_xattrs_user(inode->i_sb))
38 return 0;
48b32a35
JM
39 if (list && len <= list_size) {
40 memcpy(list, name, name_len);
41 list[name_len] = '\0';
42 }
bd4c625c 43 return len;
1da177e4
LT
44}
45
48b32a35 46struct xattr_handler reiserfs_xattr_user_handler = {
1da177e4
LT
47 .prefix = XATTR_USER_PREFIX,
48 .get = user_get,
49 .set = user_set,
1da177e4
LT
50 .list = user_list,
51};