]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/addr.c
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
19 static int addr_f(int argc
, char **argv
);
20 static void addr_help(void);
22 static const cmdinfo_t addr_cmd
=
23 { "addr", "a", addr_f
, 0, 1, 1, N_("[field-expression]"),
24 N_("set current address"), addr_help
};
31 " 'addr' uses the given field to set the filesystem address and type\n"
36 " a rootino - set the type to inode and set position to the root inode\n"
37 " a u.bmx[0].startblock (for inode with blockmap)\n"
56 print_iocur("current", iocur_top
);
59 if (cur_typ
== NULL
) {
60 dbprintf(_("no current type\n"));
63 fld
= cur_typ
->fields
;
64 if (fld
!= NULL
&& fld
->name
[0] == '\0') {
65 fa
= &ftattrtab
[fld
->ftyp
];
66 ASSERT(fa
->ftyp
== fld
->ftyp
);
70 dbprintf(_("no fields for type %s\n"), cur_typ
->name
);
73 fl
= flist_scan(argv
[1]);
76 if (!flist_parse(fld
, fl
, iocur_top
->data
, 0))
80 for (tfl
= fl
; tfl
->child
!= NULL
; tfl
= tfl
->child
) {
81 if ((tfl
->flags
& FL_OKLOW
) && tfl
->low
< tfl
->high
) {
82 dbprintf(_("array not allowed for addr command\n"));
88 if (next
== TYP_INODATA
)
89 next
= inode_next_type();
90 if (next
== TYP_NONE
) {
91 dbprintf(_("no next type for field %s\n"), fld
->name
);
94 fa
= &ftattrtab
[fld
->ftyp
];
95 ASSERT(fa
->ftyp
== fld
->ftyp
);
98 dbprintf(_("no addr function for field %s (type %s)\n"),
102 (*adf
)(iocur_top
->data
, tfl
->offset
, next
);
111 add_command(&addr_cmd
);