diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-17 00:59:06 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-20 21:29:42 -0400 |
commit | c45ac8887e778c4fa2b572c51a94a681a0955d4d (patch) | |
tree | 913d8c72376def5c3c29838273b2ddde49887c81 /fs/reiserfs | |
parent | 82234e61a8fc75599f29026c0805fc0cfe2a6c87 (diff) |
take private bits of reiserfs_xattr.h to fs/reiserfs/xattr.h
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/file.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr.h | 124 | ||||
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_security.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_trusted.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_user.c | 2 |
10 files changed, 133 insertions, 9 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index ace635053a36..e26ee4988e78 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/time.h> | 5 | #include <linux/time.h> |
6 | #include <linux/reiserfs_fs.h> | 6 | #include <linux/reiserfs_fs.h> |
7 | #include <linux/reiserfs_acl.h> | 7 | #include <linux/reiserfs_acl.h> |
8 | #include <linux/reiserfs_xattr.h> | 8 | #include "xattr.h" |
9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
10 | #include <linux/pagemap.h> | 10 | #include <linux/pagemap.h> |
11 | #include <linux/swap.h> | 11 | #include <linux/swap.h> |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 9e8cd5acd79c..894c7316e9c6 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
7 | #include <linux/reiserfs_fs.h> | 7 | #include <linux/reiserfs_fs.h> |
8 | #include <linux/reiserfs_acl.h> | 8 | #include <linux/reiserfs_acl.h> |
9 | #include <linux/reiserfs_xattr.h> | 9 | #include "xattr.h" |
10 | #include <linux/exportfs.h> | 10 | #include <linux/exportfs.h> |
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/highmem.h> | 12 | #include <linux/highmem.h> |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 146378865239..cb67ebf882a9 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/reiserfs_fs.h> | 17 | #include <linux/reiserfs_fs.h> |
18 | #include <linux/reiserfs_acl.h> | 18 | #include <linux/reiserfs_acl.h> |
19 | #include <linux/reiserfs_xattr.h> | 19 | #include "xattr.h" |
20 | #include <linux/quotaops.h> | 20 | #include <linux/quotaops.h> |
21 | 21 | ||
22 | #define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK_MAX) set_nlink(i, 1); } | 22 | #define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK_MAX) set_nlink(i, 1); } |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 208dfd144409..a67fc7d28de5 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
19 | #include <linux/reiserfs_fs.h> | 19 | #include <linux/reiserfs_fs.h> |
20 | #include <linux/reiserfs_acl.h> | 20 | #include <linux/reiserfs_acl.h> |
21 | #include <linux/reiserfs_xattr.h> | 21 | #include "xattr.h" |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
24 | #include <linux/buffer_head.h> | 24 | #include <linux/buffer_head.h> |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index c24deda8a8bc..ead5d8aab440 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include <linux/file.h> | 43 | #include <linux/file.h> |
44 | #include <linux/pagemap.h> | 44 | #include <linux/pagemap.h> |
45 | #include <linux/xattr.h> | 45 | #include <linux/xattr.h> |
46 | #include <linux/reiserfs_xattr.h> | 46 | #include "xattr.h" |
47 | #include <linux/reiserfs_acl.h> | 47 | #include <linux/reiserfs_acl.h> |
48 | #include <asm/uaccess.h> | 48 | #include <asm/uaccess.h> |
49 | #include <net/checksum.h> | 49 | #include <net/checksum.h> |
diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h new file mode 100644 index 000000000000..367c0459db6d --- /dev/null +++ b/fs/reiserfs/xattr.h | |||
@@ -0,0 +1,124 @@ | |||
1 | #include <linux/reiserfs_xattr.h> | ||
2 | #include <linux/init.h> | ||
3 | #include <linux/list.h> | ||
4 | #include <linux/rwsem.h> | ||
5 | #include <linux/reiserfs_fs_i.h> | ||
6 | #include <linux/reiserfs_fs.h> | ||
7 | |||
8 | struct inode; | ||
9 | struct dentry; | ||
10 | struct iattr; | ||
11 | struct super_block; | ||
12 | struct nameidata; | ||
13 | |||
14 | int reiserfs_xattr_register_handlers(void) __init; | ||
15 | void reiserfs_xattr_unregister_handlers(void); | ||
16 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | ||
17 | int reiserfs_lookup_privroot(struct super_block *sb); | ||
18 | int reiserfs_delete_xattrs(struct inode *inode); | ||
19 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | ||
20 | int reiserfs_permission(struct inode *inode, int mask); | ||
21 | |||
22 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
23 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) | ||
24 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, | ||
25 | void *buffer, size_t size); | ||
26 | int reiserfs_setxattr(struct dentry *dentry, const char *name, | ||
27 | const void *value, size_t size, int flags); | ||
28 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | ||
29 | int reiserfs_removexattr(struct dentry *dentry, const char *name); | ||
30 | |||
31 | int reiserfs_xattr_get(struct inode *, const char *, void *, size_t); | ||
32 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); | ||
33 | int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *, | ||
34 | struct inode *, const char *, const void *, | ||
35 | size_t, int); | ||
36 | |||
37 | extern const struct xattr_handler reiserfs_xattr_user_handler; | ||
38 | extern const struct xattr_handler reiserfs_xattr_trusted_handler; | ||
39 | extern const struct xattr_handler reiserfs_xattr_security_handler; | ||
40 | #ifdef CONFIG_REISERFS_FS_SECURITY | ||
41 | int reiserfs_security_init(struct inode *dir, struct inode *inode, | ||
42 | const struct qstr *qstr, | ||
43 | struct reiserfs_security_handle *sec); | ||
44 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
45 | struct inode *inode, | ||
46 | struct reiserfs_security_handle *sec); | ||
47 | void reiserfs_security_free(struct reiserfs_security_handle *sec); | ||
48 | #endif | ||
49 | |||
50 | static inline int reiserfs_xattrs_initialized(struct super_block *sb) | ||
51 | { | ||
52 | return REISERFS_SB(sb)->priv_root != NULL; | ||
53 | } | ||
54 | |||
55 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) | ||
56 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) | ||
57 | { | ||
58 | loff_t ret = 0; | ||
59 | if (reiserfs_file_data_log(inode)) { | ||
60 | ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize); | ||
61 | ret >>= inode->i_sb->s_blocksize_bits; | ||
62 | } | ||
63 | return ret; | ||
64 | } | ||
65 | |||
66 | /* We may have to create up to 3 objects: xattr root, xattr dir, xattr file. | ||
67 | * Let's try to be smart about it. | ||
68 | * xattr root: We cache it. If it's not cached, we may need to create it. | ||
69 | * xattr dir: If anything has been loaded for this inode, we can set a flag | ||
70 | * saying so. | ||
71 | * xattr file: Since we don't cache xattrs, we can't tell. We always include | ||
72 | * blocks for it. | ||
73 | * | ||
74 | * However, since root and dir can be created between calls - YOU MUST SAVE | ||
75 | * THIS VALUE. | ||
76 | */ | ||
77 | static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | ||
78 | { | ||
79 | size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
80 | |||
81 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { | ||
82 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
83 | if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) | ||
84 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
85 | } | ||
86 | |||
87 | return nblocks; | ||
88 | } | ||
89 | |||
90 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
91 | { | ||
92 | init_rwsem(&REISERFS_I(inode)->i_xattr_sem); | ||
93 | } | ||
94 | |||
95 | #else | ||
96 | |||
97 | #define reiserfs_getxattr NULL | ||
98 | #define reiserfs_setxattr NULL | ||
99 | #define reiserfs_listxattr NULL | ||
100 | #define reiserfs_removexattr NULL | ||
101 | |||
102 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
103 | { | ||
104 | } | ||
105 | #endif /* CONFIG_REISERFS_FS_XATTR */ | ||
106 | |||
107 | #ifndef CONFIG_REISERFS_FS_SECURITY | ||
108 | static inline int reiserfs_security_init(struct inode *dir, | ||
109 | struct inode *inode, | ||
110 | const struct qstr *qstr, | ||
111 | struct reiserfs_security_handle *sec) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | static inline int | ||
116 | reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
117 | struct inode *inode, | ||
118 | struct reiserfs_security_handle *sec) | ||
119 | { | ||
120 | return 0; | ||
121 | } | ||
122 | static inline void reiserfs_security_free(struct reiserfs_security_handle *sec) | ||
123 | {} | ||
124 | #endif | ||
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 6da0396e5052..c0a8c519b2e1 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/xattr.h> | 7 | #include <linux/xattr.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/posix_acl_xattr.h> | 9 | #include <linux/posix_acl_xattr.h> |
10 | #include <linux/reiserfs_xattr.h> | 10 | #include "xattr.h" |
11 | #include <linux/reiserfs_acl.h> | 11 | #include <linux/reiserfs_acl.h> |
12 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
13 | 13 | ||
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index 534668fa41be..6104066e44c4 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/pagemap.h> | 4 | #include <linux/pagemap.h> |
5 | #include <linux/xattr.h> | 5 | #include <linux/xattr.h> |
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | #include <linux/reiserfs_xattr.h> | 7 | #include "xattr.h" |
8 | #include <linux/security.h> | 8 | #include <linux/security.h> |
9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
10 | 10 | ||
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c index 9883736ce3ec..f995b258c141 100644 --- a/fs/reiserfs/xattr_trusted.c +++ b/fs/reiserfs/xattr_trusted.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/fs.h> | 4 | #include <linux/fs.h> |
5 | #include <linux/pagemap.h> | 5 | #include <linux/pagemap.h> |
6 | #include <linux/xattr.h> | 6 | #include <linux/xattr.h> |
7 | #include <linux/reiserfs_xattr.h> | 7 | #include "xattr.h" |
8 | #include <asm/uaccess.h> | 8 | #include <asm/uaccess.h> |
9 | 9 | ||
10 | static int | 10 | static int |
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c index 45ae1a00013a..748978db6f03 100644 --- a/fs/reiserfs/xattr_user.c +++ b/fs/reiserfs/xattr_user.c | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <linux/fs.h> | 3 | #include <linux/fs.h> |
4 | #include <linux/pagemap.h> | 4 | #include <linux/pagemap.h> |
5 | #include <linux/xattr.h> | 5 | #include <linux/xattr.h> |
6 | #include <linux/reiserfs_xattr.h> | 6 | #include "xattr.h" |
7 | #include <asm/uaccess.h> | 7 | #include <asm/uaccess.h> |
8 | 8 | ||
9 | static int | 9 | static int |