]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/io.h
Update copyright/license notices to match SGI legal prefered boilerplate.
[thirdparty/xfsprogs-dev.git] / db / io.h
1 /*
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
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.
8 *
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.
13 *
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
17 */
18
19 struct typ;
20
21 #define BBMAP_SIZE (XFS_MAX_BLOCKSIZE / BBSIZE)
22 typedef struct bbmap {
23 __int64_t b[BBMAP_SIZE];
24 } bbmap_t;
25
26 typedef struct iocur {
27 __int64_t bb; /* BB number in filesystem of buf */
28 int blen; /* length of "buf", bb's */
29 int boff; /* data - buf */
30 void *buf; /* base address of buffer */
31 void *data; /* current interesting data */
32 xfs_ino_t dirino; /* current directory inode number */
33 xfs_ino_t ino; /* current inode number */
34 int len; /* length of "data", bytes */
35 __uint16_t mode; /* current inode's mode */
36 xfs_off_t off; /* fs offset of "data" in bytes */
37 const struct typ *typ; /* type of "data" */
38 int use_bbmap; /* set if bbmap is valid */
39 bbmap_t bbmap; /* map daddr if fragmented */
40 } iocur_t;
41
42 #define DB_RING_ADD 1 /* add to ring on set_cur */
43 #define DB_RING_IGN 0 /* do not add to ring on set_cur */
44
45 extern iocur_t *iocur_base; /* base of stack */
46 extern iocur_t *iocur_top; /* top element of stack */
47 extern int iocur_sp; /* current top of stack */
48 extern int iocur_len; /* length of stack array */
49
50 extern void io_init(void);
51 extern void off_cur(int off, int len);
52 extern void pop_cur(void);
53 extern void print_iocur(char *tag, iocur_t *ioc);
54 extern void push_cur(void);
55 extern int read_bbs(__int64_t daddr, int count, void **bufp,
56 bbmap_t *bbmap);
57 extern int write_bbs(__int64_t daddr, int count, void *bufp,
58 bbmap_t *bbmap);
59 extern void write_cur(void);
60 extern void set_cur(const struct typ *t, __int64_t d, int c, int ring_add,
61 bbmap_t *bbmap);
62 extern void ring_add(void);