]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/type.h
libxfs: sanitize agcount on load
[thirdparty/xfsprogs-dev.git] / db / type.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 field;
20
21 #define szof(x,y) sizeof(((x *)0)->y)
22 #define szcount(x,y) (szof(x,y) / szof(x,y[0]))
23
24 typedef enum typnm
25 {
26 TYP_AGF, TYP_AGFL, TYP_AGI, TYP_ATTR, TYP_BMAPBTA,
27 TYP_BMAPBTD, TYP_BNOBT, TYP_CNTBT, TYP_RMAPBT, TYP_REFCBT, TYP_DATA,
28 TYP_DIR2, TYP_DQBLK, TYP_INOBT, TYP_INODATA, TYP_INODE,
29 TYP_LOG, TYP_RTBITMAP, TYP_RTSUMMARY, TYP_SB, TYP_SYMLINK,
30 TYP_TEXT, TYP_FINOBT, TYP_NONE
31 } typnm_t;
32
33 #define DB_WRITE 1
34 #define DB_READ 0
35
36 typedef void (*opfunc_t)(const struct field *fld, int argc, char **argv);
37 typedef void (*pfunc_t)(int action, const struct field *fld, int argc, char **argv);
38
39 typedef struct typ
40 {
41 typnm_t typnm;
42 char *name;
43 pfunc_t pfunc;
44 const struct field *fields;
45 const struct xfs_buf_ops *bops;
46 unsigned long crc_off;
47 #define TYP_F_NO_CRC_OFF (-1UL)
48 } typ_t;
49 extern const typ_t *typtab, *cur_typ;
50
51 extern void type_init(void);
52 extern void type_set_tab_crc(void);
53 extern void type_set_tab_spcrc(void);
54 extern void handle_block(int action, const struct field *fields, int argc,
55 char **argv);
56 extern void handle_string(int action, const struct field *fields, int argc,
57 char **argv);
58 extern void handle_struct(int action, const struct field *fields, int argc,
59 char **argv);
60 extern void handle_text(int action, const struct field *fields, int argc,
61 char **argv);