]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/agfl.c
apply gettext translation to more strings
[thirdparty/xfsprogs-dev.git] / db / agfl.c
1 /*
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
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.
8 *
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.
13 *
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
17 */
18
19 #include <xfs/libxfs.h>
20 #include "command.h"
21 #include "type.h"
22 #include "faddr.h"
23 #include "fprint.h"
24 #include "field.h"
25 #include "io.h"
26 #include "bit.h"
27 #include "output.h"
28 #include "init.h"
29 #include "agfl.h"
30
31 static int agfl_bno_size(void *obj, int startoff);
32 static int agfl_f(int argc, char **argv);
33 static void agfl_help(void);
34
35 static const cmdinfo_t agfl_cmd =
36 { "agfl", NULL, agfl_f, 0, 1, 1, N_("[agno]"),
37 N_("set address to agfl block"), agfl_help };
38
39 const field_t agfl_hfld[] = { {
40 "", FLDT_AGFL, OI(0), C1, 0, TYP_NONE, },
41 { NULL }
42 };
43
44 #define OFF(f) bitize(offsetof(xfs_agfl_t, agfl_ ## f))
45 const field_t agfl_flds[] = {
46 { "bno", FLDT_AGBLOCKNZ, OI(OFF(bno)), agfl_bno_size,
47 FLD_ARRAY|FLD_COUNT, TYP_DATA },
48 { NULL }
49 };
50
51 static int
52 agfl_bno_size(
53 void *obj,
54 int startoff)
55 {
56 return XFS_AGFL_SIZE(mp);
57 }
58
59 static void
60 agfl_help(void)
61 {
62 dbprintf(_(
63 "\n"
64 " set allocation group freelist\n"
65 "\n"
66 " Example:\n"
67 "\n"
68 " agfl 5"
69 "\n"
70 " Located in the fourth sector of each allocation group,\n"
71 " the agfl freelist for internal btree space allocation is maintained\n"
72 " for each allocation group. This acts as a reserved pool of space\n"
73 " separate from the general filesystem freespace (not used for user data).\n"
74 "\n"
75 ));
76
77 }
78
79 static int
80 agfl_f(
81 int argc,
82 char **argv)
83 {
84 xfs_agnumber_t agno;
85 char *p;
86
87 if (argc > 1) {
88 agno = (xfs_agnumber_t)strtoul(argv[1], &p, 0);
89 if (*p != '\0' || agno >= mp->m_sb.sb_agcount) {
90 dbprintf(_("bad allocation group number %s\n"), argv[1]);
91 return 0;
92 }
93 cur_agno = agno;
94 } else if (cur_agno == NULLAGNUMBER)
95 cur_agno = 0;
96 ASSERT(typtab[TYP_AGFL].typnm == TYP_AGFL);
97 set_cur(&typtab[TYP_AGFL],
98 XFS_AG_DADDR(mp, cur_agno, XFS_AGFL_DADDR(mp)),
99 XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
100 return 0;
101 }
102
103 void
104 agfl_init(void)
105 {
106 add_command(&agfl_cmd);
107 }
108
109 /*ARGSUSED*/
110 int
111 agfl_size(
112 void *obj,
113 int startoff,
114 int idx)
115 {
116 return bitize(mp->m_sb.sb_sectsize);
117 }