]>
Commit | Line | Data |
---|---|---|
1 | // SPDX-License-Identifier: GPL-2.0 | |
2 | /* | |
3 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. | |
4 | * All Rights Reserved. | |
5 | */ | |
6 | ||
7 | /* | |
8 | * This header is effectively a "namespace multiplexor" for the | |
9 | * user level XFS code. It provides all of the necessary stuff | |
10 | * such that we can build some parts of the XFS kernel code in | |
11 | * user space in a controlled fashion, and translates the names | |
12 | * used in the kernel into the names which libxfs is going to | |
13 | * make available to user tools. | |
14 | * | |
15 | * It should only ever be #include'd by XFS "kernel" code being | |
16 | * compiled in user space. | |
17 | * | |
18 | * Our goals here are to... | |
19 | * o "share" large amounts of complex code between user and | |
20 | * kernel space; | |
21 | * o shield the user tools from changes in the bleeding | |
22 | * edge kernel code, merging source changes when | |
23 | * convenient and not immediately (no symlinks); | |
24 | * o i.e. be able to merge changes to the kernel source back | |
25 | * into the affected user tools in a controlled fashion; | |
26 | * o provide a _minimalist_ life-support system for kernel | |
27 | * code in user land, not the "everything + the kitchen | |
28 | * sink" model which libsim had mutated into; | |
29 | * o allow the kernel code to be completely free of code | |
30 | * specifically there to support the user level build. | |
31 | */ | |
32 | ||
33 | /* | |
34 | * define a guard and something we can check to determine what include context | |
35 | * we are running from. | |
36 | */ | |
37 | #ifndef __LIBXFS_INTERNAL_XFS_H__ | |
38 | #define __LIBXFS_INTERNAL_XFS_H__ | |
39 | ||
40 | /* CONFIG_XFS_* must be defined to 1 to work with IS_ENABLED() */ | |
41 | #define CONFIG_XFS_RT 1 | |
42 | #define CONFIG_XFS_BTREE_IN_MEM 1 | |
43 | ||
44 | #include "libxfs_api_defs.h" | |
45 | #include "platform_defs.h" | |
46 | #include "xfs.h" | |
47 | ||
48 | #include "list.h" | |
49 | #include "hlist.h" | |
50 | #include "cache.h" | |
51 | #include "bitops.h" | |
52 | #include "kmem.h" | |
53 | #include "libfrog/radix-tree.h" | |
54 | #include "libfrog/bitmask.h" | |
55 | #include "libfrog/div64.h" | |
56 | #include "libfrog/util.h" | |
57 | #include "atomic.h" | |
58 | #include "spinlock.h" | |
59 | #include "linux-err.h" | |
60 | ||
61 | #include "xfs_types.h" | |
62 | #include "xfs_arch.h" | |
63 | ||
64 | #include "xfs_fs.h" | |
65 | #include "libfrog/crc32c.h" | |
66 | ||
67 | #include <sys/xattr.h> | |
68 | #ifdef HAVE_GETRANDOM_NONBLOCK | |
69 | #include <sys/random.h> | |
70 | #endif | |
71 | ||
72 | /* Zones used in libxfs allocations that aren't in shared header files */ | |
73 | extern struct kmem_cache *xfs_buf_item_cache; | |
74 | extern struct kmem_cache *xfs_ili_cache; | |
75 | extern struct kmem_cache *xfs_buf_cache; | |
76 | extern struct kmem_cache *xfs_inode_cache; | |
77 | extern struct kmem_cache *xfs_trans_cache; | |
78 | ||
79 | /* fake up iomap, (not) used in xfs_bmap.[ch] */ | |
80 | #define IOMAP_F_SHARED 0x04 | |
81 | #define xfs_bmbt_to_iomap(a, b, c, d, e, f) ((void) 0) | |
82 | ||
83 | /* CRC stuff, buffer API dependent on it */ | |
84 | #define crc32c(c,p,l) crc32c_le((c),(unsigned char const *)(p),(l)) | |
85 | ||
86 | /* fake up kernel's iomap, (not) used in xfs_bmap.[ch] */ | |
87 | struct iomap { | |
88 | unsigned long long offset; /* do not use */ | |
89 | unsigned long long length; /* do not use */ | |
90 | }; | |
91 | ||
92 | #define cancel_delayed_work_sync(work) do { } while(0) | |
93 | ||
94 | #include "xfs_cksum.h" | |
95 | ||
96 | /* | |
97 | * This mirrors the kernel include for xfs_buf.h - it's implicitly included in | |
98 | * every files via a similar include in the kernel xfs_linux.h. | |
99 | */ | |
100 | #include "libxfs_io.h" | |
101 | ||
102 | /* for all the support code that uses progname in error messages */ | |
103 | extern char *progname; | |
104 | ||
105 | #undef ASSERT | |
106 | #define ASSERT(ex) assert(ex) | |
107 | ||
108 | /* | |
109 | * We have no need for the "linux" dev_t in userspace, so these | |
110 | * are no-ops, and an xfs_dev_t is stored in VFS_I(ip)->i_rdev | |
111 | */ | |
112 | #define xfs_to_linux_dev_t(dev) dev | |
113 | #define linux_to_xfs_dev_t(dev) dev | |
114 | ||
115 | #ifndef EWRONGFS | |
116 | #define EWRONGFS EINVAL | |
117 | #endif | |
118 | ||
119 | #define xfs_error_level 0 | |
120 | ||
121 | #define STATIC static | |
122 | ||
123 | /* | |
124 | * Starting in Linux 4.15, the %p (raw pointer value) printk modifier | |
125 | * prints a hashed version of the pointer to avoid leaking kernel | |
126 | * pointers into dmesg. If we're trying to debug the kernel we want the | |
127 | * raw values, so override this behavior as best we can. | |
128 | * | |
129 | * In userspace we don't have this problem. | |
130 | */ | |
131 | #define PTR_FMT "%p" | |
132 | ||
133 | #define XFS_IGET_CREATE 0x1 | |
134 | #define XFS_IGET_UNTRUSTED 0x2 | |
135 | ||
136 | extern void cmn_err(int, char *, ...); | |
137 | enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; | |
138 | ||
139 | #define xfs_info(mp,fmt,args...) cmn_err(CE_CONT, _(fmt), ## args) | |
140 | #define xfs_info_ratelimited(mp,fmt,args...) cmn_err(CE_CONT, _(fmt), ## args) | |
141 | #define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE, _(fmt), ## args) | |
142 | #define xfs_warn(mp,fmt,args...) cmn_err((mp) ? CE_WARN : CE_WARN, _(fmt), ## args) | |
143 | #define xfs_err(mp,fmt,args...) cmn_err(CE_ALERT, _(fmt), ## args) | |
144 | #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT, _(fmt), ## args) | |
145 | ||
146 | #define xfs_buf_ioerror_alert(bp,f) ((void) 0); | |
147 | ||
148 | #define xfs_hex_dump(d,n) ((void) 0) | |
149 | #define xfs_stack_trace() ((void) 0) | |
150 | ||
151 | ||
152 | #define xfs_force_shutdown(d,n) ((void) 0) | |
153 | #define xfs_mod_delalloc(a,b,c) ((void) 0) | |
154 | #define xfs_mod_sb_delalloc(sb, d) ((void) 0) | |
155 | ||
156 | /* stop unused var warnings by assigning mp to itself */ | |
157 | ||
158 | #define xfs_corruption_error(e,l,mp,b,sz,fi,ln,fa) do { \ | |
159 | (mp) = (mp); \ | |
160 | cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \ | |
161 | } while (0) | |
162 | ||
163 | #define XFS_CORRUPTION_ERROR(e, lvl, mp, buf, bufsize) do { \ | |
164 | (mp) = (mp); \ | |
165 | cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \ | |
166 | } while (0) | |
167 | ||
168 | #define XFS_ERROR_REPORT(e,l,mp) do { \ | |
169 | (mp) = (mp); \ | |
170 | cmn_err(CE_ALERT, "%s: XFS_ERROR_REPORT", (e)); \ | |
171 | } while (0) | |
172 | ||
173 | #define XFS_WARN_CORRUPT(mp, expr) \ | |
174 | ( xfs_is_reporting_corruption(mp) ? \ | |
175 | (printf("%s: XFS_WARN_CORRUPT at %s:%d", #expr, \ | |
176 | __func__, __LINE__), true) : true) | |
177 | ||
178 | #define XFS_IS_CORRUPT(mp, expr) \ | |
179 | (unlikely(expr) ? XFS_WARN_CORRUPT((mp), (expr)) : false) | |
180 | ||
181 | #define XFS_ERRLEVEL_LOW 1 | |
182 | #define XFS_ILOCK_EXCL 0 | |
183 | #define XFS_ILOCK_SHARED 0 | |
184 | #define XFS_IOLOCK_EXCL 0 | |
185 | #define XFS_STATS_INC(mp, count) do { (mp) = (mp); } while (0) | |
186 | #define XFS_STATS_DEC(mp, count, x) do { (mp) = (mp); } while (0) | |
187 | #define XFS_STATS_ADD(mp, count, x) do { (mp) = (mp); } while (0) | |
188 | #define XFS_TEST_ERROR(expr,a,b) ( expr ) | |
189 | ||
190 | #define __section(section) __attribute__((__section__(section))) | |
191 | ||
192 | #define xfs_printk_once(func, dev, fmt, ...) \ | |
193 | ({ \ | |
194 | static bool __section(".data.once") __print_once; \ | |
195 | bool __ret_print_once = !__print_once; \ | |
196 | \ | |
197 | if (!__print_once) { \ | |
198 | __print_once = true; \ | |
199 | func(dev, fmt, ##__VA_ARGS__); \ | |
200 | } \ | |
201 | unlikely(__ret_print_once); \ | |
202 | }) | |
203 | ||
204 | #define xfs_info_once(dev, fmt, ...) \ | |
205 | xfs_printk_once(xfs_info, dev, fmt, ##__VA_ARGS__) | |
206 | ||
207 | /* Need to be able to handle this bare or in control flow */ | |
208 | static inline bool WARN_ON(bool expr) { | |
209 | return (expr); | |
210 | } | |
211 | ||
212 | #define WARN_ON_ONCE(e) WARN_ON(e) | |
213 | ||
214 | #define percpu_counter_read_positive(x) ((*x) > 0 ? (*x) : 0) | |
215 | #define percpu_counter_sum_positive(x) ((*x) > 0 ? (*x) : 0) | |
216 | ||
217 | #ifdef HAVE_GETRANDOM_NONBLOCK | |
218 | uint32_t get_random_u32(void); | |
219 | #else | |
220 | #define get_random_u32() (0) | |
221 | #endif | |
222 | ||
223 | #define PAGE_SIZE getpagesize() | |
224 | extern unsigned int PAGE_SHIFT; | |
225 | ||
226 | #define inode_peek_iversion(inode) (inode)->i_version | |
227 | #define inode_set_iversion_queried(inode, version) do { \ | |
228 | (inode)->i_version = (version); \ | |
229 | } while (0) | |
230 | ||
231 | struct inode; | |
232 | struct mnt_idmap; | |
233 | ||
234 | void inode_init_owner(struct mnt_idmap *idmap, struct inode *inode, | |
235 | const struct inode *dir, umode_t mode); | |
236 | ||
237 | #define min_t(type,x,y) \ | |
238 | ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) | |
239 | #define max_t(type,x,y) \ | |
240 | ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) | |
241 | ||
242 | /** | |
243 | * swap - swap values of @a and @b | |
244 | * @a: first value | |
245 | * @b: second value | |
246 | */ | |
247 | #define swap(a, b) \ | |
248 | do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) | |
249 | ||
250 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | |
251 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | |
252 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | |
253 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | |
254 | ||
255 | /* | |
256 | * Handling for kernel bitmap types. | |
257 | */ | |
258 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, NBBY * sizeof(long)) | |
259 | #define DECLARE_BITMAP(name,bits) \ | |
260 | unsigned long name[BITS_TO_LONGS(bits)] | |
261 | #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) | |
262 | ||
263 | /* | |
264 | * This is a common helper function for find_next_bit and | |
265 | * find_next_zero_bit. The difference is the "invert" argument, which | |
266 | * is XORed with each fetched word before searching it for one bits. | |
267 | */ | |
268 | static inline unsigned long | |
269 | _find_next_bit(const unsigned long *addr, unsigned long nbits, | |
270 | unsigned long start, unsigned long invert) | |
271 | { | |
272 | unsigned long tmp; | |
273 | ||
274 | if (!nbits || start >= nbits) | |
275 | return nbits; | |
276 | ||
277 | tmp = addr[start / BITS_PER_LONG] ^ invert; | |
278 | ||
279 | /* Handle 1st word. */ | |
280 | tmp &= BITMAP_FIRST_WORD_MASK(start); | |
281 | start = round_down(start, BITS_PER_LONG); | |
282 | ||
283 | while (!tmp) { | |
284 | start += BITS_PER_LONG; | |
285 | if (start >= nbits) | |
286 | return nbits; | |
287 | ||
288 | tmp = addr[start / BITS_PER_LONG] ^ invert; | |
289 | } | |
290 | ||
291 | return min(start + ffs(tmp), nbits); | |
292 | } | |
293 | ||
294 | /* | |
295 | * Find the next set bit in a memory region. | |
296 | */ | |
297 | static inline unsigned long | |
298 | find_next_bit(const unsigned long *addr, unsigned long size, | |
299 | unsigned long offset) | |
300 | { | |
301 | return _find_next_bit(addr, size, offset, 0UL); | |
302 | } | |
303 | static inline unsigned long | |
304 | find_next_zero_bit(const unsigned long *addr, unsigned long size, | |
305 | unsigned long offset) | |
306 | { | |
307 | return _find_next_bit(addr, size, offset, ~0UL); | |
308 | } | |
309 | #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) | |
310 | ||
311 | /* | |
312 | * xfs_iroundup: round up argument to next power of two | |
313 | */ | |
314 | static inline uint | |
315 | roundup_pow_of_two(uint v) | |
316 | { | |
317 | int i; | |
318 | uint m; | |
319 | ||
320 | if ((v & (v - 1)) == 0) | |
321 | return v; | |
322 | ASSERT((v & 0x80000000) == 0); | |
323 | if ((v & (v + 1)) == 0) | |
324 | return v + 1; | |
325 | for (i = 0, m = 1; i < 31; i++, m <<= 1) { | |
326 | if (v & m) | |
327 | continue; | |
328 | v |= m; | |
329 | if ((v & (v + 1)) == 0) | |
330 | return v + 1; | |
331 | } | |
332 | ASSERT(0); | |
333 | return 0; | |
334 | } | |
335 | ||
336 | /* If @b is a power of 2, return log2(b). Else return -1. */ | |
337 | static inline int8_t log2_if_power2(unsigned long b) | |
338 | { | |
339 | unsigned long mask = 1; | |
340 | unsigned int i; | |
341 | unsigned int ret = 1; | |
342 | ||
343 | if (!is_power_of_2(b)) | |
344 | return -1; | |
345 | ||
346 | for (i = 0; i < NBBY * sizeof(unsigned long); i++, mask <<= 1) { | |
347 | if (b & mask) | |
348 | ret = i; | |
349 | } | |
350 | ||
351 | return ret; | |
352 | } | |
353 | ||
354 | /* If @b is a power of 2, return a mask of the lower bits, else return zero. */ | |
355 | static inline unsigned long long mask64_if_power2(unsigned long b) | |
356 | { | |
357 | return is_power_of_2(b) ? b - 1 : 0; | |
358 | } | |
359 | ||
360 | /* buffer management */ | |
361 | #define XBF_TRYLOCK 0 | |
362 | #define XBF_DONE 0 | |
363 | #define xfs_buf_stale(bp) ((bp)->b_flags |= LIBXFS_B_STALE) | |
364 | #define XFS_BUF_UNDELAYWRITE(bp) ((bp)->b_flags &= ~LIBXFS_B_DIRTY) | |
365 | ||
366 | /* buffer type flags for write callbacks */ | |
367 | #define _XBF_INODES 0 /* inode buffer */ | |
368 | #define _XBF_DQUOTS 0 /* dquot buffer */ | |
369 | #define _XBF_LOGRECOVERY 0 /* log recovery buffer */ | |
370 | ||
371 | static inline int | |
372 | xfs_buf_incore( | |
373 | struct xfs_buftarg *target, | |
374 | xfs_daddr_t blkno, | |
375 | size_t numblks, | |
376 | xfs_buf_flags_t flags, | |
377 | struct xfs_buf **bpp) | |
378 | { | |
379 | *bpp = NULL; | |
380 | return -ENOENT; | |
381 | } | |
382 | ||
383 | #define xfs_buf_oneshot(bp) ((void) 0) | |
384 | ||
385 | #define xfs_buf_zero(bp, off, len) \ | |
386 | memset((bp)->b_addr + off, 0, len); | |
387 | ||
388 | void __xfs_buf_mark_corrupt(struct xfs_buf *bp, xfs_failaddr_t fa); | |
389 | #define xfs_buf_mark_corrupt(bp) __xfs_buf_mark_corrupt((bp), __this_address) | |
390 | ||
391 | /* mount stuff */ | |
392 | #define xfs_trans_set_sync(tp) ((void) 0) | |
393 | #define xfs_trans_buf_set_type(tp, bp, t) ({ \ | |
394 | int __t = (t); \ | |
395 | __t = __t; /* no set-but-unused warning */ \ | |
396 | tp = tp; /* no set-but-unused warning */ \ | |
397 | }) | |
398 | ||
399 | #define xfs_trans_buf_copy_type(dbp, sbp) | |
400 | ||
401 | static inline void | |
402 | xfs_buf_readahead( | |
403 | struct xfs_buftarg *target, | |
404 | xfs_daddr_t blkno, | |
405 | size_t numblks, | |
406 | const struct xfs_buf_ops *ops) | |
407 | { | |
408 | } | |
409 | #define xfs_buf_readahead_map(a,b,c,ops) ((void) 0) /* no readahead */ | |
410 | ||
411 | #define xfs_sort qsort | |
412 | ||
413 | #define xfs_ilock(ip,mode) ((void) 0) | |
414 | #define xfs_ilock_data_map_shared(ip) (0) | |
415 | #define xfs_ilock_attr_map_shared(ip) (0) | |
416 | #define xfs_iunlock(ip,mode) ({ \ | |
417 | typeof(mode) __mode = mode; \ | |
418 | __mode = __mode; /* no set-but-unused warning */ \ | |
419 | }) | |
420 | #define xfs_lock_two_inodes(ip0,mode0,ip1,mode1) ((void) 0) | |
421 | #define xfs_assert_ilocked(ip, flags) ((void) 0) | |
422 | #define xfs_lock_inodes(i_tab, nr, mode) ((void) 0) | |
423 | #define xfs_sort_inodes(i_tab, nr) ((void) 0) | |
424 | ||
425 | /* space allocation */ | |
426 | #define XFS_EXTENT_BUSY_DISCARDED 0x01 /* undergoing a discard op. */ | |
427 | #define XFS_EXTENT_BUSY_SKIP_DISCARD 0x02 /* do not discard */ | |
428 | ||
429 | #define xfs_extent_busy_reuse(...) ((void) 0) | |
430 | /* avoid unused variable warning */ | |
431 | #define xfs_extent_busy_insert(tp,xg,bno,len,flags)({ \ | |
432 | struct xfs_group *__foo = xg; \ | |
433 | __foo = __foo; /* no set-but-unused warning */ \ | |
434 | }) | |
435 | #define xfs_extent_busy_trim(group,minlen,maxlen,bno,len,busy_gen) ({ \ | |
436 | unsigned __foo = *(busy_gen); \ | |
437 | *(busy_gen) = __foo; \ | |
438 | false; \ | |
439 | }) | |
440 | #define xfs_extent_busy_flush(tp,pag,busy_gen,alloc_flags) ((int)(0)) | |
441 | ||
442 | #define xfs_rotorstep 1 | |
443 | #define xfs_bmap_rtalloc(a) (-ENOSYS) | |
444 | #define xfs_inode_is_filestream(ip) (0) | |
445 | #define xfs_filestream_lookup_ag(ip) (0) | |
446 | #define xfs_filestream_new_ag(ip,ag) (0) | |
447 | #define xfs_filestream_select_ag(...) (-ENOSYS) | |
448 | ||
449 | #define xfs_trans_inode_buf(tp, bp) ((void) 0) | |
450 | ||
451 | /* quota bits */ | |
452 | #define xfs_trans_mod_dquot_byino(t,i,f,d) ({ \ | |
453 | uint _f = (f); \ | |
454 | _f = _f; /* shut up gcc */ \ | |
455 | }) | |
456 | #define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0) | |
457 | ||
458 | /* hack too silence gcc */ | |
459 | static inline int retzero(void) { return 0; } | |
460 | #define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) retzero() | |
461 | #define xfs_quota_unreserve_blkres(i,b) retzero() | |
462 | ||
463 | #define xfs_quota_reserve_blkres(i,b) (0) | |
464 | #define xfs_qm_dqattach(i) (0) | |
465 | ||
466 | #define uuid_copy(s,d) platform_uuid_copy((s),(d)) | |
467 | #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) | |
468 | ||
469 | #define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0) | |
470 | #define xfs_sb_validate_fsb_count(sbp, nblks) (0) | |
471 | #define xlog_calc_iovec_len(len) roundup(len, sizeof(uint32_t)) | |
472 | ||
473 | #define xfs_zoned_add_available(mp, rtxnum) do { } while (0) | |
474 | ||
475 | /* | |
476 | * Prototypes for kernel static functions that are aren't in their | |
477 | * associated header files. | |
478 | */ | |
479 | struct xfs_da_args; | |
480 | struct xfs_bmap_free; | |
481 | struct xfs_bmap_free_item; | |
482 | struct xfs_mount; | |
483 | struct xfs_sb; | |
484 | struct xfs_trans; | |
485 | struct xfs_inode; | |
486 | struct xfs_log_item; | |
487 | struct xfs_buf; | |
488 | struct xfs_buf_map; | |
489 | struct xfs_buf_log_item; | |
490 | struct xfs_buftarg; | |
491 | ||
492 | /* xfs_attr.c */ | |
493 | int xfs_attr_rmtval_get(struct xfs_da_args *); | |
494 | ||
495 | /* xfs_bmap.c */ | |
496 | void xfs_bmap_del_free(struct xfs_bmap_free *, struct xfs_bmap_free_item *); | |
497 | ||
498 | /* xfs_mount.c */ | |
499 | void xfs_mount_common(struct xfs_mount *, struct xfs_sb *); | |
500 | ||
501 | /* | |
502 | * logitem.c and trans.c prototypes | |
503 | */ | |
504 | void xfs_trans_init(struct xfs_mount *); | |
505 | int xfs_trans_roll(struct xfs_trans **); | |
506 | ||
507 | /* xfs_trans_item.c */ | |
508 | void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *); | |
509 | void xfs_trans_del_item(struct xfs_log_item *); | |
510 | ||
511 | /* xfs_inode_item.c */ | |
512 | void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); | |
513 | ||
514 | /* xfs_buf_item.c */ | |
515 | void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); | |
516 | void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint); | |
517 | ||
518 | /* xfs_trans_buf.c */ | |
519 | struct xfs_buf *xfs_trans_buf_item_match(struct xfs_trans *, | |
520 | struct xfs_buftarg *, struct xfs_buf_map *, int); | |
521 | ||
522 | /* local source files */ | |
523 | #define xfs_add_fdblocks(mp, delta) \ | |
524 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FDBLOCKS, delta, false) | |
525 | #define xfs_dec_fdblocks(mp, delta, rsvd) \ | |
526 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FDBLOCKS, -(int64_t)(delta), rsvd) | |
527 | #define xfs_add_frextents(mp, delta) \ | |
528 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FREXTENTS, delta, 0) | |
529 | #define xfs_dec_frextents(mp, delta) \ | |
530 | libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FREXTENTS, -(int64_t)(delta), 0) | |
531 | int libxfs_mod_incore_sb(struct xfs_mount *, int, int64_t, int); | |
532 | /* percpu counters in mp are #defined to the superblock sb_ counters */ | |
533 | #define xfs_reinit_percpu_counters(mp) | |
534 | ||
535 | void xfs_trans_mod_sb(struct xfs_trans *, uint, long); | |
536 | ||
537 | void xfs_verifier_error(struct xfs_buf *bp, int error, | |
538 | xfs_failaddr_t failaddr); | |
539 | void xfs_inode_verifier_error(struct xfs_inode *ip, int error, | |
540 | const char *name, void *buf, size_t bufsz, | |
541 | xfs_failaddr_t failaddr); | |
542 | ||
543 | #define xfs_buf_verifier_error(bp,e,n,bu,bus,fa) \ | |
544 | xfs_verifier_error(bp, e, fa) | |
545 | void | |
546 | xfs_buf_corruption_error(struct xfs_buf *bp, xfs_failaddr_t fa); | |
547 | ||
548 | int libxfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb, | |
549 | xfs_off_t count_fsb); | |
550 | ||
551 | /* xfs_log.c */ | |
552 | struct xfs_item_ops; | |
553 | bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t); | |
554 | void xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *lip, int type, | |
555 | const struct xfs_item_ops *ops); | |
556 | #define xfs_attr_use_log_assist(mp) (0) | |
557 | #define xlog_drop_incompat_feat(log) do { } while (0) | |
558 | #define xfs_log_in_recovery(mp) (false) | |
559 | ||
560 | /* xfs_icache.c */ | |
561 | #define xfs_inode_clear_cowblocks_tag(ip) do { } while (0) | |
562 | #define xfs_inode_set_cowblocks_tag(ip) do { } while (0) | |
563 | #define xfs_inode_set_eofblocks_tag(ip) do { } while (0) | |
564 | ||
565 | /* xfs_stats.h */ | |
566 | #define XFS_STATS_CALC_INDEX(member) 0 | |
567 | #define XFS_STATS_INC_OFF(mp, off) | |
568 | #define XFS_STATS_ADD_OFF(mp, off, val) | |
569 | ||
570 | typedef unsigned char u8; | |
571 | unsigned int hweight8(unsigned int w); | |
572 | unsigned int hweight32(unsigned int w); | |
573 | unsigned int hweight64(__u64 w); | |
574 | ||
575 | #define xfs_buf_cache_init(bch) (0) | |
576 | #define xfs_buf_cache_destroy(bch) ((void)0) | |
577 | ||
578 | static inline int xfs_iunlink_init(struct xfs_perag *pag) { return 0; } | |
579 | static inline void xfs_iunlink_destroy(struct xfs_perag *pag) { } | |
580 | ||
581 | xfs_agnumber_t xfs_set_inode_alloc(struct xfs_mount *mp, | |
582 | xfs_agnumber_t agcount); | |
583 | ||
584 | /* Keep static checkers quiet about nonstatic functions by exporting */ | |
585 | /* xfs_bmap_util.h */ | |
586 | struct xfs_bmalloca; | |
587 | int xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp, | |
588 | struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz, | |
589 | int rt, int eof, int delay, int convert, | |
590 | xfs_fileoff_t *offp, xfs_extlen_t *lenp); | |
591 | bool xfs_bmap_adjacent(struct xfs_bmalloca *ap); | |
592 | int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip, | |
593 | int whichfork, struct xfs_bmbt_irec *rec, | |
594 | int *is_empty); | |
595 | ||
596 | /* xfs_inode.h */ | |
597 | #define xfs_iflags_set(ip, flags) do { } while (0) | |
598 | #define xfs_finish_inode_setup(ip) ((void) 0) | |
599 | ||
600 | /* linux/wordpart.h */ | |
601 | ||
602 | /** | |
603 | * upper_32_bits - return bits 32-63 of a number | |
604 | * @n: the number we're accessing | |
605 | * | |
606 | * A basic shift-right of a 64- or 32-bit quantity. Use this to suppress | |
607 | * the "right shift count >= width of type" warning when that quantity is | |
608 | * 32-bits. | |
609 | */ | |
610 | #define upper_32_bits(n) ((uint32_t)(((n) >> 16) >> 16)) | |
611 | ||
612 | /** | |
613 | * lower_32_bits - return bits 0-31 of a number | |
614 | * @n: the number we're accessing | |
615 | */ | |
616 | #define lower_32_bits(n) ((uint32_t)((n) & 0xffffffff)) | |
617 | ||
618 | #define cond_resched() ((void)0) | |
619 | ||
620 | /* xfs_linux.h */ | |
621 | #define irix_sgid_inherit (false) | |
622 | #define vfsgid_in_group_p(...) (false) | |
623 | ||
624 | #endif /* __LIBXFS_INTERNAL_XFS_H__ */ |