]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/addr.c
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
31 static int addr_f(int argc
, char **argv
);
32 static void addr_help(void);
34 static const cmdinfo_t addr_cmd
=
35 { "addr", "a", addr_f
, 0, 1, 1, N_("[field-expression]"),
36 N_("set current address"), addr_help
};
43 " 'addr' uses the given field to set the filesystem address and type\n"
48 " a rootino - set the type to inode and set position to the root inode\n"
49 " a u.bmx[0].startblock (for inode with blockmap)\n"
68 print_iocur("current", iocur_top
);
71 if (cur_typ
== NULL
) {
72 dbprintf(_("no current type\n"));
75 fld
= cur_typ
->fields
;
76 if (fld
!= NULL
&& fld
->name
[0] == '\0') {
77 fa
= &ftattrtab
[fld
->ftyp
];
78 ASSERT(fa
->ftyp
== fld
->ftyp
);
82 dbprintf(_("no fields for type %s\n"), cur_typ
->name
);
85 fl
= flist_scan(argv
[1]);
88 if (!flist_parse(fld
, fl
, iocur_top
->data
, 0))
92 for (tfl
= fl
; tfl
->child
!= NULL
; tfl
= tfl
->child
) {
93 if ((tfl
->flags
& FL_OKLOW
) && tfl
->low
< tfl
->high
) {
94 dbprintf(_("array not allowed for addr command\n"));
100 if (next
== TYP_INODATA
)
101 next
= inode_next_type();
102 if (next
== TYP_NONE
) {
103 dbprintf(_("no next type for field %s\n"), fld
->name
);
106 fa
= &ftattrtab
[fld
->ftyp
];
107 ASSERT(fa
->ftyp
== fld
->ftyp
);
110 dbprintf(_("no addr function for field %s (type %s)\n"),
111 fld
->name
, fa
->name
);
114 (*adf
)(iocur_top
->data
, tfl
->offset
, next
);
123 add_command(&addr_cmd
);