Merge of master-melb:xfs-cmds:21780a by kenmcd.
#
-# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+# Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as
Logs/* built .census install.* install-dev.* *.gz
SUBDIRS = include libxfs libxlog libhandle libdisk \
- copy db fsck growfs io imap logprint mkfile mkfs repair rtcp \
+ copy db fsck growfs io logprint mkfile mkfs repair rtcp \
m4 man doc po debian build
default: $(CONFIGURE)
+++ /dev/null
-#
-# Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# Further, this software is distributed without any warranty that it is
-# free of the rightful claim of any third person regarding infringement
-# or the like. Any license provided herein, whether implied or
-# otherwise, applies only to this software file. Patent licenses, if
-# any, provided herein do not apply to combinations of this program with
-# other software, or any other product whatsoever.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston MA 02111-1307, USA.
-#
-# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
-# Mountain View, CA 94043, or:
-#
-# http://www.sgi.com
-#
-# For further information regarding this notice, see:
-#
-# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
-#
-
-TOPDIR = ..
-include $(TOPDIR)/include/builddefs
-
-LTCOMMAND = xfs_imap
-CFILES = xfs_imap.c
-
-default: $(LTCOMMAND)
-
-include $(BUILDRULES)
-
-install:
-install-dev:
/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
return syssgi(SGI_XFS_FSOPERATIONS, fd, cmd, 0, arg);
}
switch (cmd) {
+ case SGI_FS_INUMBERS:
case SGI_FS_BULKSTAT:
- return syssgi(SGI_FS_BULKSTAT, fd,
+ return syssgi(cmd, fd,
((xfs_fsop_bulkreq_t*)arg)->lastip,
((xfs_fsop_bulkreq_t*)arg)->icount,
((xfs_fsop_bulkreq_t*)arg)->ubuffer,
#define XFS_IOC_FSGEOMETRY_V1 XFS_FS_GEOMETRY
#define XFS_IOC_FSBULKSTAT SGI_FS_BULKSTAT
#define XFS_IOC_FSBULKSTAT_SINGLE SGI_FS_BULKSTAT_SINGLE
-#define XFS_IOC_FSINUMBERS /* TODO */
+#define XFS_IOC_FSINUMBERS SGI_FS_INUMBERS
#define XFS_IOC_PATH_TO_FSHANDLE /* TODO */
#define XFS_IOC_PATH_TO_HANDLE /* TODO */
#define XFS_IOC_FD_TO_HANDLE /* TODO */
LSRCFILES = xfs_bmap.sh xfs_freeze.sh
HFILES = command.h input.h init.h io.h
CFILES = command.c input.c init.c help.c quit.c \
- attr.c bmap.c file.c freeze.c fsync.c getrusage.c \
+ attr.c bmap.c file.c freeze.c fsync.c getrusage.c imap.c \
mmap.c open.c pread.c prealloc.c pwrite.c truncate.c
ifeq ($(HAVE_FADVISE),yes)
/*
- * Copyright (c) 2001-2003 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2001-2003,2005 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-/*
- * Inode map display utility for XFS.
- */
-
#include <xfs/libxfs.h>
+#include "command.h"
+#include "input.h"
+#include "init.h"
+#include "io.h"
+
+#if defined(__sgi__)
+# define ino64p ino64_t *
+#else
+# define ino64p __u64 *
+#endif
-int main(int argc, char **argv)
+static cmdinfo_t imap_cmd;
+
+int
+imap_f(int argc, char **argv)
{
int count;
int nent;
- int fd;
int i;
- char *name;
- char *progname;
__s64 last = 0;
xfs_inogrp_t *t;
xfs_fsop_bulkreq_t bulkreq;
- progname = basename(argv[0]);
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-
- if (argc < 2)
- name = ".";
- else
- name = argv[1];
- fd = open(name, O_RDONLY);
- if (fd < 0) {
- perror(name);
- return 1;
- }
- if (!platform_test_xfs_fd(fd)) {
- fprintf(stderr, _("%s: specified file "
- "[\"%s\"] is not on an XFS filesystem\n"),
- progname, name);
- exit(1);
- }
-
- if (argc < 3)
+ if (argc != 2)
nent = 1;
else
- nent = atoi(argv[2]);
+ nent = atoi(argv[1]);
t = malloc(nent * sizeof(*t));
- bulkreq.lastip = &last;
+ bulkreq.lastip = (ino64p)&last;
bulkreq.icount = nent;
- bulkreq.ubuffer = t;
+ bulkreq.ubuffer = (void *)t;
bulkreq.ocount = &count;
- while (xfsctl(name, fd, XFS_IOC_FSINUMBERS, &bulkreq) == 0) {
+ while (xfsctl(file->name, file->fd, XFS_IOC_FSINUMBERS, &bulkreq) == 0) {
if (count == 0)
return 0;
for (i = 0; i < count; i++) {
}
}
perror("xfsctl(XFS_IOC_FSINUMBERS)");
- return 1;
+ exitcode = 1;
+ return 0;
+}
+
+void
+imap_init(void)
+{
+ imap_cmd.name = _("imap");
+ imap_cmd.cfunc = imap_f;
+ imap_cmd.argmin = 0;
+ imap_cmd.argmax = 0;
+ imap_cmd.args = _("[nentries]");
+ imap_cmd.flags = CMD_NOMAP_OK;
+ imap_cmd.oneline = _("inode map for filesystem of current file");
+
+ if (expert)
+ add_command(&imap_cmd);
}
fsync_init();
getrusage_init();
help_init();
+ imap_init();
inject_init();
mmap_init();
open_init();
extern void fsync_init(void);
extern void getrusage_init(void);
extern void help_init(void);
+extern void imap_init(void);
extern void inject_init(void);
extern void mmap_init(void);
extern void open_init(void);