]>
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 | ||
106 | #define IHOLD(ip) ((void) 0) | |
107 | ||
5dcd1db5 DC |
108 | #define XFS_IGET_CREATE 0x1 |
109 | #define XFS_IGET_UNTRUSTED 0x2 | |
110 | ||
b626fb59 DC |
111 | extern void cmn_err(int, char *, ...); |
112 | enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; | |
113 | ||
114 | #define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args) | |
115 | #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) | |
116 | #define xfs_hex_dump(d,n) ((void) 0) | |
117 | ||
6f4c54a4 | 118 | #define xfs_force_shutdown(d,n) ((void) 0) |
b626fb59 | 119 | |
a2ceac1f | 120 | /* stop unused var warnings by assigning mp to itself */ |
e0607266 DC |
121 | #define XFS_CORRUPTION_ERROR(e,l,mp,m) do { \ |
122 | (mp) = (mp); \ | |
123 | cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \ | |
124 | } while (0) | |
125 | ||
126 | #define XFS_ERROR_REPORT(e,l,mp) do { \ | |
127 | (mp) = (mp); \ | |
128 | cmn_err(CE_ALERT, "%s: XFS_ERROR_REPORT", (e)); \ | |
129 | } while (0) | |
130 | ||
5e656dbb | 131 | #define XFS_QM_DQATTACH(mp,ip,flags) 0 |
5e656dbb BN |
132 | #define XFS_ERRLEVEL_LOW 1 |
133 | #define XFS_FORCED_SHUTDOWN(mp) 0 | |
134 | #define XFS_ILOCK_EXCL 0 | |
ece930fa CH |
135 | #define XFS_STATS_INC(mp, count) do { (mp) = (mp); } while (0) |
136 | #define XFS_STATS_DEC(mp, count, x) do { (mp) = (mp); } while (0) | |
137 | #define XFS_STATS_ADD(mp, count, x) do { (mp) = (mp); } while (0) | |
5e656dbb BN |
138 | #define XFS_TRANS_MOD_DQUOT_BYINO(mp,tp,ip,field,delta) do { } while (0) |
139 | #define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0 | |
140 | #define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0 | |
141 | #define XFS_TEST_ERROR(expr,a,b,c) ( expr ) | |
23639f77 ES |
142 | #define XFS_WANT_CORRUPTED_GOTO(mp, expr, l) \ |
143 | { \ | |
144 | if (!(expr)) { \ | |
145 | if ((mp)->m_flags & LIBXFS_MOUNT_WANT_CORRUPTED) \ | |
146 | printf("WANT_CORRUPTED_GOTO at %s:%d\n", \ | |
147 | __func__, __LINE__); \ | |
148 | error = -EFSCORRUPTED; \ | |
149 | goto l; \ | |
150 | } \ | |
151 | } | |
152 | #define XFS_WANT_CORRUPTED_RETURN(mp, expr) \ | |
153 | { \ | |
154 | if (!(expr)) { \ | |
155 | if ((mp)->m_flags & LIBXFS_MOUNT_WANT_CORRUPTED) \ | |
156 | printf("WANT_CORRUPTED_RETURN at %s:%d\n", \ | |
157 | __func__, __LINE__); \ | |
158 | return -EFSCORRUPTED; \ | |
159 | } \ | |
160 | } | |
5e656dbb | 161 | |
5e656dbb BN |
162 | #ifdef __GNUC__ |
163 | #define __return_address __builtin_return_address(0) | |
164 | #endif | |
165 | ||
364e85ec DC |
166 | #define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 |
167 | ||
5e656dbb BN |
168 | /* miscellaneous kernel routines not in user space */ |
169 | #define down_read(a) ((void) 0) | |
170 | #define up_read(a) ((void) 0) | |
171 | #define spin_lock_init(a) ((void) 0) | |
172 | #define spin_lock(a) ((void) 0) | |
173 | #define spin_unlock(a) ((void) 0) | |
174 | #define likely(x) (x) | |
175 | #define unlikely(x) (x) | |
56b2de80 DC |
176 | #define rcu_read_lock() ((void) 0) |
177 | #define rcu_read_unlock() ((void) 0) | |
c1587ecf CH |
178 | /* Need to be able to handle this bare or in control flow */ |
179 | static inline bool WARN_ON_ONCE(bool expr) { | |
180 | return (expr); | |
181 | } | |
19ebedcf | 182 | |
cbf3beaa GW |
183 | #define percpu_counter_read(x) (*x) |
184 | #define percpu_counter_read_positive(x) ((*x) > 0 ? (*x) : 0) | |
185 | #define percpu_counter_sum(x) (*x) | |
5e656dbb | 186 | |
2bd0ea18 | 187 | /* |
49f693fa | 188 | * prandom_u32 is used for di_gen inode allocation, it must be zero for libxfs |
5e656dbb | 189 | * or all sorts of badness can occur! |
2bd0ea18 | 190 | */ |
49f693fa | 191 | #define prandom_u32() 0 |
2bd0ea18 | 192 | |
b2327e1a | 193 | #define PAGE_SIZE getpagesize() |
2bd0ea18 | 194 | |
5e656dbb BN |
195 | static inline int __do_div(unsigned long long *n, unsigned base) |
196 | { | |
197 | int __res; | |
198 | __res = (int)(((unsigned long) *n) % (unsigned) base); | |
199 | *n = ((unsigned long) *n) / (unsigned) base; | |
200 | return __res; | |
201 | } | |
202 | ||
203 | #define do_div(n,base) (__do_div((unsigned long long *)&(n), (base))) | |
204 | #define do_mod(a, b) ((a) % (b)) | |
205 | #define rol32(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) | |
2bd0ea18 | 206 | |
5e656dbb BN |
207 | #define min_t(type,x,y) \ |
208 | ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) | |
209 | #define max_t(type,x,y) \ | |
210 | ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) | |
57c9fccb | 211 | |
91eba724 | 212 | |
7338c4b8 BF |
213 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) |
214 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | |
215 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | |
216 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | |
217 | ||
218 | /* | |
219 | * Handling for kernel bitmap types. | |
220 | */ | |
221 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, NBBY * sizeof(long)) | |
222 | #define DECLARE_BITMAP(name,bits) \ | |
223 | unsigned long name[BITS_TO_LONGS(bits)] | |
224 | #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) | |
225 | ||
226 | /* | |
227 | * This is a common helper function for find_next_bit and | |
228 | * find_next_zero_bit. The difference is the "invert" argument, which | |
229 | * is XORed with each fetched word before searching it for one bits. | |
230 | */ | |
231 | static inline unsigned long | |
232 | _find_next_bit(const unsigned long *addr, unsigned long nbits, | |
233 | unsigned long start, unsigned long invert) | |
234 | { | |
235 | unsigned long tmp; | |
236 | ||
237 | if (!nbits || start >= nbits) | |
238 | return nbits; | |
239 | ||
240 | tmp = addr[start / BITS_PER_LONG] ^ invert; | |
241 | ||
242 | /* Handle 1st word. */ | |
243 | tmp &= BITMAP_FIRST_WORD_MASK(start); | |
244 | start = round_down(start, BITS_PER_LONG); | |
245 | ||
246 | while (!tmp) { | |
247 | start += BITS_PER_LONG; | |
248 | if (start >= nbits) | |
249 | return nbits; | |
250 | ||
251 | tmp = addr[start / BITS_PER_LONG] ^ invert; | |
252 | } | |
253 | ||
254 | return min(start + ffs(tmp), nbits); | |
255 | } | |
256 | ||
257 | /* | |
258 | * Find the next set bit in a memory region. | |
259 | */ | |
260 | static inline unsigned long | |
261 | find_next_bit(const unsigned long *addr, unsigned long size, | |
262 | unsigned long offset) | |
263 | { | |
264 | return _find_next_bit(addr, size, offset, 0UL); | |
265 | } | |
266 | static inline unsigned long | |
267 | find_next_zero_bit(const unsigned long *addr, unsigned long size, | |
268 | unsigned long offset) | |
269 | { | |
270 | return _find_next_bit(addr, size, offset, ~0UL); | |
271 | } | |
272 | #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) | |
91eba724 | 273 | |
5e656dbb BN |
274 | static inline __attribute__((const)) |
275 | int is_power_of_2(unsigned long n) | |
276 | { | |
277 | return (n != 0 && ((n & (n - 1)) == 0)); | |
278 | } | |
2bd0ea18 NS |
279 | |
280 | /* | |
5e656dbb | 281 | * xfs_iroundup: round up argument to next power of two |
2bd0ea18 | 282 | */ |
5e656dbb BN |
283 | static inline uint |
284 | roundup_pow_of_two(uint v) | |
285 | { | |
286 | int i; | |
287 | uint m; | |
288 | ||
289 | if ((v & (v - 1)) == 0) | |
290 | return v; | |
291 | ASSERT((v & 0x80000000) == 0); | |
292 | if ((v & (v + 1)) == 0) | |
293 | return v + 1; | |
294 | for (i = 0, m = 1; i < 31; i++, m <<= 1) { | |
295 | if (v & m) | |
296 | continue; | |
297 | v |= m; | |
298 | if ((v & (v + 1)) == 0) | |
299 | return v + 1; | |
300 | } | |
301 | ASSERT(0); | |
302 | return 0; | |
303 | } | |
2bd0ea18 | 304 | |
88cd79be DC |
305 | static inline __uint64_t |
306 | roundup_64(__uint64_t x, __uint32_t y) | |
307 | { | |
308 | x += y - 1; | |
309 | do_div(x, y); | |
310 | return x * y; | |
311 | } | |
312 | ||
2bd0ea18 NS |
313 | /* buffer management */ |
314 | #define XFS_BUF_LOCK 0 | |
2bd0ea18 | 315 | #define XFS_BUF_TRYLOCK 0 |
56b2de80 DC |
316 | #define XBF_LOCK XFS_BUF_LOCK |
317 | #define XBF_TRYLOCK XFS_BUF_TRYLOCK | |
318 | #define XBF_DONT_BLOCK 0 | |
a2ceac1f | 319 | #define XBF_UNMAPPED 0 |
e9d35108 | 320 | #define XBF_DONE 0 |
2bd0ea18 | 321 | #define XFS_BUF_GETERROR(bp) 0 |
f1b058f9 NS |
322 | #define XFS_BUF_DONE(bp) ((bp)->b_flags |= LIBXFS_B_UPTODATE) |
323 | #define XFS_BUF_ISDONE(bp) ((bp)->b_flags & LIBXFS_B_UPTODATE) | |
a2ceac1f | 324 | #define xfs_buf_stale(bp) ((bp)->b_flags |= LIBXFS_B_STALE) |
f1b058f9 | 325 | #define XFS_BUF_UNDELAYWRITE(bp) ((bp)->b_flags &= ~LIBXFS_B_DIRTY) |
2bd0ea18 NS |
326 | #define XFS_BUF_SET_VTYPE(a,b) ((void) 0) |
327 | #define XFS_BUF_SET_VTYPE_REF(a,b,c) ((void) 0) | |
328 | #define XFS_BUF_SET_BDSTRAT_FUNC(a,b) ((void) 0) | |
5e656dbb | 329 | |
9d6fabc0 DC |
330 | /* avoid gcc warning */ |
331 | #define xfs_incore(bt,blkno,len,lockit) ({ \ | |
332 | typeof(blkno) __foo = (blkno); \ | |
6bddecbc | 333 | typeof(len) __bar = (len); \ |
9d6fabc0 | 334 | (blkno) = __foo; \ |
6bddecbc | 335 | (len) = __bar; /* no set-but-unused warning */ \ |
9d6fabc0 DC |
336 | NULL; \ |
337 | }) | |
2bd0ea18 | 338 | #define xfs_buf_relse(bp) libxfs_putbuf(bp) |
75c8b434 | 339 | #define xfs_buf_get(devp,blkno,len,f) (libxfs_getbuf((devp), (blkno), (len))) |
9d6fabc0 | 340 | #define xfs_bwrite(bp) libxfs_writebuf((bp), 0) |
e9d35108 | 341 | #define xfs_buf_delwri_queue(bp, bl) libxfs_writebuf((bp), 0) |
57c9fccb | 342 | |
56b2de80 DC |
343 | #define XBRW_READ LIBXFS_BREAD |
344 | #define XBRW_WRITE LIBXFS_BWRITE | |
345 | #define xfs_buf_iomove(bp,off,len,data,f) libxfs_iomove(bp,off,len,data,f) | |
346 | #define xfs_buf_zero(bp,off,len) libxfs_iomove(bp,off,len,0,LIBXFS_BZERO) | |
2bd0ea18 | 347 | |
5e656dbb BN |
348 | /* mount stuff */ |
349 | #define XFS_MOUNT_32BITINODES LIBXFS_MOUNT_32BITINODES | |
350 | #define XFS_MOUNT_ATTR2 LIBXFS_MOUNT_ATTR2 | |
351 | #define XFS_MOUNT_SMALL_INUMS 0 /* ignored in userspace */ | |
352 | #define XFS_MOUNT_WSYNC 0 /* ignored in userspace */ | |
353 | #define XFS_MOUNT_NOALIGN 0 /* ignored in userspace */ | |
3439d03a | 354 | #define XFS_MOUNT_IKEEP 0 /* ignored in userspace */ |
ff105f75 DC |
355 | #define XFS_MOUNT_SWALLOC 0 /* ignored in userspace */ |
356 | #define XFS_MOUNT_RDONLY 0 /* ignored in userspace */ | |
5e656dbb | 357 | |
5e656dbb BN |
358 | |
359 | #define xfs_trans_get_block_res(tp) 1 | |
360 | #define xfs_trans_set_sync(tp) ((void) 0) | |
e9d35108 | 361 | #define xfs_trans_ordered_buf(tp, bp) ((void) 0) |
5e656dbb BN |
362 | #define xfs_trans_agblocks_delta(tp, d) |
363 | #define xfs_trans_agflist_delta(tp, d) | |
364 | #define xfs_trans_agbtree_delta(tp, d) | |
6bddecbc DC |
365 | #define xfs_trans_buf_set_type(tp, bp, t) ({ \ |
366 | int __t = (t); \ | |
367 | __t = __t; /* no set-but-unused warning */ \ | |
fca3ed92 | 368 | tp = tp; /* no set-but-unused warning */ \ |
6bddecbc DC |
369 | }) |
370 | ||
8b4dc4a9 | 371 | #define xfs_trans_buf_copy_type(dbp, sbp) |
5e656dbb | 372 | |
10851b18 DC |
373 | /* no readahead, need to avoid set-but-unused var warnings. */ |
374 | #define xfs_buf_readahead(a,d,c,ops) ({ \ | |
375 | xfs_daddr_t __d = d; \ | |
376 | __d = __d; /* no set-but-unused warning */ \ | |
377 | }) | |
a2ceac1f | 378 | #define xfs_buf_readahead_map(a,b,c,ops) ((void) 0) /* no readahead */ |
a2ceac1f | 379 | #define xfs_buftrace(x,y) ((void) 0) /* debug only */ |
5e656dbb BN |
380 | |
381 | #define xfs_cmn_err(tag,level,mp,fmt,args...) cmn_err(level,fmt, ## args) | |
a2ceac1f DC |
382 | #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) |
383 | #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) | |
384 | #define xfs_alert_tag(mp,tag,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) | |
5e656dbb | 385 | |
2bd0ea18 NS |
386 | #define xfs_dir2_trace_args(where, args) ((void) 0) |
387 | #define xfs_dir2_trace_args_b(where, args, bp) ((void) 0) | |
388 | #define xfs_dir2_trace_args_bb(where, args, lbp, dbp) ((void) 0) | |
389 | #define xfs_dir2_trace_args_bibii(where, args, bs, ss, bd, sd, c) ((void) 0) | |
390 | #define xfs_dir2_trace_args_db(where, args, db, bp) ((void) 0) | |
391 | #define xfs_dir2_trace_args_i(where, args, i) ((void) 0) | |
392 | #define xfs_dir2_trace_args_s(where, args, s) ((void) 0) | |
393 | #define xfs_dir2_trace_args_sb(where, args, s, bp) ((void) 0) | |
5e656dbb | 394 | #define xfs_sort qsort |
2bd0ea18 | 395 | |
5e656dbb BN |
396 | #define xfs_icsb_reinit_counters(mp) do { } while (0) |
397 | #define xfs_initialize_perag_icache(pag) ((void) 0) | |
27c21191 | 398 | |
5e656dbb | 399 | #define xfs_ilock(ip,mode) ((void) 0) |
a2ceac1f DC |
400 | #define xfs_ilock_nowait(ip,mode) ((void) 0) |
401 | #define xfs_ilock_demote(ip,mode) ((void) 0) | |
ff105f75 DC |
402 | #define xfs_ilock_data_map_shared(ip) (0) |
403 | #define xfs_ilock_attr_map_shared(ip) (0) | |
404 | #define xfs_iunlock(ip,mode) ({ \ | |
405 | typeof(mode) __mode = mode; \ | |
406 | __mode = __mode; /* no set-but-unused warning */ \ | |
407 | }) | |
a2ceac1f | 408 | #define __xfs_flock(ip) ((void) 0) |
2bd0ea18 | 409 | |
5e656dbb | 410 | /* space allocation */ |
a2ceac1f | 411 | #define xfs_extent_busy_reuse(mp,ag,bno,len,user) ((void) 0) |
aefc06c1 ES |
412 | /* avoid unused variable warning */ |
413 | #define xfs_extent_busy_insert(tp,ag,bno,len,flags)({ \ | |
414 | xfs_agnumber_t __foo = ag; \ | |
415 | __foo = __foo; /* no set-but-unused warning */ \ | |
416 | }) | |
cd80de04 CH |
417 | #define xfs_extent_busy_trim(args,bno,len,busy_gen) ({ \ |
418 | unsigned __foo = *(busy_gen); \ | |
419 | *(busy_gen) = __foo; \ | |
420 | false; \ | |
421 | }) | |
422 | #define xfs_extent_busy_flush(mp,pag,busy_gen) (0) | |
a2ceac1f | 423 | |
56b2de80 DC |
424 | /* avoid unused variable warning */ |
425 | #define xfs_alloc_busy_insert(tp,ag,b,len) ({ \ | |
426 | xfs_agnumber_t __foo = ag; \ | |
427 | __foo = 0; \ | |
428 | }) | |
a2ceac1f | 429 | |
5e656dbb | 430 | #define xfs_rotorstep 1 |
1f2ace68 | 431 | #define xfs_bmap_rtalloc(a) (-ENOSYS) |
5e656dbb | 432 | #define xfs_get_extsz_hint(ip) (0) |
10460994 | 433 | #define xfs_get_cowextsz_hint(ip) (0) |
5e656dbb BN |
434 | #define xfs_inode_is_filestream(ip) (0) |
435 | #define xfs_filestream_lookup_ag(ip) (0) | |
436 | #define xfs_filestream_new_ag(ip,ag) (0) | |
2bd0ea18 | 437 | |
a2ceac1f DC |
438 | #define xfs_log_force(mp,flags) ((void) 0) |
439 | #define XFS_LOG_SYNC 1 | |
440 | ||
441 | /* quota bits */ | |
442 | #define xfs_trans_mod_dquot_byino(t,i,f,d) ((void) 0) | |
443 | #define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0) | |
444 | #define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) ((void) 0) | |
445 | #define xfs_qm_dqattach(i,f) (0) | |
446 | ||
5dfa5cd2 DC |
447 | #define uuid_copy(s,d) platform_uuid_copy((s),(d)) |
448 | #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) | |
449 | ||
e9d35108 | 450 | #define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0) |
4896e6c8 | 451 | #define xfs_sb_validate_fsb_count(sbp, nblks) (0) |
e9d35108 | 452 | |
2bd0ea18 | 453 | /* |
5e656dbb | 454 | * Prototypes for kernel static functions that are aren't in their |
b626fb59 | 455 | * associated header files. |
2bd0ea18 | 456 | */ |
b626fb59 DC |
457 | struct xfs_da_args; |
458 | struct xfs_bmap_free; | |
459 | struct xfs_bmap_free_item; | |
460 | struct xfs_mount; | |
461 | struct xfs_sb; | |
462 | struct xfs_trans; | |
463 | struct xfs_inode; | |
464 | struct xfs_log_item; | |
465 | struct xfs_buf; | |
466 | struct xfs_buf_map; | |
467 | struct xfs_buf_log_item; | |
468 | struct xfs_buftarg; | |
2bd0ea18 | 469 | |
5e656dbb BN |
470 | /* xfs_attr.c */ |
471 | int xfs_attr_rmtval_get(struct xfs_da_args *); | |
2bd0ea18 NS |
472 | |
473 | /* xfs_bmap.c */ | |
2cf6d225 | 474 | void xfs_bmap_del_free(struct xfs_bmap_free *, struct xfs_bmap_free_item *); |
5e656dbb BN |
475 | |
476 | /* xfs_mount.c */ | |
b626fb59 DC |
477 | int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t); |
478 | void xfs_mount_common(struct xfs_mount *, struct xfs_sb *); | |
5e656dbb BN |
479 | |
480 | /* | |
481 | * logitem.c and trans.c prototypes | |
482 | */ | |
4329aa4c DC |
483 | void xfs_trans_init(struct xfs_mount *); |
484 | int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); | |
2bd0ea18 NS |
485 | |
486 | /* xfs_trans_item.c */ | |
c40bdaa2 DC |
487 | void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *); |
488 | void xfs_trans_del_item(struct xfs_log_item *); | |
2bd0ea18 | 489 | |
2bd0ea18 | 490 | /* xfs_inode_item.c */ |
b626fb59 | 491 | void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); |
2bd0ea18 NS |
492 | |
493 | /* xfs_buf_item.c */ | |
b626fb59 DC |
494 | void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); |
495 | void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint); | |
2bd0ea18 | 496 | |
5e656dbb | 497 | /* xfs_trans_buf.c */ |
b626fb59 DC |
498 | struct xfs_buf *xfs_trans_buf_item_match(struct xfs_trans *, |
499 | struct xfs_buftarg *, struct xfs_buf_map *, int); | |
5e656dbb | 500 | |
2bd0ea18 | 501 | /* local source files */ |
19ebedcf DC |
502 | #define xfs_mod_fdblocks(mp, delta, rsvd) \ |
503 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FDBLOCKS, delta, rsvd) | |
504 | #define xfs_mod_frextents(mp, delta) \ | |
505 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FREXTENTS, delta, 0) | |
506 | int libxfs_mod_incore_sb(struct xfs_mount *, int, int64_t, int); | |
2dd13604 ES |
507 | /* percpu counters in mp are #defined to the superblock sb_ counters */ |
508 | #define xfs_reinit_percpu_counters(mp) | |
19ebedcf | 509 | |
b626fb59 | 510 | void xfs_trans_mod_sb(struct xfs_trans *, uint, long); |
79737cd9 DC |
511 | void xfs_trans_init(struct xfs_mount *); |
512 | int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); | |
99c1ec96 | 513 | void xfs_verifier_error(struct xfs_buf *bp); |
f616e2bf | 514 | |
b626fb59 DC |
515 | /* XXX: this is clearly a bug - a shared header needs to export this */ |
516 | /* xfs_rtalloc.c */ | |
517 | int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t); | |
518 | ||
9542ae13 DC |
519 | int libxfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb, |
520 | xfs_off_t count_fsb); | |
521 | ||
a65d8d29 BF |
522 | bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t); |
523 | ||
f7b1a8b1 BF |
524 | /* xfs_icache.c */ |
525 | #define xfs_inode_set_cowblocks_tag(ip) | |
526 | #define xfs_inode_set_eofblocks_tag(ip) | |
527 | ||
5d8acc46 DC |
528 | /* xfs_stats.h */ |
529 | #define XFS_STATS_CALC_INDEX(member) 0 | |
530 | #define XFS_STATS_INC_OFF(mp, off) | |
531 | #define XFS_STATS_ADD_OFF(mp, off, val) | |
532 | ||
533 | ||
b626fb59 | 534 | #endif /* __LIBXFS_INTERNAL_XFS_H__ */ |