diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-15 15:18:43 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-15 15:18:43 -0400 |
commit | 1d4f6404de26df49eb8452f8fdf7672b59f407fc (patch) | |
tree | 9bbc9fdd45f8e9fc5444e8c84f4777a607c13e2b /fs/btrfs/ctree.h | |
parent | 24af03ea5e765d57860c975efcdcd41ec7f63fd9 (diff) |
Btrfs: directory testing code and dir item fixes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index e8a26fd8ea9f..7a3492d5888e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -180,37 +180,6 @@ struct btrfs_root { | |||
180 | #define BTRFS_EXTENT_ITEM_KEY 4 | 180 | #define BTRFS_EXTENT_ITEM_KEY 4 |
181 | #define BTRFS_STRING_ITEM_KEY 5 | 181 | #define BTRFS_STRING_ITEM_KEY 5 |
182 | 182 | ||
183 | static inline u64 btrfs_dir_objectid(struct btrfs_dir_item *d) | ||
184 | { | ||
185 | return le64_to_cpu(d->objectid); | ||
186 | } | ||
187 | |||
188 | static inline void btrfs_set_dir_objectid(struct btrfs_dir_item *d, u64 val) | ||
189 | { | ||
190 | d->objectid = cpu_to_le64(val); | ||
191 | } | ||
192 | |||
193 | static inline u16 btrfs_dir_flags(struct btrfs_dir_item *d) | ||
194 | { | ||
195 | return le16_to_cpu(d->flags); | ||
196 | } | ||
197 | |||
198 | static inline void btrfs_set_dir_flags(struct btrfs_dir_item *d, u16 val) | ||
199 | { | ||
200 | d->flags = cpu_to_le16(val); | ||
201 | } | ||
202 | |||
203 | static inline u8 btrfs_dir_type(struct btrfs_dir_item *d) | ||
204 | { | ||
205 | return d->type; | ||
206 | } | ||
207 | |||
208 | static inline void btrfs_set_dir_type(struct btrfs_dir_item *d, u8 val) | ||
209 | { | ||
210 | d->type = val; | ||
211 | } | ||
212 | |||
213 | |||
214 | static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei) | 183 | static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei) |
215 | { | 184 | { |
216 | return le64_to_cpu(ei->owner); | 185 | return le64_to_cpu(ei->owner); |
@@ -267,6 +236,41 @@ static inline void btrfs_set_item_size(struct btrfs_item *item, u16 val) | |||
267 | item->size = cpu_to_le16(val); | 236 | item->size = cpu_to_le16(val); |
268 | } | 237 | } |
269 | 238 | ||
239 | static inline u64 btrfs_dir_objectid(struct btrfs_dir_item *d) | ||
240 | { | ||
241 | return le64_to_cpu(d->objectid); | ||
242 | } | ||
243 | |||
244 | static inline void btrfs_set_dir_objectid(struct btrfs_dir_item *d, u64 val) | ||
245 | { | ||
246 | d->objectid = cpu_to_le64(val); | ||
247 | } | ||
248 | |||
249 | static inline u16 btrfs_dir_flags(struct btrfs_dir_item *d) | ||
250 | { | ||
251 | return le16_to_cpu(d->flags); | ||
252 | } | ||
253 | |||
254 | static inline void btrfs_set_dir_flags(struct btrfs_dir_item *d, u16 val) | ||
255 | { | ||
256 | d->flags = cpu_to_le16(val); | ||
257 | } | ||
258 | |||
259 | static inline u8 btrfs_dir_type(struct btrfs_dir_item *d) | ||
260 | { | ||
261 | return d->type; | ||
262 | } | ||
263 | |||
264 | static inline void btrfs_set_dir_type(struct btrfs_dir_item *d, u8 val) | ||
265 | { | ||
266 | d->type = val; | ||
267 | } | ||
268 | |||
269 | static inline u32 btrfs_dir_name_len(struct btrfs_item *i) | ||
270 | { | ||
271 | return btrfs_item_size(i) - sizeof(struct btrfs_dir_item); | ||
272 | } | ||
273 | |||
270 | static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu, | 274 | static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu, |
271 | struct btrfs_disk_key *disk) | 275 | struct btrfs_disk_key *disk) |
272 | { | 276 | { |
@@ -506,4 +510,10 @@ int btrfs_update_root(struct btrfs_root *root, struct btrfs_key *key, | |||
506 | struct btrfs_root_item *item); | 510 | struct btrfs_root_item *item); |
507 | int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, | 511 | int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, |
508 | struct btrfs_root_item *item, struct btrfs_key *key); | 512 | struct btrfs_root_item *item, struct btrfs_key *key); |
513 | int btrfs_insert_dir_item(struct btrfs_root *root, char *name, int name_len, | ||
514 | u64 dir, u64 objectid, u8 type); | ||
515 | int btrfs_lookup_dir_item(struct btrfs_root *root, struct btrfs_path *path, | ||
516 | u64 dir, char *name, int name_len, int mod); | ||
517 | int btrfs_match_dir_item_name(struct btrfs_root *root, struct btrfs_path *path, | ||
518 | char *name, int name_len); | ||
509 | #endif | 519 | #endif |