]>
Commit | Line | Data |
---|---|---|
2bd0ea18 NS |
1 | /* |
2 | * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. | |
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 | #ifndef __LIBXFS_H__ | |
33 | #define __LIBXFS_H__ | |
34 | ||
35 | #include "platform_defs.h" | |
36 | ||
2bd0ea18 NS |
37 | #include <xfs_fs.h> |
38 | #include <xfs_types.h> | |
39 | #include <arch.h> | |
40 | #include <xfs_arch.h> | |
41 | #include <xfs_sb.h> | |
42 | #include <xfs_bit.h> | |
43 | #include <xfs_inum.h> | |
44 | #include <xfs_ag.h> | |
45 | #include <xfs_da_btree.h> | |
46 | #include <xfs_bmap_btree.h> | |
47 | #include <xfs_alloc_btree.h> | |
48 | #include <xfs_ialloc_btree.h> | |
49 | #include <xfs_alloc.h> | |
50 | #include <xfs_ialloc.h> | |
51 | #include <xfs_rtalloc.h> | |
52 | #include <xfs_btree.h> | |
53 | #include <xfs_dir.h> | |
54 | #include <xfs_dir_sf.h> | |
55 | #include <xfs_dir_leaf.h> | |
56 | #include <xfs_dir2.h> | |
57 | #include <xfs_dir2_data.h> | |
58 | #include <xfs_dir2_leaf.h> | |
59 | #include <xfs_dir2_block.h> | |
60 | #include <xfs_dir2_node.h> | |
61 | #include <xfs_dir2_sf.h> | |
62 | #include <xfs_attr_sf.h> | |
63 | #include <xfs_dinode.h> | |
64 | #include <xfs_attr_leaf.h> | |
65 | #include <xfs_quota.h> | |
66 | #include <xfs_dqblk.h> | |
67 | #include <xfs_mount.h> | |
68 | #include <xfs_trans_space.h> | |
69 | #include <xfs_inode.h> | |
70 | #include <xfs_buf_item.h> | |
71 | #include <xfs_inode_item.h> | |
72 | #include <xfs_cred.h> | |
73 | #include <xfs_bmap.h> | |
74 | #include <xfs_imap.h> | |
75 | #include <xfs_log.h> | |
76 | #include <xfs_log_priv.h> | |
77 | ||
78 | /* | |
79 | * Argument structure for libxfs_init(). | |
80 | */ | |
81 | typedef struct { | |
82 | /* input parameters */ | |
83 | char *volname; /* pathname of volume */ | |
84 | char *dname; /* pathname of data "subvolume" */ | |
85 | char *logname; /* pathname of log "subvolume" */ | |
86 | char *rtname; /* pathname of realtime "subvolume" */ | |
87 | int isreadonly; /* filesystem is only read in applic */ | |
88 | int disfile; /* data "subvolume" is a regular file */ int dcreat; /* try to create data subvolume */ | |
89 | int lisfile; /* log "subvolume" is a regular file */ | |
90 | int lcreat; /* try to create log subvolume */ | |
91 | int risfile; /* realtime "subvolume" is a reg file */ int rcreat; /* try to create realtime subvolume */ | |
92 | char *notvolmsg; /* format string for not XLV message */ | |
93 | int notvolok; /* set if not XLV => try data */ | |
94 | /* output results */ | |
95 | dev_t ddev; /* device for data subvolume */ | |
96 | dev_t logdev; /* device for log subvolume */ | |
97 | dev_t rtdev; /* device for realtime subvolume */ | |
98 | long long dsize; /* size of data subvolume (BBs) */ | |
99 | long long logBBsize; /* size of log subvolume (BBs) */ | |
100 | /* (blocks allocated for use as | |
101 | * log is stored in mount structure) */ | |
102 | long long logBBstart; /* start block of log subvolume (BBs) */ long long rtsize; /* size of realtime subvolume (BBs) */ | |
103 | int dfd; /* data subvolume file descriptor */ | |
104 | int logfd; /* log subvolume file descriptor */ | |
105 | int rtfd; /* realtime subvolume file descriptor */ | |
c5907b96 | 106 | int setblksize; /* attempt to set device block size */ |
2bd0ea18 NS |
107 | } libxfs_init_t; |
108 | ||
109 | #define LIBXFS_ISREADONLY 0x0069 /* disallow all mounted filesystems */ | |
110 | #define LIBXFS_ISINACTIVE 0x6900 /* allow mounted only if mounted ro */ | |
111 | ||
112 | extern char *progname; | |
113 | extern int libxfs_init (libxfs_init_t *); | |
114 | extern int libxfs_device_to_fd (dev_t); | |
c5907b96 | 115 | extern dev_t libxfs_device_open (char *, int, int, int); |
2bd0ea18 NS |
116 | extern void libxfs_device_zero (dev_t, xfs_daddr_t, uint); |
117 | extern void libxfs_device_close (dev_t); | |
118 | ||
119 | /* check or write log footer: specify device, log size in blocks & uuid */ | |
120 | extern int libxfs_log_clear (dev_t, xfs_daddr_t, uint, uuid_t *, int); | |
121 | ||
122 | /* | |
123 | * Define a user-level mount structure with all we need | |
124 | * in order to make use of the numerous XFS_* macros. | |
125 | */ | |
126 | struct xfs_inode; | |
127 | typedef struct xfs_mount { | |
128 | xfs_sb_t m_sb; /* copy of fs superblock */ | |
129 | int m_bsize; /* fs logical block size */ | |
130 | xfs_agnumber_t m_agfrotor; /* last ag where space found */ | |
131 | xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ | |
34317449 | 132 | xfs_agnumber_t m_maxagi; /* highest inode alloc group */ |
2bd0ea18 NS |
133 | uint m_rsumlevels; /* rt summary levels */ |
134 | uint m_rsumsize; /* size of rt summary, bytes */ | |
135 | struct xfs_inode *m_rbmip; /* pointer to bitmap inode */ | |
136 | struct xfs_inode *m_rsumip; /* pointer to summary inode */ | |
137 | struct xfs_inode *m_rootip; /* pointer to root directory */ | |
138 | dev_t m_dev; | |
139 | dev_t m_logdev; | |
140 | dev_t m_rtdev; | |
141 | __uint8_t m_dircook_elog; /* log d-cookie entry bits */ | |
142 | __uint8_t m_blkbit_log; /* blocklog + NBBY */ | |
143 | __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ | |
144 | __uint8_t m_agno_log; /* log #ag's */ | |
145 | __uint8_t m_agino_log; /* #bits for agino in inum */ | |
146 | __uint16_t m_inode_cluster_size;/* min inode buf size */ | |
147 | uint m_blockmask; /* sb_blocksize-1 */ | |
148 | uint m_blockwsize; /* sb_blocksize in words */ | |
149 | uint m_blockwmask; /* blockwsize-1 */ | |
150 | uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */ | |
151 | uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */ | |
152 | uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */ | |
153 | uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */ | |
154 | uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */ | |
155 | uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */ | |
156 | uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ | |
157 | uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ | |
158 | uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ | |
159 | xfs_perag_t *m_perag; /* per-ag accounting info */ | |
160 | uint m_flags; /* global mount flags */ | |
161 | uint m_qflags; /* quota status flags */ | |
162 | uint m_attroffset; /* inode attribute offset */ | |
163 | int m_da_node_ents; /* how many entries in danode */ | |
164 | int m_ialloc_inos; /* inodes in inode allocation */ | |
165 | int m_ialloc_blks; /* blocks in inode allocation */ | |
166 | int m_litino; /* size of inode union area */ | |
167 | int m_inoalign_mask;/* mask sb_inoalignmt if used */ | |
168 | xfs_trans_reservations_t m_reservations;/* precomputed res values */ | |
169 | __uint64_t m_maxicount; /* maximum inode count */ | |
170 | int m_dalign; /* stripe unit */ | |
171 | int m_swidth; /* stripe width */ | |
172 | int m_sinoalign; /* stripe unit inode alignmnt */ | |
173 | int m_dir_magicpct; /* 37% of the dir blocksize */ | |
174 | __uint8_t m_dirversion; /* 1 or 2 */ | |
175 | int m_dirblksize; /* directory block sz--bytes */ | |
176 | int m_dirblkfsbs; /* directory block sz--fsbs */ | |
177 | xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */ | |
178 | xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v2 */ | |
179 | xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v2 */ | |
180 | } xfs_mount_t; | |
181 | ||
182 | ||
183 | extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *, | |
184 | dev_t, dev_t, dev_t, int); | |
185 | extern void libxfs_mount_common (xfs_mount_t *, xfs_sb_t *); | |
186 | extern void libxfs_umount (xfs_mount_t *); | |
187 | extern int libxfs_rtmount_init (xfs_mount_t *); | |
188 | extern void libxfs_alloc_compute_maxlevels (xfs_mount_t *); | |
189 | extern void libxfs_bmap_compute_maxlevels (xfs_mount_t *, int); | |
190 | extern void libxfs_ialloc_compute_maxlevels (xfs_mount_t *); | |
191 | extern void libxfs_trans_init (xfs_mount_t *); | |
192 | ||
193 | ||
194 | /* | |
195 | * Simple I/O interface | |
196 | */ | |
197 | typedef struct xfs_buf { | |
198 | xfs_daddr_t b_blkno; | |
199 | unsigned b_bcount; | |
200 | dev_t b_dev; | |
201 | void *b_fsprivate; | |
202 | void *b_fsprivate2; | |
203 | void *b_fsprivate3; | |
204 | char *b_addr; | |
205 | /* b_addr must be the last field */ | |
206 | } xfs_buf_t; | |
207 | #define XFS_BUF_PTR(bp) ((bp)->b_addr) | |
208 | #define xfs_buf_offset(bp, offset) (XFS_BUF_PTR(bp) + (offset)) | |
209 | #define XFS_BUF_ADDR(bp) ((bp)->b_blkno) | |
210 | #define XFS_BUF_COUNT(bp) ((bp)->b_bcount) | |
211 | #define XFS_BUF_TARGET(bp) ((bp)->b_dev) | |
212 | #define XFS_BUF_SET_PTR(bp,p,cnt) ((bp)->b_addr = (char *)(p)); \ | |
213 | XFS_BUF_SETCOUNT(bp,cnt) | |
214 | #define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_blkno = (blk)) | |
215 | #define XFS_BUF_SETCOUNT(bp,cnt) ((bp)->b_bcount = (cnt)) | |
216 | ||
217 | #define XFS_BUF_FSPRIVATE(bp,type) ((type)(bp)->b_fsprivate) | |
218 | #define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fsprivate = (void *)(val) | |
219 | #define XFS_BUF_FSPRIVATE2(bp,type) ((type)(bp)->b_fsprivate2) | |
220 | #define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val) | |
221 | #define XFS_BUF_FSPRIVATE3(bp,type) ((type)(bp)->b_fsprivate3) | |
222 | #define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val) | |
223 | ||
224 | extern xfs_buf_t *libxfs_getbuf (dev_t, xfs_daddr_t, int); | |
225 | extern xfs_buf_t *libxfs_readbuf (dev_t, xfs_daddr_t, int, int); | |
226 | extern xfs_buf_t *libxfs_getsb (xfs_mount_t *, int); | |
227 | extern int libxfs_readbufr (dev_t, xfs_daddr_t, xfs_buf_t *, int, int); | |
228 | extern int libxfs_writebuf (xfs_buf_t *, int); | |
229 | extern int libxfs_writebuf_int (xfs_buf_t *, int); | |
230 | extern void libxfs_putbuf (xfs_buf_t *); | |
231 | ||
232 | ||
233 | /* | |
234 | * Transaction interface | |
235 | */ | |
236 | ||
237 | typedef struct xfs_log_item { | |
238 | struct xfs_log_item_desc *li_desc; /* ptr to current desc*/ | |
239 | struct xfs_mount *li_mountp; /* ptr to fs mount */ | |
240 | uint li_type; /* item type */ | |
241 | } xfs_log_item_t; | |
242 | ||
243 | typedef struct xfs_inode_log_item { | |
244 | xfs_log_item_t ili_item; /* common portion */ | |
245 | struct xfs_inode *ili_inode; /* inode pointer */ | |
246 | unsigned short ili_flags; /* misc flags */ | |
247 | unsigned int ili_last_fields; /* fields when flushed*/ | |
248 | xfs_inode_log_format_t ili_format; /* logged structure */ | |
249 | } xfs_inode_log_item_t; | |
250 | ||
251 | typedef struct xfs_buf_log_item { | |
252 | xfs_log_item_t bli_item; /* common item structure */ | |
253 | struct xfs_buf *bli_buf; /* real buffer pointer */ | |
254 | unsigned int bli_flags; /* misc flags */ | |
255 | unsigned int bli_recur; /* recursion count */ | |
256 | xfs_buf_log_format_t bli_format; /* in-log header */ | |
257 | } xfs_buf_log_item_t; | |
258 | ||
259 | #include <xfs_trans.h> | |
260 | ||
261 | typedef struct xfs_trans { | |
262 | unsigned int t_type; /* transaction type */ | |
263 | xfs_mount_t *t_mountp; /* ptr to fs mount struct */ | |
264 | unsigned int t_flags; /* misc flags */ | |
265 | long t_icount_delta; /* superblock icount change */ | |
266 | long t_ifree_delta; /* superblock ifree change */ | |
267 | long t_fdblocks_delta; /* superblock fdblocks chg */ | |
268 | long t_frextents_delta; /* superblock freextents chg */ | |
269 | unsigned int t_items_free; /* log item descs free */ | |
270 | xfs_log_item_chunk_t t_items; /* first log item desc chunk */ | |
271 | } xfs_trans_t; | |
272 | ||
273 | extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *, int); | |
274 | extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *); | |
275 | extern int libxfs_trans_reserve (xfs_trans_t *, uint,uint,uint,uint,uint); | |
276 | extern int libxfs_trans_commit (xfs_trans_t *, uint, xfs_lsn_t *); | |
277 | extern void libxfs_trans_cancel (xfs_trans_t *, int); | |
278 | extern void libxfs_mod_sb (xfs_trans_t *, __int64_t); | |
279 | ||
280 | extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | |
281 | uint, struct xfs_inode **); | |
282 | extern void libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint); | |
283 | extern void libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint); | |
284 | extern void libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *); | |
285 | extern void libxfs_trans_log_inode (xfs_trans_t *, struct xfs_inode *, | |
286 | uint); | |
287 | ||
288 | extern void libxfs_trans_brelse (xfs_trans_t *, struct xfs_buf *); | |
289 | extern void libxfs_trans_binval (xfs_trans_t *, struct xfs_buf *); | |
290 | extern void libxfs_trans_bjoin (xfs_trans_t *, struct xfs_buf *); | |
291 | extern void libxfs_trans_bhold (xfs_trans_t *, struct xfs_buf *); | |
292 | extern void libxfs_trans_log_buf (xfs_trans_t *, struct xfs_buf *, | |
293 | uint, uint); | |
294 | extern xfs_buf_t *libxfs_trans_get_buf (xfs_trans_t *, dev_t, | |
295 | xfs_daddr_t, int, uint); | |
296 | extern int libxfs_trans_read_buf (xfs_mount_t *, xfs_trans_t *, dev_t, | |
297 | xfs_daddr_t, int, uint, struct xfs_buf **); | |
298 | ||
299 | ||
300 | /* | |
301 | * Simple memory interface | |
302 | */ | |
303 | typedef struct xfs_zone { | |
304 | int zone_unitsize; /* Size in bytes of zone unit */ | |
305 | char *zone_name; /* tag name */ | |
306 | int allocated; /* debug: How many currently allocated */ | |
307 | } xfs_zone_t; | |
308 | ||
309 | extern xfs_zone_t *libxfs_zone_init (int, char *); | |
310 | extern void *libxfs_zone_zalloc (xfs_zone_t *); | |
311 | extern void libxfs_zone_free (xfs_zone_t *, void *); | |
312 | extern void *libxfs_malloc (size_t); | |
313 | extern void libxfs_free (void *); | |
314 | extern void *libxfs_realloc (void *, size_t); | |
315 | ||
316 | ||
317 | /* | |
318 | * Inode interface | |
319 | */ | |
320 | struct xfs_inode_log_item; | |
321 | typedef struct xfs_inode { | |
322 | xfs_mount_t *i_mount; /* fs mount struct ptr */ | |
323 | xfs_ino_t i_ino; /* inode number (agno/agino) */ | |
324 | xfs_daddr_t i_blkno; /* blkno of inode buffer */ | |
325 | dev_t i_dev; /* dev for this inode */ | |
326 | ushort i_len; /* len of inode buffer */ | |
327 | ushort i_boffset; /* off of inode in buffer */ | |
328 | xfs_ifork_t *i_afp; /* attribute fork pointer */ | |
329 | xfs_ifork_t i_df; /* data fork */ | |
330 | struct xfs_trans *i_transp; /* ptr to owning transaction */ | |
331 | struct xfs_inode_log_item *i_itemp; /* logging information */ | |
332 | unsigned int i_delayed_blks; /* count of delay alloc blks */ | |
333 | xfs_dinode_core_t i_d; /* most of ondisk inode */ | |
334 | } xfs_inode_t; | |
335 | ||
336 | extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t, | |
337 | ushort, dev_t, cred_t *, xfs_inode_t **); | |
338 | extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *); | |
339 | ||
340 | extern void libxfs_idata_realloc (xfs_inode_t *, int, int); | |
341 | extern int libxfs_iread (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | |
342 | xfs_inode_t **, xfs_daddr_t); | |
343 | extern void libxfs_ichgtime (xfs_inode_t *, int); | |
344 | extern int libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *); | |
345 | extern int libxfs_itobp (xfs_mount_t *, xfs_trans_t *, xfs_inode_t *, | |
346 | xfs_dinode_t **, xfs_buf_t **, xfs_daddr_t); | |
347 | extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | |
348 | uint, xfs_inode_t **, xfs_daddr_t); | |
349 | extern void libxfs_iput (xfs_inode_t *, uint); | |
350 | ||
351 | ||
352 | /* | |
353 | * Directory interface | |
354 | */ | |
355 | extern void libxfs_dir_mount (xfs_mount_t *); | |
356 | extern void libxfs_dir2_mount (xfs_mount_t *); | |
357 | extern int libxfs_dir_init (xfs_trans_t *, xfs_inode_t *, xfs_inode_t *); | |
358 | extern int libxfs_dir2_init (xfs_trans_t *, xfs_inode_t *, xfs_inode_t *); | |
359 | extern int libxfs_dir_createname (xfs_trans_t *, xfs_inode_t *, char *, | |
360 | int, xfs_ino_t, xfs_fsblock_t *, | |
361 | xfs_bmap_free_t *, xfs_extlen_t); | |
362 | extern int libxfs_dir2_createname (xfs_trans_t *, xfs_inode_t *, char *, | |
363 | int, xfs_ino_t, xfs_fsblock_t *, | |
364 | xfs_bmap_free_t *, xfs_extlen_t); | |
365 | extern int libxfs_dir_lookup (xfs_trans_t *, xfs_inode_t *, | |
366 | char *, int, xfs_ino_t *); | |
367 | extern int libxfs_dir2_lookup (xfs_trans_t *, xfs_inode_t *, | |
368 | char *, int, xfs_ino_t *); | |
369 | extern int libxfs_dir_replace (xfs_trans_t *, xfs_inode_t *, | |
370 | char *, int, xfs_ino_t, xfs_fsblock_t *, | |
371 | xfs_bmap_free_t *, xfs_extlen_t); | |
372 | extern int libxfs_dir2_replace (xfs_trans_t *, xfs_inode_t *, | |
373 | char *, int, xfs_ino_t, xfs_fsblock_t *, | |
374 | xfs_bmap_free_t *, xfs_extlen_t); | |
375 | extern int libxfs_dir_removename (xfs_trans_t *, xfs_inode_t *, | |
376 | char *, int, xfs_ino_t, xfs_fsblock_t *, | |
377 | xfs_bmap_free_t *, xfs_extlen_t); | |
378 | extern int libxfs_dir2_removename (xfs_trans_t *, xfs_inode_t *, | |
379 | char *, int, xfs_ino_t, xfs_fsblock_t *, | |
380 | xfs_bmap_free_t *, xfs_extlen_t); | |
381 | extern int libxfs_dir_bogus_removename (xfs_trans_t *, xfs_inode_t *, | |
382 | char *, xfs_fsblock_t *, xfs_bmap_free_t *, | |
383 | xfs_extlen_t, xfs_dahash_t, int); | |
384 | extern int libxfs_dir2_bogus_removename (xfs_trans_t *, xfs_inode_t *, | |
385 | char *, xfs_fsblock_t *, xfs_bmap_free_t *, | |
386 | xfs_extlen_t, xfs_dahash_t, int); | |
387 | ||
388 | ||
389 | /* | |
390 | * Block map interface | |
391 | */ | |
392 | extern int libxfs_bmapi (xfs_trans_t *, xfs_inode_t *, xfs_fileoff_t, | |
393 | xfs_filblks_t, int, xfs_fsblock_t *, | |
394 | xfs_extlen_t, xfs_bmbt_irec_t *, int *, | |
395 | xfs_bmap_free_t *); | |
396 | extern int libxfs_bmap_finish (xfs_trans_t **, xfs_bmap_free_t *, | |
397 | xfs_fsblock_t, int *); | |
398 | extern int libxfs_bmap_next_offset (xfs_trans_t *, xfs_inode_t *, | |
399 | xfs_fileoff_t *, int); | |
400 | extern int libxfs_bunmapi (xfs_trans_t *, xfs_inode_t *, xfs_fileoff_t, | |
401 | xfs_filblks_t, int, xfs_extnum_t, | |
402 | xfs_fsblock_t *, xfs_bmap_free_t *, int *); | |
403 | extern void libxfs_bmap_del_free (xfs_bmap_free_t *, | |
404 | xfs_bmap_free_item_t *, xfs_bmap_free_item_t *); | |
405 | ||
406 | ||
407 | /* | |
408 | * All other routines we want to keep common... | |
409 | */ | |
410 | ||
411 | extern int libxfs_highbit32 (__uint32_t); | |
412 | extern int libxfs_highbit64 (__uint64_t); | |
413 | extern uint libxfs_da_log2_roundup (uint); | |
414 | ||
415 | extern void libxfs_xlate_sb (void *, xfs_sb_t *, int, xfs_arch_t, | |
416 | __int64_t); | |
417 | extern void libxfs_xlate_dinode_core (xfs_caddr_t buf, | |
418 | xfs_dinode_core_t *, int, xfs_arch_t); | |
419 | ||
420 | extern int libxfs_alloc_fix_freelist (xfs_alloc_arg_t *, int); | |
421 | extern int libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t, | |
422 | xfs_off_t, int, int); | |
423 | ||
424 | extern xfs_dahash_t libxfs_da_hashname (char *, int); | |
425 | extern int libxfs_attr_leaf_newentsize (xfs_da_args_t *, int, int *); | |
426 | ||
427 | extern xfs_filblks_t libxfs_bmbt_get_blockcount (xfs_bmbt_rec_t *); | |
428 | extern xfs_fileoff_t libxfs_bmbt_get_startoff (xfs_bmbt_rec_t *); | |
93cc2301 | 429 | extern void libxfs_bmbt_get_all (xfs_bmbt_rec_t *, xfs_bmbt_irec_t *); |
2bd0ea18 NS |
430 | |
431 | extern int libxfs_free_extent (xfs_trans_t *, xfs_fsblock_t, xfs_extlen_t); | |
432 | extern int libxfs_rtfree_extent (xfs_trans_t *, xfs_rtblock_t, | |
433 | xfs_extlen_t); | |
434 | ||
435 | /* Directory/Attribute routines used by xfs_repair */ | |
436 | extern void libxfs_da_bjoin (xfs_trans_t *, xfs_dabuf_t *); | |
437 | extern int libxfs_da_shrink_inode (xfs_da_args_t *, xfs_dablk_t, | |
438 | xfs_dabuf_t *); | |
439 | extern int libxfs_da_grow_inode (xfs_da_args_t *, xfs_dablk_t *); | |
440 | extern void libxfs_da_bhold (xfs_trans_t *, xfs_dabuf_t *); | |
441 | extern void libxfs_da_brelse (xfs_trans_t *, xfs_dabuf_t *); | |
442 | extern int libxfs_da_read_bufr (xfs_trans_t *, xfs_inode_t *, xfs_dablk_t, | |
443 | xfs_daddr_t, xfs_dabuf_t **, int); | |
444 | extern int libxfs_da_read_buf (xfs_trans_t *, xfs_inode_t *, | |
445 | xfs_dablk_t, xfs_daddr_t, xfs_dabuf_t **, int); | |
446 | extern int libxfs_da_get_buf (xfs_trans_t *, xfs_inode_t *, | |
447 | xfs_dablk_t, xfs_daddr_t, xfs_dabuf_t **, int); | |
448 | extern void libxfs_da_log_buf (xfs_trans_t *, xfs_dabuf_t *, uint, uint); | |
449 | extern int libxfs_dir2_shrink_inode (xfs_da_args_t *, xfs_dir2_db_t, | |
450 | xfs_dabuf_t *); | |
451 | extern int libxfs_dir2_grow_inode (xfs_da_args_t *, int, xfs_dir2_db_t *); | |
452 | extern int libxfs_dir2_isleaf (xfs_trans_t *, xfs_inode_t *, int *); | |
453 | extern int libxfs_dir2_isblock (xfs_trans_t *, xfs_inode_t *, int *); | |
454 | extern void libxfs_dir2_data_use_free (xfs_trans_t *, xfs_dabuf_t *, | |
455 | xfs_dir2_data_unused_t *, xfs_dir2_data_aoff_t, | |
456 | xfs_dir2_data_aoff_t, int *, int *); | |
457 | extern void libxfs_dir2_data_make_free (xfs_trans_t *, xfs_dabuf_t *, | |
458 | xfs_dir2_data_aoff_t, xfs_dir2_data_aoff_t, | |
459 | int *, int *); | |
460 | extern void libxfs_dir2_data_log_entry (xfs_trans_t *, xfs_dabuf_t *, | |
461 | xfs_dir2_data_entry_t *); | |
462 | extern void libxfs_dir2_data_log_header (xfs_trans_t *, xfs_dabuf_t *); | |
463 | extern void libxfs_dir2_data_freescan (xfs_mount_t *, xfs_dir2_data_t *, | |
464 | int *, char *); | |
465 | extern void libxfs_dir2_free_log_bests (xfs_trans_t *, xfs_dabuf_t *, | |
466 | int, int); | |
467 | ||
468 | /* Shared utility routines */ | |
469 | extern unsigned int libxfs_log2_roundup(unsigned int i); | |
470 | ||
2bd0ea18 | 471 | #endif /* __LIBXFS_H__ */ |