]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/io.h
02f6237dde8b796f7598aaf4e0923308aa7fdacf
[thirdparty/xfsprogs-dev.git] / db / io.h
1 /*
2 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32
33 struct typ;
34
35 #define BBMAP_SIZE (XFS_MAX_BLOCKSIZE / BBSIZE)
36 typedef struct bbmap {
37 __int64_t b[BBMAP_SIZE];
38 } bbmap_t;
39
40 typedef struct iocur {
41 __int64_t bb; /* BB number in filesystem of buf */
42 int blen; /* length of "buf", bb's */
43 int boff; /* data - buf */
44 void *buf; /* base address of buffer */
45 void *data; /* current interesting data */
46 xfs_ino_t dirino; /* current directory inode number */
47 xfs_ino_t ino; /* current inode number */
48 int len; /* length of "data", bytes */
49 __uint16_t mode; /* current inode's mode */
50 xfs_off_t off; /* fs offset of "data" in bytes */
51 const struct typ *typ; /* type of "data" */
52 int use_bbmap; /* set if bbmap is valid */
53 bbmap_t bbmap; /* map daddr if fragmented */
54 } iocur_t;
55
56 #define DB_RING_ADD 1 /* add to ring on set_cur */
57 #define DB_RING_IGN 0 /* do not add to ring on set_cur */
58
59 extern iocur_t *iocur_base; /* base of stack */
60 extern iocur_t *iocur_top; /* top element of stack */
61 extern int iocur_sp; /* current top of stack */
62 extern int iocur_len; /* length of stack array */
63
64 extern void io_init(void);
65 extern void off_cur(int off, int len);
66 extern void pop_cur(void);
67 extern void print_iocur(char *tag, iocur_t *ioc);
68 extern void push_cur(void);
69 extern int read_bbs(__int64_t daddr, int count, void **bufp,
70 bbmap_t *bbmap);
71 extern int write_bbs(__int64_t daddr, int count, void *bufp,
72 bbmap_t *bbmap);
73 extern void write_cur(void);
74 extern void set_cur(const struct typ *t, __int64_t d, int c, int ring_add,
75 bbmap_t *bbmap);
76 extern void ring_add(void);