2 * Copyright (c) 2001-2003,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
20 #include "xfs/command.h"
21 #include "xfs/input.h"
25 static cmdinfo_t imap_cmd
;
28 imap_f(int argc
, char **argv
)
35 xfs_fsop_bulkreq_t bulkreq
;
42 t
= malloc(nent
* sizeof(*t
));
44 bulkreq
.lastip
= &last
;
45 bulkreq
.icount
= nent
;
46 bulkreq
.ubuffer
= (void *)t
;
47 bulkreq
.ocount
= &count
;
49 while (xfsctl(file
->name
, file
->fd
, XFS_IOC_FSINUMBERS
, &bulkreq
) == 0) {
52 for (i
= 0; i
< count
; i
++) {
53 printf(_("ino %10llu count %2d mask %016llx\n"),
54 (unsigned long long)t
[i
].xi_startino
,
56 (unsigned long long)t
[i
].xi_allocmask
);
59 perror("xfsctl(XFS_IOC_FSINUMBERS)");
67 imap_cmd
.name
= "imap";
68 imap_cmd
.cfunc
= imap_f
;
71 imap_cmd
.args
= _("[nentries]");
72 imap_cmd
.flags
= CMD_NOMAP_OK
;
73 imap_cmd
.oneline
= _("inode map for filesystem of current file");
76 add_command(&imap_cmd
);