aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_node.h
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-11-01 22:38:42 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 22:38:42 -0500
commita844f4510dce23c07f3923cb42138f5fdd745017 (patch)
treeffb37e9e60f02d5e92bd69bb53b568e1c991c17f /fs/xfs/xfs_dir2_node.h
parent61c1e689fbde7cb50a76262bba190715d86beab6 (diff)
[XFS] Remove xfs_macros.c, xfs_macros.h, rework headers a whole lot.
SGI-PV: 943122 SGI-Modid: xfs-linux:xfs-kern:23901a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_node.h')
-rw-r--r--fs/xfs/xfs_dir2_node.h111
1 files changed, 35 insertions, 76 deletions
diff --git a/fs/xfs/xfs_dir2_node.h b/fs/xfs/xfs_dir2_node.h
index 96db420c7c5c..70fa0797c207 100644
--- a/fs/xfs/xfs_dir2_node.h
+++ b/fs/xfs/xfs_dir2_node.h
@@ -45,10 +45,6 @@ struct xfs_inode;
45struct xfs_trans; 45struct xfs_trans;
46 46
47/* 47/*
48 * Constants.
49 */
50
51/*
52 * Offset of the freespace index. 48 * Offset of the freespace index.
53 */ 49 */
54#define XFS_DIR2_FREE_SPACE 2 50#define XFS_DIR2_FREE_SPACE 2
@@ -58,9 +54,6 @@ struct xfs_trans;
58 54
59#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */ 55#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */
60 56
61/*
62 * Structures.
63 */
64typedef struct xfs_dir2_free_hdr { 57typedef struct xfs_dir2_free_hdr {
65 __uint32_t magic; /* XFS_DIR2_FREE_MAGIC */ 58 __uint32_t magic; /* XFS_DIR2_FREE_MAGIC */
66 __int32_t firstdb; /* db of first entry */ 59 __int32_t firstdb; /* db of first entry */
@@ -73,87 +66,53 @@ typedef struct xfs_dir2_free {
73 xfs_dir2_data_off_t bests[1]; /* best free counts */ 66 xfs_dir2_data_off_t bests[1]; /* best free counts */
74 /* unused entries are -1 */ 67 /* unused entries are -1 */
75} xfs_dir2_free_t; 68} xfs_dir2_free_t;
69
76#define XFS_DIR2_MAX_FREE_BESTS(mp) \ 70#define XFS_DIR2_MAX_FREE_BESTS(mp) \
77 (((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \ 71 (((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \
78 (uint)sizeof(xfs_dir2_data_off_t)) 72 (uint)sizeof(xfs_dir2_data_off_t))
79 73
80/* 74/*
81 * Macros.
82 */
83
84/*
85 * Convert data space db to the corresponding free db. 75 * Convert data space db to the corresponding free db.
86 */ 76 */
87#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDB)
88xfs_dir2_db_t
89xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db);
90#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db) 77#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db)
91#else 78static inline xfs_dir2_db_t
92#define XFS_DIR2_DB_TO_FDB(mp,db) \ 79xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db)
93 (XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp)) 80{
94#endif 81 return (XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp));
82}
95 83
96/* 84/*
97 * Convert data space db to the corresponding index in a free db. 85 * Convert data space db to the corresponding index in a free db.
98 */ 86 */
99#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDINDEX)
100int
101xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db);
102#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db) 87#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db)
103#else 88static inline int
104#define XFS_DIR2_DB_TO_FDINDEX(mp,db) ((db) % XFS_DIR2_MAX_FREE_BESTS(mp)) 89xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)
105#endif 90{
106 91 return ((db) % XFS_DIR2_MAX_FREE_BESTS(mp));
107/* 92}
108 * Functions. 93
109 */ 94extern void xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
110 95 int first, int last);
111extern void 96extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
112 xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp, 97 struct xfs_dabuf *lbp);
113 int first, int last); 98extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count);
114 99extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp,
115extern int 100 struct xfs_da_args *args, int *indexp,
116 xfs_dir2_leaf_to_node(struct xfs_da_args *args, struct xfs_dabuf *lbp); 101 struct xfs_da_state *state);
117 102extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp,
118extern xfs_dahash_t 103 struct xfs_dabuf *leaf2_bp);
119 xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count); 104extern int xfs_dir2_leafn_split(struct xfs_da_state *state,
120 105 struct xfs_da_state_blk *oldblk,
121extern int 106 struct xfs_da_state_blk *newblk);
122 xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp, 107extern int xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
123 struct xfs_da_args *args, int *indexp, 108extern void xfs_dir2_leafn_unbalance(struct xfs_da_state *state,
124 struct xfs_da_state *state); 109 struct xfs_da_state_blk *drop_blk,
125 110 struct xfs_da_state_blk *save_blk);
126extern int 111extern int xfs_dir2_node_addname(struct xfs_da_args *args);
127 xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp, 112extern int xfs_dir2_node_lookup(struct xfs_da_args *args);
128 struct xfs_dabuf *leaf2_bp); 113extern int xfs_dir2_node_removename(struct xfs_da_args *args);
129 114extern int xfs_dir2_node_replace(struct xfs_da_args *args);
130extern int 115extern int xfs_dir2_node_trim_free(struct xfs_da_args *args, xfs_fileoff_t fo,
131 xfs_dir2_leafn_split(struct xfs_da_state *state, 116 int *rvalp);
132 struct xfs_da_state_blk *oldblk,
133 struct xfs_da_state_blk *newblk);
134
135extern int
136 xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
137
138extern void
139 xfs_dir2_leafn_unbalance(struct xfs_da_state *state,
140 struct xfs_da_state_blk *drop_blk,
141 struct xfs_da_state_blk *save_blk);
142
143extern int
144 xfs_dir2_node_addname(struct xfs_da_args *args);
145
146extern int
147 xfs_dir2_node_lookup(struct xfs_da_args *args);
148
149extern int
150 xfs_dir2_node_removename(struct xfs_da_args *args);
151
152extern int
153 xfs_dir2_node_replace(struct xfs_da_args *args);
154
155extern int
156 xfs_dir2_node_trim_free(struct xfs_da_args *args, xfs_fileoff_t fo,
157 int *rvalp);
158 117
159#endif /* __XFS_DIR2_NODE_H__ */ 118#endif /* __XFS_DIR2_NODE_H__ */