]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/agi.c
f1c56516e8382a5ee4d73d356a933f3ba0a1fc46
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 agi_f(int argc
, char **argv
);
47 static void agi_help(void);
49 static const cmdinfo_t agi_cmd
=
50 { "agi", NULL
, agi_f
, 0, 1, 1, "[agno]",
51 "set address to agi header", agi_help
};
53 const field_t agi_hfld
[] = {
54 { "", FLDT_AGI
, OI(0), C1
, 0, TYP_NONE
},
58 #define OFF(f) bitize(offsetof(xfs_agi_t, agi_ ## f))
59 const field_t agi_flds
[] = {
60 { "magicnum", FLDT_UINT32X
, OI(OFF(magicnum
)), C1
, 0, TYP_NONE
},
61 { "versionnum", FLDT_UINT32D
, OI(OFF(versionnum
)), C1
, 0, TYP_NONE
},
62 { "seqno", FLDT_AGNUMBER
, OI(OFF(seqno
)), C1
, 0, TYP_NONE
},
63 { "length", FLDT_AGBLOCK
, OI(OFF(length
)), C1
, 0, TYP_NONE
},
64 { "count", FLDT_AGINO
, OI(OFF(count
)), C1
, 0, TYP_NONE
},
65 { "root", FLDT_AGBLOCK
, OI(OFF(root
)), C1
, 0, TYP_INOBT
},
66 { "level", FLDT_UINT32D
, OI(OFF(level
)), C1
, 0, TYP_NONE
},
67 { "freecount", FLDT_AGINO
, OI(OFF(freecount
)), C1
, 0, TYP_NONE
},
68 { "newino", FLDT_AGINO
, OI(OFF(newino
)), C1
, 0, TYP_INODE
},
69 { "dirino", FLDT_AGINO
, OI(OFF(dirino
)), C1
, 0, TYP_INODE
},
70 { "unlinked", FLDT_AGINONN
, OI(OFF(unlinked
)),
71 CI(XFS_AGI_UNLINKED_BUCKETS
), FLD_ARRAY
, TYP_NONE
},
80 " set allocation group inode btree\n"
84 " agi 3 (set location to 3rd allocation group inode btree and type to 'agi')\n"
86 " Located in the 3rd 512 byte block of each allocation group,\n"
87 " the agi inode btree tracks all used/free inodes in the allocation group.\n"
88 " Inodes are allocated in 16k 'chunks', each btree entry tracks a 'chunk'.\n"
102 agno
= (xfs_agnumber_t
)strtoul(argv
[1], &p
, 0);
103 if (*p
!= '\0' || agno
>= mp
->m_sb
.sb_agcount
) {
104 dbprintf("bad allocation group number %s\n", argv
[1]);
108 } else if (cur_agno
== NULLAGNUMBER
)
110 ASSERT(typtab
[TYP_AGI
].typnm
== TYP_AGI
);
111 set_cur(&typtab
[TYP_AGI
], XFS_AG_DADDR(mp
, cur_agno
, XFS_AGI_DADDR
), 1,
119 add_command(&agi_cmd
);
129 return bitize(mp
->m_sb
.sb_sectsize
);