]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/dir.h
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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.
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.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
38 /* 1 bit per byte, max XFS blocksize == 64K bits / NBBY */
39 #define DA_BMAP_SIZE 8192
41 typedef unsigned char da_freemap_t
;
44 * the cursor gets passed up and down the da btree processing
45 * routines. The interior block processing routines use the
46 * cursor to determine if the pointers to and from the preceding
47 * and succeeding sibling blocks are ok and whether the values in
48 * the current block are consistent with the entries in the parent
49 * nodes. When a block is traversed, a parent-verification routine
50 * is called to verify if the next logical entry in the next level up
51 * is consistent with the greatest hashval in the next block of the
52 * current level. The verification routine is itself recursive and
53 * calls itself if it has to traverse an interior block to get
54 * the next logical entry. The routine recurses upwards through
55 * the tree until it finds a block where it can simply step to
56 * the next entry. The hashval in that entry should be equal to
57 * the hashval being passed to it (the greatest hashval in the block
58 * that the entry points to). If that isn't true, then the tree
59 * is blown and we need to trash it, salvage and trash it, or fix it.
60 * Currently, we just trash it.
62 typedef struct da_level_state
{
63 xfs_buf_t
*bp
; /* block bp */
65 xfs_da_intnode_t
*n
; /* bp data */
67 xfs_dablk_t bno
; /* file block number */
68 xfs_dahash_t hashval
; /* last verified hashval */
69 int index
; /* current index in block */
70 int dirty
; /* is buffer dirty ? (1 == yes) */
73 typedef struct da_bt_cursor
{
74 int active
; /* highest level in tree (# levels-1) */
75 int type
; /* 0 if dir, 1 if attr */
77 xfs_dablk_t greatest_bno
;
79 da_level_state_t level
[XFS_DA_NODE_MAXDEPTH
];
80 struct blkmap
*blkmap
;
87 err_release_da_cursor(
89 da_bt_cursor_t
*cursor
,
93 get_first_dblock_fsbno(
100 da_freemap_t
*dir_freemap
);
108 process_shortform_dir(
113 int *dino_dirty
, /* is dinode buffer dirty? */
114 xfs_ino_t
*parent
, /* out - NULLFSINO if entry doesn't exist */
115 char *dirname
, /* directory pathname */
116 int *repair
); /* out - 1 if dir was fixed up */
127 struct blkmap
*blkmap
);
132 da_bt_cursor_t
*cursor
,
137 xfs_mount_t
*mp
, da_freemap_t
*map
,
138 int start
, int stop
);
141 traverse_int_dablock(
143 da_bt_cursor_t
*da_cursor
,
150 da_bt_cursor_t
*cursor
,
154 verify_final_da_path(
156 da_bt_cursor_t
*cursor
,
160 #endif /* _XR_DIR_H */