]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/dir.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
24 /* 1 bit per byte, max XFS blocksize == 64K bits / NBBY */
25 #define DA_BMAP_SIZE 8192
27 typedef unsigned char da_freemap_t
;
30 * the cursor gets passed up and down the da btree processing
31 * routines. The interior block processing routines use the
32 * cursor to determine if the pointers to and from the preceding
33 * and succeeding sibling blocks are ok and whether the values in
34 * the current block are consistent with the entries in the parent
35 * nodes. When a block is traversed, a parent-verification routine
36 * is called to verify if the next logical entry in the next level up
37 * is consistent with the greatest hashval in the next block of the
38 * current level. The verification routine is itself recursive and
39 * calls itself if it has to traverse an interior block to get
40 * the next logical entry. The routine recurses upwards through
41 * the tree until it finds a block where it can simply step to
42 * the next entry. The hashval in that entry should be equal to
43 * the hashval being passed to it (the greatest hashval in the block
44 * that the entry points to). If that isn't true, then the tree
45 * is blown and we need to trash it, salvage and trash it, or fix it.
46 * Currently, we just trash it.
48 typedef struct da_level_state
{
49 xfs_buf_t
*bp
; /* block bp */
51 xfs_da_intnode_t
*n
; /* bp data */
53 xfs_dablk_t bno
; /* file block number */
54 xfs_dahash_t hashval
; /* last verified hashval */
55 int index
; /* current index in block */
56 int dirty
; /* is buffer dirty ? (1 == yes) */
59 typedef struct da_bt_cursor
{
60 int active
; /* highest level in tree (# levels-1) */
61 int type
; /* 0 if dir, 1 if attr */
63 xfs_dablk_t greatest_bno
;
65 da_level_state_t level
[XFS_DA_NODE_MAXDEPTH
];
66 struct blkmap
*blkmap
;
73 err_release_da_cursor(
75 da_bt_cursor_t
*cursor
,
79 get_first_dblock_fsbno(
86 da_freemap_t
*dir_freemap
);
94 process_shortform_dir(
99 int *dino_dirty
, /* is dinode buffer dirty? */
100 xfs_ino_t
*parent
, /* out - NULLFSINO if entry doesn't exist */
101 char *dirname
, /* directory pathname */
102 int *repair
); /* out - 1 if dir was fixed up */
113 struct blkmap
*blkmap
);
118 da_bt_cursor_t
*cursor
,
123 xfs_mount_t
*mp
, da_freemap_t
*map
,
124 int start
, int stop
);
127 traverse_int_dablock(
129 da_bt_cursor_t
*da_cursor
,
136 da_bt_cursor_t
*cursor
,
140 verify_final_da_path(
142 da_bt_cursor_t
*cursor
,
146 #endif /* _XR_DIR_H */