]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2bd0ea18 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. |
4 | * All Rights Reserved. | |
2bd0ea18 NS |
5 | */ |
6 | ||
7 | struct typ; | |
8 | ||
9 | #define BBMAP_SIZE (XFS_MAX_BLOCKSIZE / BBSIZE) | |
10 | typedef struct bbmap { | |
48e32b40 DC |
11 | int nmaps; |
12 | struct xfs_buf_map b[BBMAP_SIZE]; | |
2bd0ea18 NS |
13 | } bbmap_t; |
14 | ||
15 | typedef struct iocur { | |
14f8b681 | 16 | int64_t bb; /* BB number in filesystem of buf */ |
2bd0ea18 NS |
17 | int blen; /* length of "buf", bb's */ |
18 | int boff; /* data - buf */ | |
19 | void *buf; /* base address of buffer */ | |
20 | void *data; /* current interesting data */ | |
21 | xfs_ino_t dirino; /* current directory inode number */ | |
22 | xfs_ino_t ino; /* current inode number */ | |
23 | int len; /* length of "data", bytes */ | |
14f8b681 | 24 | uint16_t mode; /* current inode's mode */ |
2bd0ea18 NS |
25 | xfs_off_t off; /* fs offset of "data" in bytes */ |
26 | const struct typ *typ; /* type of "data" */ | |
72298d16 DC |
27 | bbmap_t *bbmap; /* map daddr if fragmented */ |
28 | struct xfs_buf *bp; /* underlying buffer */ | |
6a40ccc6 ES |
29 | bool ino_crc_ok; |
30 | bool ino_buf; | |
31 | bool dquot_buf; | |
32 | bool need_crc; | |
2bd0ea18 NS |
33 | } iocur_t; |
34 | ||
35 | #define DB_RING_ADD 1 /* add to ring on set_cur */ | |
36 | #define DB_RING_IGN 0 /* do not add to ring on set_cur */ | |
37 | ||
38 | extern iocur_t *iocur_base; /* base of stack */ | |
39 | extern iocur_t *iocur_top; /* top element of stack */ | |
40 | extern int iocur_sp; /* current top of stack */ | |
41 | extern int iocur_len; /* length of stack array */ | |
42 | ||
43 | extern void io_init(void); | |
44 | extern void off_cur(int off, int len); | |
45 | extern void pop_cur(void); | |
46 | extern void print_iocur(char *tag, iocur_t *ioc); | |
47 | extern void push_cur(void); | |
3540b418 | 48 | extern void push_cur_and_set_type(void); |
5dd33a51 | 49 | extern void write_cur(void); |
db23e0f4 BD |
50 | extern void set_cur(const struct typ *type, xfs_daddr_t blknum, |
51 | int len, int ring_add, bbmap_t *bbmap); | |
2bd0ea18 | 52 | extern void ring_add(void); |
db23e0f4 | 53 | extern void set_iocur_type(const struct typ *type); |
c9f5e3db | 54 | extern void xfs_dummy_verify(struct xfs_buf *bp); |
86769b32 | 55 | extern void xfs_verify_recalc_crc(struct xfs_buf *bp); |
0522f1cc | 56 | |
b511ff41 DC |
57 | /* |
58 | * returns -1 for unchecked, 0 for bad and 1 for good | |
59 | */ | |
60 | static inline int | |
e66e9ee7 | 61 | iocur_crc_valid(void) |
0522f1cc | 62 | { |
b511ff41 DC |
63 | if (!iocur_top->bp) |
64 | return -1; | |
65 | if (iocur_top->bp->b_flags & LIBXFS_B_UNCHECKED) | |
66 | return -1; | |
66fc04e0 | 67 | return (iocur_top->bp->b_error != -EFSBADCRC && |
a73b88f2 | 68 | (!iocur_top->ino_buf || iocur_top->ino_crc_ok)); |
0522f1cc | 69 | } |