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
19 #include <xfs/libxfs.h>
20 #include <xfs/command.h>
21 #include <xfs/input.h>
26 # define ino64p ino64_t *
28 # define ino64p __u64 *
31 static cmdinfo_t imap_cmd
;
34 imap_f(int argc
, char **argv
)
41 xfs_fsop_bulkreq_t bulkreq
;
48 t
= malloc(nent
* sizeof(*t
));
50 bulkreq
.lastip
= (ino64p
)&last
;
51 bulkreq
.icount
= nent
;
52 bulkreq
.ubuffer
= (void *)t
;
53 bulkreq
.ocount
= &count
;
55 while (xfsctl(file
->name
, file
->fd
, XFS_IOC_FSINUMBERS
, &bulkreq
) == 0) {
58 for (i
= 0; i
< count
; i
++) {
59 printf(_("ino %10llu count %2d mask %016llx\n"),
60 (unsigned long long)t
[i
].xi_startino
,
62 (unsigned long long)t
[i
].xi_allocmask
);
65 perror("xfsctl(XFS_IOC_FSINUMBERS)");
73 imap_cmd
.name
= _("imap");
74 imap_cmd
.cfunc
= imap_f
;
77 imap_cmd
.args
= _("[nentries]");
78 imap_cmd
.flags
= CMD_NOMAP_OK
;
79 imap_cmd
.oneline
= _("inode map for filesystem of current file");
82 add_command(&imap_cmd
);