USB: remove broken usb-serial num_endpoints check
[linux-2.6/s3c2410-cpufreq.git] / fs / reiserfs / xattr_user.c
blob073f39364b1136dcd9cbb808f5820b3e5581ff58
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 #define XATTR_USER_PREFIX "user."
15 static int
16 user_get(struct inode *inode, const char *name, void *buffer, size_t size)
19 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
20 return -EINVAL;
21 if (!reiserfs_xattrs_user(inode->i_sb))
22 return -EOPNOTSUPP;
23 return reiserfs_xattr_get(inode, name, buffer, size);
26 static int
27 user_set(struct inode *inode, const char *name, const void *buffer,
28 size_t size, int flags)
31 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
32 return -EINVAL;
34 if (!reiserfs_xattrs_user(inode->i_sb))
35 return -EOPNOTSUPP;
36 return reiserfs_xattr_set(inode, name, buffer, size, flags);
39 static int user_del(struct inode *inode, const char *name)
41 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
42 return -EINVAL;
44 if (!reiserfs_xattrs_user(inode->i_sb))
45 return -EOPNOTSUPP;
46 return 0;
49 static int
50 user_list(struct inode *inode, const char *name, int namelen, char *out)
52 int len = namelen;
53 if (!reiserfs_xattrs_user(inode->i_sb))
54 return 0;
56 if (out)
57 memcpy(out, name, len);
59 return len;
62 struct 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,