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