]>
Commit | Line | Data |
---|---|---|
2bd0ea18 | 1 | /* |
da23017d NS |
2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
2bd0ea18 | 4 | * |
da23017d 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 | * | |
da23017d 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 | * |
da23017d 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 NS |
17 | */ |
18 | ||
19 | /* | |
20 | * This header is effectively a "namespace multiplexor" for the | |
21 | * user level XFS code. It provides all of the necessary stuff | |
22 | * such that we can build some parts of the XFS kernel code in | |
23 | * user space in a controlled fashion, and translates the names | |
24 | * used in the kernel into the names which libxfs is going to | |
25 | * make available to user tools. | |
26 | * | |
27 | * It should only ever be #include'd by XFS "kernel" code being | |
28 | * compiled in user space. | |
dfc130f3 | 29 | * |
2bd0ea18 NS |
30 | * Our goals here are to... |
31 | * o "share" large amounts of complex code between user and | |
32 | * kernel space; | |
33 | * o shield the user tools from changes in the bleeding | |
34 | * edge kernel code, merging source changes when | |
35 | * convenient and not immediately (no symlinks); | |
36 | * o i.e. be able to merge changes to the kernel source back | |
37 | * into the affected user tools in a controlled fashion; | |
38 | * o provide a _minimalist_ life-support system for kernel | |
39 | * code in user land, not the "everything + the kitchen | |
40 | * sink" model which libsim had mutated into; | |
41 | * o allow the kernel code to be completely free of code | |
42 | * specifically there to support the user level build. | |
43 | */ | |
44 | ||
f616e2bf DC |
45 | /* |
46 | * define a guard and something we can check to determine what include context | |
47 | * we are running from. | |
48 | */ | |
b626fb59 DC |
49 | #ifndef __LIBXFS_INTERNAL_XFS_H__ |
50 | #define __LIBXFS_INTERNAL_XFS_H__ | |
f616e2bf | 51 | |
e515cca1 | 52 | #include "libxfs_api_defs.h" |
6b803e5a | 53 | #include "platform_defs.h" |
dcabd4e7 | 54 | #include "xfs.h" |
b626fb59 | 55 | |
6b803e5a CH |
56 | #include "list.h" |
57 | #include "hlist.h" | |
58 | #include "cache.h" | |
59 | #include "bitops.h" | |
60 | #include "kmem.h" | |
61 | #include "radix-tree.h" | |
62 | #include "atomic.h" | |
b626fb59 | 63 | |
6b803e5a CH |
64 | #include "xfs_types.h" |
65 | #include "xfs_arch.h" | |
b626fb59 | 66 | |
6b803e5a | 67 | #include "xfs_fs.h" |
b626fb59 DC |
68 | |
69 | /* CRC stuff, buffer API dependent on it */ | |
70 | extern uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len); | |
71 | extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len); | |
72 | ||
73 | #define crc32(c,p,l) crc32_le((c),(unsigned char const *)(p),(l)) | |
74 | #define crc32c(c,p,l) crc32c_le((c),(unsigned char const *)(p),(l)) | |
75 | ||
6b803e5a | 76 | #include "xfs_cksum.h" |
b626fb59 DC |
77 | |
78 | /* | |
79 | * This mirrors the kernel include for xfs_buf.h - it's implicitly included in | |
80 | * every files via a similar include in the kernel xfs_linux.h. | |
81 | */ | |
897853d5 | 82 | #include "libxfs_io.h" |
b626fb59 DC |
83 | |
84 | /* for all the support code that uses progname in error messages */ | |
85 | extern char *progname; | |
2bd0ea18 | 86 | |
a2ceac1f DC |
87 | #undef ASSERT |
88 | #define ASSERT(ex) assert(ex) | |
5e656dbb | 89 | |
a2ceac1f DC |
90 | #ifndef EWRONGFS |
91 | #define EWRONGFS EINVAL | |
92 | #endif | |
5e656dbb | 93 | |
56b2de80 | 94 | #define xfs_error_level 0 |
5e656dbb BN |
95 | |
96 | #define STATIC static | |
5e656dbb | 97 | |
b626fb59 DC |
98 | /* XXX: need to push these out to make LIBXFS_ATTR defines */ |
99 | #define ATTR_ROOT 0x0002 | |
100 | #define ATTR_SECURE 0x0008 | |
101 | #define ATTR_CREATE 0x0010 | |
102 | #define ATTR_REPLACE 0x0020 | |
5e656dbb BN |
103 | #define ATTR_KERNOTIME 0 |
104 | #define ATTR_KERNOVAL 0 | |
105 | ||
5dcd1db5 DC |
106 | #define XFS_IGET_CREATE 0x1 |
107 | #define XFS_IGET_UNTRUSTED 0x2 | |
108 | ||
b626fb59 DC |
109 | extern void cmn_err(int, char *, ...); |
110 | enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; | |
111 | ||
112 | #define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args) | |
113 | #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) | |
114 | #define xfs_hex_dump(d,n) ((void) 0) | |
115 | ||
6f4c54a4 | 116 | #define xfs_force_shutdown(d,n) ((void) 0) |
b626fb59 | 117 | |
a2ceac1f | 118 | /* stop unused var warnings by assigning mp to itself */ |
e0607266 DC |
119 | #define XFS_CORRUPTION_ERROR(e,l,mp,m) do { \ |
120 | (mp) = (mp); \ | |
121 | cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \ | |
122 | } while (0) | |
123 | ||
124 | #define XFS_ERROR_REPORT(e,l,mp) do { \ | |
125 | (mp) = (mp); \ | |
126 | cmn_err(CE_ALERT, "%s: XFS_ERROR_REPORT", (e)); \ | |
127 | } while (0) | |
128 | ||
5e656dbb BN |
129 | #define XFS_ERRLEVEL_LOW 1 |
130 | #define XFS_FORCED_SHUTDOWN(mp) 0 | |
131 | #define XFS_ILOCK_EXCL 0 | |
ece930fa CH |
132 | #define XFS_STATS_INC(mp, count) do { (mp) = (mp); } while (0) |
133 | #define XFS_STATS_DEC(mp, count, x) do { (mp) = (mp); } while (0) | |
134 | #define XFS_STATS_ADD(mp, count, x) do { (mp) = (mp); } while (0) | |
e2a190dd | 135 | #define XFS_TEST_ERROR(expr,a,b) ( expr ) |
23639f77 ES |
136 | #define XFS_WANT_CORRUPTED_GOTO(mp, expr, l) \ |
137 | { \ | |
138 | if (!(expr)) { \ | |
139 | if ((mp)->m_flags & LIBXFS_MOUNT_WANT_CORRUPTED) \ | |
140 | printf("WANT_CORRUPTED_GOTO at %s:%d\n", \ | |
141 | __func__, __LINE__); \ | |
142 | error = -EFSCORRUPTED; \ | |
143 | goto l; \ | |
144 | } \ | |
145 | } | |
146 | #define XFS_WANT_CORRUPTED_RETURN(mp, expr) \ | |
147 | { \ | |
148 | if (!(expr)) { \ | |
149 | if ((mp)->m_flags & LIBXFS_MOUNT_WANT_CORRUPTED) \ | |
150 | printf("WANT_CORRUPTED_RETURN at %s:%d\n", \ | |
151 | __func__, __LINE__); \ | |
152 | return -EFSCORRUPTED; \ | |
153 | } \ | |
154 | } | |
5e656dbb | 155 | |
5e656dbb BN |
156 | #ifdef __GNUC__ |
157 | #define __return_address __builtin_return_address(0) | |
158 | #endif | |
159 | ||
364e85ec DC |
160 | #define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 |
161 | ||
5e656dbb BN |
162 | /* miscellaneous kernel routines not in user space */ |
163 | #define down_read(a) ((void) 0) | |
164 | #define up_read(a) ((void) 0) | |
165 | #define spin_lock_init(a) ((void) 0) | |
166 | #define spin_lock(a) ((void) 0) | |
167 | #define spin_unlock(a) ((void) 0) | |
168 | #define likely(x) (x) | |
169 | #define unlikely(x) (x) | |
56b2de80 DC |
170 | #define rcu_read_lock() ((void) 0) |
171 | #define rcu_read_unlock() ((void) 0) | |
c1587ecf CH |
172 | /* Need to be able to handle this bare or in control flow */ |
173 | static inline bool WARN_ON_ONCE(bool expr) { | |
174 | return (expr); | |
175 | } | |
19ebedcf | 176 | |
cbf3beaa GW |
177 | #define percpu_counter_read(x) (*x) |
178 | #define percpu_counter_read_positive(x) ((*x) > 0 ? (*x) : 0) | |
179 | #define percpu_counter_sum(x) (*x) | |
5e656dbb | 180 | |
2bd0ea18 | 181 | /* |
49f693fa | 182 | * prandom_u32 is used for di_gen inode allocation, it must be zero for libxfs |
5e656dbb | 183 | * or all sorts of badness can occur! |
2bd0ea18 | 184 | */ |
49f693fa | 185 | #define prandom_u32() 0 |
2bd0ea18 | 186 | |
b2327e1a | 187 | #define PAGE_SIZE getpagesize() |
2bd0ea18 | 188 | |
5e656dbb BN |
189 | static inline int __do_div(unsigned long long *n, unsigned base) |
190 | { | |
191 | int __res; | |
192 | __res = (int)(((unsigned long) *n) % (unsigned) base); | |
193 | *n = ((unsigned long) *n) / (unsigned) base; | |
194 | return __res; | |
195 | } | |
196 | ||
197 | #define do_div(n,base) (__do_div((unsigned long long *)&(n), (base))) | |
198 | #define do_mod(a, b) ((a) % (b)) | |
199 | #define rol32(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) | |
2bd0ea18 | 200 | |
5e656dbb BN |
201 | #define min_t(type,x,y) \ |
202 | ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) | |
203 | #define max_t(type,x,y) \ | |
204 | ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) | |
57c9fccb | 205 | |
91eba724 | 206 | |
7338c4b8 BF |
207 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) |
208 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | |
209 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | |
210 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | |
211 | ||
212 | /* | |
213 | * Handling for kernel bitmap types. | |
214 | */ | |
215 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, NBBY * sizeof(long)) | |
216 | #define DECLARE_BITMAP(name,bits) \ | |
217 | unsigned long name[BITS_TO_LONGS(bits)] | |
218 | #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) | |
219 | ||
220 | /* | |
221 | * This is a common helper function for find_next_bit and | |
222 | * find_next_zero_bit. The difference is the "invert" argument, which | |
223 | * is XORed with each fetched word before searching it for one bits. | |
224 | */ | |
225 | static inline unsigned long | |
226 | _find_next_bit(const unsigned long *addr, unsigned long nbits, | |
227 | unsigned long start, unsigned long invert) | |
228 | { | |
229 | unsigned long tmp; | |
230 | ||
231 | if (!nbits || start >= nbits) | |
232 | return nbits; | |
233 | ||
234 | tmp = addr[start / BITS_PER_LONG] ^ invert; | |
235 | ||
236 | /* Handle 1st word. */ | |
237 | tmp &= BITMAP_FIRST_WORD_MASK(start); | |
238 | start = round_down(start, BITS_PER_LONG); | |
239 | ||
240 | while (!tmp) { | |
241 | start += BITS_PER_LONG; | |
242 | if (start >= nbits) | |
243 | return nbits; | |
244 | ||
245 | tmp = addr[start / BITS_PER_LONG] ^ invert; | |
246 | } | |
247 | ||
248 | return min(start + ffs(tmp), nbits); | |
249 | } | |
250 | ||
251 | /* | |
252 | * Find the next set bit in a memory region. | |
253 | */ | |
254 | static inline unsigned long | |
255 | find_next_bit(const unsigned long *addr, unsigned long size, | |
256 | unsigned long offset) | |
257 | { | |
258 | return _find_next_bit(addr, size, offset, 0UL); | |
259 | } | |
260 | static inline unsigned long | |
261 | find_next_zero_bit(const unsigned long *addr, unsigned long size, | |
262 | unsigned long offset) | |
263 | { | |
264 | return _find_next_bit(addr, size, offset, ~0UL); | |
265 | } | |
266 | #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) | |
91eba724 | 267 | |
5e656dbb BN |
268 | static inline __attribute__((const)) |
269 | int is_power_of_2(unsigned long n) | |
270 | { | |
271 | return (n != 0 && ((n & (n - 1)) == 0)); | |
272 | } | |
2bd0ea18 NS |
273 | |
274 | /* | |
5e656dbb | 275 | * xfs_iroundup: round up argument to next power of two |
2bd0ea18 | 276 | */ |
5e656dbb BN |
277 | static inline uint |
278 | roundup_pow_of_two(uint v) | |
279 | { | |
280 | int i; | |
281 | uint m; | |
282 | ||
283 | if ((v & (v - 1)) == 0) | |
284 | return v; | |
285 | ASSERT((v & 0x80000000) == 0); | |
286 | if ((v & (v + 1)) == 0) | |
287 | return v + 1; | |
288 | for (i = 0, m = 1; i < 31; i++, m <<= 1) { | |
289 | if (v & m) | |
290 | continue; | |
291 | v |= m; | |
292 | if ((v & (v + 1)) == 0) | |
293 | return v + 1; | |
294 | } | |
295 | ASSERT(0); | |
296 | return 0; | |
297 | } | |
2bd0ea18 | 298 | |
14f8b681 DW |
299 | static inline uint64_t |
300 | roundup_64(uint64_t x, uint32_t y) | |
88cd79be DC |
301 | { |
302 | x += y - 1; | |
303 | do_div(x, y); | |
304 | return x * y; | |
305 | } | |
306 | ||
2bd0ea18 | 307 | /* buffer management */ |
e8a1c983 | 308 | #define XBF_TRYLOCK 0 |
a2ceac1f | 309 | #define XBF_UNMAPPED 0 |
e9d35108 | 310 | #define XBF_DONE 0 |
a2ceac1f | 311 | #define xfs_buf_stale(bp) ((bp)->b_flags |= LIBXFS_B_STALE) |
f1b058f9 | 312 | #define XFS_BUF_UNDELAYWRITE(bp) ((bp)->b_flags &= ~LIBXFS_B_DIRTY) |
2bd0ea18 | 313 | #define XFS_BUF_SET_BDSTRAT_FUNC(a,b) ((void) 0) |
5e656dbb | 314 | |
9d6fabc0 DC |
315 | /* avoid gcc warning */ |
316 | #define xfs_incore(bt,blkno,len,lockit) ({ \ | |
317 | typeof(blkno) __foo = (blkno); \ | |
6bddecbc | 318 | typeof(len) __bar = (len); \ |
9d6fabc0 | 319 | (blkno) = __foo; \ |
6bddecbc | 320 | (len) = __bar; /* no set-but-unused warning */ \ |
9d6fabc0 DC |
321 | NULL; \ |
322 | }) | |
2bd0ea18 | 323 | #define xfs_buf_relse(bp) libxfs_putbuf(bp) |
75c8b434 | 324 | #define xfs_buf_get(devp,blkno,len,f) (libxfs_getbuf((devp), (blkno), (len))) |
9d6fabc0 | 325 | #define xfs_bwrite(bp) libxfs_writebuf((bp), 0) |
e9d35108 | 326 | #define xfs_buf_delwri_queue(bp, bl) libxfs_writebuf((bp), 0) |
57c9fccb | 327 | |
56b2de80 DC |
328 | #define XBRW_READ LIBXFS_BREAD |
329 | #define XBRW_WRITE LIBXFS_BWRITE | |
330 | #define xfs_buf_iomove(bp,off,len,data,f) libxfs_iomove(bp,off,len,data,f) | |
331 | #define xfs_buf_zero(bp,off,len) libxfs_iomove(bp,off,len,0,LIBXFS_BZERO) | |
2bd0ea18 | 332 | |
5e656dbb BN |
333 | /* mount stuff */ |
334 | #define XFS_MOUNT_32BITINODES LIBXFS_MOUNT_32BITINODES | |
335 | #define XFS_MOUNT_ATTR2 LIBXFS_MOUNT_ATTR2 | |
336 | #define XFS_MOUNT_SMALL_INUMS 0 /* ignored in userspace */ | |
337 | #define XFS_MOUNT_WSYNC 0 /* ignored in userspace */ | |
338 | #define XFS_MOUNT_NOALIGN 0 /* ignored in userspace */ | |
3439d03a | 339 | #define XFS_MOUNT_IKEEP 0 /* ignored in userspace */ |
ff105f75 DC |
340 | #define XFS_MOUNT_SWALLOC 0 /* ignored in userspace */ |
341 | #define XFS_MOUNT_RDONLY 0 /* ignored in userspace */ | |
5e656dbb | 342 | |
5e656dbb | 343 | |
5e656dbb | 344 | #define xfs_trans_set_sync(tp) ((void) 0) |
e9d35108 | 345 | #define xfs_trans_ordered_buf(tp, bp) ((void) 0) |
5e656dbb BN |
346 | #define xfs_trans_agblocks_delta(tp, d) |
347 | #define xfs_trans_agflist_delta(tp, d) | |
348 | #define xfs_trans_agbtree_delta(tp, d) | |
6bddecbc DC |
349 | #define xfs_trans_buf_set_type(tp, bp, t) ({ \ |
350 | int __t = (t); \ | |
351 | __t = __t; /* no set-but-unused warning */ \ | |
fca3ed92 | 352 | tp = tp; /* no set-but-unused warning */ \ |
6bddecbc DC |
353 | }) |
354 | ||
8b4dc4a9 | 355 | #define xfs_trans_buf_copy_type(dbp, sbp) |
5e656dbb | 356 | |
10851b18 DC |
357 | /* no readahead, need to avoid set-but-unused var warnings. */ |
358 | #define xfs_buf_readahead(a,d,c,ops) ({ \ | |
359 | xfs_daddr_t __d = d; \ | |
360 | __d = __d; /* no set-but-unused warning */ \ | |
361 | }) | |
a2ceac1f | 362 | #define xfs_buf_readahead_map(a,b,c,ops) ((void) 0) /* no readahead */ |
5e656dbb | 363 | |
a2ceac1f DC |
364 | #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) |
365 | #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) | |
366 | #define xfs_alert_tag(mp,tag,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) | |
5e656dbb | 367 | |
5e656dbb | 368 | #define xfs_sort qsort |
2bd0ea18 | 369 | |
5e656dbb | 370 | #define xfs_ilock(ip,mode) ((void) 0) |
a2ceac1f DC |
371 | #define xfs_ilock_nowait(ip,mode) ((void) 0) |
372 | #define xfs_ilock_demote(ip,mode) ((void) 0) | |
ff105f75 DC |
373 | #define xfs_ilock_data_map_shared(ip) (0) |
374 | #define xfs_ilock_attr_map_shared(ip) (0) | |
375 | #define xfs_iunlock(ip,mode) ({ \ | |
376 | typeof(mode) __mode = mode; \ | |
377 | __mode = __mode; /* no set-but-unused warning */ \ | |
378 | }) | |
2bd0ea18 | 379 | |
5e656dbb | 380 | /* space allocation */ |
a2ceac1f | 381 | #define xfs_extent_busy_reuse(mp,ag,bno,len,user) ((void) 0) |
aefc06c1 ES |
382 | /* avoid unused variable warning */ |
383 | #define xfs_extent_busy_insert(tp,ag,bno,len,flags)({ \ | |
384 | xfs_agnumber_t __foo = ag; \ | |
385 | __foo = __foo; /* no set-but-unused warning */ \ | |
386 | }) | |
cd80de04 CH |
387 | #define xfs_extent_busy_trim(args,bno,len,busy_gen) ({ \ |
388 | unsigned __foo = *(busy_gen); \ | |
389 | *(busy_gen) = __foo; \ | |
390 | false; \ | |
391 | }) | |
b0a898fe | 392 | #define xfs_extent_busy_flush(mp,pag,busy_gen) ((void)(0)) |
a2ceac1f | 393 | |
5e656dbb | 394 | #define xfs_rotorstep 1 |
1f2ace68 | 395 | #define xfs_bmap_rtalloc(a) (-ENOSYS) |
5e656dbb | 396 | #define xfs_get_extsz_hint(ip) (0) |
10460994 | 397 | #define xfs_get_cowextsz_hint(ip) (0) |
5e656dbb BN |
398 | #define xfs_inode_is_filestream(ip) (0) |
399 | #define xfs_filestream_lookup_ag(ip) (0) | |
400 | #define xfs_filestream_new_ag(ip,ag) (0) | |
2bd0ea18 | 401 | |
a2ceac1f DC |
402 | #define xfs_log_force(mp,flags) ((void) 0) |
403 | #define XFS_LOG_SYNC 1 | |
404 | ||
405 | /* quota bits */ | |
406 | #define xfs_trans_mod_dquot_byino(t,i,f,d) ((void) 0) | |
407 | #define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0) | |
408 | #define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) ((void) 0) | |
409 | #define xfs_qm_dqattach(i,f) (0) | |
410 | ||
5dfa5cd2 DC |
411 | #define uuid_copy(s,d) platform_uuid_copy((s),(d)) |
412 | #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) | |
413 | ||
e9d35108 | 414 | #define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0) |
4896e6c8 | 415 | #define xfs_sb_validate_fsb_count(sbp, nblks) (0) |
e9d35108 | 416 | |
2bd0ea18 | 417 | /* |
5e656dbb | 418 | * Prototypes for kernel static functions that are aren't in their |
b626fb59 | 419 | * associated header files. |
2bd0ea18 | 420 | */ |
b626fb59 DC |
421 | struct xfs_da_args; |
422 | struct xfs_bmap_free; | |
423 | struct xfs_bmap_free_item; | |
424 | struct xfs_mount; | |
425 | struct xfs_sb; | |
426 | struct xfs_trans; | |
427 | struct xfs_inode; | |
428 | struct xfs_log_item; | |
429 | struct xfs_buf; | |
430 | struct xfs_buf_map; | |
431 | struct xfs_buf_log_item; | |
432 | struct xfs_buftarg; | |
2bd0ea18 | 433 | |
5e656dbb BN |
434 | /* xfs_attr.c */ |
435 | int xfs_attr_rmtval_get(struct xfs_da_args *); | |
2bd0ea18 NS |
436 | |
437 | /* xfs_bmap.c */ | |
2cf6d225 | 438 | void xfs_bmap_del_free(struct xfs_bmap_free *, struct xfs_bmap_free_item *); |
5e656dbb BN |
439 | |
440 | /* xfs_mount.c */ | |
b626fb59 DC |
441 | int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t); |
442 | void xfs_mount_common(struct xfs_mount *, struct xfs_sb *); | |
5e656dbb BN |
443 | |
444 | /* | |
445 | * logitem.c and trans.c prototypes | |
446 | */ | |
4329aa4c DC |
447 | void xfs_trans_init(struct xfs_mount *); |
448 | int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); | |
2bd0ea18 NS |
449 | |
450 | /* xfs_trans_item.c */ | |
c40bdaa2 DC |
451 | void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *); |
452 | void xfs_trans_del_item(struct xfs_log_item *); | |
2bd0ea18 | 453 | |
2bd0ea18 | 454 | /* xfs_inode_item.c */ |
b626fb59 | 455 | void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); |
2bd0ea18 NS |
456 | |
457 | /* xfs_buf_item.c */ | |
b626fb59 DC |
458 | void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); |
459 | void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint); | |
2bd0ea18 | 460 | |
5e656dbb | 461 | /* xfs_trans_buf.c */ |
b626fb59 DC |
462 | struct xfs_buf *xfs_trans_buf_item_match(struct xfs_trans *, |
463 | struct xfs_buftarg *, struct xfs_buf_map *, int); | |
5e656dbb | 464 | |
2bd0ea18 | 465 | /* local source files */ |
19ebedcf DC |
466 | #define xfs_mod_fdblocks(mp, delta, rsvd) \ |
467 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FDBLOCKS, delta, rsvd) | |
468 | #define xfs_mod_frextents(mp, delta) \ | |
469 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FREXTENTS, delta, 0) | |
470 | int libxfs_mod_incore_sb(struct xfs_mount *, int, int64_t, int); | |
2dd13604 ES |
471 | /* percpu counters in mp are #defined to the superblock sb_ counters */ |
472 | #define xfs_reinit_percpu_counters(mp) | |
19ebedcf | 473 | |
b626fb59 | 474 | void xfs_trans_mod_sb(struct xfs_trans *, uint, long); |
79737cd9 DC |
475 | void xfs_trans_init(struct xfs_mount *); |
476 | int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); | |
99c1ec96 | 477 | void xfs_verifier_error(struct xfs_buf *bp); |
f616e2bf | 478 | |
b626fb59 DC |
479 | /* XXX: this is clearly a bug - a shared header needs to export this */ |
480 | /* xfs_rtalloc.c */ | |
481 | int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t); | |
482 | ||
0b10a7f4 DW |
483 | struct xfs_rtalloc_rec { |
484 | xfs_rtblock_t ar_startblock; | |
485 | xfs_rtblock_t ar_blockcount; | |
486 | }; | |
487 | ||
488 | typedef int (*xfs_rtalloc_query_range_fn)( | |
489 | struct xfs_trans *tp, | |
490 | struct xfs_rtalloc_rec *rec, | |
491 | void *priv); | |
492 | ||
9542ae13 DC |
493 | int libxfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb, |
494 | xfs_off_t count_fsb); | |
495 | ||
a65d8d29 BF |
496 | bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t); |
497 | ||
f7b1a8b1 | 498 | /* xfs_icache.c */ |
9587a34c DW |
499 | #define xfs_inode_set_cowblocks_tag(ip) do { } while (0) |
500 | #define xfs_inode_set_eofblocks_tag(ip) do { } while (0) | |
f7b1a8b1 | 501 | |
5d8acc46 DC |
502 | /* xfs_stats.h */ |
503 | #define XFS_STATS_CALC_INDEX(member) 0 | |
504 | #define XFS_STATS_INC_OFF(mp, off) | |
505 | #define XFS_STATS_ADD_OFF(mp, off, val) | |
506 | ||
4a492e72 | 507 | typedef unsigned char u8; |
5d8acc46 | 508 | |
b626fb59 | 509 | #endif /* __LIBXFS_INTERNAL_XFS_H__ */ |