]>
Commit | Line | Data |
---|---|---|
2bd0ea18 | 1 | /* |
f302e9e4 NS |
2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
2bd0ea18 | 4 | * |
f302e9e4 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 | |
2bd0ea18 NS |
7 | * published by the Free Software Foundation. |
8 | * | |
f302e9e4 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. | |
2bd0ea18 | 13 | * |
f302e9e4 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 | |
2bd0ea18 | 17 | */ |
5e656dbb | 18 | |
2bd0ea18 NS |
19 | #ifndef __LIBXFS_H__ |
20 | #define __LIBXFS_H__ | |
21 | ||
2b288ccf NS |
22 | #define XFS_BIG_INUMS 1 |
23 | #define XFS_BIG_BLKNOS 1 | |
24 | ||
2e542de0 | 25 | #include <xfs/platform_defs.h> |
2bd0ea18 | 26 | |
f5015c24 | 27 | #include <xfs/list.h> |
c40bdaa2 | 28 | #include <xfs/hlist.h> |
f1b058f9 | 29 | #include <xfs/cache.h> |
5e656dbb BN |
30 | #include <xfs/bitops.h> |
31 | #include <xfs/kmem.h> | |
e9416bd3 | 32 | #include <xfs/radix-tree.h> |
5e656dbb | 33 | #include <xfs/swab.h> |
c40bdaa2 | 34 | #include <xfs/atomic.h> |
f1b058f9 | 35 | |
2e542de0 | 36 | #include <xfs/xfs_types.h> |
a2ceac1f | 37 | #include <xfs/xfs_fs.h> |
2e542de0 | 38 | #include <xfs/xfs_arch.h> |
2d4bfb91 | 39 | |
4b1bcf96 | 40 | #include <xfs/xfs_shared.h> |
dcbc51df | 41 | #include <xfs/xfs_format.h> |
2d4bfb91 | 42 | #include <xfs/xfs_log_format.h> |
a3149b81 | 43 | #include <xfs/xfs_quota_defs.h> |
364e85ec | 44 | #include <xfs/xfs_trans_resv.h> |
2d4bfb91 | 45 | |
2e542de0 NS |
46 | #include <xfs/xfs_bit.h> |
47 | #include <xfs/xfs_inum.h> | |
f302e9e4 | 48 | #include <xfs/xfs_sb.h> |
2e542de0 | 49 | #include <xfs/xfs_ag.h> |
2e542de0 NS |
50 | #include <xfs/xfs_bmap_btree.h> |
51 | #include <xfs/xfs_alloc_btree.h> | |
52 | #include <xfs/xfs_ialloc_btree.h> | |
2e542de0 NS |
53 | #include <xfs/xfs_attr_sf.h> |
54 | #include <xfs/xfs_dinode.h> | |
5dcd1db5 | 55 | #include <xfs/xfs_inode_fork.h> |
1d519883 | 56 | #include <xfs/xfs_inode_buf.h> |
f302e9e4 NS |
57 | #include <xfs/xfs_alloc.h> |
58 | #include <xfs/xfs_btree.h> | |
b194c7d8 | 59 | #include <xfs/xfs_btree_trace.h> |
2e542de0 | 60 | #include <xfs/xfs_bmap.h> |
c40bdaa2 | 61 | #include <xfs/xfs_trace.h> |
f302e9e4 | 62 | |
cc085d77 | 63 | |
1167ddc4 AE |
64 | #ifndef ARRAY_SIZE |
65 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | |
66 | #endif | |
2bd0ea18 | 67 | |
b391b7cd NS |
68 | #ifndef XFS_SUPER_MAGIC |
69 | #define XFS_SUPER_MAGIC 0x58465342 | |
70 | #endif | |
71 | ||
a580302f ES |
72 | #define xfs_isset(a,i) ((a)[(i)/(sizeof((a))*NBBY)] & (1<<((i)%(sizeof((a))*NBBY)))) |
73 | ||
c40bdaa2 DC |
74 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) |
75 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | |
76 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | |
77 | ||
2bd0ea18 NS |
78 | /* |
79 | * Argument structure for libxfs_init(). | |
80 | */ | |
81 | typedef struct { | |
dfc130f3 RC |
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 */ | |
b74a1f6a | 88 | int isdirect; /* we can attempt to use direct I/O */ |
d0572de5 BN |
89 | int disfile; /* data "subvolume" is a regular file */ |
90 | int dcreat; /* try to create data subvolume */ | |
dfc130f3 RC |
91 | int lisfile; /* log "subvolume" is a regular file */ |
92 | int lcreat; /* try to create log subvolume */ | |
d0572de5 BN |
93 | int risfile; /* realtime "subvolume" is a reg file */ |
94 | int rcreat; /* try to create realtime subvolume */ | |
74668075 | 95 | int setblksize; /* attempt to set device blksize */ |
d0572de5 | 96 | int usebuflock; /* lock xfs_buf_t's - for MT usage */ |
dfc130f3 RC |
97 | /* output results */ |
98 | dev_t ddev; /* device for data subvolume */ | |
99 | dev_t logdev; /* device for log subvolume */ | |
100 | dev_t rtdev; /* device for realtime subvolume */ | |
101 | long long dsize; /* size of data subvolume (BBs) */ | |
102 | long long logBBsize; /* size of log subvolume (BBs) */ | |
103 | /* (blocks allocated for use as | |
104 | * log is stored in mount structure) */ | |
74668075 NS |
105 | long long logBBstart; /* start block of log subvolume (BBs) */ |
106 | long long rtsize; /* size of realtime subvolume (BBs) */ | |
107 | int dbsize; /* data subvolume device blksize */ | |
108 | int lbsize; /* log subvolume device blksize */ | |
109 | int rtbsize; /* realtime subvolume device blksize */ | |
dfc130f3 RC |
110 | int dfd; /* data subvolume file descriptor */ |
111 | int logfd; /* log subvolume file descriptor */ | |
112 | int rtfd; /* realtime subvolume file descriptor */ | |
ba9ecd40 DC |
113 | int icache_flags; /* cache init flags */ |
114 | int bcache_flags; /* cache init flags */ | |
2bd0ea18 NS |
115 | } libxfs_init_t; |
116 | ||
9440d84d NS |
117 | #define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails */ |
118 | #define LIBXFS_ISREADONLY 0x0002 /* disallow all mounted filesystems */ | |
119 | #define LIBXFS_ISINACTIVE 0x0004 /* allow mounted only if mounted ro */ | |
7eb6693f NS |
120 | #define LIBXFS_DANGEROUSLY 0x0008 /* repairing a device mounted ro */ |
121 | #define LIBXFS_EXCLUSIVELY 0x0010 /* disallow other accesses (O_EXCL) */ | |
b74a1f6a | 122 | #define LIBXFS_DIRECT 0x0020 /* can use direct I/O, not buffered */ |
2bd0ea18 | 123 | |
75c8b434 DC |
124 | /* |
125 | * IO verifier callbacks need the xfs_mount pointer, so we have to behave | |
126 | * somewhat like the kernel now for userspace IO in terms of having buftarg | |
127 | * based devices... | |
128 | */ | |
129 | struct xfs_buftarg { | |
130 | struct xfs_mount *bt_mount; | |
131 | dev_t dev; | |
132 | }; | |
133 | ||
134 | extern void libxfs_buftarg_init(struct xfs_mount *mp, dev_t ddev, | |
135 | dev_t logdev, dev_t rtdev); | |
136 | ||
2bd0ea18 NS |
137 | extern char *progname; |
138 | extern int libxfs_init (libxfs_init_t *); | |
f1b058f9 | 139 | extern void libxfs_destroy (void); |
2bd0ea18 | 140 | extern int libxfs_device_to_fd (dev_t); |
c5907b96 | 141 | extern dev_t libxfs_device_open (char *, int, int, int); |
75c8b434 | 142 | extern void libxfs_device_zero(struct xfs_buftarg *, xfs_daddr_t, uint); |
2bd0ea18 | 143 | extern void libxfs_device_close (dev_t); |
b74a1f6a | 144 | extern int libxfs_device_alignment (void); |
b6281496 | 145 | extern void libxfs_report(FILE *); |
fd5eda53 | 146 | extern void platform_findsizes(char *path, int fd, long long *sz, int *bsz); |
2bd0ea18 NS |
147 | |
148 | /* check or write log footer: specify device, log size in blocks & uuid */ | |
989b74bc NS |
149 | typedef xfs_caddr_t (libxfs_get_block_t)(xfs_caddr_t, int, void *); |
150 | ||
75c8b434 DC |
151 | extern int libxfs_log_clear (struct xfs_buftarg *, xfs_daddr_t, uint, |
152 | uuid_t *, int, int, int); | |
989b74bc NS |
153 | extern int libxfs_log_header (xfs_caddr_t, uuid_t *, int, int, int, |
154 | libxfs_get_block_t *, void *); | |
155 | ||
75c8b434 | 156 | |
dfc130f3 | 157 | /* |
2bd0ea18 NS |
158 | * Define a user-level mount structure with all we need |
159 | * in order to make use of the numerous XFS_* macros. | |
160 | */ | |
2bd0ea18 NS |
161 | typedef struct xfs_mount { |
162 | xfs_sb_t m_sb; /* copy of fs superblock */ | |
062998e3 | 163 | char *m_fsname; /* filesystem name */ |
2bd0ea18 NS |
164 | int m_bsize; /* fs logical block size */ |
165 | xfs_agnumber_t m_agfrotor; /* last ag where space found */ | |
166 | xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ | |
b391b7cd | 167 | xfs_agnumber_t m_maxagi; /* highest inode alloc group */ |
2bd0ea18 NS |
168 | uint m_rsumlevels; /* rt summary levels */ |
169 | uint m_rsumsize; /* size of rt summary, bytes */ | |
170 | struct xfs_inode *m_rbmip; /* pointer to bitmap inode */ | |
171 | struct xfs_inode *m_rsumip; /* pointer to summary inode */ | |
75c8b434 DC |
172 | struct xfs_buftarg *m_ddev_targp; |
173 | struct xfs_buftarg *m_logdev_targp; | |
174 | struct xfs_buftarg *m_rtdev_targp; | |
175 | #define m_dev m_ddev_targp | |
176 | #define m_logdev m_logdev_targp | |
177 | #define m_rtdev m_rtdev_targp | |
2bd0ea18 NS |
178 | __uint8_t m_dircook_elog; /* log d-cookie entry bits */ |
179 | __uint8_t m_blkbit_log; /* blocklog + NBBY */ | |
180 | __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ | |
9440d84d | 181 | __uint8_t m_sectbb_log; /* sectorlog - BBSHIFT */ |
2bd0ea18 NS |
182 | __uint8_t m_agno_log; /* log #ag's */ |
183 | __uint8_t m_agino_log; /* #bits for agino in inum */ | |
7b5f9801 | 184 | uint m_inode_cluster_size;/* min inode buf size */ |
2bd0ea18 NS |
185 | uint m_blockmask; /* sb_blocksize-1 */ |
186 | uint m_blockwsize; /* sb_blocksize in words */ | |
187 | uint m_blockwmask; /* blockwsize-1 */ | |
188 | uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */ | |
189 | uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */ | |
190 | uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */ | |
191 | uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */ | |
192 | uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */ | |
193 | uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */ | |
194 | uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ | |
195 | uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ | |
196 | uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ | |
56b2de80 | 197 | struct radix_tree_root m_perag_tree; |
2bd0ea18 NS |
198 | uint m_flags; /* global mount flags */ |
199 | uint m_qflags; /* quota status flags */ | |
200 | uint m_attroffset; /* inode attribute offset */ | |
6bef826c NS |
201 | uint m_dir_node_ents; /* #entries in a dir danode */ |
202 | uint m_attr_node_ents; /* #entries in attr danode */ | |
2bd0ea18 NS |
203 | int m_ialloc_inos; /* inodes in inode allocation */ |
204 | int m_ialloc_blks; /* blocks in inode allocation */ | |
205 | int m_litino; /* size of inode union area */ | |
206 | int m_inoalign_mask;/* mask sb_inoalignmt if used */ | |
cf52c730 | 207 | struct xfs_trans_resv m_resv; /* precomputed res values */ |
2bd0ea18 NS |
208 | __uint64_t m_maxicount; /* maximum inode count */ |
209 | int m_dalign; /* stripe unit */ | |
210 | int m_swidth; /* stripe width */ | |
211 | int m_sinoalign; /* stripe unit inode alignmnt */ | |
57c9fccb | 212 | int m_attr_magicpct;/* 37% of the blocksize */ |
2bd0ea18 | 213 | int m_dir_magicpct; /* 37% of the dir blocksize */ |
51ca7008 | 214 | const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */ |
2bd0ea18 NS |
215 | int m_dirblksize; /* directory block sz--bytes */ |
216 | int m_dirblkfsbs; /* directory block sz--fsbs */ | |
217 | xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */ | |
218 | xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v2 */ | |
219 | xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v2 */ | |
32390f05 DC |
220 | |
221 | /* | |
222 | * anonymous struct to allow xfs_dquot_buf.c to compile. | |
223 | * Pointer is always null in userspace, so code does not use it at all | |
224 | */ | |
225 | struct { | |
226 | int qi_dqperchunk; | |
227 | } *m_quotainfo; | |
228 | ||
2bd0ea18 NS |
229 | } xfs_mount_t; |
230 | ||
d43bc409 DC |
231 | /* |
232 | * Per-ag incore structure, copies of information in agf and agi, | |
233 | * to improve the performance of allocation group selection. | |
234 | */ | |
235 | typedef struct xfs_perag { | |
236 | struct xfs_mount *pag_mount; /* owner filesystem */ | |
237 | xfs_agnumber_t pag_agno; /* AG this structure belongs to */ | |
238 | atomic_t pag_ref; /* perag reference count */ | |
239 | char pagf_init; /* this agf's entry is initialized */ | |
240 | char pagi_init; /* this agi's entry is initialized */ | |
241 | char pagf_metadata; /* the agf is preferred to be metadata */ | |
242 | char pagi_inodeok; /* The agi is ok for inodes */ | |
243 | __uint8_t pagf_levels[XFS_BTNUM_AGF]; | |
244 | /* # of levels in bno & cnt btree */ | |
245 | __uint32_t pagf_flcount; /* count of blocks in freelist */ | |
246 | xfs_extlen_t pagf_freeblks; /* total free blocks */ | |
247 | xfs_extlen_t pagf_longest; /* longest free space */ | |
248 | __uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */ | |
249 | xfs_agino_t pagi_freecount; /* number of free inodes */ | |
250 | xfs_agino_t pagi_count; /* number of allocated inodes */ | |
251 | ||
252 | /* | |
253 | * Inode allocation search lookup optimisation. | |
254 | * If the pagino matches, the search for new inodes | |
255 | * doesn't need to search the near ones again straight away | |
256 | */ | |
257 | xfs_agino_t pagl_pagino; | |
258 | xfs_agino_t pagl_leftrec; | |
259 | xfs_agino_t pagl_rightrec; | |
260 | int pagb_count; /* pagb slots in use */ | |
261 | } xfs_perag_t; | |
a2ceac1f | 262 | |
9aa57116 DC |
263 | #define LIBXFS_MOUNT_DEBUGGER 0x0001 |
264 | #define LIBXFS_MOUNT_32BITINODES 0x0002 | |
265 | #define LIBXFS_MOUNT_32BITINOOPT 0x0004 | |
266 | #define LIBXFS_MOUNT_COMPAT_ATTR 0x0008 | |
267 | #define LIBXFS_MOUNT_ATTR2 0x0010 | |
2bd0ea18 | 268 | |
2556c98b | 269 | #define LIBXFS_BHASHSIZE(sbp) (1<<10) |
f1b058f9 | 270 | |
2bd0ea18 NS |
271 | extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *, |
272 | dev_t, dev_t, dev_t, int); | |
2bd0ea18 | 273 | extern void libxfs_umount (xfs_mount_t *); |
f1b058f9 | 274 | extern void libxfs_rtmount_destroy (xfs_mount_t *); |
2bd0ea18 | 275 | |
79737cd9 | 276 | /* |
ddd5a162 | 277 | * xfs/xfs_da_format.h needs struct xfs_mount to be defined |
79737cd9 | 278 | */ |
ddd5a162 DC |
279 | #include <xfs/xfs_da_format.h> |
280 | #include <xfs/xfs_da_btree.h> | |
79737cd9 | 281 | #include <xfs/xfs_dir2.h> |
2bd0ea18 NS |
282 | |
283 | /* | |
284 | * Simple I/O interface | |
285 | */ | |
a2ceac1f DC |
286 | #define XB_PAGES 2 |
287 | ||
288 | struct xfs_buf_map { | |
289 | xfs_daddr_t bm_bn; /* block number for I/O */ | |
290 | int bm_len; /* size of I/O */ | |
291 | }; | |
292 | ||
293 | #define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \ | |
294 | struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) }; | |
295 | ||
296 | struct xfs_buf_ops { | |
297 | void (*verify_read)(struct xfs_buf *); | |
298 | void (*verify_write)(struct xfs_buf *); | |
299 | }; | |
300 | ||
2bd0ea18 | 301 | typedef struct xfs_buf { |
f1b058f9 NS |
302 | struct cache_node b_node; |
303 | unsigned int b_flags; | |
5dfa5cd2 | 304 | xfs_daddr_t b_bn; |
f1b058f9 | 305 | unsigned b_bcount; |
a2ceac1f | 306 | unsigned int b_length; |
75c8b434 DC |
307 | struct xfs_buftarg *b_target; |
308 | #define b_dev b_target->dev | |
2556c98b | 309 | pthread_mutex_t b_lock; |
50722af1 CH |
310 | pthread_t b_holder; |
311 | unsigned int b_recur; | |
5dfa5cd2 | 312 | void *b_fspriv; |
f1b058f9 NS |
313 | void *b_fsprivate2; |
314 | void *b_fsprivate3; | |
a2ceac1f | 315 | void *b_addr; |
a6a7776a | 316 | int b_error; |
a2ceac1f | 317 | const struct xfs_buf_ops *b_ops; |
a2ceac1f DC |
318 | struct xfs_perag *b_pag; |
319 | struct xfs_buf_map *b_map; | |
320 | int b_nmaps; | |
2556c98b BN |
321 | #ifdef XFS_BUF_TRACING |
322 | struct list_head b_lock_list; | |
323 | const char *b_func; | |
324 | const char *b_file; | |
325 | int b_line; | |
326 | #endif | |
2bd0ea18 | 327 | } xfs_buf_t; |
f1b058f9 NS |
328 | |
329 | enum xfs_buf_flags_t { /* b_flags bits */ | |
330 | LIBXFS_B_EXIT = 0x0001, /* ==LIBXFS_EXIT_ON_FAILURE */ | |
331 | LIBXFS_B_DIRTY = 0x0002, /* buffer has been modified */ | |
332 | LIBXFS_B_STALE = 0x0004, /* buffer marked as invalid */ | |
a2ceac1f DC |
333 | LIBXFS_B_UPTODATE = 0x0008, /* buffer is sync'd to disk */ |
334 | LIBXFS_B_DISCONTIG = 0x0010, /* discontiguous buffer */ | |
f1b058f9 NS |
335 | }; |
336 | ||
5dfa5cd2 DC |
337 | #define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL)) |
338 | ||
a2ceac1f | 339 | #define XFS_BUF_PTR(bp) ((char *)(bp)->b_addr) |
2bd0ea18 | 340 | #define xfs_buf_offset(bp, offset) (XFS_BUF_PTR(bp) + (offset)) |
5dfa5cd2 | 341 | #define XFS_BUF_ADDR(bp) ((bp)->b_bn) |
57c9fccb | 342 | #define XFS_BUF_SIZE(bp) ((bp)->b_bcount) |
2bd0ea18 NS |
343 | #define XFS_BUF_COUNT(bp) ((bp)->b_bcount) |
344 | #define XFS_BUF_TARGET(bp) ((bp)->b_dev) | |
c40bdaa2 DC |
345 | #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \ |
346 | (bp)->b_addr = (char *)(p); \ | |
347 | XFS_BUF_SET_COUNT(bp,cnt); \ | |
348 | }) | |
349 | ||
5dfa5cd2 | 350 | #define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_bn = (blk)) |
2aa2e7b9 | 351 | #define XFS_BUF_SET_COUNT(bp,cnt) ((bp)->b_bcount = (cnt)) |
2bd0ea18 | 352 | |
5dfa5cd2 DC |
353 | #define XFS_BUF_FSPRIVATE(bp,type) ((type)(bp)->b_fspriv) |
354 | #define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fspriv = (void *)(val) | |
2bd0ea18 NS |
355 | #define XFS_BUF_FSPRIVATE2(bp,type) ((type)(bp)->b_fsprivate2) |
356 | #define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val) | |
357 | #define XFS_BUF_FSPRIVATE3(bp,type) ((type)(bp)->b_fsprivate3) | |
358 | #define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val) | |
359 | ||
69ec88b5 BN |
360 | #define XFS_BUF_SET_PRIORITY(bp,pri) cache_node_set_priority( \ |
361 | libxfs_bcache, \ | |
362 | (struct cache_node *)(bp), \ | |
363 | (pri)) | |
364 | #define XFS_BUF_PRIORITY(bp) (cache_node_get_priority( \ | |
365 | (struct cache_node *)(bp))) | |
a2ceac1f DC |
366 | #define xfs_buf_set_ref(bp,ref) ((void) 0) |
367 | #define xfs_buf_ioerror(bp,err) (bp)->b_error = (err); | |
69ec88b5 | 368 | |
4896e6c8 DC |
369 | #define xfs_daddr_to_agno(mp,d) \ |
370 | ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) | |
371 | #define xfs_daddr_to_agbno(mp,d) \ | |
372 | ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) | |
373 | ||
f1b058f9 | 374 | /* Buffer Cache Interfaces */ |
2556c98b | 375 | |
f1b058f9 NS |
376 | extern struct cache *libxfs_bcache; |
377 | extern struct cache_operations libxfs_bcache_operations; | |
2556c98b | 378 | |
2ae22647 CH |
379 | #define LIBXFS_GETBUF_TRYLOCK (1 << 0) |
380 | ||
2556c98b BN |
381 | #ifdef XFS_BUF_TRACING |
382 | ||
75c8b434 | 383 | #define libxfs_readbuf(dev, daddr, len, flags, ops) \ |
2ae22647 | 384 | libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \ |
75c8b434 DC |
385 | (dev), (daddr), (len), (flags), (ops)) |
386 | #define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \ | |
a2ceac1f | 387 | libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \ |
75c8b434 | 388 | (dev), (map), (nmaps), (flags), (ops)) |
2556c98b | 389 | #define libxfs_writebuf(buf, flags) \ |
2ae22647 CH |
390 | libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \ |
391 | (buf), (flags)) | |
2556c98b | 392 | #define libxfs_getbuf(dev, daddr, len) \ |
2ae22647 CH |
393 | libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ |
394 | (dev), (daddr), (len)) | |
7e3ab890 | 395 | #define libxfs_getbuf_map(dev, map, nmaps, flags) \ |
a2ceac1f | 396 | libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \ |
7e3ab890 | 397 | (dev), (map), (nmaps), (flags)) |
2ae22647 | 398 | #define libxfs_getbuf_flags(dev, daddr, len, flags) \ |
a2ceac1f | 399 | libxfs_trace_getbuf_flags(__FUNCTION__, __FILE__, __LINE__, \ |
2ae22647 | 400 | (dev), (daddr), (len), (flags)) |
2556c98b | 401 | #define libxfs_putbuf(buf) \ |
2ae22647 | 402 | libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf)) |
2556c98b | 403 | |
2ae22647 | 404 | extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int, |
75c8b434 DC |
405 | struct xfs_buftarg *, xfs_daddr_t, int, int, |
406 | const struct xfs_buf_ops *); | |
a2ceac1f | 407 | extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int, |
75c8b434 DC |
408 | struct xfs_buftarg *, struct xfs_buf_map *, int, int, |
409 | const struct xfs_buf_ops *); | |
2ae22647 CH |
410 | extern int libxfs_trace_writebuf(const char *, const char *, int, |
411 | xfs_buf_t *, int); | |
a2ceac1f | 412 | extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int, |
75c8b434 | 413 | struct xfs_buftarg *, xfs_daddr_t, int); |
a2ceac1f | 414 | extern xfs_buf_t *libxfs_trace_getbuf_map(const char *, const char *, int, |
7e3ab890 | 415 | struct xfs_buftarg *, struct xfs_buf_map *, int, int); |
2ae22647 | 416 | extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int, |
75c8b434 | 417 | struct xfs_buftarg *, xfs_daddr_t, int, unsigned int); |
2ae22647 CH |
418 | extern void libxfs_trace_putbuf (const char *, const char *, int, |
419 | xfs_buf_t *); | |
2556c98b BN |
420 | |
421 | #else | |
422 | ||
75c8b434 DC |
423 | extern xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int, |
424 | const struct xfs_buf_ops *); | |
425 | extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, | |
426 | int, int, const struct xfs_buf_ops *); | |
2556c98b | 427 | extern int libxfs_writebuf(xfs_buf_t *, int); |
75c8b434 DC |
428 | extern xfs_buf_t *libxfs_getbuf(struct xfs_buftarg *, xfs_daddr_t, int); |
429 | extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, | |
7e3ab890 | 430 | struct xfs_buf_map *, int, int); |
75c8b434 DC |
431 | extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, |
432 | int, unsigned int); | |
2bd0ea18 | 433 | extern void libxfs_putbuf (xfs_buf_t *); |
2556c98b BN |
434 | |
435 | #endif | |
436 | ||
437 | extern xfs_buf_t *libxfs_getsb(xfs_mount_t *, int); | |
438 | extern void libxfs_bcache_purge(void); | |
439 | extern void libxfs_bcache_flush(void); | |
440 | extern void libxfs_purgebuf(xfs_buf_t *); | |
441 | extern int libxfs_bcache_overflowed(void); | |
442 | extern int libxfs_bcache_usage(void); | |
2bd0ea18 | 443 | |
e6b359b3 | 444 | /* Buffer (Raw) Interfaces */ |
75c8b434 | 445 | extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int); |
2556c98b BN |
446 | extern void libxfs_putbufr(xfs_buf_t *); |
447 | ||
448 | extern int libxfs_writebuf_int(xfs_buf_t *, int); | |
800db1c1 | 449 | extern int libxfs_writebufr(struct xfs_buf *); |
75c8b434 | 450 | extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int); |
6d5e5ee0 | 451 | extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int); |
e6b359b3 | 452 | |
9f38f08d | 453 | extern int libxfs_bhash_size; |
9f38f08d | 454 | |
57c9fccb NS |
455 | #define LIBXFS_BREAD 0x1 |
456 | #define LIBXFS_BWRITE 0x2 | |
457 | #define LIBXFS_BZERO 0x4 | |
458 | ||
459 | extern void libxfs_iomove (xfs_buf_t *, uint, int, void *, int); | |
460 | ||
2bd0ea18 NS |
461 | /* |
462 | * Transaction interface | |
463 | */ | |
464 | ||
465 | typedef struct xfs_log_item { | |
466 | struct xfs_log_item_desc *li_desc; /* ptr to current desc*/ | |
467 | struct xfs_mount *li_mountp; /* ptr to fs mount */ | |
468 | uint li_type; /* item type */ | |
5dfa5cd2 | 469 | xfs_lsn_t li_lsn; |
2bd0ea18 NS |
470 | } xfs_log_item_t; |
471 | ||
472 | typedef struct xfs_inode_log_item { | |
473 | xfs_log_item_t ili_item; /* common portion */ | |
474 | struct xfs_inode *ili_inode; /* inode pointer */ | |
475 | unsigned short ili_flags; /* misc flags */ | |
a2ceac1f | 476 | unsigned int ili_fields; /* fields to be logged */ |
2bd0ea18 NS |
477 | unsigned int ili_last_fields; /* fields when flushed*/ |
478 | xfs_inode_log_format_t ili_format; /* logged structure */ | |
c40bdaa2 | 479 | int ili_lock_flags; |
2bd0ea18 NS |
480 | } xfs_inode_log_item_t; |
481 | ||
482 | typedef struct xfs_buf_log_item { | |
483 | xfs_log_item_t bli_item; /* common item structure */ | |
484 | struct xfs_buf *bli_buf; /* real buffer pointer */ | |
485 | unsigned int bli_flags; /* misc flags */ | |
486 | unsigned int bli_recur; /* recursion count */ | |
487 | xfs_buf_log_format_t bli_format; /* in-log header */ | |
488 | } xfs_buf_log_item_t; | |
489 | ||
47fe8b7e DC |
490 | #define XFS_BLI_DIRTY (1<<0) |
491 | #define XFS_BLI_HOLD (1<<1) | |
492 | #define XFS_BLI_STALE (1<<2) | |
493 | #define XFS_BLI_INODE_ALLOC_BUF (1<<3) | |
494 | ||
364e85ec DC |
495 | typedef struct xfs_dq_logitem { |
496 | xfs_log_item_t qli_item; /* common portion */ | |
497 | struct xfs_dquot *qli_dquot; /* dquot ptr */ | |
498 | xfs_lsn_t qli_flush_lsn; /* lsn at last flush */ | |
499 | xfs_dq_logformat_t qli_format; /* logged structure */ | |
500 | } xfs_dq_logitem_t; | |
501 | ||
502 | typedef struct xfs_qoff_logitem { | |
503 | xfs_log_item_t qql_item; /* common portion */ | |
504 | struct xfs_qoff_logitem *qql_start_lip; /* qoff-start logitem, if any */ | |
505 | xfs_qoff_logformat_t qql_format; /* logged structure */ | |
506 | } xfs_qoff_logitem_t; | |
2bd0ea18 NS |
507 | |
508 | typedef struct xfs_trans { | |
509 | unsigned int t_type; /* transaction type */ | |
ca86e759 NS |
510 | unsigned int t_log_res; /* amt of log space resvd */ |
511 | unsigned int t_log_count; /* count for perm log res */ | |
2bd0ea18 NS |
512 | xfs_mount_t *t_mountp; /* ptr to fs mount struct */ |
513 | unsigned int t_flags; /* misc flags */ | |
514 | long t_icount_delta; /* superblock icount change */ | |
515 | long t_ifree_delta; /* superblock ifree change */ | |
516 | long t_fdblocks_delta; /* superblock fdblocks chg */ | |
517 | long t_frextents_delta; /* superblock freextents chg */ | |
c40bdaa2 | 518 | struct list_head t_items; /* first log item desc chunk */ |
2bd0ea18 NS |
519 | } xfs_trans_t; |
520 | ||
364e85ec DC |
521 | extern void xfs_trans_init(struct xfs_mount *); |
522 | extern int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); | |
523 | ||
2bd0ea18 NS |
524 | extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *, int); |
525 | extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *); | |
48ea6cb9 DC |
526 | extern int libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_res *, |
527 | uint, uint); | |
5e656dbb | 528 | extern int libxfs_trans_commit (xfs_trans_t *, uint); |
2bd0ea18 | 529 | extern void libxfs_trans_cancel (xfs_trans_t *, int); |
f1b058f9 | 530 | extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *, xfs_mount_t *, int); |
2bd0ea18 NS |
531 | |
532 | extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | |
46eca962 | 533 | uint, uint, struct xfs_inode **); |
2bd0ea18 NS |
534 | extern void libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint); |
535 | extern void libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint); | |
536 | extern void libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *); | |
56b2de80 | 537 | extern void libxfs_trans_ijoin_ref(xfs_trans_t *, struct xfs_inode *, int); |
2bd0ea18 NS |
538 | extern void libxfs_trans_log_inode (xfs_trans_t *, struct xfs_inode *, |
539 | uint); | |
540 | ||
541 | extern void libxfs_trans_brelse (xfs_trans_t *, struct xfs_buf *); | |
542 | extern void libxfs_trans_binval (xfs_trans_t *, struct xfs_buf *); | |
543 | extern void libxfs_trans_bjoin (xfs_trans_t *, struct xfs_buf *); | |
544 | extern void libxfs_trans_bhold (xfs_trans_t *, struct xfs_buf *); | |
545 | extern void libxfs_trans_log_buf (xfs_trans_t *, struct xfs_buf *, | |
546 | uint, uint); | |
a2ceac1f | 547 | /* |
2bd0ea18 NS |
548 | extern xfs_buf_t *libxfs_trans_get_buf (xfs_trans_t *, dev_t, |
549 | xfs_daddr_t, int, uint); | |
550 | extern int libxfs_trans_read_buf (xfs_mount_t *, xfs_trans_t *, dev_t, | |
551 | xfs_daddr_t, int, uint, struct xfs_buf **); | |
a2ceac1f DC |
552 | */ |
553 | ||
75c8b434 DC |
554 | struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp, |
555 | struct xfs_buftarg *btp, | |
556 | struct xfs_buf_map *map, int nmaps, | |
557 | uint flags); | |
a2ceac1f DC |
558 | |
559 | static inline struct xfs_buf * | |
560 | libxfs_trans_get_buf( | |
561 | struct xfs_trans *tp, | |
75c8b434 | 562 | struct xfs_buftarg *btp, |
a2ceac1f DC |
563 | xfs_daddr_t blkno, |
564 | int numblks, | |
565 | uint flags) | |
566 | { | |
567 | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); | |
75c8b434 | 568 | return libxfs_trans_get_buf_map(tp, btp, &map, 1, flags); |
a2ceac1f DC |
569 | } |
570 | ||
571 | int libxfs_trans_read_buf_map(struct xfs_mount *mp, | |
75c8b434 DC |
572 | struct xfs_trans *tp, |
573 | struct xfs_buftarg *btp, | |
a2ceac1f DC |
574 | struct xfs_buf_map *map, int nmaps, |
575 | uint flags, struct xfs_buf **bpp, | |
576 | const struct xfs_buf_ops *ops); | |
577 | ||
578 | static inline int | |
579 | libxfs_trans_read_buf( | |
580 | struct xfs_mount *mp, | |
581 | struct xfs_trans *tp, | |
75c8b434 | 582 | struct xfs_buftarg *btp, |
a2ceac1f DC |
583 | xfs_daddr_t blkno, |
584 | int numblks, | |
585 | uint flags, | |
586 | struct xfs_buf **bpp, | |
587 | const struct xfs_buf_ops *ops) | |
588 | { | |
589 | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); | |
75c8b434 | 590 | return libxfs_trans_read_buf_map(mp, tp, btp, &map, 1, |
a2ceac1f DC |
591 | flags, bpp, ops); |
592 | } | |
2bd0ea18 | 593 | |
2bd0ea18 NS |
594 | /* |
595 | * Inode interface | |
596 | */ | |
2bd0ea18 | 597 | typedef struct xfs_inode { |
f1b058f9 | 598 | struct cache_node i_node; |
2bd0ea18 NS |
599 | xfs_mount_t *i_mount; /* fs mount struct ptr */ |
600 | xfs_ino_t i_ino; /* inode number (agno/agino) */ | |
56b2de80 | 601 | struct xfs_imap i_imap; /* location for xfs_imap() */ |
f756f80c | 602 | struct xfs_buftarg i_dev; /* dev for this inode */ |
2bd0ea18 NS |
603 | xfs_ifork_t *i_afp; /* attribute fork pointer */ |
604 | xfs_ifork_t i_df; /* data fork */ | |
f1b058f9 NS |
605 | xfs_trans_t *i_transp; /* ptr to owning transaction */ |
606 | xfs_inode_log_item_t *i_itemp; /* logging information */ | |
2bd0ea18 | 607 | unsigned int i_delayed_blks; /* count of delay alloc blks */ |
5e656dbb BN |
608 | xfs_icdinode_t i_d; /* most of ondisk inode */ |
609 | xfs_fsize_t i_size; /* in-memory size */ | |
2bd0ea18 NS |
610 | } xfs_inode_t; |
611 | ||
57c9fccb NS |
612 | #define LIBXFS_ATTR_ROOT 0x0002 /* use attrs in root namespace */ |
613 | #define LIBXFS_ATTR_SECURE 0x0008 /* use attrs in security namespace */ | |
614 | #define LIBXFS_ATTR_CREATE 0x0010 /* create, but fail if attr exists */ | |
615 | #define LIBXFS_ATTR_REPLACE 0x0020 /* set, but fail if attr not exists */ | |
616 | ||
a2ceac1f DC |
617 | /* |
618 | * Project quota id helpers (previously projid was 16bit only and using two | |
619 | * 16bit values to hold new 32bit projid was chosen to retain compatibility with | |
620 | * "old" filesystems). | |
621 | * | |
622 | * Copied here from xfs_inode.h because it has to be defined after the struct | |
623 | * xfs_inode... | |
624 | */ | |
625 | static inline prid_t | |
626 | xfs_get_projid(struct xfs_icdinode *id) | |
627 | { | |
628 | return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo; | |
629 | } | |
630 | ||
631 | static inline void | |
632 | xfs_set_projid(struct xfs_icdinode *id, prid_t projid) | |
633 | { | |
634 | id->di_projid_hi = (__uint16_t) (projid >> 16); | |
635 | id->di_projid_lo = (__uint16_t) (projid & 0xffff); | |
636 | } | |
637 | ||
9f064b7e | 638 | typedef struct cred { |
14290264 NS |
639 | uid_t cr_uid; |
640 | gid_t cr_gid; | |
641 | } cred_t; | |
642 | ||
2bd0ea18 | 643 | extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t, |
9f064b7e NS |
644 | nlink_t, xfs_dev_t, struct cred *, |
645 | struct fsxattr *, xfs_inode_t **); | |
2bd0ea18 NS |
646 | extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *); |
647 | ||
56b2de80 DC |
648 | extern void libxfs_trans_ichgtime(struct xfs_trans *, |
649 | struct xfs_inode *, int); | |
2bd0ea18 | 650 | extern int libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *); |
f1b058f9 NS |
651 | |
652 | /* Inode Cache Interfaces */ | |
2bd0ea18 NS |
653 | extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, |
654 | uint, xfs_inode_t **, xfs_daddr_t); | |
655 | extern void libxfs_iput (xfs_inode_t *, uint); | |
656 | ||
5e656dbb BN |
657 | /* Shared utility routines */ |
658 | extern unsigned int libxfs_log2_roundup(unsigned int i); | |
2bd0ea18 | 659 | |
2bd0ea18 NS |
660 | extern int libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t, |
661 | xfs_off_t, int, int); | |
5e656dbb | 662 | extern int libxfs_bmap_finish(xfs_trans_t **, xfs_bmap_free_t *, int *); |
2bd0ea18 | 663 | |
5e656dbb BN |
664 | extern void libxfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, ...); |
665 | extern void libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...); | |
2bd0ea18 | 666 | |
1552a820 NS |
667 | extern void cmn_err(int, char *, ...); |
668 | enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; | |
f302e9e4 | 669 | |
cb5b3ef4 MV |
670 | |
671 | #define LIBXFS_BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT) | |
2556c98b BN |
672 | extern int libxfs_nproc(void); |
673 | extern unsigned long libxfs_physmem(void); /* in kilobytes */ | |
cb5b3ef4 | 674 | |
f302e9e4 | 675 | #include <xfs/xfs_ialloc.h> |
f302e9e4 NS |
676 | |
677 | #include <xfs/xfs_attr_leaf.h> | |
9d6fabc0 | 678 | #include <xfs/xfs_attr_remote.h> |
f302e9e4 | 679 | #include <xfs/xfs_trans_space.h> |
f302e9e4 | 680 | |
5e656dbb BN |
681 | #define XFS_INOBT_IS_FREE_DISK(rp,i) \ |
682 | ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0) | |
56b2de80 | 683 | |
5e656dbb BN |
684 | /* |
685 | * public xfs kernel routines to be called as libxfs_* | |
686 | */ | |
687 | ||
688 | /* xfs_alloc.c */ | |
689 | int libxfs_alloc_fix_freelist(xfs_alloc_arg_t *, int); | |
690 | ||
691 | /* xfs_attr.c */ | |
56b2de80 DC |
692 | int libxfs_attr_get(struct xfs_inode *, const unsigned char *, |
693 | unsigned char *, int *, int); | |
694 | int libxfs_attr_set(struct xfs_inode *, const unsigned char *, | |
695 | unsigned char *, int, int); | |
696 | int libxfs_attr_remove(struct xfs_inode *, const unsigned char *, int); | |
5e656dbb BN |
697 | |
698 | /* xfs_bmap.c */ | |
699 | xfs_bmbt_rec_host_t *xfs_bmap_search_extents(xfs_inode_t *, xfs_fileoff_t, | |
700 | int, int *, xfs_extnum_t *, xfs_bmbt_irec_t *, | |
49f693fa | 701 | xfs_bmbt_irec_t *); |
56b2de80 | 702 | void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
5e656dbb BN |
703 | |
704 | /* xfs_attr_leaf.h */ | |
705 | #define libxfs_attr_leaf_newentsize xfs_attr_leaf_newentsize | |
706 | ||
707 | /* xfs_bit.h */ | |
708 | #define libxfs_highbit32 xfs_highbit32 | |
709 | #define libxfs_highbit64 xfs_highbit64 | |
710 | ||
711 | /* xfs_bmap.h */ | |
712 | #define libxfs_bmap_cancel xfs_bmap_cancel | |
713 | #define libxfs_bmap_last_offset xfs_bmap_last_offset | |
a2ceac1f DC |
714 | #define libxfs_bmapi_write xfs_bmapi_write |
715 | #define libxfs_bmapi_read xfs_bmapi_read | |
5e656dbb BN |
716 | #define libxfs_bunmapi xfs_bunmapi |
717 | ||
718 | /* xfs_bmap_btree.h */ | |
719 | #define libxfs_bmbt_disk_get_all xfs_bmbt_disk_get_all | |
720 | ||
721 | /* xfs_da_btree.h */ | |
722 | #define libxfs_da_brelse xfs_da_brelse | |
723 | #define libxfs_da_hashname xfs_da_hashname | |
724 | #define libxfs_da_shrink_inode xfs_da_shrink_inode | |
a2ceac1f | 725 | #define libxfs_da_read_buf xfs_da_read_buf |
5e656dbb BN |
726 | |
727 | /* xfs_dir2.h */ | |
728 | #define libxfs_dir_createname xfs_dir_createname | |
729 | #define libxfs_dir_init xfs_dir_init | |
730 | #define libxfs_dir_lookup xfs_dir_lookup | |
731 | #define libxfs_dir_replace xfs_dir_replace | |
732 | #define libxfs_dir2_isblock xfs_dir2_isblock | |
733 | #define libxfs_dir2_isleaf xfs_dir2_isleaf | |
734 | ||
735 | /* xfs_dir2_data.h */ | |
736 | #define libxfs_dir2_data_freescan xfs_dir2_data_freescan | |
737 | #define libxfs_dir2_data_log_entry xfs_dir2_data_log_entry | |
738 | #define libxfs_dir2_data_log_header xfs_dir2_data_log_header | |
739 | #define libxfs_dir2_data_make_free xfs_dir2_data_make_free | |
740 | #define libxfs_dir2_data_use_free xfs_dir2_data_use_free | |
741 | #define libxfs_dir2_shrink_inode xfs_dir2_shrink_inode | |
742 | ||
743 | /* xfs_inode.h */ | |
744 | #define libxfs_dinode_from_disk xfs_dinode_from_disk | |
745 | #define libxfs_dinode_to_disk xfs_dinode_to_disk | |
a2ceac1f DC |
746 | void xfs_dinode_from_disk(struct xfs_icdinode *, |
747 | struct xfs_dinode *); | |
e0607266 | 748 | #define libxfs_dinode_calc_crc xfs_dinode_calc_crc |
5e656dbb BN |
749 | #define libxfs_idata_realloc xfs_idata_realloc |
750 | #define libxfs_idestroy_fork xfs_idestroy_fork | |
751 | ||
a73b88f2 DC |
752 | #define libxfs_dinode_verify xfs_dinode_verify |
753 | bool xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino, | |
754 | struct xfs_dinode *dip); | |
755 | ||
4896e6c8 | 756 | /* xfs_sb.h */ |
5e656dbb BN |
757 | #define libxfs_mod_sb xfs_mod_sb |
758 | #define libxfs_sb_from_disk xfs_sb_from_disk | |
759 | #define libxfs_sb_to_disk xfs_sb_to_disk | |
760 | ||
e0607266 DC |
761 | /* xfs_symlink.h */ |
762 | #define libxfs_symlink_blocks xfs_symlink_blocks | |
763 | #define libxfs_symlink_hdr_ok xfs_symlink_hdr_ok | |
764 | ||
364e85ec DC |
765 | /* xfs_trans_resv.h */ |
766 | #define libxfs_trans_resv_calc xfs_trans_resv_calc | |
767 | ||
5e656dbb BN |
768 | /* xfs_rtalloc.c */ |
769 | int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t); | |
770 | ||
7e280e68 DC |
771 | /* CRC wrappers */ |
772 | ||
773 | extern uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len); | |
774 | extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len); | |
775 | ||
776 | #define crc32(c,p,l) crc32_le((c),(unsigned char const *)(p),(l)) | |
777 | #define crc32c(c,p,l) crc32c_le((c),(unsigned char const *)(p),(l)) | |
778 | ||
779 | #include <xfs/xfs_cksum.h> | |
780 | ||
4896e6c8 DC |
781 | #define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args) |
782 | #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) | |
783 | #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) | |
784 | #define xfs_hex_dump(d,n) ((void) 0) | |
785 | ||
2bd0ea18 | 786 | #endif /* __LIBXFS_H__ */ |