]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/dir2.h
Merge whitespace changes over
[thirdparty/xfsprogs-dev.git] / repair / dir2.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 #ifndef _XR_DIR2_H
34 #define _XR_DIR2_H
35
36 struct blkmap;
37 struct bmap_ext;
38
39 /*
40 * the cursor gets passed up and down the da btree processing
41 * routines. The interior block processing routines use the
42 * cursor to determine if the pointers to and from the preceding
43 * and succeeding sibling blocks are ok and whether the values in
44 * the current block are consistent with the entries in the parent
45 * nodes. When a block is traversed, a parent-verification routine
46 * is called to verify if the next logical entry in the next level up
47 * is consistent with the greatest hashval in the next block of the
48 * current level. The verification routine is itself recursive and
49 * calls itself if it has to traverse an interior block to get
50 * the next logical entry. The routine recurses upwards through
51 * the tree until it finds a block where it can simply step to
52 * the next entry. The hashval in that entry should be equal to
53 * the hashval being passed to it (the greatest hashval in the block
54 * that the entry points to). If that isn't true, then the tree
55 * is blown and we need to trash it, salvage and trash it, or fix it.
56 * Currently, we just trash it.
57 */
58 typedef struct dir2_level_state {
59 xfs_dabuf_t *bp; /* block bp */
60 xfs_dablk_t bno; /* file block number */
61 xfs_dahash_t hashval; /* last verified hashval */
62 int index; /* current index in block */
63 int dirty; /* is buffer dirty ? (1 == yes) */
64 } dir2_level_state_t;
65
66 typedef struct dir2_bt_cursor {
67 int active; /* highest level in tree (# levels-1) */
68 int type; /* 0 if dir, 1 if attr */
69 xfs_ino_t ino;
70 xfs_dablk_t greatest_bno;
71 xfs_dinode_t *dip;
72 dir2_level_state_t level[XFS_DA_NODE_MAXDEPTH];
73 struct blkmap *blkmap;
74 } dir2_bt_cursor_t;
75
76
77 /* ROUTINES */
78
79 void
80 err_release_dir2_cursor(
81 xfs_mount_t *mp,
82 dir2_bt_cursor_t *cursor,
83 int prev_level);
84
85 xfs_dabuf_t *
86 da_read_buf(
87 xfs_mount_t *mp,
88 int nex,
89 struct bmap_ext *bmp);
90
91 int
92 da_bwrite(
93 xfs_mount_t *mp,
94 xfs_dabuf_t *bp);
95
96 void
97 da_brelse(
98 xfs_dabuf_t *bp);
99
100 int
101 process_dir2(
102 xfs_mount_t *mp,
103 xfs_ino_t ino,
104 xfs_dinode_t *dip,
105 int ino_discovery,
106 int *dirty,
107 char *dirname,
108 xfs_ino_t *parent,
109 struct blkmap *blkmap);
110
111 void
112 process_sf_dir2_fixi8(
113 xfs_dir2_sf_t *sfp,
114 xfs_dir2_sf_entry_t **next_sfep);
115
116 void
117 dir2_add_badlist(
118 xfs_ino_t ino);
119
120 int
121 dir2_is_badino(
122 xfs_ino_t ino);
123
124 #endif /* _XR_DIR2_H */