fat: cleanup fs/fat/dir.c
[linux-2.6/mini2440.git] / fs / reiserfs / xattr_user.c
blob1384efcb938e078d882587ee9e84e1de10090bb2
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>
9 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
10 # include <linux/reiserfs_acl.h>
11 #endif
13 static int
14 user_get(struct inode *inode, const char *name, void *buffer, size_t size)
17 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
18 return -EINVAL;
19 if (!reiserfs_xattrs_user(inode->i_sb))
20 return -EOPNOTSUPP;
21 return reiserfs_xattr_get(inode, name, buffer, size);
24 static int
25 user_set(struct inode *inode, const char *name, const void *buffer,
26 size_t size, int flags)
29 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
30 return -EINVAL;
32 if (!reiserfs_xattrs_user(inode->i_sb))
33 return -EOPNOTSUPP;
34 return reiserfs_xattr_set(inode, name, buffer, size, flags);
37 static int user_del(struct inode *inode, const char *name)
39 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
40 return -EINVAL;
42 if (!reiserfs_xattrs_user(inode->i_sb))
43 return -EOPNOTSUPP;
44 return 0;
47 static int
48 user_list(struct inode *inode, const char *name, int namelen, char *out)
50 int len = namelen;
51 if (!reiserfs_xattrs_user(inode->i_sb))
52 return 0;
54 if (out)
55 memcpy(out, name, len);
57 return len;
60 struct reiserfs_xattr_handler user_handler = {
61 .prefix = XATTR_USER_PREFIX,
62 .get = user_get,
63 .set = user_set,
64 .del = user_del,
65 .list = user_list,