]>
Commit | Line | Data |
---|---|---|
2bd0ea18 | 1 | /* |
da23017d NS |
2 | * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
dfc130f3 | 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 | 7 | * published by the Free Software Foundation. |
dfc130f3 | 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. | |
dfc130f3 | 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 | struct typ; | |
20 | ||
21 | #define BBMAP_SIZE (XFS_MAX_BLOCKSIZE / BBSIZE) | |
22 | typedef struct bbmap { | |
48e32b40 DC |
23 | int nmaps; |
24 | struct xfs_buf_map b[BBMAP_SIZE]; | |
2bd0ea18 NS |
25 | } bbmap_t; |
26 | ||
27 | typedef struct iocur { | |
28 | __int64_t bb; /* BB number in filesystem of buf */ | |
29 | int blen; /* length of "buf", bb's */ | |
30 | int boff; /* data - buf */ | |
31 | void *buf; /* base address of buffer */ | |
32 | void *data; /* current interesting data */ | |
33 | xfs_ino_t dirino; /* current directory inode number */ | |
34 | xfs_ino_t ino; /* current inode number */ | |
35 | int len; /* length of "data", bytes */ | |
36 | __uint16_t mode; /* current inode's mode */ | |
37 | xfs_off_t off; /* fs offset of "data" in bytes */ | |
38 | const struct typ *typ; /* type of "data" */ | |
72298d16 DC |
39 | bbmap_t *bbmap; /* map daddr if fragmented */ |
40 | struct xfs_buf *bp; /* underlying buffer */ | |
a73b88f2 DC |
41 | int ino_crc_ok:1; |
42 | int ino_buf:1; | |
66a40d02 | 43 | int dquot_buf:1; |
fd491857 | 44 | int need_crc:1; |
2bd0ea18 NS |
45 | } iocur_t; |
46 | ||
47 | #define DB_RING_ADD 1 /* add to ring on set_cur */ | |
48 | #define DB_RING_IGN 0 /* do not add to ring on set_cur */ | |
49 | ||
50 | extern iocur_t *iocur_base; /* base of stack */ | |
51 | extern iocur_t *iocur_top; /* top element of stack */ | |
52 | extern int iocur_sp; /* current top of stack */ | |
53 | extern int iocur_len; /* length of stack array */ | |
54 | ||
55 | extern void io_init(void); | |
56 | extern void off_cur(int off, int len); | |
57 | extern void pop_cur(void); | |
58 | extern void print_iocur(char *tag, iocur_t *ioc); | |
59 | extern void push_cur(void); | |
2a8b3fdf | 60 | extern int read_buf(__int64_t daddr, int count, void *bufp); |
2bd0ea18 NS |
61 | extern void write_cur(void); |
62 | extern void set_cur(const struct typ *t, __int64_t d, int c, int ring_add, | |
63 | bbmap_t *bbmap); | |
64 | extern void ring_add(void); | |
9ba69ce2 | 65 | extern void set_iocur_type(const struct typ *t); |
c9f5e3db | 66 | extern void xfs_dummy_verify(struct xfs_buf *bp); |
86769b32 | 67 | extern void xfs_verify_recalc_crc(struct xfs_buf *bp); |
0522f1cc | 68 | |
b511ff41 DC |
69 | /* |
70 | * returns -1 for unchecked, 0 for bad and 1 for good | |
71 | */ | |
72 | static inline int | |
0522f1cc DC |
73 | iocur_crc_valid() |
74 | { | |
b511ff41 DC |
75 | if (!iocur_top->bp) |
76 | return -1; | |
77 | if (iocur_top->bp->b_flags & LIBXFS_B_UNCHECKED) | |
78 | return -1; | |
66fc04e0 | 79 | return (iocur_top->bp->b_error != -EFSBADCRC && |
a73b88f2 | 80 | (!iocur_top->ino_buf || iocur_top->ino_crc_ok)); |
0522f1cc | 81 | } |