]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs.h
bump version to 2.2, document changes -- sync shared headers, EVMS stripe
[thirdparty/xfsprogs-dev.git] / libxfs / xfs.h
CommitLineData
2bd0ea18 1/*
0d3e0b37 2 * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
2bd0ea18
NS
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32
33/*
34 * This header is effectively a "namespace multiplexor" for the
35 * user level XFS code. It provides all of the necessary stuff
36 * such that we can build some parts of the XFS kernel code in
37 * user space in a controlled fashion, and translates the names
38 * used in the kernel into the names which libxfs is going to
39 * make available to user tools.
40 *
41 * It should only ever be #include'd by XFS "kernel" code being
42 * compiled in user space.
43 *
44 * Our goals here are to...
45 * o "share" large amounts of complex code between user and
46 * kernel space;
47 * o shield the user tools from changes in the bleeding
48 * edge kernel code, merging source changes when
49 * convenient and not immediately (no symlinks);
50 * o i.e. be able to merge changes to the kernel source back
51 * into the affected user tools in a controlled fashion;
52 * o provide a _minimalist_ life-support system for kernel
53 * code in user land, not the "everything + the kitchen
54 * sink" model which libsim had mutated into;
55 * o allow the kernel code to be completely free of code
56 * specifically there to support the user level build.
57 */
58
59#include <libxfs.h>
60#include <string.h>
61#include <errno.h>
62#include <sys/stat.h>
2bd0ea18
NS
63
64/*
65 * Map XFS kernel routine names to libxfs.h names
66 */
67
68#define xfs_xlatesb libxfs_xlate_sb
69#define xfs_xlate_dinode_core libxfs_xlate_dinode_core
70#define xfs_bmbt_get_all libxfs_bmbt_get_all
71#define xfs_bmbt_get_blockcount libxfs_bmbt_get_blockcount
72#define xfs_bmbt_get_startoff libxfs_bmbt_get_startoff
73#define xfs_da_hashname libxfs_da_hashname
74#define xfs_da_log2_roundup libxfs_da_log2_roundup
75#define xfs_highbit32 libxfs_highbit32
76#define xfs_highbit64 libxfs_highbit64
77#define xfs_attr_leaf_newentsize libxfs_attr_leaf_newentsize
78#define xfs_alloc_compute_maxlevels libxfs_alloc_compute_maxlevels
79#define xfs_bmap_compute_maxlevels libxfs_bmap_compute_maxlevels
80#define xfs_ialloc_compute_maxlevels libxfs_ialloc_compute_maxlevels
81
82#define xfs_dir_init libxfs_dir_init
83#define xfs_dir2_init libxfs_dir2_init
84#define xfs_dir_mount libxfs_dir_mount
85#define xfs_dir2_mount libxfs_dir2_mount
86#define xfs_dir_createname libxfs_dir_createname
87#define xfs_dir2_createname libxfs_dir2_createname
88#define xfs_dir_lookup libxfs_dir_lookup
89#define xfs_dir2_lookup libxfs_dir2_lookup
90#define xfs_dir_replace libxfs_dir_replace
91#define xfs_dir2_replace libxfs_dir2_replace
92#define xfs_dir_removename libxfs_dir_removename
93#define xfs_dir2_removename libxfs_dir2_removename
94#define xfs_dir_bogus_removename libxfs_dir_bogus_removename
95#define xfs_dir2_bogus_removename libxfs_dir2_bogus_removename
96
97#define xfs_mount_common libxfs_mount_common
a33a9e62 98#define xfs_initialize_perag libxfs_initialize_perag
2bd0ea18
NS
99#define xfs_rtmount_init libxfs_rtmount_init
100#define xfs_alloc_fix_freelist libxfs_alloc_fix_freelist
101#define xfs_iread libxfs_iread
102#define xfs_ialloc libxfs_ialloc
103#define xfs_idata_realloc libxfs_idata_realloc
104#define xfs_itobp libxfs_itobp
105#define xfs_ichgtime libxfs_ichgtime
106#define xfs_bmapi libxfs_bmapi
107#define xfs_bmap_finish libxfs_bmap_finish
108#define xfs_bmap_del_free libxfs_bmap_del_free
109#define xfs_bunmapi libxfs_bunmapi
110#define xfs_free_extent libxfs_free_extent
111#define xfs_rtfree_extent libxfs_rtfree_extent
112#define xfs_mod_sb libxfs_mod_sb
113#define xfs_mod_incore_sb libxfs_mod_incore_sb
114
115#define xfs_trans_init libxfs_trans_init
116#define xfs_trans_dup libxfs_trans_dup
117#define xfs_trans_iget libxfs_trans_iget
118#define xfs_trans_ijoin libxfs_trans_ijoin
119#define xfs_trans_ihold libxfs_trans_ihold
120#define xfs_trans_bjoin libxfs_trans_bjoin
121#define xfs_trans_bhold libxfs_trans_bhold
122#define xfs_trans_alloc libxfs_trans_alloc
123#define xfs_trans_commit libxfs_trans_commit
124#define xfs_trans_mod_sb libxfs_trans_mod_sb
125#define xfs_trans_reserve libxfs_trans_reserve
126#define xfs_trans_get_buf libxfs_trans_get_buf
127#define xfs_trans_log_buf libxfs_trans_log_buf
128#define xfs_trans_read_buf libxfs_trans_read_buf
129#define xfs_trans_log_inode libxfs_trans_log_inode
130#define xfs_trans_inode_alloc_buf libxfs_trans_inode_alloc_buf
131#define xfs_trans_brelse libxfs_trans_brelse
132#define xfs_trans_binval libxfs_trans_binval
133
134#define xfs_da_shrink_inode libxfs_da_shrink_inode
135#define xfs_da_grow_inode libxfs_da_grow_inode
136#define xfs_da_brelse libxfs_da_brelse
137#define xfs_da_read_buf libxfs_da_read_buf
138#define xfs_da_get_buf libxfs_da_get_buf
139#define xfs_da_log_buf libxfs_da_log_buf
140#define xfs_da_do_buf libxfs_da_do_buf
141#define xfs_dir2_shrink_inode libxfs_dir2_shrink_inode
142#define xfs_dir2_grow_inode libxfs_dir2_grow_inode
143#define xfs_dir2_isleaf libxfs_dir2_isleaf
144#define xfs_dir2_isblock libxfs_dir2_isblock
145#define xfs_dir2_data_use_free libxfs_dir2_data_use_free
146#define xfs_dir2_data_make_free libxfs_dir2_data_make_free
147#define xfs_dir2_data_log_entry libxfs_dir2_data_log_entry
148#define xfs_dir2_data_log_header libxfs_dir2_data_log_header
149#define xfs_dir2_data_freescan libxfs_dir2_data_freescan
150#define xfs_dir2_free_log_bests libxfs_dir2_free_log_bests
151
152
153/*
154 * Infrastructure to support building kernel XFS code in user space
155 */
156
157/* buffer management */
158#define XFS_BUF_LOCK 0
159#define XFS_BUF_MAPPED 0
160#define XFS_BUF_TRYLOCK 0
161#define XFS_BUF_ISDONE(bp) 0
162#define XFS_BUF_GETERROR(bp) 0
163#define XFS_BUF_DONE(bp) ((void) 0)
164#define XFS_BUF_SET_REF(a,b) ((void) 0)
165#define XFS_BUF_SET_VTYPE(a,b) ((void) 0)
166#define XFS_BUF_SET_VTYPE_REF(a,b,c) ((void) 0)
167#define XFS_BUF_SET_BDSTRAT_FUNC(a,b) ((void) 0)
168#define xfs_baread(a,b,c) ((void) 0) /* no readahead */
169#define xfs_buftrace(x,y) ((void) 0) /* debug only */
170#define xfs_buf_item_log_debug(bip,a,b) ((void) 0) /* debug only */
171#define xfs_validate_extents(e,n,f) ((void) 0) /* debug only */
172#define xfs_buf_relse(bp) libxfs_putbuf(bp)
6d1d29a7
NS
173#define xfs_read_buf(mp,devp,blkno,len,f,bpp) \
174 ( *(bpp) = libxfs_readbuf( *(dev_t*)devp, (blkno), (len), 1), 0 )
2bd0ea18 175
2bd0ea18
NS
176/* transaction management */
177#define xfs_trans_set_sync(tp) ((void) 0)
178#define xfs_trans_agblocks_delta(tp, d) ((void) 0) /* debug only */
179#define xfs_trans_agflist_delta(tp, d) ((void) 0) /* debug only */
180#define xfs_trans_agbtree_delta(tp, d) ((void) 0) /* debug only */
181#define xfs_trans_mod_dquot_byino(tp,ip,f,d) ((void) 0)
182#define xfs_trans_get_block_res(tp) 1
183#define xfs_trans_reserve_blkquota(tp,i,n) 0
184#define xfs_trans_unreserve_blkquota(tp,i,n) ((void) 0)
185#define xfs_trans_unreserve_rtblkquota(tp,i,n) ((void) 0)
186
2bd0ea18 187/* memory management */
9de59d6e
SL
188#define KM_SLEEP 1
189#define KM_SLEEP_IO 2
836f654f
NS
190#define kmem_zone xfs_zone
191#define kmem_zone_t xfs_zone_t
2bd0ea18
NS
192#define kmem_zone_init(a, b) libxfs_zone_init(a, b)
193#define kmem_zone_alloc(z, f) libxfs_zone_zalloc(z)
194#define kmem_zone_zalloc(z, f) libxfs_zone_zalloc(z)
195#define kmem_zone_free(z, p) libxfs_zone_free(z, p)
196#define kmem_realloc(p,sz,u,f) libxfs_realloc(p,sz)
044fe078 197#define kmem_zalloc(size, f) libxfs_malloc(size)
2bd0ea18
NS
198#define kmem_alloc(size, f) libxfs_malloc(size)
199#define kmem_free(p, size) libxfs_free(p)
200
201/* directory management */
202#define xfs_dir2_trace_args(where, args) ((void) 0)
203#define xfs_dir2_trace_args_b(where, args, bp) ((void) 0)
204#define xfs_dir2_trace_args_bb(where, args, lbp, dbp) ((void) 0)
205#define xfs_dir2_trace_args_bibii(where, args, bs, ss, bd, sd, c) ((void) 0)
206#define xfs_dir2_trace_args_db(where, args, db, bp) ((void) 0)
207#define xfs_dir2_trace_args_i(where, args, i) ((void) 0)
208#define xfs_dir2_trace_args_s(where, args, s) ((void) 0)
209#define xfs_dir2_trace_args_sb(where, args, s, bp) ((void) 0)
210#define xfs_dir_shortform_validate_ondisk(a,b) ((void) 0)
211
2bd0ea18
NS
212/* block management */
213#define xfs_bmap_check_extents(ip,w) ((void) 0)
214#define xfs_bmap_trace_delete(f,d,ip,i,c,w) ((void) 0)
215#define xfs_bmap_trace_exlist(f,ip,i,w) ((void) 0)
216#define xfs_bmap_trace_insert(f,d,ip,i,c,r1,r2,w) ((void) 0)
217#define xfs_bmap_trace_post_update(f,d,ip,i,w) ((void) 0)
218#define xfs_bmap_trace_pre_update(f,d,ip,i,w) ((void) 0)
219#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap) ((void) 0)
220#define xfs_bunmap_trace(ip, bno, len, flags, ra) ((void) 0)
221#define XFS_BMBT_TRACE_ARGBI(c,b,i) ((void) 0)
222#define XFS_BMBT_TRACE_ARGBII(c,b,i,j) ((void) 0)
223#define XFS_BMBT_TRACE_ARGFFFI(c,o,b,i,j) ((void) 0)
224#define XFS_BMBT_TRACE_ARGI(c,i) ((void) 0)
225#define XFS_BMBT_TRACE_ARGIFK(c,i,f,k) ((void) 0)
226#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) ((void) 0)
227#define XFS_BMBT_TRACE_ARGIK(c,i,k) ((void) 0)
228#define XFS_BMBT_TRACE_CURSOR(c,s) ((void) 0)
229
3e535bba
NS
230/* space allocation */
231#define xfs_alloc_search_busy(tp,ag,b,len) ((void) 0)
232#define xfs_alloc_mark_busy(tp,ag,b,len) ((void) 0)
2bd0ea18
NS
233
234/* anything else */
188239e6 235typedef __uint32_t uint_t;
2bd0ea18
NS
236typedef __uint32_t inst_t; /* an instruction */
237typedef enum { B_FALSE, B_TRUE } boolean_t;
238typedef struct { dev_t dev; } buftarg_t;
239#define STATIC
5ce1d1f7 240#define ATTR_ROOT 0x0002 /* use attrs in root namespace */
afe9b7a8
MN
241#define ENOATTR ENODATA /* Attribute not found */
242#define EFSCORRUPTED 990 /* Filesystem is corrupted */
2bd0ea18
NS
243#define ktrace_t void
244#define m_ddev_targp m_dev
6d1d29a7 245#define m_rtdev_targp(m)(&(m)->m_rtdev)
9911e5dc 246#define kdev_none(x) (!(x))
2bd0ea18
NS
247#define KERN_WARNING
248#define XFS_ERROR(e) (e)
2bd0ea18
NS
249#define XFS_TEST_ERROR(expr,a,b,c) ( expr )
250#define TRACE_FREE(s,a,b,x,f) ((void) 0)
251#define TRACE_ALLOC(s,a) ((void) 0)
252#define TRACE_MODAGF(a,b,c) ((void) 0)
253#define XFS_FORCED_SHUTDOWN(mp) 0
34317449
NS
254#define XFS_MOUNT_WSYNC 0 /* ignored in userspace */
255#define XFS_MOUNT_NOALIGN 0 /* ignored in userspace */
256#define XFS_MOUNT_32BITINODES 0x1 /* enforce in userspace */
2bd0ea18 257#define XFS_ILOCK_EXCL 0
e56fcdce
NS
258#define down_read(a) ((void) 0)
259#define up_read(a) ((void) 0)
2bd0ea18
NS
260#define mrlock(a,b,c) ((void) 0)
261#define mraccunlock(a) ((void) 0)
262#define mrunlock(a) ((void) 0)
263#define mraccess(a) ((void) 0)
264#define ismrlocked(a,b) 1
3e535bba 265#define spinlock_init(a,b) ((void) 0)
2bd0ea18
NS
266#define ovbcopy(from,to,count) memmove(to,from,count)
267#define __return_address __builtin_return_address(0)
268#define xfs_btree_reada_bufl(m,fsb,c) ((void) 0)
269#define xfs_btree_reada_bufs(m,fsb,c,x) ((void) 0)
270#undef XFS_DIR_SHORTFORM_VALIDATE_ONDISK
271#define XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp,dip) 0
272
5b64e00a
NS
273#if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 95))
274# define xfs_fs_cmn_err(a,b,msg,args...)( fprintf(stderr, msg, ## args) )
275# define printk(msg,args...) ( fprintf(stderr, msg, ## args) )
276#else
277# define xfs_fs_cmn_err(a,b,...) ( fprintf(stderr, __VA_ARGS__) )
278# define printk(...) ( fprintf(stderr, __VA_ARGS__) )
279#endif
280
2bd0ea18
NS
281#define do_mod(a, b) ((a) % (b))
282#define do_div(n,base) ({ \
283 int __res; \
284 __res = ((unsigned long) n) % (unsigned) base; \
285 n = ((unsigned long) n) / (unsigned) base; \
286 __res; })
287
288#include <asm/page.h>
044fe078 289#define NBPP PAGE_SIZE
2bd0ea18
NS
290
291static inline int atomicIncWithWrap(int *a, int b)
292{
293 int r = *a;
294 (*a)++;
295 if (*a == b)
296 *a = 0;
297 return r;
298}
299
300
301/*
302 * Prototypes needed for a clean build
303 */
304
305/* xfs_alloc.c */
306int xfs_alloc_get_freelist (xfs_trans_t *, xfs_buf_t *, xfs_agblock_t *);
307void xfs_alloc_log_agf (xfs_trans_t *, xfs_buf_t *, int);
308int xfs_alloc_put_freelist (xfs_trans_t *, xfs_buf_t *, xfs_buf_t *,
309 xfs_agblock_t);
310int xfs_alloc_read_agf (xfs_mount_t *, xfs_trans_t *, xfs_agnumber_t,
311 int, xfs_buf_t **);
312int xfs_alloc_vextent (xfs_alloc_arg_t *);
313int xfs_alloc_pagf_init (xfs_mount_t *, xfs_trans_t *, xfs_agnumber_t, int);
314int xfs_alloc_ag_vextent_size (xfs_alloc_arg_t *);
315int xfs_alloc_ag_vextent_near (xfs_alloc_arg_t *);
316int xfs_alloc_ag_vextent_exact (xfs_alloc_arg_t *);
317int xfs_alloc_ag_vextent_small (xfs_alloc_arg_t *, xfs_btree_cur_t *,
318 xfs_agblock_t *, xfs_extlen_t *, int *);
319
320/* xfs_ialloc.c */
321int xfs_dialloc (xfs_trans_t *, xfs_ino_t, mode_t, int, xfs_buf_t **,
322 boolean_t *, xfs_ino_t *);
323void xfs_ialloc_log_agi (xfs_trans_t *, xfs_buf_t *, int);
324int xfs_ialloc_read_agi (xfs_mount_t *, xfs_trans_t *, xfs_agnumber_t,
325 xfs_buf_t **);
326int xfs_dilocate (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, xfs_fsblock_t *,
327 int *, int *, uint);
328
329/* xfs_rtalloc.c */
330int xfs_rtfree_extent (xfs_trans_t *, xfs_rtblock_t, xfs_extlen_t);
331int xfs_rtmodify_range (xfs_mount_t *, xfs_trans_t *, xfs_rtblock_t,
332 xfs_extlen_t, int);
333int xfs_rtmodify_summary (xfs_mount_t *, xfs_trans_t *, int,
334 xfs_rtblock_t, int, xfs_buf_t **, xfs_fsblock_t *);
335
336/* xfs_btree.c */
337extern xfs_zone_t *xfs_btree_cur_zone;
338void xfs_btree_check_key (xfs_btnum_t, void *, void *);
339void xfs_btree_check_rec (xfs_btnum_t, void *, void *);
340int xfs_btree_check_lblock (xfs_btree_cur_t *, xfs_btree_lblock_t *,
341 int, xfs_buf_t *);
342int xfs_btree_check_sblock (xfs_btree_cur_t *, xfs_btree_sblock_t *,
343 int, xfs_buf_t *);
344int xfs_btree_check_sptr (xfs_btree_cur_t *, xfs_agblock_t, int);
345int xfs_btree_check_lptr (xfs_btree_cur_t *, xfs_dfsbno_t, int);
346void xfs_btree_del_cursor (xfs_btree_cur_t *, int);
347int xfs_btree_dup_cursor (xfs_btree_cur_t *, xfs_btree_cur_t **);
348int xfs_btree_firstrec (xfs_btree_cur_t *, int);
349xfs_btree_block_t *xfs_btree_get_block (xfs_btree_cur_t *, int, xfs_buf_t **);
350xfs_buf_t *xfs_btree_get_bufs (xfs_mount_t *, xfs_trans_t *, xfs_agnumber_t,
351 xfs_agblock_t, uint);
352xfs_buf_t *xfs_btree_get_bufl (xfs_mount_t *, xfs_trans_t *tp,
353 xfs_fsblock_t, uint);
354xfs_btree_cur_t *xfs_btree_init_cursor (xfs_mount_t *, xfs_trans_t *,
355 xfs_buf_t *, xfs_agnumber_t, xfs_btnum_t,
356 xfs_inode_t *, int);
357int xfs_btree_islastblock (xfs_btree_cur_t *, int);
358int xfs_btree_lastrec (xfs_btree_cur_t *, int);
359void xfs_btree_offsets (__int64_t, const short *, int, int *, int *);
2bd0ea18
NS
360void xfs_btree_setbuf (xfs_btree_cur_t *, int, xfs_buf_t *);
361int xfs_btree_read_bufs (xfs_mount_t *, xfs_trans_t *, xfs_agnumber_t,
362 xfs_agblock_t, uint, xfs_buf_t **, int);
363int xfs_btree_read_bufl (xfs_mount_t *, xfs_trans_t *, xfs_fsblock_t,
364 uint, xfs_buf_t **, int);
60ca9704
NS
365int xfs_btree_readahead_core (xfs_btree_cur_t *, int, int);
366static inline int xfs_btree_readahead (xfs_btree_cur_t *cur, int lev, int lr)
367{
368 if ((cur->bc_ra[lev] | lr) == cur->bc_ra[lev])
369 return 0;
370 return xfs_btree_readahead_core(cur, lev, lr);
371}
372
2bd0ea18
NS
373
374/* xfs_inode.c */
375int xfs_ialloc (xfs_trans_t *, xfs_inode_t *, mode_t, nlink_t, dev_t, cred_t *,
376 xfs_prid_t, int, xfs_buf_t **, boolean_t *, xfs_inode_t **);
377int xfs_iread_extents (xfs_trans_t *, xfs_inode_t *, int);
378int xfs_imap (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, xfs_imap_t *, uint);
379int xfs_iextents_copy (xfs_inode_t *, xfs_bmbt_rec_32_t *, int);
380int xfs_iflush_int (xfs_inode_t *, xfs_buf_t *);
381int xfs_iflush_fork (xfs_inode_t *, xfs_dinode_t *, xfs_inode_log_item_t *,
382 int, xfs_buf_t *);
2f8883de
NS
383int xfs_iformat_local (xfs_inode_t *, xfs_dinode_t *, int, int);
384int xfs_iformat_extents (xfs_inode_t *, xfs_dinode_t *, int);
385int xfs_iformat_btree (xfs_inode_t *, xfs_dinode_t *, int);
2bd0ea18
NS
386void xfs_iroot_realloc (xfs_inode_t *, int, int);
387void xfs_idata_realloc (xfs_inode_t *, int, int);
388void xfs_iext_realloc (xfs_inode_t *, int, int);
389void xfs_idestroy_fork (xfs_inode_t *, int);
390uint xfs_iroundup (uint);
391
392/* xfs_bmap.c */
393xfs_bmbt_rec_t *xfs_bmap_search_extents (xfs_inode_t *ip,
394 xfs_fileoff_t, int, int *, xfs_extnum_t *,
395 xfs_bmbt_irec_t *, xfs_bmbt_irec_t *);
396int xfs_bmap_read_extents (xfs_trans_t *, xfs_inode_t *, int);
397void xfs_bmap_add_free (xfs_fsblock_t, xfs_filblks_t, xfs_bmap_free_t *,
398 xfs_mount_t *);
399int xfs_bmap_first_unused (xfs_trans_t *, xfs_inode_t *, xfs_extlen_t,
400 xfs_fileoff_t *, int);
401int xfs_bmap_last_offset (xfs_trans_t *, xfs_inode_t *, xfs_fileoff_t *, int);
402int xfs_bmap_last_before (xfs_trans_t *, xfs_inode_t *, xfs_fileoff_t *, int);
403int xfs_bmap_one_block (xfs_inode_t *, int);
404int xfs_bmapi_single (xfs_trans_t *, xfs_inode_t *, int, xfs_fsblock_t *,
405 xfs_fileoff_t);
406int xfs_bmapi (xfs_trans_t *, xfs_inode_t *, xfs_fileoff_t,
407 xfs_filblks_t, int, xfs_fsblock_t *, xfs_extlen_t,
408 xfs_bmbt_irec_t *, int *, xfs_bmap_free_t *);
409int xfs_bunmapi (xfs_trans_t *, xfs_inode_t *, xfs_fileoff_t,
410 xfs_filblks_t, int, xfs_extnum_t, xfs_fsblock_t *,
411 xfs_bmap_free_t *, int *);
412int xfs_bmap_add_extent_hole_delay (xfs_inode_t *ip, xfs_extnum_t,
413 xfs_btree_cur_t *, xfs_bmbt_irec_t *, int *, int);
414int xfs_bmap_add_extent_hole_real (xfs_inode_t *, xfs_extnum_t,
415 xfs_btree_cur_t *, xfs_bmbt_irec_t *, int *, int);
416int xfs_bmap_add_extent_unwritten_real (xfs_inode_t *, xfs_extnum_t,
417 xfs_btree_cur_t **, xfs_bmbt_irec_t *, int *);
418int xfs_bmap_add_extent_delay_real (xfs_inode_t *, xfs_extnum_t,
419 xfs_btree_cur_t **, xfs_bmbt_irec_t *, xfs_filblks_t *,
420 xfs_fsblock_t *, xfs_bmap_free_t *, int *, int);
421int xfs_bmap_extents_to_btree (xfs_trans_t *, xfs_inode_t *, xfs_fsblock_t *,
422 xfs_bmap_free_t *, xfs_btree_cur_t **, int, int *, int);
423void xfs_bmap_delete_exlist (xfs_inode_t *, xfs_extnum_t, xfs_extnum_t, int);
424xfs_filblks_t xfs_bmap_worst_indlen (xfs_inode_t *, xfs_filblks_t);
85a875e9 425int xfs_bmap_isaeof (xfs_inode_t *, xfs_fileoff_t, int, char *);
2bd0ea18
NS
426void xfs_bmap_insert_exlist (xfs_inode_t *, xfs_extnum_t, xfs_extnum_t,
427 xfs_bmbt_irec_t *, int);
428
429/* xfs_bmap_btree.c */
430int xfs_check_nostate_extents (xfs_bmbt_rec_t *, xfs_extnum_t);
431void xfs_bmbt_log_ptrs (xfs_btree_cur_t *, xfs_buf_t *, int, int);
432void xfs_bmbt_log_keys (xfs_btree_cur_t *, xfs_buf_t *, int, int);
433int xfs_bmbt_killroot (xfs_btree_cur_t *, int);
434int xfs_bmbt_updkey (xfs_btree_cur_t *, xfs_bmbt_key_t *, int);
435int xfs_bmbt_lshift (xfs_btree_cur_t *, int, int *);
436int xfs_bmbt_rshift (xfs_btree_cur_t *, int, int *);
437int xfs_bmbt_split (xfs_btree_cur_t *, int, xfs_fsblock_t *,
438 xfs_bmbt_key_t *, xfs_btree_cur_t **, int *);
439
440/* xfs_ialloc_btree.c */
441int xfs_inobt_newroot (xfs_btree_cur_t *, int *);
442int xfs_inobt_rshift (xfs_btree_cur_t *, int, int *);
443int xfs_inobt_lshift (xfs_btree_cur_t *, int, int *);
444int xfs_inobt_split (xfs_btree_cur_t *, int, xfs_agblock_t *,
445 xfs_inobt_key_t *, xfs_btree_cur_t **, int *);
446void xfs_inobt_log_keys (xfs_btree_cur_t *, xfs_buf_t *, int, int);
447void xfs_inobt_log_ptrs (xfs_btree_cur_t *, xfs_buf_t *, int, int);
448void xfs_inobt_log_recs (xfs_btree_cur_t *, xfs_buf_t *, int, int);
449void xfs_inobt_log_block (xfs_trans_t *, xfs_buf_t *, int);
450int xfs_inobt_updkey (xfs_btree_cur_t *, xfs_inobt_key_t *, int);
451
452/* xfs_alloc_btree.c */
453void xfs_alloc_log_ptrs (xfs_btree_cur_t *, xfs_buf_t *, int, int);
454void xfs_alloc_log_keys (xfs_btree_cur_t *, xfs_buf_t *, int, int);
455void xfs_alloc_log_recs (xfs_btree_cur_t *, xfs_buf_t *, int, int);
456void xfs_alloc_log_block (xfs_trans_t *, xfs_buf_t *, int);
457int xfs_alloc_updkey (xfs_btree_cur_t *, xfs_alloc_key_t *, int);
458int xfs_alloc_lshift (xfs_btree_cur_t *, int, int *);
459int xfs_alloc_rshift (xfs_btree_cur_t *, int, int *);
460int xfs_alloc_newroot (xfs_btree_cur_t *, int *);
461int xfs_alloc_split (xfs_btree_cur_t *, int, xfs_agblock_t *,
462 xfs_alloc_key_t *, xfs_btree_cur_t **, int *);
463
464/* xfs_da_btree.c */
2f8883de 465xfs_dabuf_t *xfs_da_buf_make (int, xfs_buf_t **, inst_t *);
836f654f
NS
466void xfs_da_binval (struct xfs_trans *, xfs_dabuf_t *);
467void xfs_da_buf_done (xfs_dabuf_t *);
2bd0ea18
NS
468int xfs_da_root_join (xfs_da_state_t *, xfs_da_state_blk_t *);
469int xfs_da_root_split (xfs_da_state_t *, xfs_da_state_blk_t *,
470 xfs_da_state_blk_t *);
471void xfs_da_node_add (xfs_da_state_t *, xfs_da_state_blk_t *,
472 xfs_da_state_blk_t *);
473int xfs_da_node_split (xfs_da_state_t *, xfs_da_state_blk_t *,
474 xfs_da_state_blk_t *, xfs_da_state_blk_t *, int, int *);
475void xfs_da_node_rebalance (xfs_da_state_t *, xfs_da_state_blk_t *,
476 xfs_da_state_blk_t *);
477void xfs_da_node_remove (xfs_da_state_t *, xfs_da_state_blk_t *);
478void xfs_da_node_unbalance (xfs_da_state_t *, xfs_da_state_blk_t *,
479 xfs_da_state_blk_t *);
480int xfs_da_node_order (xfs_dabuf_t *, xfs_dabuf_t *);
481int xfs_da_node_toosmall (xfs_da_state_t *, int *);
482uint xfs_da_node_lasthash (xfs_dabuf_t *, int *);
483int xfs_da_do_buf (xfs_trans_t *, xfs_inode_t *, xfs_dablk_t, xfs_daddr_t *,
484 xfs_dabuf_t **, int, int, inst_t *);
836f654f
NS
485int xfs_da_split (xfs_da_state_t *);
486int xfs_da_node_create (xfs_da_args_t *, xfs_dablk_t, int,
487 xfs_dabuf_t **, int);
488int xfs_da_join (xfs_da_state_t *);
489void xfs_da_fixhashpath (xfs_da_state_t *, xfs_da_state_path_t *);
490int xfs_da_node_lookup_int (xfs_da_state_t *, int *);
491int xfs_da_path_shift (xfs_da_state_t *, xfs_da_state_path_t *,
492 int, int, int *);
493int xfs_da_blk_unlink (xfs_da_state_t *, xfs_da_state_blk_t *,
494 xfs_da_state_blk_t *);
495int xfs_da_blk_link (xfs_da_state_t *, xfs_da_state_blk_t *,
496 xfs_da_state_blk_t *);
497xfs_da_state_t *xfs_da_state_alloc (void);
498void xfs_da_state_free (xfs_da_state_t *);
499void xfs_da_state_kill_altpath (xfs_da_state_t *);
2bd0ea18
NS
500
501/* xfs_dir.c */
502int xfs_dir_node_addname (xfs_da_args_t *);
503int xfs_dir_leaf_lookup (xfs_da_args_t *);
504int xfs_dir_node_lookup (xfs_da_args_t *);
505int xfs_dir_leaf_replace (xfs_da_args_t *);
506int xfs_dir_node_replace (xfs_da_args_t *);
507int xfs_dir_node_removename (xfs_da_args_t *);
508int xfs_dir_leaf_removename (xfs_da_args_t *, int *, int *);
509
510/* xfs_dir_leaf.c */
511void xfs_dir_leaf_rebalance (xfs_da_state_t *, xfs_da_state_blk_t *,
512 xfs_da_state_blk_t *);
513void xfs_dir_leaf_add_work (xfs_dabuf_t *, xfs_da_args_t *, int, int);
514int xfs_dir_leaf_compact (xfs_trans_t *, xfs_dabuf_t *, int, int);
515int xfs_dir_leaf_figure_balance (xfs_da_state_t *, xfs_da_state_blk_t *,
516 xfs_da_state_blk_t *, int *, int *);
517void xfs_dir_leaf_moveents (xfs_dir_leafblock_t *, int,
518 xfs_dir_leafblock_t *, int, int, xfs_mount_t *);
519
520/* xfs_dir2_leaf.c */
521void xfs_dir2_leaf_check (xfs_inode_t *, xfs_dabuf_t *);
522int xfs_dir2_leaf_lookup_int (xfs_da_args_t *, xfs_dabuf_t **,
523 int *, xfs_dabuf_t **);
524
525/* xfs_dir2_block.c */
526void xfs_dir2_block_log_tail (xfs_trans_t *, xfs_dabuf_t *);
527void xfs_dir2_block_log_leaf (xfs_trans_t *, xfs_dabuf_t *, int, int);
528int xfs_dir2_block_lookup_int (xfs_da_args_t *, xfs_dabuf_t **, int *);
529
530/* xfs_dir2_node.c */
531void xfs_dir2_leafn_check (xfs_inode_t *, xfs_dabuf_t *);
532int xfs_dir2_leafn_remove (xfs_da_args_t *, xfs_dabuf_t *, int,
533 xfs_da_state_blk_t *, int *);
534int xfs_dir2_node_addname_int (xfs_da_args_t *, xfs_da_state_blk_t *);
535
536/* xfs_dir2_sf.c */
537void xfs_dir2_sf_check (xfs_da_args_t *);
538int xfs_dir2_sf_addname_pick (xfs_da_args_t *, int,
539 xfs_dir2_sf_entry_t **, xfs_dir2_data_aoff_t *);
540void xfs_dir2_sf_addname_easy (xfs_da_args_t *, xfs_dir2_sf_entry_t *,
541 xfs_dir2_data_aoff_t, int);
542void xfs_dir2_sf_addname_hard (xfs_da_args_t *, int, int);
543void xfs_dir2_sf_toino8 (xfs_da_args_t *);
544void xfs_dir2_sf_toino4 (xfs_da_args_t *);
545
546/* xfs_attr_leaf.c */
547void xfs_attr_leaf_rebalance (xfs_da_state_t *, xfs_da_state_blk_t *,
548 xfs_da_state_blk_t *);
549int xfs_attr_leaf_add_work (xfs_dabuf_t *, xfs_da_args_t *, int);
550void xfs_attr_leaf_compact (xfs_trans_t *, xfs_dabuf_t *);
551void xfs_attr_leaf_moveents (xfs_attr_leafblock_t *, int,
552 xfs_attr_leafblock_t *, int, int, xfs_mount_t *);
553int xfs_attr_leaf_figure_balance (xfs_da_state_t *, xfs_da_state_blk_t *,
554 xfs_da_state_blk_t *, int *, int *);
555
556/* xfs_trans_item.c */
557xfs_log_item_desc_t *xfs_trans_add_item (xfs_trans_t *, xfs_log_item_t *);
558xfs_log_item_desc_t *xfs_trans_find_item (xfs_trans_t *, xfs_log_item_t *);
559void xfs_trans_free_item (xfs_trans_t *, xfs_log_item_desc_t *);
560void xfs_trans_free_items (xfs_trans_t *, int);
561
562/* xfs_trans_buf.c */
563xfs_buf_t *xfs_trans_buf_item_match (xfs_trans_t *, buftarg_t *,
564 xfs_daddr_t, int);
565xfs_buf_t *xfs_trans_buf_item_match_all (xfs_trans_t *, buftarg_t *,
566 xfs_daddr_t, int);
567
568/* xfs_inode_item.c */
569void xfs_inode_item_init (xfs_inode_t *, xfs_mount_t *);
570
571/* xfs_buf_item.c */
572void xfs_buf_item_init (xfs_buf_t *, xfs_mount_t *);
573void xfs_buf_item_log (xfs_buf_log_item_t *, uint, uint);
574
575/* local source files */
576int xfs_mod_incore_sb (xfs_mount_t *, xfs_sb_field_t, int, int);
577void xfs_trans_mod_sb (xfs_trans_t *, uint, long);
578int xfs_trans_unlock_chunk (xfs_log_item_chunk_t *, int, int, xfs_lsn_t);
579
580
581#ifndef DEBUG
582#define xfs_inobp_check(mp,bp) ((void) 0)
583#define xfs_btree_check_key(a,b,c) ((void) 0)
584#define xfs_btree_check_rec(a,b,c) ((void) 0)
585#define xfs_btree_check_block(a,b,c,d) ((void) 0)
586#define xfs_dir2_sf_check(args) ((void) 0)
587#define xfs_dir2_leaf_check(dp,bp) ((void) 0)
588#define xfs_dir2_leafn_check(dp,bp) ((void) 0)
589#undef xfs_dir2_data_check
590#define xfs_dir2_data_check(dp,bp) ((void) 0)
591#endif