USB: usbfs: keep async URBs until the device file is closed
[linux-2.6/mini2440.git] / fs / reiserfs / xattr_security.c
blob056008db13775ccf235b6b2b3822f66efe9fb825
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 static int
10 security_get(struct inode *inode, const char *name, void *buffer, size_t size)
12 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
13 return -EINVAL;
15 if (is_reiserfs_priv_object(inode))
16 return -EPERM;
18 return reiserfs_xattr_get(inode, name, buffer, size);
21 static int
22 security_set(struct inode *inode, const char *name, const void *buffer,
23 size_t size, int flags)
25 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
26 return -EINVAL;
28 if (is_reiserfs_priv_object(inode))
29 return -EPERM;
31 return reiserfs_xattr_set(inode, name, buffer, size, flags);
34 static int security_del(struct inode *inode, const char *name)
36 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
37 return -EINVAL;
39 if (is_reiserfs_priv_object(inode))
40 return -EPERM;
42 return 0;
45 static int
46 security_list(struct inode *inode, const char *name, int namelen, char *out)
48 int len = namelen;
50 if (is_reiserfs_priv_object(inode))
51 return 0;
53 if (out)
54 memcpy(out, name, len);
56 return len;
59 struct reiserfs_xattr_handler security_handler = {
60 .prefix = XATTR_SECURITY_PREFIX,
61 .get = security_get,
62 .set = security_set,
63 .del = security_del,
64 .list = security_list,