[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / fs / reiserfs / xattr_user.c
blob0772806466a867de2945ecd27fcc9195c9e000ca
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 int error;
21 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
22 return -EINVAL;
24 if (!reiserfs_xattrs_user (inode->i_sb))
25 return -EOPNOTSUPP;
27 error = reiserfs_permission_locked (inode, MAY_READ, NULL);
28 if (error)
29 return error;
31 return reiserfs_xattr_get (inode, name, buffer, size);
34 static int
35 user_set (struct inode *inode, const char *name, const void *buffer,
36 size_t size, int flags)
39 int error;
41 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
42 return -EINVAL;
44 if (!reiserfs_xattrs_user (inode->i_sb))
45 return -EOPNOTSUPP;
47 if (!S_ISREG (inode->i_mode) &&
48 (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX))
49 return -EPERM;
51 error = reiserfs_permission_locked (inode, MAY_WRITE, NULL);
52 if (error)
53 return error;
55 return reiserfs_xattr_set (inode, name, buffer, size, flags);
58 static int
59 user_del (struct inode *inode, const char *name)
61 int error;
63 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
64 return -EINVAL;
66 if (!reiserfs_xattrs_user (inode->i_sb))
67 return -EOPNOTSUPP;
69 if (!S_ISREG (inode->i_mode) &&
70 (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX))
71 return -EPERM;
73 error = reiserfs_permission_locked (inode, MAY_WRITE, NULL);
74 if (error)
75 return error;
77 return 0;
80 static int
81 user_list (struct inode *inode, const char *name, int namelen, char *out)
83 int len = namelen;
84 if (!reiserfs_xattrs_user (inode->i_sb))
85 return 0;
87 if (out)
88 memcpy (out, name, len);
90 return len;
93 struct reiserfs_xattr_handler user_handler = {
94 .prefix = XATTR_USER_PREFIX,
95 .get = user_get,
96 .set = user_set,
97 .del = user_del,
98 .list = user_list,