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