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/
46
static int agf_f(int argc, char **argv);
47
static void agf_help(void);
49
static const cmdinfo_t agf_cmd =
50
{ "agf", NULL, agf_f, 0, 1, 1, "[agno]",
51
"set address to agf header", agf_help };
53
const field_t agf_hfld[] = {
54
{ "", FLDT_AGF, OI(0), C1, 0, TYP_NONE },
58
#define OFF(f) bitize(offsetof(xfs_agf_t, agf_ ## f))
59
#define SZ(f) bitszof(xfs_agf_t, agf_ ## f)
60
const field_t agf_flds[] = {
61
{ "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE },
62
{ "versionnum", FLDT_UINT32D, OI(OFF(versionnum)), C1, 0, TYP_NONE },
63
{ "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE },
64
{ "length", FLDT_AGBLOCK, OI(OFF(length)), C1, 0, TYP_NONE },
65
{ "roots", FLDT_AGBLOCK, OI(OFF(roots)), CI(XFS_BTNUM_AGF),
66
FLD_ARRAY|FLD_SKIPALL, TYP_NONE },
67
{ "bnoroot", FLDT_AGBLOCK,
68
OI(OFF(roots) + XFS_BTNUM_BNO * SZ(roots[XFS_BTNUM_BNO])), C1, 0,
70
{ "cntroot", FLDT_AGBLOCK,
71
OI(OFF(roots) + XFS_BTNUM_CNT * SZ(roots[XFS_BTNUM_CNT])), C1, 0,
73
{ "levels", FLDT_UINT32D, OI(OFF(levels)), CI(XFS_BTNUM_AGF),
74
FLD_ARRAY|FLD_SKIPALL, TYP_NONE },
75
{ "bnolevel", FLDT_UINT32D,
76
OI(OFF(levels) + XFS_BTNUM_BNO * SZ(levels[XFS_BTNUM_BNO])), C1, 0,
78
{ "cntlevel", FLDT_UINT32D,
79
OI(OFF(levels) + XFS_BTNUM_CNT * SZ(levels[XFS_BTNUM_CNT])), C1, 0,
81
{ "flfirst", FLDT_UINT32D, OI(OFF(flfirst)), C1, 0, TYP_NONE },
82
{ "fllast", FLDT_UINT32D, OI(OFF(fllast)), C1, 0, TYP_NONE },
83
{ "flcount", FLDT_UINT32D, OI(OFF(flcount)), C1, 0, TYP_NONE },
84
{ "freeblks", FLDT_EXTLEN, OI(OFF(freeblks)), C1, 0, TYP_NONE },
85
{ "longest", FLDT_EXTLEN, OI(OFF(longest)), C1, 0, TYP_NONE },
94
" set allocation group free block list\n"
98
" agf 2 - move location to AGF in 2nd filesystem allocation group\n"
100
" Located in the 2nd 512 byte block of each allocation group,\n"
101
" the AGF contains the root of two different freespace btrees:\n"
102
" The 'cnt' btree keeps track freespace indexed on section size.\n"
103
" The 'bno' btree tracks sections of freespace indexed on block number.\n"
116
agno = (xfs_agnumber_t)strtoul(argv[1], &p, 0);
117
if (*p != '\0' || agno >= mp->m_sb.sb_agcount) {
118
dbprintf("bad allocation group number %s\n", argv[1]);
122
} else if (cur_agno == NULLAGNUMBER)
124
ASSERT(typtab[TYP_AGF].typnm == TYP_AGF);
125
set_cur(&typtab[TYP_AGF], XFS_AG_DADDR(mp, cur_agno, XFS_AGF_DADDR), 1,
133
add_command(&agf_cmd);
142
return bitize(mp->m_sb.sb_sectsize);