]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/addr.c
2 * Copyright (c) 2000-2001 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/
45 static int addr_f(int argc
, char **argv
);
46 static void addr_help(void);
48 static const cmdinfo_t addr_cmd
=
49 { "addr", "a", addr_f
, 0, 1, 1, "[field-expression]",
50 "set current address", addr_help
};
57 " 'addr' uses the given field to set the filesystem address and type\n"
62 " a rootino - set the type to inode and set position to the root inode\n"
63 " a u.bmx[0].startblock (for inode with blockmap)\n"
82 print_iocur("current", iocur_top
);
85 if (cur_typ
== NULL
) {
86 dbprintf("no current type\n");
89 fld
= cur_typ
->fields
;
90 if (fld
!= NULL
&& fld
->name
[0] == '\0') {
91 fa
= &ftattrtab
[fld
->ftyp
];
92 ASSERT(fa
->ftyp
== fld
->ftyp
);
96 dbprintf("no fields for type %s\n", cur_typ
->name
);
99 fl
= flist_scan(argv
[1]);
102 if (!flist_parse(fld
, fl
, iocur_top
->data
, 0)) {
107 for (tfl
= fl
; tfl
->child
!= NULL
; tfl
= tfl
->child
) {
108 if ((tfl
->flags
& FL_OKLOW
) && tfl
->low
< tfl
->high
) {
109 dbprintf("array not allowed for addr command\n");
116 if (next
== TYP_INODATA
)
117 next
= inode_next_type();
118 if (next
== TYP_NONE
) {
119 dbprintf("no next type for field %s\n", fld
->name
);
122 fa
= &ftattrtab
[fld
->ftyp
];
123 ASSERT(fa
->ftyp
== fld
->ftyp
);
126 dbprintf("no addr function for field %s (type %s)\n",
127 fld
->name
, fa
->name
);
130 (*adf
)(iocur_top
->data
, tfl
->offset
, next
);
138 add_command(&addr_cmd
);