]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/io.h
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
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
7 * published by the Free Software Foundation.
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.
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
21 #define BBMAP_SIZE (XFS_MAX_BLOCKSIZE / BBSIZE)
22 typedef struct bbmap
{
24 struct xfs_buf_map b
[BBMAP_SIZE
];
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" */
39 bbmap_t
*bbmap
; /* map daddr if fragmented */
40 struct xfs_buf
*bp
; /* underlying buffer */
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 */
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 */
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);
60 extern void push_cur_and_set_type(void);
61 extern int read_buf(int64_t daddr
, int count
, void *bufp
);
62 extern void write_cur(void);
63 extern void set_cur(const struct typ
*type
, xfs_daddr_t blknum
,
64 int len
, int ring_add
, bbmap_t
*bbmap
);
65 extern void ring_add(void);
66 extern void set_iocur_type(const struct typ
*type
);
67 extern void xfs_dummy_verify(struct xfs_buf
*bp
);
68 extern void xfs_verify_recalc_crc(struct xfs_buf
*bp
);
71 * returns -1 for unchecked, 0 for bad and 1 for good
78 if (iocur_top
->bp
->b_flags
& LIBXFS_B_UNCHECKED
)
80 return (iocur_top
->bp
->b_error
!= -EFSBADCRC
&&
81 (!iocur_top
->ino_buf
|| iocur_top
->ino_crc_ok
));