aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2012-12-05 10:28:46 -0500
committerTheodore Ts'o <tytso@mit.edu>2012-12-05 10:28:46 -0500
commit879b38257bf2b6fa8406693a3b5b5a0649e7c594 (patch)
tree5677d607180d2136b785e6ed4195555f5d76ff8c /fs
parent152a7b0a808a00601328feba2001cbb2b530f771 (diff)
ext4: export inline xattr functions
The inline data feature will need some inline xattr functions, so export them from fs/ext4/xattr.c so that inline.c can use them. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/xattr.c39
-rw-r--r--fs/ext4/xattr.h58
2 files changed, 64 insertions, 33 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index b1adda1b750..a47dc3883a2 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -61,11 +61,6 @@
61#include "xattr.h" 61#include "xattr.h"
62#include "acl.h" 62#include "acl.h"
63 63
64#define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
65#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
66#define BFIRST(bh) ENTRY(BHDR(bh)+1)
67#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
68
69#ifdef EXT4_XATTR_DEBUG 64#ifdef EXT4_XATTR_DEBUG
70# define ea_idebug(inode, f...) do { \ 65# define ea_idebug(inode, f...) do { \
71 printk(KERN_DEBUG "inode %s:%lu: ", \ 66 printk(KERN_DEBUG "inode %s:%lu: ", \
@@ -312,7 +307,7 @@ cleanup:
312 return error; 307 return error;
313} 308}
314 309
315static int 310int
316ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name, 311ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
317 void *buffer, size_t buffer_size) 312 void *buffer, size_t buffer_size)
318{ 313{
@@ -581,21 +576,6 @@ static size_t ext4_xattr_free_space(struct ext4_xattr_entry *last,
581 return (*min_offs - ((void *)last - base) - sizeof(__u32)); 576 return (*min_offs - ((void *)last - base) - sizeof(__u32));
582} 577}
583 578
584struct ext4_xattr_info {
585 int name_index;
586 const char *name;
587 const void *value;
588 size_t value_len;
589};
590
591struct ext4_xattr_search {
592 struct ext4_xattr_entry *first;
593 void *base;
594 void *end;
595 struct ext4_xattr_entry *here;
596 int not_found;
597};
598
599static int 579static int
600ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s) 580ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
601{ 581{
@@ -949,14 +929,8 @@ bad_block:
949#undef header 929#undef header
950} 930}
951 931
952struct ext4_xattr_ibody_find { 932int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
953 struct ext4_xattr_search s; 933 struct ext4_xattr_ibody_find *is)
954 struct ext4_iloc iloc;
955};
956
957static int
958ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
959 struct ext4_xattr_ibody_find *is)
960{ 934{
961 struct ext4_xattr_ibody_header *header; 935 struct ext4_xattr_ibody_header *header;
962 struct ext4_inode *raw_inode; 936 struct ext4_inode *raw_inode;
@@ -984,10 +958,9 @@ ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
984 return 0; 958 return 0;
985} 959}
986 960
987static int 961int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
988ext4_xattr_ibody_set(handle_t *handle, struct inode *inode, 962 struct ext4_xattr_info *i,
989 struct ext4_xattr_info *i, 963 struct ext4_xattr_ibody_find *is)
990 struct ext4_xattr_ibody_find *is)
991{ 964{
992 struct ext4_xattr_ibody_header *header; 965 struct ext4_xattr_ibody_header *header;
993 struct ext4_xattr_search *s = &is->s; 966 struct ext4_xattr_search *s = &is->s;
diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
index 91f31ca7d9a..40ca7a6f5ee 100644
--- a/fs/ext4/xattr.h
+++ b/fs/ext4/xattr.h
@@ -65,6 +65,32 @@ struct ext4_xattr_entry {
65 EXT4_I(inode)->i_extra_isize)) 65 EXT4_I(inode)->i_extra_isize))
66#define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1)) 66#define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1))
67 67
68#define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
69#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
70#define BFIRST(bh) ENTRY(BHDR(bh)+1)
71#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
72
73
74struct ext4_xattr_info {
75 int name_index;
76 const char *name;
77 const void *value;
78 size_t value_len;
79};
80
81struct ext4_xattr_search {
82 struct ext4_xattr_entry *first;
83 void *base;
84 void *end;
85 struct ext4_xattr_entry *here;
86 int not_found;
87};
88
89struct ext4_xattr_ibody_find {
90 struct ext4_xattr_search s;
91 struct ext4_iloc iloc;
92};
93
68# ifdef CONFIG_EXT4_FS_XATTR 94# ifdef CONFIG_EXT4_FS_XATTR
69 95
70extern const struct xattr_handler ext4_xattr_user_handler; 96extern const struct xattr_handler ext4_xattr_user_handler;
@@ -90,6 +116,15 @@ extern void ext4_exit_xattr(void);
90 116
91extern const struct xattr_handler *ext4_xattr_handlers[]; 117extern const struct xattr_handler *ext4_xattr_handlers[];
92 118
119extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
120 struct ext4_xattr_ibody_find *is);
121extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
122 const char *name,
123 void *buffer, size_t buffer_size);
124extern int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
125 struct ext4_xattr_info *i,
126 struct ext4_xattr_ibody_find *is);
127
93# else /* CONFIG_EXT4_FS_XATTR */ 128# else /* CONFIG_EXT4_FS_XATTR */
94 129
95static inline int 130static inline int
@@ -143,6 +178,29 @@ ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
143 178
144#define ext4_xattr_handlers NULL 179#define ext4_xattr_handlers NULL
145 180
181static inline int
182ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
183 struct ext4_xattr_ibody_find *is)
184{
185 return -EOPNOTSUPP;
186}
187
188static inline int
189ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
190 struct ext4_xattr_info *i,
191 struct ext4_xattr_ibody_find *is)
192{
193 return -EOPNOTSUPP;
194}
195
196static inline int
197ext4_xattr_ibody_get(struct inode *inode, int name_index,
198 const char *name,
199 void *buffer, size_t buffer_size)
200{
201 return -EOPNOTSUPP;
202}
203
146# endif /* CONFIG_EXT4_FS_XATTR */ 204# endif /* CONFIG_EXT4_FS_XATTR */
147 205
148#ifdef CONFIG_EXT4_FS_SECURITY 206#ifdef CONFIG_EXT4_FS_SECURITY