xfs: kill struct xfs_dir2_block
[deliverable/linux.git] / fs / xfs / xfs_dir2_block.h
CommitLineData
1da177e4 1/*
7b718769
NS
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
1da177e4 4 *
7b718769
NS
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
1da177e4
LT
7 * published by the Free Software Foundation.
8 *
7b718769
NS
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
1da177e4 13 *
7b718769
NS
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1da177e4
LT
17 */
18#ifndef __XFS_DIR2_BLOCK_H__
19#define __XFS_DIR2_BLOCK_H__
20
21/*
a64b0417
CH
22 * Directory version 2, single block format structures.
23 *
24 * The single block format looks like the following drawing on disk:
25 *
26 * +-------------------------------------------------+
27 * | xfs_dir2_data_hdr_t |
28 * +-------------------------------------------------+
29 * | xfs_dir2_data_entry_t OR xfs_dir2_data_unused_t |
30 * | xfs_dir2_data_entry_t OR xfs_dir2_data_unused_t |
31 * | xfs_dir2_data_entry_t OR xfs_dir2_data_unused_t |
32 * | ... |
33 * +-------------------------------------------------+
34 * | unused space |
35 * +-------------------------------------------------+
36 * | ... |
37 * | xfs_dir2_leaf_entry_t |
38 * | xfs_dir2_leaf_entry_t |
39 * +-------------------------------------------------+
40 * | xfs_dir2_block_tail_t |
41 * +-------------------------------------------------+
42 *
43 * As all the entries are variable size structures the accessors in this
44 * file and xfs_dir2_data.h should be used to iterate over them.
1da177e4 45 */
1da177e4
LT
46struct uio;
47struct xfs_dabuf;
48struct xfs_da_args;
49struct xfs_dir2_data_hdr;
50struct xfs_dir2_leaf_entry;
51struct xfs_inode;
52struct xfs_mount;
53struct xfs_trans;
54
1da177e4
LT
55#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */
56
57typedef struct xfs_dir2_block_tail {
e922fffa
NS
58 __be32 count; /* count of leaf entries */
59 __be32 stale; /* count of stale lf entries */
1da177e4
LT
60} xfs_dir2_block_tail_t;
61
1da177e4
LT
62/*
63 * Pointer to the leaf header embedded in a data block (1-block format)
64 */
a844f451 65static inline xfs_dir2_block_tail_t *
4f6ae1a4 66xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_data_hdr_t *hdr)
a844f451 67{
4f6ae1a4 68 return ((xfs_dir2_block_tail_t *)((char *)hdr + mp->m_dirblksize)) - 1;
a844f451 69}
1da177e4
LT
70
71/*
72 * Pointer to the leaf entries embedded in a data block (1-block format)
73 */
a844f451
NS
74static inline struct xfs_dir2_leaf_entry *
75xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp)
76{
e922fffa 77 return ((struct xfs_dir2_leaf_entry *)btp) - be32_to_cpu(btp->count);
a844f451 78}
1da177e4
LT
79
80/*
81 * Function declarations.
82 */
a844f451 83extern int xfs_dir2_block_addname(struct xfs_da_args *args);
051e7cd4
CH
84extern int xfs_dir2_block_getdents(struct xfs_inode *dp, void *dirent,
85 xfs_off_t *offset, filldir_t filldir);
a844f451
NS
86extern int xfs_dir2_block_lookup(struct xfs_da_args *args);
87extern int xfs_dir2_block_removename(struct xfs_da_args *args);
88extern int xfs_dir2_block_replace(struct xfs_da_args *args);
89extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
90 struct xfs_dabuf *lbp, struct xfs_dabuf *dbp);
91extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
1da177e4
LT
92
93#endif /* __XFS_DIR2_BLOCK_H__ */
This page took 0.540943 seconds and 5 git commands to generate.