Commit 879b38257bf2b6fa8406693a3b5b5a0649e7c594

Authored by Tao Ma
Committed by Theodore Ts'o
1 parent 152a7b0a80

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>

Showing 2 changed files with 64 additions and 33 deletions Side-by-side Diff

... ... @@ -61,11 +61,6 @@
61 61 #include "xattr.h"
62 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 64 #ifdef EXT4_XATTR_DEBUG
70 65 # define ea_idebug(inode, f...) do { \
71 66 printk(KERN_DEBUG "inode %s:%lu: ", \
... ... @@ -312,7 +307,7 @@
312 307 return error;
313 308 }
314 309  
315   -static int
  310 +int
316 311 ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
317 312 void *buffer, size_t buffer_size)
318 313 {
... ... @@ -581,21 +576,6 @@
581 576 return (*min_offs - ((void *)last - base) - sizeof(__u32));
582 577 }
583 578  
584   -struct ext4_xattr_info {
585   - int name_index;
586   - const char *name;
587   - const void *value;
588   - size_t value_len;
589   -};
590   -
591   -struct 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   -
599 579 static int
600 580 ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
601 581 {
... ... @@ -949,14 +929,8 @@
949 929 #undef header
950 930 }
951 931  
952   -struct ext4_xattr_ibody_find {
953   - struct ext4_xattr_search s;
954   - struct ext4_iloc iloc;
955   -};
956   -
957   -static int
958   -ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
959   - struct ext4_xattr_ibody_find *is)
  932 +int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
  933 + struct ext4_xattr_ibody_find *is)
960 934 {
961 935 struct ext4_xattr_ibody_header *header;
962 936 struct ext4_inode *raw_inode;
... ... @@ -984,10 +958,9 @@
984 958 return 0;
985 959 }
986 960  
987   -static int
988   -ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
989   - struct ext4_xattr_info *i,
990   - struct ext4_xattr_ibody_find *is)
  961 +int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
  962 + struct ext4_xattr_info *i,
  963 + struct ext4_xattr_ibody_find *is)
991 964 {
992 965 struct ext4_xattr_ibody_header *header;
993 966 struct ext4_xattr_search *s = &is->s;
... ... @@ -65,6 +65,32 @@
65 65 EXT4_I(inode)->i_extra_isize))
66 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 +
  74 +struct ext4_xattr_info {
  75 + int name_index;
  76 + const char *name;
  77 + const void *value;
  78 + size_t value_len;
  79 +};
  80 +
  81 +struct 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 +
  89 +struct ext4_xattr_ibody_find {
  90 + struct ext4_xattr_search s;
  91 + struct ext4_iloc iloc;
  92 +};
  93 +
68 94 # ifdef CONFIG_EXT4_FS_XATTR
69 95  
70 96 extern const struct xattr_handler ext4_xattr_user_handler;
... ... @@ -90,6 +116,15 @@
90 116  
91 117 extern const struct xattr_handler *ext4_xattr_handlers[];
92 118  
  119 +extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
  120 + struct ext4_xattr_ibody_find *is);
  121 +extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
  122 + const char *name,
  123 + void *buffer, size_t buffer_size);
  124 +extern 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 128 # else /* CONFIG_EXT4_FS_XATTR */
94 129  
95 130 static inline int
... ... @@ -142,6 +177,29 @@
142 177 }
143 178  
144 179 #define ext4_xattr_handlers NULL
  180 +
  181 +static inline int
  182 +ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
  183 + struct ext4_xattr_ibody_find *is)
  184 +{
  185 + return -EOPNOTSUPP;
  186 +}
  187 +
  188 +static inline int
  189 +ext4_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 +
  196 +static inline int
  197 +ext4_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 +}
145 203  
146 204 # endif /* CONFIG_EXT4_FS_XATTR */
147 205