]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Bunch of portability related changes to xfsprogs. Includes some code to
authorNathan Scott <nathans@sgi.com>
Mon, 31 Mar 2003 02:57:10 +0000 (02:57 +0000)
committerNathan Scott <nathans@sgi.com>
Mon, 31 Mar 2003 02:57:10 +0000 (02:57 +0000)
allow db/mkfs/repair to be used on Mac's (maybe useful for dual boot), &
some code to build on IRIX too (useful for purify-ing xfs_repair only).
bump version for portability changes.

41 files changed:
VERSION
build/rpm/Makefile
configure.in
db/check.c
db/fprint.c
db/write.c
debian/changelog
doc/CHANGES
doc/INSTALL
freeze/xfs_freeze.c
growfs/xfs_growfs.c
imap/xfs_imap.c
include/builddefs.in
include/buildmacros
include/handle.h
include/libxlog.h
include/platform_defs.h.in
include/xfs_bmap_btree.h
include/xfs_fs.h
include/xfs_inode.h
include/xfs_mount.h
io/bmap.c
io/open.c
io/pread.c
io/prealloc.c
io/resblks.c
libhandle/handle.c
libxfs/Makefile
libxfs/darwin.c [new file with mode: 0644]
libxfs/init.c
libxfs/init.h
libxfs/irix.c [new file with mode: 0644]
libxfs/linux.c
libxfs/xfs.h
man/man3/handle.3
mkfile/xfs_mkfile.c
mkfs/Makefile
mkfs/xfs_mkfs.c
po/Makefile
po/xfsprogs.pot
rtcp/xfs_rtcp.c

diff --git a/VERSION b/VERSION
index 8dde1cb6a1699b4e7f4c0fc45bf71eb2617134ba..3d294f97afaee1c393cab82d5101666312522715 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=4
-PKG_REVISION=3
+PKG_REVISION=4
 PKG_BUILD=0
index b980f6741d0bbf4e80a7a9771304d6ef6e0eada1..112c2a3d6905fa24c99802f09e8700a908b7bf2a 100644 (file)
@@ -85,7 +85,6 @@ ${SPECF} : ${SPECF}.in
            -e's|@pkg_version@|$(PKG_VERSION)|g' \
            -e's|@pkg_release@|$(PKG_RELEASE)|g' \
            -e's|@pkg_distribution@|$(PKG_DISTRIBUTION)|g' \
-           -e's|@pkg_builder@|$(PKG_BUILDER)|g' \
            -e's|@build_root@|$(DIST_ROOT)|g' \
            -e'/^BuildRoot: *$$/d' \
            -e's|@make@|$(MAKE)|g' < $< > $@
index 0b3c2bec65f7574e792ff8b260547a4c02084af9..574d3c0679a979a7ddcf7e043967513d1b2a890f 100644 (file)
@@ -10,7 +10,7 @@ AC_SUBST(pkg_name)
 # defaults (to change paths and/or executables, build parameters, etc):
 #
 #   DEBUG  OPTIMIZER  MALLOCLIB
-#   PLATFORM  DISTRIBUTION  BUILDER
+#   PLATFORM  DISTRIBUTION  INSTALL_USER  INSTALL_GROUP
 #   MAKE  CC  LD  TAR  ZIP  AWK  SED  ECHO  RPM  LIBTOOL
 #   MSGFMT  MSGMERGE  XGETTEXT
 #
@@ -41,15 +41,19 @@ AC_SUBST(pkg_release)
 
 pkg_platform=`uname -s`
 pkg_distribution="Generic $pkg_platform"
-pkg_platform=`echo $pkg_platform | tr 'A-Z' 'a-z'`
+pkg_platform=`echo $pkg_platform | tr 'A-Z' 'a-z' | sed -e 's/irix64/irix/'`
 test -z "$PLATFORM" || pkg_platform="$PLATFORM"
 test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
 AC_SUBST(pkg_distribution)
 AC_SUBST(pkg_platform)
 
-pkg_builder=`id -u -n`@`hostname`
-test -z "$BUILDER" || pkg_builder="$BUILDER"
-AC_SUBST(pkg_builder)
+pkg_user=root
+test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER"
+AC_SUBST(pkg_user)
+
+pkg_group=root
+test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP"
+AC_SUBST(pkg_group)
 
 dnl check if user wants their own C compiler
 test -z "$CC" && AC_PROG_CC
@@ -118,27 +122,6 @@ test -z "$ECHO" && AC_PATH_PROG(ECHO, echo, /bin/echo)
 echo=$ECHO
 AC_SUBST(echo)
 
-dnl check if the msgfmt program is available
-test -z "$MSGFMT" && AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
-msgfmt=$MSGFMT
-AC_SUBST(msgfmt)
-
-dnl check if the msgmerge program is available
-test -z "$MSGMERGE" && AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge)
-msgmerge=$MSGMERGE
-AC_SUBST(msgmerge)
-
-dnl ensure xgettext is installed
-test -z "$XGETTEXT" && AC_CHECK_PROG(XGETTEXT, xgettext, /usr/bin/xgettext)
-if test "$XGETTEXT" = ""; then
-       echo
-       echo 'FATAL ERROR: xgettext does not seem to be installed.'
-       echo $pkg_name cannot be built without a working gettext installation.
-       exit 1
-fi
-xgettext=$XGETTEXT
-AC_SUBST(xgettext)
-
 dnl ensure libtool is installed
 test -z "$LIBTOOL" && AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin)
 if test "$LIBTOOL" = ""; then
@@ -156,20 +139,45 @@ AC_ARG_ENABLE(shared,
        enable_shared=yes)
 AC_SUBST(enable_shared)
 
-dnl will we be making use of gettext?
-AC_ARG_ENABLE(gettext,
-       [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
-       enable_gettext=yes)
-AC_SUBST(enable_gettext)
-
 dnl will we be making use of readline?
 AC_ARG_ENABLE(readline,
        [ --enable-readline=[yes/no] Enable readline command editing [default=no]],,
        enable_readline=no)
-libreadline="-lreadline -lncurses"
+if test $enable_readline = yes; then
+       libreadline="-lreadline -lncurses"
+else
+       libreadline=""
+fi
 AC_SUBST(libreadline)
 AC_SUBST(enable_readline)
 
+dnl will we be making use of gettext?
+AC_ARG_ENABLE(gettext,
+       [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
+       enable_gettext=yes)
+AC_SUBST(enable_gettext)
+
+dnl check if the msgfmt, msgmerge, xgettext programs are available
+if test "$enable_gettext" = yes; then
+       test -z "$MSGFMT" && AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
+       msgfmt=$MSGFMT
+       AC_SUBST(msgfmt)
+       test -z "$MSGMERGE" && AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge)
+       msgmerge=$MSGMERGE
+       AC_SUBST(msgmerge)
+
+       test -z "$XGETTEXT" && AC_CHECK_PROG(XGETTEXT, xgettext, /usr/bin/xgettext)
+       xgettext=$XGETTEXT
+       AC_SUBST(xgettext)
+
+       if test "$XGETTEXT" = ""; then
+               echo
+               echo 'FATAL ERROR: xgettext does not seem to be installed.'
+               echo $pkg_name cannot be built without a working gettext installation.
+               exit 1
+       fi
+fi
+
 dnl Checks for UUID header and library.
 AC_CHECK_HEADER(uuid/uuid.h,, [
        echo
@@ -185,7 +193,7 @@ AC_CHECK_LIB(uuid, uuid_generate,, [
 ])
 
 dnl
-dnl Caution - using libuuid shared adds an additional runtime dependency,
+dnl Caution: using libuuid shared adds an additional runtime dependency,
 dnl but the rpm spec file and debian control file do _not_ enforce this.
 dnl We want to keep our runtime dependencies to an absolute minimum for
 dnl this particular package, but the option is there.
index c9136055016c09fd39f728b509896790428dfc90..c8bff4924377f8a96c84f01e7931b26e6ab449ac 100644 (file)
@@ -2674,8 +2674,8 @@ process_inode(
                dbprintf("inode %lld mode %#o fmt %s "
                         "afmt %s "
                         "nex %d anex %d nblk %lld sz %lld%s%s\n",
-                       id->ino, dic->di_mode, fmtnames[dic->di_format],
-                       fmtnames[dic->di_aformat],
+                       id->ino, dic->di_mode, fmtnames[(int)dic->di_format],
+                       fmtnames[(int)dic->di_aformat],
                        dic->di_nextents,
                        dic->di_anextents,
                        dic->di_nblocks, dic->di_size,
index 601fff8d2121665de8b85267292169a9518dd71d..64064a8e2d15702ac2a26a4eaaad856b4ebbbbb6 100644 (file)
@@ -67,7 +67,7 @@ fp_charns(
             i++, p++) {
                if (*p == '\\' || *p == '\'' || *p == '"' || *p == '\?')
                        dbprintf("\\%c", *p);
-               else if (isgraph(*p) || *p == ' ')
+               else if (isgraph((int)*p) || *p == ' ')
                        dbprintf("%c", *p);
                else if (*p == '\a' || *p == '\b' || *p == '\f' || *p == '\n' ||
                         *p == '\r' || *p == '\t' || *p == '\v')
index a5470df3282e01bb90b63bcb84815b4ed503c552..8ad757dbc123f84d1ebc49673f7fc6fbb49e111c 100644 (file)
@@ -520,16 +520,16 @@ convert_arg(
                     while (*arg=='-') arg++;
                     
                     /* get first nybble */
-                    if (!isxdigit(*arg)) return NULL;
-                    *rbuf=NYBBLE(*arg)<<4;
+                    if (!isxdigit((int)*arg)) return NULL;
+                    *rbuf=NYBBLE((int)*arg)<<4;
                     arg++;
                     
                     /* skip more hyphens */
                     while (*arg=='-') arg++;
                     
                     /* get second nybble */
-                    if (!isxdigit(*arg)) return NULL;
-                    *rbuf++|=NYBBLE(*arg);
+                    if (!isxdigit((int)*arg)) return NULL;
+                    *rbuf++|=NYBBLE((int)*arg);
                     arg++;
                 }
                 if (bytes<0&&*arg) return NULL;
index 597cea42e1828fe2f86818e0891078f6f7cb4ef0..31db749563d46882c33691c412bc7b09f2c47c7f 100644 (file)
@@ -1,9 +1,9 @@
-xfsprogs (2.4.3-1) unstable; urgency=low
+xfsprogs (2.4.4-1) unstable; urgency=low
 
   * New upstream release
   * Dependencies on libreadline4 and libreadline4-dev added
 
- -- Nathan Scott <nathans@debian.org>  Thu, 27 Mar 2003 10:30:18 +1100
+ -- Nathan Scott <nathans@debian.org>  Sun, 30 Mar 2003 10:30:18 +1000
 
 xfsprogs (2.4.1-1) unstable; urgency=low
 
index 134a932b8e73bcd274be6a18de091827a7c14acf..4034eed4806e91b6240d115fbee6710e0cde0646 100644 (file)
@@ -1,5 +1,21 @@
-CVS
-       - Correct display of imaxpct in mkfs output
+xfsprogs-2.4.4 (30 March 2003)
+       - Correct display of imaxpct in mkfs.xfs output.
+       - Portability changes; including some code to support use
+         of several tools on Mac OS X (for Russell), also did a
+         simplistic backport to IRIX (for me), so that I can run
+         purify on some of the tools.
+       - See doc/INSTALL for more details on this.
+       - Sync up user/kernel source in libxfs and headers.
+       - Fix up some warnings when compiling libxfs on big endian
+         platforms.
+       - Fix a configure.in botch which resulted in libreadline
+         always being used even when it was not asked for.
+       - Fixed the configure.in script so that if gettext disabled,
+         we don't check for the gettext tools (and no longer fails
+         if they were not found).
+       - Added the ability to specify a different user and/or group
+         to install as (previously, and still by default, root/root
+         were always used here).
 
 xfsprogs-2.4.3 (27 March 2003)
        - Cleanups to the build process, in particular the automatic
index 3c8f7a611d659e25fce20b0139840e797fa94f91..2ef911d864b1ea97793038099cc670bb9e856739 100644 (file)
@@ -2,6 +2,13 @@ This document describes how to configure and build the open source XFS
 commands and utilites ("xfsprogs") from source, and how to install and
 run them.
 
+See the README file in the top level directory for details about how
+to contribute to the XFS project.
+
+
+Linux Instructions
+==================
+
 0. If you have the binary rpm, simply install it and skip to step 2 (below).
    The rpm command to do this is:
        # rpm -Uvh xfsprogs-*.rpm
@@ -32,7 +39,6 @@ run them.
    If you want to build the package and install it manually, use the
    following steps:
 
-       # make configure  (or run autoconf; ./configure)
        # make
        # su root
        # make install
@@ -48,9 +54,94 @@ run them.
        OPTIMIZER=-O1
        DEBUG=-DNDEBUG
 
-   before running make configure or Makepkgs.
+   before running make or Makepkgs.
+
+
+Mac OS X Instructions
+=====================
+
+0. Note:  since there is no XFS implementation on Mac OS X, you are
+   severely limited in what you can do.  mkfs.xfs(8), xfs_db(8) and 
+   xfs_repair(8) are the only functional tools on this platform, as
+   they do not interact with the XFS kernel code at all.  Still, it
+   can be useful to have access to these utilities from Mac OS X in
+   a dual boot configuration, for example.
+
+1. Configure, build and install the package
+
+   The xfsprogs package uses autoconf/configure and expects a GNU build
+   environment (your platform must at least have both autoconf, make,
+   and glibtool). 
+
+   You will also need to have built and installed the UUID library which
+   is provided by the e2fsprogs source package.
+
+   Building libuuid:
+
+       [download; unzip/untar e2fsprogs; cd e2fsprogs]
+       $ ./configure --prefix=/usr --mandir=/usr/share/man
+       $ make lib/ext2fs/ext2_types.h
+       $ cd lib/uuid
+       $ make
+       $ su root
+       # make install
+       [verify that you now have a /usr/lib/libuuid.a]
+
+   Building xfsprogs:
+
+       [firstly set these environment variables to these values]
+       TAR=/usr/bin/gnutar
+       LIBTOOL=/usr/bin/glibtool
+       INSTALL_GROUP=wheel
+       LOCAL_CONFIGURE_OPTIONS="--enable-gettext=no"
+
+       $ make
+       $ su root
+       # make install
+       [and optionally, for the development libraries and headers]
+       # make install-dev
+
+
+IRIX Instructions
+=================
+
+0. Note: building this package on IRIX is mainly useful for the
+   XFS developers who want to run purify on some of the tools.
+   Most tools are not functional due to incomplete support for
+   the syssgi and fcntl interfaces that XFS provides and which
+   these tools make extensive use of.
+
+1. Configure, build and install the package
+
+   The xfsprogs package uses autoconf/configure and expects a GNU build
+   environment which can be obtained by installing a number of freeware
+   packages (gcc, autoconf, libtool, gmake).
+
+   Even though IRIX provides a set of UUID functions via libc, you
+   still need to have built and installed the UUID library which is
+   provided by the e2fsprogs source package.  This is because some
+   difficult to resolve differences exist between the UUID functions
+   and data types, which makes co-existence of these more trouble
+   than its worth at the moment.  Follow the instructions above for
+   building and installing libuuid.
+
+   Building xfsprogs:
+
+       [firstly set these environment variables to these values]
+       CC=/usr/freeware/bin/gcc
+       TAR=/usr/freeware/bin/tar
+       MAKE=/usr/freeware/bin/gmake
+       LIBTOOL=/usr/freeware/bin/libtool
+       MSGFMT=/usr/freeware/bin/msgfmt
+       MSGMERGE=/usr/freeware/bin/msgmerge
+       XGETTEXT=/usr/freeware/bin/xgettext
+       INSTALL_GROUP=sys
+       LOCAL_CONFIGURE_OPTIONS="--enable-gettext=no"
+
+       $ make
+       $ su root
+       # make install
+       [and optionally, for the development libraries and headers]
+       # make install-dev
 
-2. How to Contribute
 
-   See the README file in this directory for details about how to
-   contribute to the XFS project.
index aa5f03e4a8af31619a9081b51ae8f1f0293c6a9f..5e7d079c323bdd31ad6273fafeb5cdda15e801aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2001-2003 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
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <sys/ioctl.h>
 
 char   *progname;
 
@@ -54,7 +53,7 @@ main(int argc, char **argv)
        int                     ffd;    /* mount point file descriptor */
        int                     fflag, uflag;
        int                     level;
-       struct statfs           buf;
+       char                    *fname;
 
        fflag = uflag = 0;
        progname = basename(argv[0]);
@@ -80,13 +79,14 @@ main(int argc, char **argv)
        if ((fflag + uflag) != 1)
                usage();
 
-       ffd = open(argv[optind], O_RDONLY);
+       fname = argv[optind];
+       ffd = open(fname, O_RDONLY);
        if (ffd < 0) {
-               perror(argv[optind]);
+               perror(fname);
                return 1;
        }
-       fstatfs(ffd, &buf);
-       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
+       
+       if (!platform_test_xfs_fd(ffd)) {
                fprintf(stderr, _("%s: specified file "
                        "[\"%s\"] is not on an XFS filesystem\n"),
                        progname, argv[optind]);
@@ -95,7 +95,7 @@ main(int argc, char **argv)
 
        if (fflag) {
                level = 1;
-               if (ioctl(ffd, XFS_IOC_FREEZE, &level) < 0) {
+               if (xfsctl(fname, ffd, XFS_IOC_FREEZE, &level) < 0) {
                        fprintf(stderr, _("%s: cannot freeze filesystem"
                                " mounted at %s: %s\n"),
                                progname, argv[optind], strerror(errno));
@@ -104,7 +104,7 @@ main(int argc, char **argv)
        }
 
        if (uflag) {
-               if (ioctl(ffd, XFS_IOC_THAW, &level) < 0) {
+               if (xfsctl(fname, ffd, XFS_IOC_THAW, &level) < 0) {
                        fprintf(stderr, _("%s: cannot unfreeze filesystem"
                                " mounted at %s: %s\n"),
                                progname, argv[optind], strerror(errno));
index da18f4575b937966a74f2ea8b6aacd95b13bfbb4..c604819e2830c4ef9400f10106bb18f3d87e4118 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <sys/ioctl.h>
 #include "explore.h"
 
 /*
@@ -211,16 +210,23 @@ main(int argc, char **argv)
                return 1;
        }
 
+       if (!platform_test_xfs_fd(ffd)) {
+               fprintf(stderr, _("%s: specified file "
+                       "[\"%s\"] is not on an XFS filesystem\n"),
+                       progname, fname);
+               exit(1);
+       }
+
        /* get the current filesystem size & geometry */
-       if (ioctl(ffd, XFS_IOC_FSGEOMETRY, &geo) < 0) {
+       if (xfsctl(fname, ffd, XFS_IOC_FSGEOMETRY, &geo) < 0) {
                /*
-                * OK, new ioctl barfed - back off and try earlier version
+                * OK, new xfsctl barfed - back off and try earlier version
                 * as we're probably running an older kernel version.
-                * Only field added in the v2 geometry ioctl is "logsunit"
+                * Only field added in the v2 geometry xfsctl is "logsunit"
                 * so we'll zero that out for later display (as zero).
                 */
                geo.logsunit = 0;
-               if (ioctl(ffd, XFS_IOC_FSGEOMETRY_V1, &geo) < 0) {
+               if (xfsctl(fname, ffd, XFS_IOC_FSGEOMETRY_V1, &geo) < 0) {
                        fprintf(stderr, _(
                                "%s: cannot determine geometry of filesystem"
                                " mounted at %s: %s\n"),
@@ -325,14 +331,14 @@ main(int argc, char **argv)
                } else if (!error && !nflag) {
                        in.newblocks = (__u64)dsize;
                        in.imaxpct = (__u32)maxpct;
-                       if (ioctl(ffd, XFS_IOC_FSGROWFSDATA, &in) < 0) {
+                       if (xfsctl(fname, ffd, XFS_IOC_FSGROWFSDATA, &in) < 0) {
                                if (errno == EWOULDBLOCK)
                                        fprintf(stderr, _(
                                 "%s: growfs operation in progress already\n"),
                                                progname);
                                else
                                        fprintf(stderr, _(
-                               "%s: XFS_IOC_FSGROWFSDATA ioctl failed: %s\n"),
+                               "%s: XFS_IOC_FSGROWFSDATA xfsctl failed: %s\n"),
                                                progname, strerror(errno));
                                error = 1;
                        }
@@ -364,7 +370,7 @@ main(int argc, char **argv)
                } else if (!error && !nflag) {
                        in.newblocks = (__u64)rsize;
                        in.extsize = (__u32)esize;
-                       if (ioctl(ffd, XFS_IOC_FSGROWFSRT, &in) < 0) {
+                       if (xfsctl(fname, ffd, XFS_IOC_FSGROWFSRT, &in) < 0) {
                                if (errno == EWOULDBLOCK)
                                        fprintf(stderr, _(
                                "%s: growfs operation in progress already\n"),
@@ -375,7 +381,7 @@ main(int argc, char **argv)
                                                progname);
                                else
                                        fprintf(stderr, _(
-                               "%s: XFS_IOC_FSGROWFSRT ioctl failed: %s\n"),
+                               "%s: XFS_IOC_FSGROWFSRT xfsctl failed: %s\n"),
                                                progname, strerror(errno));
                                error = 1;
                        }
@@ -399,7 +405,7 @@ main(int argc, char **argv)
                                        _("log size unchanged, skipping\n"));
                } else if (!nflag) {
                        in.newblocks = (__u32)lsize;
-                       if (ioctl(ffd, XFS_IOC_FSGROWFSLOG, &in) < 0) {
+                       if (xfsctl(fname, ffd, XFS_IOC_FSGROWFSLOG, &in) < 0) {
                                if (errno == EWOULDBLOCK)
                                        fprintf(stderr,
                                _("%s: growfs operation in progress already\n"),
@@ -410,15 +416,15 @@ main(int argc, char **argv)
                                                progname);
                                else
                                        fprintf(stderr,
-                               _("%s: XFS_IOC_FSGROWFSLOG ioctl failed: %s\n"),
+                               _("%s: XFS_IOC_FSGROWFSLOG xfsctl failed: %s\n"),
                                                progname, strerror(errno));
                                error = 1;
                        }
                }
        }
 
-       if (ioctl(ffd, XFS_IOC_FSGEOMETRY_V1, &ngeo) < 0) {
-               fprintf(stderr, _("%s: XFS_IOC_FSGEOMETRY ioctl failed: %s\n"),
+       if (xfsctl(fname, ffd, XFS_IOC_FSGEOMETRY_V1, &ngeo) < 0) {
+               fprintf(stderr, _("%s: XFS_IOC_FSGEOMETRY xfsctl failed: %s\n"),
                        progname, strerror(errno));
                exit(1);
        }
index 20dd28386961f3de112bacf62c590078d4bb9cec..abfa95a42f96376e8c9be699450dd02d954e0ce3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2001-2003 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
@@ -35,7 +35,6 @@
  */
 
 #include <libxfs.h>
-#include <sys/ioctl.h>
 
 int main(int argc, char **argv)
 {
@@ -48,7 +47,6 @@ int main(int argc, char **argv)
        __s64           last = 0;
        xfs_inogrp_t    *t;
        xfs_fsop_bulkreq_t bulkreq;
-       struct statfs   buf;
 
        progname = basename(argv[0]);
        setlocale(LC_ALL, "");
@@ -64,8 +62,7 @@ int main(int argc, char **argv)
                perror(name);
                return 1;
        }
-       fstatfs(fd, &buf);
-       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
+       if (!platform_test_xfs_fd(fd)) {
                fprintf(stderr, _("%s: specified file "
                        "[\"%s\"] is not on an XFS filesystem\n"),
                        progname, name);
@@ -84,7 +81,7 @@ int main(int argc, char **argv)
        bulkreq.ubuffer = t;
        bulkreq.ocount  = &count;
 
-       while (ioctl(fd, XFS_IOC_FSINUMBERS, &bulkreq) == 0) {
+       while (xfsctl(name, fd, XFS_IOC_FSINUMBERS, &bulkreq) == 0) {
                if (count == 0)
                        return 0;
                for (i = 0; i < count; i++) {
@@ -94,6 +91,6 @@ int main(int argc, char **argv)
                                (unsigned long long)t[i].xi_allocmask);
                }
        }
-       perror("ioctl(XFS_IOC_FSINUMBERS)");
+       perror("xfsctl(XFS_IOC_FSINUMBERS)");
        return 1;
 }
index a224bc389d3e2f482beddd47c3619cfc03ff1e35..98089f8bfe99337e24f5e64bef2765ca29b02804 100644 (file)
@@ -52,11 +52,12 @@ prefix = @prefix@
 exec_prefix = @exec_prefix@
 
 PKG_NAME       = @pkg_name@
+PKG_USER       = @pkg_user@
+PKG_GROUP      = @pkg_group@
 PKG_RELEASE    = @pkg_release@
 PKG_VERSION    = @pkg_version@
 PKG_PLATFORM   = @pkg_platform@
 PKG_DISTRIBUTION= @pkg_distribution@
-PKG_BUILDER    = @pkg_builder@
 PKG_BIN_DIR    = @bindir@
 PKG_SBIN_DIR   = @sbindir@
 PKG_LIB_DIR    = @libdir@
@@ -95,9 +96,13 @@ LCFLAGS += -DXFS_BIG_FILES=1 -DXFS_BIG_FILESYSTEMS=1
 
 ifeq ($(PKG_PLATFORM),linux)
 PCFLAGS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-else
+endif
+ifeq ($(PKG_PLATFORM),darwin)
 PCFLAGS = -traditional-cpp
 endif
+ifeq ($(PKG_PLATFORM),irix)
+PLDLIBS = -ldisk -lgen
+endif
 
 GCFLAGS += $(OPTIMIZER) $(DEBUG) -funsigned-char -Wall -I$(TOPDIR)/include \
        -DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\" \
index 19be5892c98b51e10bd7e9c3c8fe38381ea57eeb..54044f41b43e1821443e10bb4c0e2d6e3f26140b 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2002-2003 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
@@ -38,7 +38,7 @@ BUILDRULES = $(TOPDIR)/include/buildrules
 # during the "dist" phase (packaging).
 
 LDFLAGS = $(LLDFLAGS)
-LDLIBS = $(LLDLIBS) $(MALLOCLIB)
+LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
 
 MAKEOPTS = --no-print-directory
 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
@@ -54,7 +54,7 @@ OBJECTS = $(ASFILES:.s=.o) \
           $(LFILES:.l=.o) \
           $(YFILES:%.y=%.tab.o)
 
-INSTALL        = $(TOPDIR)/install-sh -o root -g root
+INSTALL        = $(TOPDIR)/install-sh -o $(PKG_USER) -g $(PKG_GROUP)
 
 SHELL = /bin/sh
 IMAGES_DIR = $(TOPDIR)/all-images
index 3ad4a4fb1f25512fe8ae1f968cd734c253afde77..91357d2788c6e8977a84937f74a69ac6f703bd3a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 1995, 2001-2003 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.1 of the GNU Lesser General Public License
@@ -42,10 +42,8 @@ struct attrlist_cursor;
 
 extern int  path_to_handle (char *__path, void **__hanp, size_t *__hlen);
 extern int  path_to_fshandle (char *__path, void **__hanp, size_t *__hlen);
-extern int  fd_to_handle (int __fd, void **__hanp, size_t *__hlen);
 extern int  handle_to_fshandle (void *__hanp, size_t __hlen, void **__fshanp,
                                size_t *__fshlen);
-extern int  handle_to_fsfd (void *__hanp);
 extern void free_handle (void *__hanp, size_t __hlen);
 extern int  open_by_handle (void *__hanp, size_t __hlen, int __rw);
 extern int  readlink_by_handle (void *__hanp, size_t __hlen, void *__buf,
index 9a2736ae43996880071b22a0d0c668df6c30a145..1530908412699f9f7a3529f74b7f98d2c28dcaae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
@@ -68,8 +68,10 @@ typedef struct log {
 /*
  * macros mapping kernel code to user code
  */
+#ifndef EFSCORRUPTED
+#define EFSCORRUPTED                            990
+#endif
 #define STATIC                         static
-#define EFSCORRUPTED                    990
 #define XFS_ERROR(e)                   (e)
 #define XFS_ERROR_REPORT(e,l,mp)       ((void) 0)
 #define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0)
index 01940d89ee4cf719097fec5ff9602130ff0643b5..d7a1fca84067711c6e9ee5fd8b41bd68e0fec855 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
 #include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <uuid/uuid.h>
 
 #if defined(__linux__)
 
 #include <sys/vfs.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
-#include <uuid/uuid.h>
 #include <linux/types.h>
 #include <malloc.h>
 #include <getopt.h>
-
 #include <endian.h>
 #include "swab.h"
 
+static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
+{
+       return ioctl(fd, cmd, p);
+}
+
+static __inline__ int platform_test_xfs_fd(int fd)
+{
+       struct statfs buf;
+       if (fstatfs(fd, &buf) < 0)
+               return 0;
+       return (buf.f_type == 0x58465342);      /* XFSB */
+}
+
+static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
+{
+       return fstatfs(fd, buf);
+}
+
 #ifndef O_DIRECT
 # if defined (__powerpc__)
 #  define O_DIRECT     0400000
@@ -74,7 +91,6 @@
 
 #define ENOATTR                ENODATA /* Attribute not found */
 #define EFSCORRUPTED   990     /* Filesystem is corrupted */
-#define statfstype(bp) ((bp)->f_type)  /* statfs(2) fstyp */
 
 typedef loff_t         xfs_off_t;
 typedef __uint64_t     xfs_ino_t;
@@ -88,6 +104,187 @@ typedef unsigned char      uchar_t;
 #endif
 typedef enum { B_FALSE,B_TRUE }        boolean_t;
 
+
+#elif defined(__APPLE__)       /* Darwin */
+
+#include <libgen.h>
+#include <sys/vm.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mount.h>
+
+#include <sys/syscall.h>
+#ifndef SYS_fsctl
+#define SYS_fsctl      242
+#endif
+static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
+{
+       return syscall(SYS_fsctl, path, cmd, p, 0);
+}
+
+static __inline__ int platform_test_xfs_fd(int fd)
+{
+       struct statfs buf;
+       if (fstatfs(fd, &buf) < 0)
+               return 0;
+       return (strcmp(buf.f_fstypename, "xfs") == 0);
+}
+
+static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
+{
+       return fstatfs(fd, buf);
+}
+
+#define __int8_t       int8_t
+#define __int16_t      int16_t
+#define __int32_t      int32_t
+#define __int32_t      int32_t
+#define __int64_t      int64_t
+#define __uint8_t      u_int8_t
+#define __uint16_t     u_int16_t
+#define __uint32_t     u_int32_t
+#define __uint64_t     u_int64_t
+#define __s8           int8_t
+#define __s16          int16_t
+#define __s32          int32_t
+#define __s64          int64_t
+#define __u8           u_int8_t
+#define __u16          u_int16_t
+#define __u32          u_int32_t
+#define __u64          u_int64_t
+#define loff_t         off_t
+#define off64_t                off_t
+
+typedef off_t          xfs_off_t;
+typedef u_int64_t      xfs_ino_t;
+typedef u_int32_t      xfs_dev_t;
+typedef int64_t                xfs_daddr_t;
+typedef char*          xfs_caddr_t;
+
+typedef unsigned char  uchar_t;
+#define stat64         stat
+#define fstat64                fstat
+#define lseek64                lseek
+#define pread64                pread
+#define pwrite64       pwrite
+#define ftruncate64    ftruncate
+#define fdatasync      fsync
+#define memalign(a,sz) malloc(sz)
+
+#include <machine/endian.h>
+#define __BYTE_ORDER   BYTE_ORDER
+#define __BIG_ENDIAN   BIG_ENDIAN
+#define __LITTLE_ENDIAN        LITTLE_ENDIAN
+#include "swab.h"
+
+#define O_LARGEFILE     0
+#ifndef O_DIRECT        
+#define O_DIRECT        0
+#endif
+#ifndef O_SYNC
+#define O_SYNC          0
+#endif
+
+#define B_FALSE                0
+#define B_TRUE         1
+
+#define ENOATTR                989     /* Attribute not found */
+#define EFSCORRUPTED   990     /* Filesystem is corrupted */
+#define constpp                char * const *
+
+#define HAVE_FID       1
+
+
+#elif defined(__sgi__) /* SGI IRIX */
+
+#include <libgen.h>
+#include <values.h>
+#include <strings.h>
+#include <inttypes.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+#include <sys/sysmacros.h>
+
+#define __s8           char
+#define __s16          short
+#define __s32          __int32_t
+#define __s64          __int64_t
+#define __u8           unsigned char
+#define __u16          unsigned short
+#define __u32          __int32_t
+#define __u64          __int64_t
+#define __int8_t       char
+#define __int16_t      short
+#define __uint8_t      unsigned char
+#define __uint16_t     unsigned short
+#define loff_t         off64_t
+typedef off64_t                xfs_off_t;
+typedef __int64_t      xfs_ino_t;
+typedef __int32_t      xfs_dev_t;
+typedef __int64_t      xfs_daddr_t;
+typedef char*          xfs_caddr_t;
+
+#include <sys/endian.h>
+#define __BYTE_ORDER   BYTE_ORDER
+#define __BIG_ENDIAN   BIG_ENDIAN
+#define __LITTLE_ENDIAN        LITTLE_ENDIAN
+#include "swab.h"
+
+#define INT_MAX                INT32_MAX
+#define UINT_MAX       UINT32_MAX
+#define PATH_MAX       MAXPATHLEN
+#define constpp                char * const *
+#define isset(a,i)     ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+
+static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
+{
+       fprintf(stderr, "%s: line %d syssgi/fcntl mapping not implemented\n", 
+                       __FILE__, __LINE__);
+       errno = ENOSYS;
+       return -1;
+}
+
+static __inline__ int platform_test_xfs_fd(int fd)
+{
+       struct statvfs sbuf;
+       if (fstatvfs(fd, &sbuf) < 0)
+               return 0;
+       return (strcmp(sbuf.f_basetype, "xfs") == 0);
+}
+
+static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
+{
+       return fstatfs(fd, buf, sizeof(struct statfs), 0);
+}
+
+static __inline__ char * strsep(char **s, const char *ct)
+{
+        char *sbegin = *s, *end;
+
+        if (!sbegin)
+                return NULL;
+        end = strpbrk(sbegin, ct);
+        if (end)
+                *end++ = '\0';
+        *s = end;
+        return sbegin;
+}
+
+#define HAVE_DIOATTR   1
+#define HAVE_FSXATTR   1
+#define HAVE_GETBMAP   1
+#define HAVE_GETBMAPX  1
+#define HAVE_FSDMIDATA 1
+#define HAVE_FID       1
+#define HAVE_BBMACROS  1
+
+
+#else
+# error unknown platform... have fun porting!
 #endif
 
 
index be1ca0bd6bee0006985b1e2f3481ebe32cf0b92c..d9af87b4b8be140a449e55119138e337f46e0e4d 100644 (file)
@@ -459,6 +459,8 @@ int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb,
 #endif
 
 
+#ifdef __KERNEL__
+
 /*
  * Prototypes for xfs_bmap.c to call.
  */
@@ -706,5 +708,6 @@ xfs_bmap_do_search_extents(
        xfs_bmbt_irec_t *,
        xfs_bmbt_irec_t *);
 
+#endif /* __KERNEL__ */
 
 #endif /* __XFS_BMAP_BTREE_H__ */
index c008c24d5acaeba81223d70fc98dc71feca27ec6..d52e8146239c20f58708af1a9c6a9978fb37b2fe 100644 (file)
  * d_miniosz is the min xfer size, xfer size multiple and file seek offset
  * alignment.
  */
+#ifndef HAVE_DIOATTR
 struct dioattr {
        __u32           d_mem;          /* data buffer memory alignment */
        __u32           d_miniosz;      /* min xfer size                */
        __u32           d_maxiosz;      /* max xfer size                */
 };
+#endif
 
 /*
  * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR.
  */
+#ifndef HAVE_FSXATTR
 struct fsxattr {
        __u32           fsx_xflags;     /* xflags field value (get/set) */
        __u32           fsx_extsize;    /* extsize field value (get/set)*/
        __u32           fsx_nextents;   /* nextents field value (get)   */
        unsigned char   fsx_pad[16];
 };
+#endif
 
 /*
  * Flags for the bs_xflags/fsx_xflags field
@@ -79,6 +83,7 @@ struct fsxattr {
  * number of array elements given.  The first structure is updated on
  * return to give the offset and length for the next call.
  */
+#ifndef HAVE_GETBMAP
 struct getbmap {
        __s64           bmv_offset;     /* file offset of segment in blocks */
        __s64           bmv_block;      /* starting block (64-bit daddr_t)  */
@@ -86,6 +91,7 @@ struct getbmap {
        __s32           bmv_count;      /* # of entries in array incl. 1st  */
        __s32           bmv_entries;    /* # of entries filled in (output)  */
 };
+#endif
 
 /*
  *     Structure for XFS_IOC_GETBMAPX.  Fields bmv_offset through bmv_entries
@@ -96,6 +102,7 @@ struct getbmap {
  *     in by the XFS_IOC_GETBMAPX command for each returned structure after
  *     the first.
  */
+#ifndef HAVE_GETBMAPX
 struct getbmapx {
        __s64           bmv_offset;     /* file offset of segment in blocks */
        __s64           bmv_block;      /* starting block (64-bit daddr_t)  */
@@ -107,6 +114,7 @@ struct getbmapx {
        __s32           bmv_unused1;    /* future use                       */
        __s32           bmv_unused2;    /* future use                       */
 };
+#endif
 
 /*     bmv_iflags values - set by XFS_IOC_GETBMAPX caller.     */
 #define BMV_IF_ATTRFORK                0x1     /* return attr fork rather than data */
@@ -136,11 +144,13 @@ struct getbmapx {
  * only values previously obtained via xfs_bulkstat!  (Specifically the
  * xfs_bstat_t fields bs_dmevmask and bs_dmstate.)
  */
+#ifndef HAVE_FSDMIDATA
 struct fsdmidata {
        __u32           fsd_dmevmask;   /* corresponds to di_dmevmask */
        __u16           fsd_padding;
        __u16           fsd_dmstate;    /* corresponds to di_dmstate  */
 };
+#endif
 
 /*
  * File segment locking set data type for 64 bit access.
@@ -391,7 +401,7 @@ typedef struct {
  * This is typically called by a stateless file server in order to generate
  * "file handles".
  */
-#ifndef MAXFIDSZ
+#ifndef HAVE_FID
 #define MAXFIDSZ       46
 typedef struct fid {
        __u16           fid_len;                /* length of data in bytes */
@@ -486,6 +496,7 @@ typedef struct xfs_handle {
 /*     XFS_IOC_GETFSUUID ---------- deprecated 140      */
 
 
+#ifndef HAVE_BBMACROS
 /*
  * Block I/O parameterization. A basic block (BB) is the lowest size of
  * filesystem allocation, and must equal 512.  Length units given to bio
@@ -497,5 +508,6 @@ typedef struct xfs_handle {
 #define BTOBB(bytes)   (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT)
 #define BTOBBT(bytes)  ((__u64)(bytes) >> BBSHIFT)
 #define BBTOB(bbs)     ((bbs) << BBSHIFT)
+#endif
 
 #endif /* __XFS_FS_H__ */
index d6f56297d65c82d482b8123bdb19f492fff9be6b..a3836f4218e1db17139574a80d8673c5e6931169 100644 (file)
@@ -518,7 +518,6 @@ void                xfs_iunpin(xfs_inode_t *);
 int            xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
 int            xfs_iflush(xfs_inode_t *, uint);
 int            xfs_iflush_all(struct xfs_mount *, int);
-int            xfs_ibusy_check(xfs_inode_t *, int);
 int            xfs_iaccess(xfs_inode_t *, mode_t, cred_t *);
 uint           xfs_iroundup(uint);
 void           xfs_ichgtime(xfs_inode_t *, int);
index 924b61fbe51213f314f269115ef6850a5c4baf7d..06b7b626e32a4daa9732cd0e65885ac4e9586a31 100644 (file)
@@ -314,8 +314,6 @@ typedef struct xfs_mount {
        xfs_buftarg_t           *m_logdev_targp;/* ptr to log device */
        xfs_buftarg_t           *m_rtdev_targp; /* ptr to rt device */
 #define m_dev          m_ddev_targp->pbr_dev
-#define m_logdev       m_logdev_targp->pbr_dev
-#define m_rtdev                m_rtdev_targp->pbr_dev
        __uint8_t               m_dircook_elog; /* log d-cookie entry bits */
        __uint8_t               m_blkbit_log;   /* blocklog + NBBY */
        __uint8_t               m_blkbb_log;    /* blocklog - BBSHIFT */
@@ -544,7 +542,6 @@ extern void xfs_mount_free(xfs_mount_t *mp, int remove_bhv);
 extern int     xfs_mountfs(struct vfs *, xfs_mount_t *mp, dev_t, int);
 
 extern int     xfs_unmountfs(xfs_mount_t *, struct cred *);
-extern void    xfs_uuid_unmount(xfs_mount_t *mp);
 extern void    xfs_unmountfs_close(xfs_mount_t *, struct cred *);
 extern int     xfs_unmountfs_writesb(xfs_mount_t *);
 extern int     xfs_unmount_flush(xfs_mount_t *, int);
index 09d11a7c76424771b5050591038395750106b726..7e8ba0daf859b534c4141aeb19103a9f9622f50c 100644 (file)
--- a/io/bmap.c
+++ b/io/bmap.c
@@ -130,14 +130,14 @@ bmap_f(
                bmv_iflags &= ~(BMV_IF_PREALLOC|BMV_IF_NO_DMAPI_READ);
 
        if (vflag) {
-               if (ioctl(fdesc, XFS_IOC_FSGEOMETRY_V1, &fsgeo) < 0) {
+               if (xfsctl(fname, fdesc, XFS_IOC_FSGEOMETRY_V1, &fsgeo) < 0) {
                        fprintf(stderr,
                                _("%s: can't get geometry [\"%s\"]: %s\n"),
                                progname, fname, strerror(errno));
                        exitcode = 1;
                        return 0;
                }
-               if ((ioctl(fdesc, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
+               if ((xfsctl(fname, fdesc, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
                        fprintf(stderr,
                                _("%s: cannot read attrs on \"%s\": %s\n"),
                                progname, fname, strerror(errno));
@@ -164,10 +164,10 @@ bmap_f(
        }
                
 
-/*     Try the ioctl(XFS_IOC_GETBMAPX) for the number of extents specified by
- *     nflag, or the initial guess number of extents (256).
+/*     Try the xfsctl(XFS_IOC_GETBMAPX) for the number of extents specified
+ *     by nflag, or the initial guess number of extents (256).
  *
- *     If there are more extents than we guessed, use ioctl 
+ *     If there are more extents than we guessed, use xfsctl
  *     (XFS_IOC_FSGETXATTR[A]) to get the extent count, realloc some more 
  *     space based on this count, and try again.
  *
@@ -176,7 +176,7 @@ bmap_f(
  *     EINVAL, check the length with fstat() and return "no extents"
  *     if the length == 0.
  *
- *     Why not do the ioctl(XFS_IOC_FSGETXATTR[A]) first?  Two reasons:
+ *     Why not do the xfsctl(XFS_IOC_FSGETXATTR[A]) first?  Two reasons:
  *     (1)     The extent count may be wrong for a file with delayed
  *             allocation blocks.  The XFS_IOC_GETBMAPX forces the real
  *             allocation and fixes up the extent count.
@@ -199,14 +199,14 @@ bmap_f(
                map->bmv_count = map_size;
                map->bmv_iflags = bmv_iflags;
 
-               i = ioctl(fdesc, XFS_IOC_GETBMAPX, map);
+               i = xfsctl(fname, fdesc, XFS_IOC_GETBMAPX, map);
                if (i < 0) {
                        if (   errno == EINVAL
                            && !aflag && filesize() == 0) {
                                break;
                        } else  {
-                               fprintf(stderr, _("%s: ioctl(XFS_IOC_GETBMAPX) "
-                                       "iflags=0x%x [\"%s\"]: %s\n"),
+                               fprintf(stderr, _("%s: xfsctl(XFS_IOC_GETBMAPX)"
+                                       " iflags=0x%x [\"%s\"]: %s\n"),
                                        progname, map->bmv_iflags, fname,
                                        strerror(errno));
                                free(map);
@@ -218,14 +218,14 @@ bmap_f(
                        break;
                if (map->bmv_entries < map->bmv_count-1)
                        break;
-               /* Get number of extents from ioctl XFS_IOC_FSGETXATTR[A]
+               /* Get number of extents from xfsctl XFS_IOC_FSGETXATTR[A]
                 * syscall.
                 */
-               i = ioctl(fdesc, aflag ?
+               i = xfsctl(fname, fdesc, aflag ?
                                XFS_IOC_FSGETXATTRA : XFS_IOC_FSGETXATTR, &fsx);
                if (i < 0) {
-                       fprintf(stderr, _("%s: ioctl(XFS_IOC_FSGETXATTR%s) "
-                               "[\"%s\"]: %s\n"), progname, aflag ? "A" : "",
+                       fprintf(stderr, "%s: xfsctl(XFS_IOC_FSGETXATTR%s) "
+                               "[\"%s\"]: %s\n", progname, aflag ? "A" : "",
                                fname, strerror(errno));
                        free(map);
                        exitcode = 1;
index c479a3be8a4d1068e5bb3ebcc85a41ba483bc472..0f5075d5b3633a43371f286b7909428b440055de 100644 (file)
--- a/io/open.c
+++ b/io/open.c
@@ -41,7 +41,7 @@ static int stat_f(int, char **);
 
 int
 openfile(
-       char            *filename,
+       char            *path,
        int             aflag,
        int             cflag,
        int             dflag,
@@ -52,7 +52,6 @@ openfile(
 {
        int             fd;
        int             oflags;
-       struct statfs   buf;
 
        oflags = (rflag ? O_RDONLY : O_RDWR);
        if (aflag)
@@ -66,13 +65,12 @@ openfile(
        if (tflag)
                oflags |= O_TRUNC;
 
-       fd = open(filename, oflags, 0666);
+       fd = open(path, oflags, 0644);
        if (fd < 0) {
-               perror(filename);
+               perror(path);
                return -1;
        }
-       fstatfs(fd, &buf);
-       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
+       if (!platform_test_xfs_fd(fd)) {
                fprintf(stderr, _("%s: specified file "
                        "[\"%s\"] is not on an XFS filesystem\n"),
                        progname, fname);
@@ -83,14 +81,14 @@ openfile(
        if (!readonly && xflag) {       /* read/write and realtime */
                struct fsxattr  attr;
 
-               if (ioctl(fd, XFS_IOC_FSGETXATTR, &attr) < 0) {
+               if (xfsctl(path, fd, XFS_IOC_FSGETXATTR, &attr) < 0) {
                        perror("XFS_IOC_FSGETXATTR");
                        close(fd);
                        return -1;
                }
                if (!(attr.fsx_xflags & XFS_XFLAG_REALTIME)) {
                        attr.fsx_xflags |= XFS_XFLAG_REALTIME;
-                       if (ioctl(fd, XFS_IOC_FSSETXATTR, &attr) < 0) {
+                       if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &attr) < 0) {
                                perror("XFS_IOC_FSSETXATTR");
                                close(fd);
                                return -1;
@@ -276,8 +274,8 @@ stat_f(
                        printf(_("stat.ctime = %s"), ctime(&st.st_ctime));
                }
        }
-       if ((ioctl(fdesc, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
-               perror("XFS_IOC_FSGETXATTR");
+       if ((xfsctl(fname, fdesc, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
+               perror("xfsctl(XFS_IOC_FSGETXATTR)");
        } else {
                printf(_("xattr.xflags = 0x%x\n"), fsx.fsx_xflags);
                printf(_("xattr.nextents = %u\n"), fsx.fsx_nextents);
@@ -296,15 +294,17 @@ statfs_f(
 
        printf(_("fd.path = \"%s\"\n"),
                realpath(fname, fullname) ? fullname : fname);
-       if (fstatfs(fdesc, &st) < 0) {
+       if (platform_fstatfs(fdesc, &st) < 0) {
                perror("fstatfs");
        } else {
                printf(_("statfs.f_bsize = %lld\n"), (long long) st.f_bsize);
                printf(_("statfs.f_blocks = %lld\n"), (long long) st.f_blocks);
+#if !defined(__sgi__)
                printf(_("statfs.f_bavail = %lld\n"), (long long) st.f_bavail);
+#endif
        }
-       if ((ioctl(fdesc, XFS_IOC_FSGEOMETRY_V1, &fsgeo)) < 0) {
-               perror("XFS_IOC_FSGEOMETRY_V1");
+       if ((xfsctl(fname, fdesc, XFS_IOC_FSGEOMETRY_V1, &fsgeo)) < 0) {
+               perror("xfsctl(XFS_IOC_FSGEOMETRY_V1)");
        } else {
                printf(_("geom.bsize = %u\n"), fsgeo.blocksize);
                printf(_("geom.agcount = %u\n"), fsgeo.agcount);
index 1e69beaa216aee2d3f847d602da674d802c43e1a..d12c0a9797ea3294f134cbc29dcefe3a7829404e 100644 (file)
@@ -91,7 +91,7 @@ dump_buffer(
                        printf("%02x ", *p);
                printf(" ");
                for (j = 0; j < 16 && i + j < len; j++, s++) {
-                       if (isalnum(*s))
+                       if (isalnum((int)*s))
                                printf("%c", *s);
                        else
                                printf(".");
index 128bcd58823477bff0730e55c92f88f7ec82d010..b2b18cf925340b0ac7ccd8ced77398e3afd012c2 100644 (file)
@@ -72,8 +72,8 @@ allocsp_f(
        if (!offset_length(argv[1], argv[2], &segment))
                return 0;
 
-       if (ioctl(fdesc, XFS_IOC_ALLOCSP64, &segment) < 0) {
-               perror("XFS_IOC_ALLOCSP64");
+       if (xfsctl(fname, fdesc, XFS_IOC_ALLOCSP64, &segment) < 0) {
+               perror("xfsctl(XFS_IOC_ALLOCSP64)");
                return 0;
        }
        return 0;
@@ -89,8 +89,8 @@ freesp_f(
        if (!offset_length(argv[1], argv[2], &segment))
                return 0;
 
-       if (ioctl(fdesc, XFS_IOC_FREESP64, &segment) < 0) {
-               perror("XFS_IOC_FREESP64");
+       if (xfsctl(fname, fdesc, XFS_IOC_FREESP64, &segment) < 0) {
+               perror("xfsctl(XFS_IOC_FREESP64)");
                return 0;
        }
        return 0;
@@ -106,8 +106,8 @@ resvsp_f(
        if (!offset_length(argv[1], argv[2], &segment))
                return 0;
 
-       if (ioctl(fdesc, XFS_IOC_RESVSP64, &segment) < 0) {
-               perror("XFS_IOC_RESVSP64");
+       if (xfsctl(fname, fdesc, XFS_IOC_RESVSP64, &segment) < 0) {
+               perror("xfsctl(XFS_IOC_RESVSP64)");
                return 0;
        }
        return 0;
@@ -123,8 +123,8 @@ unresvsp_f(
        if (!offset_length(argv[1], argv[2], &segment))
                return 0;
 
-       if (ioctl(fdesc, XFS_IOC_UNRESVSP64, &segment) < 0) {
-               perror("XFS_IOC_UNRESVSP64");
+       if (xfsctl(fname, fdesc, XFS_IOC_UNRESVSP64, &segment) < 0) {
+               perror("xfsctl(XFS_IOC_UNRESVSP64)");
                return 0;
        }
        return 0;
index 5191dca1d8f5b92c2c456c0028c224cba8a258e6..07787d09626463042ea83536cdbf97ede90b5301 100644 (file)
@@ -51,12 +51,12 @@ resblks_f(
                        printf(_("non-numeric argument -- %s\n"), argv[1]);
                        return 0;
                }
-               if (ioctl(fdesc, XFS_IOC_SET_RESBLKS, &res) < 0) {
-                       perror("XFS_IOC_SET_RESBLKS");
+               if (xfsctl(fname, fdesc, XFS_IOC_SET_RESBLKS, &res) < 0) {
+                       perror("xfsctl(XFS_IOC_SET_RESBLKS)");
                        return 0;
                }
-       } else if (ioctl(fdesc, XFS_IOC_GET_RESBLKS, &res) < 0) {
-               perror("XFS_IOC_GET_RESBLKS");
+       } else if (xfsctl(fname, fdesc, XFS_IOC_GET_RESBLKS, &res) < 0) {
+               perror("xfsctl(XFS_IOC_GET_RESBLKS)");
                return 0;
        }
        printf(_("reserved blocks = %llu\n"),
index f00348a42a21d0ee324f9842e002f6a9790eae88..572cb8da478181365c716c237d16394928e3a34f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 1995, 2001-2003 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.1 of the GNU Lesser General Public License
@@ -32,8 +32,6 @@
  */
 
 #include <libxfs.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
 /* attributes.h (purposefully) unavailable to xfsprogs, make do */
 struct attrlist_cursor { __u32 opaque[4]; };
@@ -58,20 +56,26 @@ typedef union {
        char    *path;
 } comarg_t;
 
-int
+static int
 obj_to_handle (
+       char            *fspath,
        int             fsfd,
        unsigned int    opcode,
        comarg_t        obj,
        void            **hanp,
        size_t          *hlen);
 
+static int
+handle_to_fsfd (
+       void            *hanp,
+       char            **path);
+
 
 /*
  * Filesystem Handle -> Open File Descriptor Cache
  *
  * Maps filesystem handles to a corresponding open file descriptor for that
- * filesystem. We need this because we're doing handle operations via ioctl
+ * filesystem. We need this because we're doing handle operations via xfsctl
  * and we need to remember the open file descriptor for each filesystem.
  */
 
@@ -79,9 +83,10 @@ struct fdhash {
        int     fsfd;
        char    fsh[FSIDSIZE];
        struct fdhash *fnxt;
+       char    fspath[MAXPATHLEN];
 };
 
-struct fdhash *fdhash_head = NULL;
+static struct fdhash *fdhash_head = NULL;
 
 int
 path_to_fshandle (
@@ -103,12 +108,11 @@ path_to_fshandle (
 
        obj.path = path;
 
-       result = obj_to_handle (fd, XFS_IOC_PATH_TO_FSHANDLE,
+       result = obj_to_handle(path, fd, XFS_IOC_PATH_TO_FSHANDLE,
                                obj, hanp, hlen);
 
        if (result >= 0) {
                fdhp = malloc(sizeof(struct fdhash));
-
                if (fdhp == NULL) {
                        errno = ENOMEM;
                        return -1;
@@ -116,7 +120,7 @@ path_to_fshandle (
 
                fdhp->fsfd = fd;
                fdhp->fnxt = NULL;
-
+               strncpy(fdhp->fspath, path, sizeof(fdhp->fspath));
                memcpy(fdhp->fsh, *hanp, FSIDSIZE);
 
                if (fdhash_head)
@@ -148,7 +152,7 @@ path_to_handle (
 
        obj.path = path;
 
-       result = obj_to_handle (fd, XFS_IOC_PATH_TO_HANDLE, obj, hanp, hlen);
+       result = obj_to_handle (path, fd, XFS_IOC_PATH_TO_HANDLE, obj, hanp, hlen);
 
        close(fd);
 
@@ -156,20 +160,6 @@ path_to_handle (
 }
 
 
-int
-fd_to_handle (
-       int             fd,             /* input,  file descriptor */
-       void            **hanp,         /* output, pointer to data */
-       size_t          *hlen)          /* output, size of returned data */
-{
-       comarg_t        obj;
-
-       obj.fd = fd;
-
-       return obj_to_handle (fd, XFS_IOC_FD_TO_HANDLE, obj, hanp, hlen);
-}
-
-
 int
 handle_to_fshandle (
        void            *hanp,
@@ -193,21 +183,24 @@ handle_to_fshandle (
 }
 
 
-int
-handle_to_fsfd(void *hanp)
+static int
+handle_to_fsfd(void *hanp, char **path)
 {
        struct fdhash   *fdhp;
 
        for (fdhp = fdhash_head; fdhp != NULL; fdhp = fdhp->fnxt) {
-               if (memcmp(fdhp->fsh, hanp, FSIDSIZE) == 0)
+               if (memcmp(fdhp->fsh, hanp, FSIDSIZE) == 0) {
+                       *path = fdhp->fspath;
                        return fdhp->fsfd;
+               }
        }
        return -1;
 }
 
 
-int
+static int
 obj_to_handle (
+       char            *fspath,
        int             fsfd,
        unsigned int    opcode,
        comarg_t        obj,
@@ -232,13 +225,11 @@ obj_to_handle (
        hreq.ohandle  = hbuf;
        hreq.ohandlen = (__u32 *)hlen;
 
-       ret = (int) ioctl(fsfd, opcode, &hreq);
-
+       ret = xfsctl(fspath, fsfd, opcode, &hreq);
        if (ret)
                return ret;
 
        *hanp = malloc(*hlen);  
-
        if (*hanp == NULL) {
                errno = ENOMEM;
                return -1;
@@ -250,7 +241,6 @@ obj_to_handle (
 }
 
 
-
 int
 open_by_handle (
        void            *hanp,
@@ -258,10 +248,10 @@ open_by_handle (
        int             rw)
 {
        int             fd;
-       int             result;
+       char            *path;
        xfs_fsop_handlereq_t hreq;
 
-       if ((fd = handle_to_fsfd(hanp)) < 0) {
+       if ((fd = handle_to_fsfd(hanp, &path)) < 0) {
                errno = EBADF;
                return -1;
        }
@@ -274,9 +264,7 @@ open_by_handle (
        hreq.ohandle  = NULL;
        hreq.ohandlen = NULL;
 
-       result = ioctl(fd, XFS_IOC_OPEN_BY_HANDLE, &hreq);
-
-       return result;
+       return xfsctl(path, fd, XFS_IOC_OPEN_BY_HANDLE, &hreq);
 }
 
 int
@@ -287,10 +275,11 @@ readlink_by_handle (
        size_t          bufsiz)
 {
        int             fd;
+       char            *path;
        xfs_fsop_handlereq_t hreq;
 
 
-       if ((fd = handle_to_fsfd(hanp)) < 0) {
+       if ((fd = handle_to_fsfd(hanp, &path)) < 0) {
                errno = EBADF;
                return -1;
        }
@@ -303,7 +292,7 @@ readlink_by_handle (
        hreq.ohandle  = buf;
        hreq.ohandlen = (__u32 *)&bufsiz;
 
-       return (int) ioctl(fd, XFS_IOC_READLINK_BY_HANDLE, &hreq);
+       return xfsctl(path, fd, XFS_IOC_READLINK_BY_HANDLE, &hreq);
 }
 
 int
@@ -315,9 +304,10 @@ attr_multi_by_handle(
        int             flags)
 {
        int             fd;
+       char            *path;
        xfs_fsop_attrmulti_handlereq_t amhreq;
 
-       if ((fd = handle_to_fsfd(hanp)) < 0) {
+       if ((fd = handle_to_fsfd(hanp, &path)) < 0) {
                errno = EBADF;
                return -1;
        }
@@ -333,7 +323,7 @@ attr_multi_by_handle(
        amhreq.opcount = rtrvcnt;
        amhreq.ops = buf;
 
-       return (int) ioctl(fd, XFS_IOC_ATTRMULTI_BY_HANDLE, &amhreq);
+       return xfsctl(path, fd, XFS_IOC_ATTRMULTI_BY_HANDLE, &amhreq);
 }
 
 int
@@ -346,9 +336,10 @@ attr_list_by_handle(
        struct attrlist_cursor *cursor)
 {
        int             fd;
+       char            *path;
        xfs_fsop_attrlist_handlereq_t alhreq;
 
-       if ((fd = handle_to_fsfd(hanp)) < 0) {
+       if ((fd = handle_to_fsfd(hanp, &path)) < 0) {
                errno = EBADF;
                return -1;
        }
@@ -366,7 +357,7 @@ attr_list_by_handle(
        alhreq.buflen = bufsize;
        alhreq.buffer = buf;
 
-       return (int) ioctl(fd, XFS_IOC_ATTRLIST_BY_HANDLE, &alhreq);
+       return xfsctl(path, fd, XFS_IOC_ATTRLIST_BY_HANDLE, &alhreq);
 }
 
 int
@@ -376,10 +367,11 @@ fssetdm_by_handle (
        struct fsdmidata *fsdmidata)
 {
        int             fd;
+       char            *path;
        xfs_fsop_setdm_handlereq_t dmhreq;
 
 
-       if ((fd = handle_to_fsfd(hanp)) < 0) {
+       if ((fd = handle_to_fsfd(hanp, &path)) < 0) {
                errno = EBADF;
                return -1;
        }
@@ -394,7 +386,7 @@ fssetdm_by_handle (
 
        dmhreq.data = fsdmidata;
 
-       return (int) ioctl(fd, XFS_IOC_FSSETDM_BY_HANDLE, &dmhreq);
+       return xfsctl(path, fd, XFS_IOC_FSSETDM_BY_HANDLE, &dmhreq);
 }
 
 /*ARGSUSED*/
index 994afdbb247c66026bc42a9feeffb47717c31c5c..72f11c933e4a56d5064d4739c0341921cf5c57e7 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2000-2003 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
@@ -48,7 +48,8 @@ CFILES = bit.c init.c logitem.c rdwr.c trans.c util.c \
        xfs_mount.c xfs_trans.c
 
 CFILES += $(PKG_PLATFORM).c
-LSRCFILES = $(shell echo linux.c | sed -e "s/$(PKG_PLATFORM).c//g")
+PCFILES = darwin.c irix.c linux.c
+LSRCFILES = $(shell echo $(PCFILES) | sed -e "s/$(PKG_PLATFORM).c//g")
 
 # 
 # Tracing flags:
diff --git a/libxfs/darwin.c b/libxfs/darwin.c
new file mode 100644 (file)
index 0000000..87586b4
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2003 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/
+ */
+
+#include <sys/disk.h>
+#include <sys/stat.h>
+#include <sys/mount.h>
+#include <sys/ioctl.h>
+#include <libxfs.h>
+
+extern char *progname;
+
+int
+platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+{
+       return 0;
+}
+
+int
+platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal)
+{
+       int     fd, writable;
+
+       if ((fd = open(block, O_RDONLY, 0)) < 0) {
+               fprintf(stderr, _("%s: "
+                       "error opening the device special file \"%s\": %s\n"),
+                       progname, block, strerror(errno));
+               exit(1);
+       }
+
+       if (ioctl(fd, DKIOCISWRITABLE, &writable) < 0) {
+               fprintf(stderr, _("%s: can't tell if \"%s\" is writable: %s\n"),
+                       progname, block, strerror(errno));
+               exit(1);
+       }
+       close(fd);
+       return (writable == 0);
+}
+
+void
+platform_set_blocksize(int fd, char *path, int blocksize)
+{
+       return;
+}
+
+void
+platform_flush_device(int fd)
+{
+       ioctl(fd, DKIOCSYNCHRONIZECACHE, NULL);
+}
+
+__int64_t
+platform_findsize(char *path)
+{
+       __int64_t       ssize;
+       __uint64_t      size;
+       struct stat64   st;
+       int             fd;
+
+       if (stat64(path, &st) < 0) {
+               fprintf(stderr,
+                       _("%s: cannot stat the device file \"%s\": %s\n"),
+                       progname, path, strerror(errno));
+               exit(1);
+       }
+       if ((st.st_mode & S_IFMT) == S_IFREG)
+               return (__int64_t)(st.st_size >> 9);
+
+       if ((fd = open(path, O_RDONLY, 0)) < 0) {
+               fprintf(stderr, _("%s: "
+                       "error opening the device special file \"%s\": %s\n"),
+                       progname, path, strerror(errno));
+               exit(1);
+       }
+
+       if (ioctl(fd, DKIOCGETBLOCKCOUNT, &size) < 0) {
+               fprintf(stderr, _("%s: can't determine device size: %s\n"),
+                       progname, strerror(errno));
+               exit(1);
+       }
+       close(fd);
+       ssize = (__int64_t)size;
+       return ssize;
+}
index 798835b23b0b37841300cf6c7e76a5c1ab832e90..adc02b5cbb7908aa55092f3747277b49c25f1485 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
@@ -66,9 +66,9 @@ check_isactive(char *name, char *block, int fatal)
                return 0;
        if ((st.st_mode & S_IFMT) != S_IFBLK)
                return 0;
-       if (check_ismounted(name, block, &st, 0) == 0)
+       if (platform_check_ismounted(name, block, &st, 0) == 0)
                return 0;
-       return check_iswritable(name, block, &st, fatal);
+       return platform_check_iswritable(name, block, &st, fatal);
 }
 
 /* libxfs_device_to_fd:
@@ -116,7 +116,7 @@ libxfs_device_open(char *path, int creat, int readonly, int setblksize)
        }
 
        if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK) {
-               set_blocksize(fd, path, 512);
+               platform_set_blocksize(fd, path, 512);
        }
 
        /*
@@ -159,7 +159,7 @@ libxfs_device_close(dev_t dev)
                        dev_map[d].dev = dev_map[d].fd = 0;
 
                        fsync(fd);
-                       flush_device(fd);
+                       platform_flush_device(fd);
                        close(fd);
 
                        return;
@@ -224,8 +224,8 @@ libxfs_init(libxfs_init_t *a)
                                progname, a->volname);
                        goto done;
                }
-               if (!readonly && !inactive && check_ismounted(
-                                       a->volname, blockfile, NULL, 1))
+               if (!readonly && !inactive &&
+                   platform_check_ismounted(a->volname, blockfile, NULL, 1))
                        goto done;
                if (inactive && check_isactive(
                                        a->volname, blockfile, readonly))
@@ -332,8 +332,8 @@ voldone:
                                        "matching %s\n"), progname, dname);
                                goto done;
                        }
-                       if (!readonly && !inactive && check_ismounted(
-                                               dname, blockfile, NULL, 1))
+                       if (!readonly && !inactive &&
+                           platform_check_ismounted(dname, blockfile, NULL, 1))
                                goto done;
                        if (inactive && check_isactive(
                                                dname, blockfile, readonly))
@@ -341,7 +341,7 @@ voldone:
                        a->ddev = libxfs_device_open(rawfile,
                                        a->dcreat, readonly, a->setblksize);
                        a->dfd = libxfs_device_to_fd(a->ddev);
-                       a->dsize = findsize(rawfile);
+                       a->dsize = platform_findsize(rawfile);
                }
                needcd = 1;
        } else
@@ -372,8 +372,8 @@ voldone:
                                        "matching %s\n"), progname, logname);
                                goto done;
                        }
-                       if (!readonly && !inactive && check_ismounted(
-                                               logname, blockfile, NULL, 1))
+                       if (!readonly && !inactive &&
+                           platform_check_ismounted(logname, blockfile, NULL, 1))
                                goto done;
                        else if (inactive && check_isactive(
                                                logname, blockfile, readonly))
@@ -381,7 +381,7 @@ voldone:
                        a->logdev = libxfs_device_open(rawfile,
                                        a->lcreat, readonly, a->setblksize);
                        a->logfd = libxfs_device_to_fd(a->logdev);
-                       a->logBBsize = findsize(rawfile);
+                       a->logBBsize = platform_findsize(rawfile);
                }
                needcd = 1;
        } else
@@ -412,8 +412,8 @@ voldone:
                                        "matching %s\n"), progname, rtname);
                                goto done;
                        }
-                       if (!readonly && !inactive && check_ismounted(
-                                               rtname, blockfile, NULL, 1))
+                       if (!readonly && !inactive &&
+                           platform_check_ismounted(rtname, blockfile, NULL, 1))
                                goto done;
                        if (inactive && check_isactive(
                                                rtname, blockfile, readonly))
@@ -421,7 +421,7 @@ voldone:
                        a->rtdev = libxfs_device_open(rawfile,
                                        a->rcreat, readonly, a->setblksize);
                        a->rtfd = libxfs_device_to_fd(a->rtdev);
-                       a->rtsize = findsize(rawfile);
+                       a->rtsize = platform_findsize(rawfile);
                }
                needcd = 1;
        } else
index 77c19a082a97490177733f42e40fac86e9f08d64..ec93874f18c433df0b32a9591ce7f2ae52e35514 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
 
 struct stat64;
 
-extern int check_ismounted (char *path, char *block,
+extern int platform_check_ismounted (char *path, char *block,
                                        struct stat64 *sptr, int verbose);
-extern int check_iswritable (char *path, char *block,
+extern int platform_check_iswritable (char *path, char *block,
                                        struct stat64 *sptr, int fatal);
-extern __int64_t findsize (char *path);
-extern void set_blocksize (int fd, char *path, int blocksize);
-extern void flush_device (int fd);
+extern __int64_t platform_findsize (char *path);
+extern void platform_set_blocksize (int fd, char *path, int blocksize);
+extern void platform_flush_device (int fd);
 
 #endif /* LIBXFS_INIT_H */
diff --git a/libxfs/irix.c b/libxfs/irix.c
new file mode 100644 (file)
index 0000000..03af055
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2000-2003 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/
+ */
+
+#include <libxfs.h>
+
+extern char *progname;
+extern __int64_t findsize(char *);
+
+int
+platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+{
+       return 0;
+}
+
+int
+platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal)
+{
+       return 1;
+}
+
+void
+platform_set_blocksize(int fd, char *path, int blocksize)
+{
+       return;
+}
+
+void
+platform_flush_device(int fd)
+{
+       return;
+}
+
+__int64_t
+platform_findsize(char *path)
+{
+       struct stat64           st;
+
+       if (stat64(path, &st) < 0) {
+               fprintf(stderr,
+                       _("%s: cannot stat the device file \"%s\": %s\n"),
+                       progname, path, strerror(errno));
+               exit(1);
+       }
+       if ((st.st_mode & S_IFMT) == S_IFREG)
+               return (__int64_t)(st.st_size >> 9);
+
+       return findsize(path);
+}
index d01a6ab53f8d34bafb3572a540e5bd73d238e04a..38f0da3175e95f5ec42aa638df91f90039760d7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
@@ -51,7 +51,7 @@ extern char *progname;
 #define PROC_MOUNTED   "/proc/mounts"
 
 int
-check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
 {
        struct ustat    ust;
        struct stat64   st;
@@ -75,7 +75,7 @@ check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
 }
 
 int
-check_iswritable(char *name, char *block, struct stat64 *s, int fatal)
+platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal)
 {
        int             sts = 0;
        FILE            *f;
@@ -108,7 +108,7 @@ check_iswritable(char *name, char *block, struct stat64 *s, int fatal)
 }
 
 void
-set_blocksize(int fd, char *path, int blocksize)
+platform_set_blocksize(int fd, char *path, int blocksize)
 {
        if (ioctl(fd, BLKBSZSET, &blocksize) < 0) {
                fprintf(stderr, _("%s: warning - cannot set blocksize "
@@ -118,13 +118,13 @@ set_blocksize(int fd, char *path, int blocksize)
 }
 
 void
-flush_device(int fd)
+platform_flush_device(int fd)
 {
        ioctl(fd, BLKFLSBUF, 0);
 }
 
 __int64_t
-findsize(char *path)
+platform_findsize(char *path)
 {
        int             fd;
        int             error;
@@ -165,6 +165,5 @@ findsize(char *path)
        }
 
        close(fd);
-
        return ssize;
 }
index eb8ed7840971b44ee217e2c0fb4673bb6a3f5090..0059cf0bffb4be07e82531099a5045c82c147756 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
 
 #define xfs_xlatesb                    libxfs_xlate_sb
 #define xfs_xlate_dinode_core          libxfs_xlate_dinode_core
+#if ARCH_CONVERT != ARCH_NOCONVERT
 #define xfs_bmbt_get_all               libxfs_bmbt_get_all
 #define xfs_bmbt_disk_get_all          libxfs_bmbt_disk_get_all
+#else
+#define xfs_bmbt_get_all               libxfs_bmbt_get_all
+#define xfs_bmbt_disk_get_all          libxfs_bmbt_get_all
+#endif
 #define xfs_da_hashname                        libxfs_da_hashname
 #define xfs_da_log2_roundup            libxfs_da_log2_roundup
 #define xfs_highbit32                  libxfs_highbit32
 #define xfs_alloc_mark_busy(tp,ag,b,len)               ((void) 0)
 
 /* anything else */
+#if !defined(__sgi__)
 typedef __uint32_t uint_t;
 typedef __uint32_t inst_t;     /* an instruction */
+#endif
 typedef struct { dev_t dev; } xfs_buftarg_t;
 #undef MASK
 #define NBPP           getpagesize()
@@ -436,12 +443,48 @@ void xfs_bmap_insert_exlist (xfs_inode_t *, xfs_extnum_t, xfs_extnum_t,
 int  xfs_check_nostate_extents (xfs_bmbt_rec_t *, xfs_extnum_t);
 void xfs_bmbt_log_ptrs (xfs_btree_cur_t *, xfs_buf_t *, int, int);
 void xfs_bmbt_log_keys (xfs_btree_cur_t *, xfs_buf_t *, int, int);
+int  xfs_bmbt_newroot (xfs_btree_cur_t *, int *, int *);
 int  xfs_bmbt_killroot (xfs_btree_cur_t *);
 int  xfs_bmbt_updkey (xfs_btree_cur_t *, xfs_bmbt_key_t *, int);
 int  xfs_bmbt_lshift (xfs_btree_cur_t *, int, int *);
 int  xfs_bmbt_rshift (xfs_btree_cur_t *, int, int *);
 int  xfs_bmbt_split (xfs_btree_cur_t *, int, xfs_fsblock_t *,
                        xfs_bmbt_key_t *, xfs_btree_cur_t **, int *);
+void xfs_bmbt_set_all (xfs_bmbt_rec_t *, xfs_bmbt_irec_t *);
+void xfs_bmbt_set_allf (xfs_bmbt_rec_t *, xfs_fileoff_t, xfs_fsblock_t,
+                       xfs_filblks_t, xfs_exntst_t);
+void xfs_bmbt_set_blockcount (xfs_bmbt_rec_t *, xfs_filblks_t);
+void xfs_bmbt_set_startblock (xfs_bmbt_rec_t *, xfs_fsblock_t);    
+void xfs_bmbt_set_startoff (xfs_bmbt_rec_t *, xfs_fileoff_t);
+void xfs_bmbt_set_state (xfs_bmbt_rec_t *, xfs_exntst_t);
+void xfs_bmbt_log_block (struct xfs_btree_cur *, struct xfs_buf *, int);
+void xfs_bmbt_log_recs (struct xfs_btree_cur *, struct xfs_buf *, int, int);
+int  xfs_bmbt_lookup_eq (struct xfs_btree_cur *, xfs_fileoff_t, xfs_fsblock_t,
+                       xfs_filblks_t, int *);
+xfs_fsblock_t xfs_bmbt_get_startblock (xfs_bmbt_rec_t *);
+xfs_filblks_t xfs_bmbt_get_blockcount (xfs_bmbt_rec_t *);
+xfs_fileoff_t xfs_bmbt_get_startoff (xfs_bmbt_rec_t *);
+xfs_exntst_t  xfs_bmbt_get_state (xfs_bmbt_rec_t *);
+xfs_bmbt_block_t * xfs_bmbt_get_block (xfs_btree_cur_t *, int,
+                       struct xfs_buf **);
+int  xfs_bmbt_increment (struct xfs_btree_cur *, int, int *);
+int  xfs_bmbt_insert (struct xfs_btree_cur *, int *);
+int  xfs_bmbt_decrement (struct xfs_btree_cur *, int, int *);
+int  xfs_bmbt_delete (struct xfs_btree_cur *, int *);
+int  xfs_bmbt_update (struct xfs_btree_cur *, xfs_fileoff_t, xfs_fsblock_t,
+                       xfs_filblks_t, xfs_exntst_t);      
+void xfs_bmbt_to_bmdr (xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int);
+void xfs_bmdr_to_bmbt (xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int);
+#if ARCH_CONVERT != ARCH_NOCONVERT
+xfs_fileoff_t xfs_bmbt_disk_get_startoff (xfs_bmbt_rec_t *);
+void xfs_bmbt_disk_set_all (xfs_bmbt_rec_t *, xfs_bmbt_irec_t *);
+void xfs_bmbt_disk_set_allf (xfs_bmbt_rec_t *, xfs_fileoff_t, xfs_fsblock_t,
+                       xfs_filblks_t, xfs_exntst_t);
+#else
+#define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r)
+#define xfs_bmbt_disk_set_all(r, s) xfs_bmbt_set_all(r, s)
+#define xfs_bmbt_disk_set_allf(r, o, b, c, v) xfs_bmbt_set_allf(r, o, b, c, v)
+#endif
 
 /* xfs_ialloc_btree.c */
 int  xfs_inobt_newroot (xfs_btree_cur_t *, int *);
index 18c83aaf97a6298ca47c7c6bba7d8a8230dec8bb..dacc6c8f319b40d1e1c37c4d2d6eaa0c14fb9f8d 100644 (file)
@@ -1,6 +1,6 @@
 .TH HANDLE 3 
 .SH NAME
-path_to_handle, path_to_fshandle, fd_to_handle, handle_to_fshandle, open_by_handle, readlink_by_handle, attr_multi_by_handle, attr_list_by_handle, fssetdm_by_handle, free_handle \- file handle operations
+path_to_handle, path_to_fshandle, handle_to_fshandle, open_by_handle, readlink_by_handle, attr_multi_by_handle, attr_list_by_handle, fssetdm_by_handle, free_handle \- file handle operations
 .SH C SYNOPSIS
 .nf
 .B #include <sys/types.h>
@@ -12,8 +12,6 @@ path_to_handle, path_to_fshandle, fd_to_handle, handle_to_fshandle, open_by_hand
 .B "int path_to_fshandle (char *path, void **hanp,"
 .B "                      size_t *hlen);"
 .PP
-.B "int fd_to_handle (int fd, void **hanp, size_t *hlen);
-.PP
 .B "int handle_to_fshandle (void *hanp, size_t hlen,"
 .B "                        void **fshanp, size_t *fshlen);
 .PP
@@ -82,12 +80,6 @@ in which the object given by the
 .I path
 argument resides.
 .P
-The \f2fd_to_handle\f1() function
-returns the handle for the object referenced by the
-.I fd
-argument,
-which must be a valid file descriptor.
-.P
 The \f2handle_to_fshandle\f1() function
 returns the handle for the filesystem
 in which the object referenced by the
@@ -133,7 +125,6 @@ frees the storage allocated for handles
 returned by the following functions:
 \f2path_to_handle\f1(),
 \f2path_to_fshandle\f1(),
-\f2fd_to_handle\f1(),
 and
 \f2handle_to_fshandle\f1().
 .SH "SEE ALSO"
index 5d1b31725710a1d4c2af0992c77f2211b15063bc..b198cb13dd0d8f5391dc96560732bb5cb77a94de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
@@ -35,8 +35,6 @@
  */
 
 #include <libxfs.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <ctype.h>
 
 #define        MAXBUFFERSIZE   (256 * 1024)
@@ -54,7 +52,6 @@ usage(void)
 static int
 openfd(char *name, int oflags)
 {
-       struct statfs buf;
        int fd;
 
        fd = open(name, oflags, 0600);
@@ -63,8 +60,7 @@ openfd(char *name, int oflags)
                return -1;
        }
 
-       fstatfs(fd, &buf);
-       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
+       if (!platform_test_xfs_fd(fd)) {
                fprintf(stderr, _("%s: "
                        "file [\"%s\"] is not on an XFS filesystem\n"),
                        progname, name);
@@ -77,6 +73,7 @@ int
 main(int argc, char **argv)
 {
        int fd;
+       char *fname;
        loff_t result;
        loff_t size = 0;
        loff_t mult = 0;
@@ -128,8 +125,8 @@ main(int argc, char **argv)
 
        len = strlen(argv[optind]);
 
-       if (isalpha(argv[optind][len-1])) {
-               switch (argv[optind][len-1]) {
+       if (isalpha((int)argv[optind][len-1])) {
+               switch ((int)argv[optind][len-1]) {
                case 'k':
                case 'K':
                        mult = 1024;
@@ -170,8 +167,9 @@ main(int argc, char **argv)
                                                  : "");
 
                oflags = O_CREAT|O_TRUNC|O_WRONLY|(nobytes ? 0 : O_DIRECT);
+               fname = argv[optind];
 
-               if ((fd = openfd(argv[optind], oflags)) == -1) {
+               if ((fd = openfd(fname, oflags)) == -1) {
                        optind++;
                        errs++;
                        continue;
@@ -179,7 +177,7 @@ main(int argc, char **argv)
 
                if (   (oflags & O_DIRECT)
                    && (   (fd < 0 && errno == EINVAL)
-                       || ioctl(fd, XFS_IOC_DIOINFO, &da) < 0)) {
+                       || xfsctl(fname, fd, XFS_IOC_DIOINFO, &da) < 0)) {
 
                        close(fd);
 
@@ -214,7 +212,7 @@ main(int argc, char **argv)
                        flck.l_start  = 0LL;
                        flck.l_len    = size;
                        if (prealloc)
-                               ioctl(fd, XFS_IOC_RESVSP64, &flck);
+                               xfsctl(fname, fd, XFS_IOC_RESVSP64, &flck);
                        if (oflags & O_DIRECT) {
                                nbufalign = da.d_mem;
 
index d9d5a15731eed531fe90c1c9d51af03293d9b501..9612563779f41eadd5e633ed5ffda3737f8624a5 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2000-2003 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
@@ -44,7 +44,7 @@ LLDLIBS = $(LIBXFS) $(LIBUUID) $(LIBDISK)
 LTDEPENDENCIES = $(LIBXFS) $(LIBDISK)
 LLDFLAGS = -static
 
-MAXTRLIBS = $(LIBXFS) $(LIBUUID)
+MAXTRLIBS = $(LIBXFS) $(LIBUUID) $(PLDLIBS)
 LSRCFILES = $(MAXTRRES).c $(FSTYP).c
 LDIRT = $(MAXTRRES) $(MAXTRRES).o $(MAXTRRES).h $(FSTYP)
 
@@ -59,7 +59,7 @@ $(MAXTRRES).h: $(MAXTRRES)
        $(LTEXEC) ./$(MAXTRRES) > $@ || ( rm -f $@ && exit 1 )
 
 $(FSTYP):
-       $(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK)
+       $(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS)
 
 install: default
        $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
index b89ec34e7b483ee6b7542277afbe6092fe662ff4..55b84779f10ce984e72f7dd7941b95d0714073ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
@@ -2289,7 +2289,7 @@ isdigits(
        int             n = strlen(str);
 
        for (i = 0; i < n; i++) {
-               if (!isdigit(str[i]))
+               if (!isdigit((int)str[i]))
                        return 0;
        }
        return 1;
index 343dece114bec5fdbafead22aee7ec088e5a7f98..e733186cc016bdc83e71a85ec9610cb375464ab1 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2001-2003 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
@@ -39,18 +39,31 @@ LSRCFILES = $(LINGUAS:%=%.po) $(PKG_NAME).pot
 
 # TODO: db/ logprint/
 XGETTEXTFILES =        \
-               $(TOPDIR)/bmap/xfs_bmap.c \
                $(TOPDIR)/freeze/xfs_freeze.c \
                $(TOPDIR)/growfs/explore.c \
                $(TOPDIR)/growfs/xfs_growfs.c \
                $(TOPDIR)/imap/xfs_imap.c \
+               $(TOPDIR)/io/bmap.c \
+               $(TOPDIR)/io/command.c \
+               $(TOPDIR)/io/fsync.c \
+               $(TOPDIR)/io/help.c \
+               $(TOPDIR)/io/init.c \
+               $(TOPDIR)/io/open.c \
+               $(TOPDIR)/io/pread.c \
+               $(TOPDIR)/io/prealloc.c \
+               $(TOPDIR)/io/pwrite.c \
+               $(TOPDIR)/io/quit.c \
+               $(TOPDIR)/io/resblks.c \
+               $(TOPDIR)/io/truncate.c \
                $(TOPDIR)/mkfile/xfs_mkfile.c \
                $(TOPDIR)/mkfs/proto.c \
                $(TOPDIR)/mkfs/xfs_mkfs.c \
                $(TOPDIR)/libdisk/drivers.c \
                $(TOPDIR)/libdisk/lvm.c \
                $(TOPDIR)/libdisk/md.c \
+               $(TOPDIR)/libxfs/darwin.c \
                $(TOPDIR)/libxfs/init.c \
+               $(TOPDIR)/libxfs/irix.c \
                $(TOPDIR)/libxfs/linux.c \
                $(TOPDIR)/libxfs/rdwr.c \
                $(TOPDIR)/libxfs/trans.c \
index a89fd21326b3324270af2fb413cad56b98ad6d9f..a235724c17028de06f9931804d31da6c2eb71cd9 100644 (file)
+#, c-format
+msgid ""
+"Usage: %s [options] mountpoint\n"
+"\n"
+"Options:\n"
+"        -f          freeze filesystem access\n"
+"        -u          unfreeze filesystem access\n"
+msgstr ""
+
+#, c-format
+msgid "%s: specified file [\"%s\"] is not on an XFS filesystem\n"
+msgstr ""
+
+#, c-format
+msgid "%s: cannot freeze filesystem mounted at %s: %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: cannot unfreeze filesystem mounted at %s: %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: cannot access mount list %s: %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: cannot access mount point %s: %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: ignoring entry %s in %s: %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: %s is not an XFS filesystem\n"
+msgstr ""
+
+#, c-format
+msgid "%s: %s is not a filesystem mount point, according to %s\n"
+msgstr ""
+
+#, c-format
+msgid ""
+"Usage: %s [options] mountpoint\n"
+"\n"
+"Options:\n"
+"        -d          grow data/metadata section\n"
+"        -l          grow log section\n"
+"        -r          grow realtime section\n"
+"        -n          don't change anything, just show geometry\n"
+"        -I          allow inode numbers to exceed %d significant bits\n"
+"        -i          convert log from external to internal format\n"
+"        -t          alternate location for mount table (/etc/mtab)\n"
+"        -x          convert log from internal to external format\n"
+"        -D size     grow data/metadata section to size blks\n"
+"        -L size     grow/shrink log section to size blks\n"
+"        -R size     grow realtime section to size blks\n"
+"        -e size     set realtime extent size to size blks\n"
+"        -m imaxpct  set inode max percent to imaxpct\n"
+"        -V          print version information\n"
+msgstr ""
+
+#, c-format
+msgid ""
+"meta-data=%-22s isize=%-6u agcount=%u, agsize=%u blks\n"
+"         =%-22s sectsz=%-5u\n"
+"data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
+"         =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n"
+"naming   =version %-14u bsize=%-6u\n"
+"log      =%-22s bsize=%-6u blocks=%u, version=%u\n"
+"         =%-22s sectsz=%-5u sunit=%u blks\n"
+"realtime =%-22s extsz=%-6u blocks=%llu, rtextents=%llu\n"
+msgstr ""
+
+msgid "internal"
+msgstr ""
+
+msgid "external"
+msgstr ""
+
+msgid "none"
+msgstr ""
+
 #, c-format
 msgid "%s version %s\n"
 msgstr ""
 
 #, c-format
-msgid "Usage: %s [-adlpV] [-n nx] file...\n"
+msgid "%s: cannot determine geometry of filesystem mounted at %s: %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: fstat64 failed for %s: %s\n"
+msgid "%s: failed to access data device for %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: cannot open \"%s\": %s\n"
+msgid "%s: failed to access external log for %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: specified file [\"%s\"] is not on an XFS filesystem\n"
+msgid "%s: failed to access realtime device for %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: can't get geometry [\"%s\"]: %s\n"
+msgid "data size %lld too large, maximum is %lld\n"
 msgstr ""
 
 #, c-format
-msgid "xfs_bmap: fsgeo.agblocks=%u, fsgeo.blocksize=%u, fsgeo.agcount=%u\n"
+msgid "data size %lld too small, old size is %lld\n"
+msgstr ""
+
+msgid "data size unchanged, skipping\n"
+msgstr ""
+
+msgid "inode max pct unchanged, skipping\n"
 msgstr ""
 
 #, c-format
-msgid "%s: cannot read attrs on \"%s\": %s\n"
+msgid "%s: growfs operation in progress already\n"
 msgstr ""
 
 #, c-format
-msgid "xfs_bmap: fsx.dsx_xflags=%u, fsx.fsx_extsize=%u, fsx.fsx_nextents=%u\n"
+msgid "%s: XFS_IOC_FSGROWFSDATA xfsctl failed: %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: malloc of %d bytes failed.\n"
+msgid "realtime size %lld too large, maximum is %lld\n"
 msgstr ""
 
 #, c-format
+msgid "realtime size %lld too small, old size is %lld\n"
+msgstr ""
+
+msgid "realtime size unchanged, skipping\n"
+msgstr ""
+
+#, c-format
+msgid "%s: realtime growth not implemented\n"
+msgstr ""
+
+#, c-format
+msgid "%s: XFS_IOC_FSGROWFSRT xfsctl failed: %s\n"
+msgstr ""
+
+msgid "log size unchanged, skipping\n"
+msgstr ""
+
+#, c-format
+msgid "%s: log growth not supported yet\n"
+msgstr ""
+
+#, c-format
+msgid "%s: XFS_IOC_FSGROWFSLOG xfsctl failed: %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: XFS_IOC_FSGEOMETRY xfsctl failed: %s\n"
+msgstr ""
+
+#, c-format
+msgid "data blocks changed from %lld to %lld\n"
+msgstr ""
+
+#, c-format
+msgid "inode max percent changed from %d to %d\n"
+msgstr ""
+
+#, c-format
+msgid "log blocks changed from %d to %d\n"
+msgstr ""
+
+#, c-format
+msgid "log changed from %s to %s\n"
+msgstr ""
+
+#, c-format
+msgid "realtime blocks changed from %lld to %lld\n"
+msgstr ""
+
+#, c-format
+msgid "realtime extent size changed from %d to %d\n"
+msgstr ""
+
+#, c-format
+msgid "ino %10llu count %2d mask %016llx\n"
+msgstr ""
+
 msgid ""
-"xfs_bmap: i=%d map.bmv_offset=%lld, map.bmv_block=%lld, map.bmv_length=%lld, "
-"map.bmv_count=%d, map.bmv_entries=%d\n"
+"\n"
+" prints the block mapping for an XFS file's data or attribute forks\n"
+" Example:\n"
+" 'bmap -vp' - tabular format verbose map, including unwritten extents\n"
+"\n"
+" bmap prints the map of disk blocks used by the current file.\n"
+" The map lists each extent used by the file, as well as regions in the\n"
+" file that do not have any corresponding blocks (holes).\n"
+" By default, each line of the listing takes the following form:\n"
+"     extent: [startoffset..endoffset]: startblock..endblock\n"
+" Holes are marked by replacing the startblock..endblock with 'hole'.\n"
+" All the file offsets and disk blocks are in units of 512-byte blocks.\n"
+" -a -- prints the attribute fork map instead of the data fork.\n"
+" -d -- suppresses a DMAPI read event, offline portions shown as holes.\n"
+" -l -- also displays the length of each extent in 512-byte blocks.\n"
+" Note: the bmap for non-regular files can be obtained provided the file\n"
+" was opened appropriately (in particular, must be opened read-only).\n"
+"\n"
 msgstr ""
 
 #, c-format
-msgid "%s: ioctl(XFS_IOC_GETBMAPX) iflags=0x%x [\"%s\"]: %s\n"
+msgid "%s: can't get geometry [\"%s\"]: %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: ioctl(XFS_IOC_FSGETXATTR%s) [\"%s\"]: %s\n"
+msgid "%s: cannot read attrs on \"%s\": %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: malloc of %d bytes failed.\n"
+msgstr ""
+
+#, c-format
+msgid "%s: xfsctl(XFS_IOC_GETBMAPX) iflags=0x%x [\"%s\"]: %s\n"
 msgstr ""
 
 #, c-format
@@ -104,183 +274,412 @@ msgstr ""
 msgid "    %5.5o Doesn't end   on stripe width\n"
 msgstr ""
 
+msgid "bmap"
+msgstr ""
+
+msgid "[-adlpv] [-n nx]"
+msgstr ""
+
+msgid "print block mapping for an XFS file"
+msgstr ""
+
 #, c-format
-msgid ""
-"Usage: %s [options] mountpoint\n"
-"\n"
-"Options:\n"
-"        -f          freeze filesystem access\n"
-"        -u          unfreeze filesystem access\n"
+msgid "command \"%s\" not found\n"
 msgstr ""
 
 #, c-format
-msgid "%s: cannot freeze filesystem mounted at %s: %s\n"
+msgid "bad argument count %d to %s, expected at least %d arguments\n"
 msgstr ""
 
 #, c-format
-msgid "%s: cannot unfreeze filesystem mounted at %s: %s\n"
+msgid "bad argument count %d to %s, expected %d arguments\n"
 msgstr ""
 
 #, c-format
-msgid "%s: cannot access mount list %s: %s\n"
+msgid "bad argument count %d to %s, expected between %d and %d arguments\n"
+msgstr ""
+
+msgid "fsync"
+msgstr ""
+
+msgid "s"
+msgstr ""
+
+msgid "calls fsync(2) to flush all in-core file state to disk"
+msgstr ""
+
+msgid "fdatasync"
+msgstr ""
+
+msgid "ds"
+msgstr ""
+
+msgid "calls fdatasync(2) to flush the files in-core data to disk"
+msgstr ""
+
+msgid ""
+"\n"
+"Use 'help commandname' for extended help.\n"
 msgstr ""
 
 #, c-format
-msgid "%s: cannot access mount point %s: %s\n"
+msgid "command %s not found\n"
+msgstr ""
+
+msgid "help"
+msgstr ""
+
+msgid "?"
+msgstr ""
+
+msgid "[command]"
+msgstr ""
+
+msgid "help for one or all commands"
 msgstr ""
 
 #, c-format
-msgid "%s: ignoring entry %s in %s: %s\n"
+msgid "Usage: %s [-r] [-p prog] [-c cmd]... file\n"
+msgstr ""
+
+msgid ""
+"\n"
+" opens a new file in the requested mode, after closing the current file\n"
+"\n"
+" Example:\n"
+" 'open -d /tmp/data' - opens data file read-write for direct IO\n"
+"\n"
+" Opens a file for subsequent use by all of the other xfs_io commands.\n"
+" With no arguments, open uses the stat command to show the current file.\n"
+" -a -- open with the O_APPEND flag (append-only mode)\n"
+" -c -- open with O_CREAT (create the file if it doesn't exist)\n"
+" -d -- open with O_DIRECT (non-buffered IO, note alignment constraints)\n"
+" -r -- open with O_RDONLY, the default is O_RDWR\n"
+" -s -- open with O_SYNC\n"
+" -t -- open with O_TRUNC (truncate the file to zero length if it exists)\n"
+" -x -- mark the file as a realtime XFS file immediately after opening it\n"
+" Note1: read/write direct IO requests must be blocksize aligned.\n"
+" Note2: the bmap for non-regular files can be obtained provided the file\n"
+" was opened appropriately (in particular, must be opened read-only).\n"
+"\n"
+msgstr ""
+
+msgid "socket"
+msgstr ""
+
+msgid "directory"
+msgstr ""
+
+msgid "char device"
+msgstr ""
+
+msgid "block device"
+msgstr ""
+
+msgid "regular file"
+msgstr ""
+
+msgid "symbolic link"
+msgstr ""
+
+msgid "fifo"
 msgstr ""
 
 #, c-format
-msgid "%s: %s is not an XFS filesystem\n"
+msgid "fd.path = \"%s\"\n"
 msgstr ""
 
 #, c-format
-msgid "%s: %s is not a filesystem mount point, according to %s\n"
+msgid "fd.flags = %s,%s,%s%s%s\n"
+msgstr ""
+
+msgid "sync"
+msgstr ""
+
+msgid "non-sync"
+msgstr ""
+
+msgid "direct"
+msgstr ""
+
+msgid "non-direct"
+msgstr ""
+
+msgid "read-only"
+msgstr ""
+
+msgid "read-write"
+msgstr ""
+
+msgid ",real-time"
+msgstr ""
+
+msgid ",append-only"
 msgstr ""
 
 #, c-format
-msgid ""
-"Usage: %s [options] mountpoint\n"
-"\n"
-"Options:\n"
-"        -d          grow data/metadata section\n"
-"        -l          grow log section\n"
-"        -r          grow realtime section\n"
-"        -n          don't change anything, just show geometry\n"
-"        -I          allow inode numbers to exceed %d significant bits\n"
-"        -i          convert log from external to internal format\n"
-"        -t          alternate location for mount table (/etc/mtab)\n"
-"        -x          convert log from internal to external format\n"
-"        -D size     grow data/metadata section to size blks\n"
-"        -L size     grow/shrink log section to size blks\n"
-"        -R size     grow realtime section to size blks\n"
-"        -e size     set realtime extent size to size blks\n"
-"        -m imaxpct  set inode max percent to imaxpct\n"
-"        -V          print version information\n"
+msgid "stat.ino = %lld\n"
 msgstr ""
 
 #, c-format
-msgid ""
-"meta-data=%-22s isize=%-6u agcount=%u, agsize=%u blks\n"
-"         =%-22s sectsz=%-5u\n"
-"data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
-"         =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n"
-"naming   =version %-14u bsize=%-6u\n"
-"log      =%-22s bsize=%-6u blocks=%u, version=%u\n"
-"         =%-22s sectsz=%-5u sunit=%u blks\n"
-"realtime =%-22s extsz=%-6u blocks=%llu, rtextents=%llu\n"
+msgid "stat.type = %s\n"
 msgstr ""
 
-msgid "internal"
+#, c-format
+msgid "stat.size = %lld\n"
 msgstr ""
 
-msgid "external"
+#, c-format
+msgid "stat.blocks = %lld\n"
 msgstr ""
 
-msgid "none"
+#, c-format
+msgid "stat.atime = %s"
 msgstr ""
 
 #, c-format
-msgid "%s: cannot determine geometry of filesystem mounted at %s: %s\n"
+msgid "stat.mtime = %s"
 msgstr ""
 
 #, c-format
-msgid "%s: failed to access data device for %s\n"
+msgid "stat.ctime = %s"
 msgstr ""
 
 #, c-format
-msgid "%s: failed to access external log for %s\n"
+msgid "xattr.xflags = 0x%x\n"
 msgstr ""
 
 #, c-format
-msgid "%s: failed to access realtime device for %s\n"
+msgid "xattr.nextents = %u\n"
 msgstr ""
 
 #, c-format
-msgid "data size %lld too large, maximum is %lld\n"
+msgid "statfs.f_bsize = %lld\n"
 msgstr ""
 
 #, c-format
-msgid "data size %lld too small, old size is %lld\n"
+msgid "statfs.f_blocks = %lld\n"
 msgstr ""
 
-msgid "data size unchanged, skipping\n"
+#, c-format
+msgid "statfs.f_bavail = %lld\n"
 msgstr ""
 
-msgid "inode max pct unchanged, skipping\n"
+#, c-format
+msgid "geom.bsize = %u\n"
 msgstr ""
 
 #, c-format
-msgid "%s: growfs operation in progress already\n"
+msgid "geom.agcount = %u\n"
 msgstr ""
 
 #, c-format
-msgid "%s: XFS_IOC_FSGROWFSDATA ioctl failed: %s\n"
+msgid "geom.agblocks = %u\n"
 msgstr ""
 
 #, c-format
-msgid "realtime size %lld too large, maximum is %lld\n"
+msgid "geom.datablocks = %llu\n"
 msgstr ""
 
 #, c-format
-msgid "realtime size %lld too small, old size is %lld\n"
+msgid "geom.rtblocks = %llu\n"
 msgstr ""
 
-msgid "realtime size unchanged, skipping\n"
+#, c-format
+msgid "geom.rtextents = %llu\n"
 msgstr ""
 
 #, c-format
-msgid "%s: realtime growth not implemented\n"
+msgid "geom.rtextsize = %u\n"
 msgstr ""
 
 #, c-format
-msgid "%s: XFS_IOC_FSGROWFSRT ioctl failed: %s\n"
+msgid "geom.sunit = %u\n"
 msgstr ""
 
-msgid "log size unchanged, skipping\n"
+#, c-format
+msgid "geom.swidth = %u\n"
+msgstr ""
+
+msgid "open"
+msgstr ""
+
+msgid "o"
+msgstr ""
+
+msgid "[-acdrstx] [path]"
+msgstr ""
+
+msgid "close the current file, open file specified by path"
+msgstr ""
+
+msgid "stat"
+msgstr ""
+
+msgid "[-v]"
+msgstr ""
+
+msgid "statistics on the currently open file"
+msgstr ""
+
+msgid "statfs"
+msgstr ""
+
+msgid "statistics on the filesystem of the currently open file"
+msgstr ""
+
+msgid ""
+"\n"
+" reads a range of bytes in a specified block size from the given offset\n"
+"\n"
+" Example:\n"
+" 'read -v 512 20' - dumps 20 bytes read from 512 bytes into the file\n"
+"\n"
+" Reads a segment of the currently open file, optionally dumping it to the\n"
+" standard output stream (with -v option) for subsequent inspection.\n"
+" The reads are performed in sequential blocks starting at offset, with the\n"
+" blocksize tunable using the -b option (default blocksize is 4096 bytes).\n"
+"\n"
 msgstr ""
 
 #, c-format
-msgid "%s: log growth not supported yet\n"
+msgid "non-numeric bsize -- %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: XFS_IOC_FSGROWFSLOG ioctl failed: %s\n"
+msgid "non-numeric offset argument -- %s\n"
 msgstr ""
 
 #, c-format
-msgid "%s: XFS_IOC_FSGEOMETRY ioctl failed: %s\n"
+msgid "non-numeric length argument -- %s\n"
 msgstr ""
 
 #, c-format
-msgid "data blocks changed from %lld to %lld\n"
+msgid "read %u/%u bytes at offset %llu\n"
+msgstr ""
+
+msgid "pread"
+msgstr ""
+
+msgid "r"
+msgstr ""
+
+msgid "[-b bs] [-v] off len"
+msgstr ""
+
+msgid "reads a number of bytes at a specified offset"
+msgstr ""
+
+msgid "allocsp"
+msgstr ""
+
+msgid "off len"
+msgstr ""
+
+msgid "allocates zeroed space for part of a file"
+msgstr ""
+
+msgid "freesp"
+msgstr ""
+
+msgid "frees space associated with part of a file"
+msgstr ""
+
+msgid "resvsp"
+msgstr ""
+
+msgid "reserves space associated with part of a file"
+msgstr ""
+
+msgid "unresvsp"
+msgstr ""
+
+msgid "frees reserved space associated with part of a file"
+msgstr ""
+
+msgid ""
+"\n"
+" writes a range of bytes (in block size increments) from the given offset\n"
+"\n"
+" Example:\n"
+" 'write 512 20' - writes 20 bytes at 512 bytes into the open file\n"
+"\n"
+" Writes into a segment of the currently open file, using either a buffer\n"
+" filled with a set pattern (0xcdcdcdcd) or data read from an input file.\n"
+" -S -- use an alternate seed number\n"
+" -i -- specifies an input file from which to source data to write\n"
+" -d -- open the input file for direct IO\n"
+" -s -- skip a number of bytes at the start of the input file\n"
+" The writes are performed in sequential blocks starting at offset, with the\n"
+" blocksize tunable using the -b option (default blocksize is 4096 bytes).\n"
+"\n"
 msgstr ""
 
 #, c-format
-msgid "inode max percent changed from %d to %d\n"
+msgid "non-numeric skip -- %s\n"
 msgstr ""
 
 #, c-format
-msgid "log blocks changed from %d to %d\n"
+msgid "non-numeric seed -- %s\n"
 msgstr ""
 
 #, c-format
-msgid "log changed from %s to %s\n"
+msgid "wrote %u/%u bytes at offset %llu\n"
+msgstr ""
+
+msgid "pwrite"
+msgstr ""
+
+msgid "w"
+msgstr ""
+
+msgid "[-i infile [-d] [-s skip]] [-b bs] [-S seed] off len"
+msgstr ""
+
+msgid "writes a number of bytes at a specified offset"
+msgstr ""
+
+msgid "quit"
+msgstr ""
+
+msgid "q"
+msgstr ""
+
+msgid "exit xfs_io"
 msgstr ""
 
 #, c-format
-msgid "realtime blocks changed from %lld to %lld\n"
+msgid "non-numeric argument -- %s\n"
 msgstr ""
 
 #, c-format
-msgid "realtime extent size changed from %d to %d\n"
+msgid "reserved blocks = %llu\n"
 msgstr ""
 
 #, c-format
-msgid "ino %10llu count %2d mask %016llx\n"
+msgid "available reserved blocks = %llu\n"
+msgstr ""
+
+msgid "resblks"
+msgstr ""
+
+msgid "[blocks]"
+msgstr ""
+
+msgid "get and/or set count of reserved filesystem blocks"
+msgstr ""
+
+#, c-format
+msgid "non-numeric truncate argument -- %s\n"
+msgstr ""
+
+msgid "truncate"
+msgstr ""
+
+msgid "off"
+msgstr ""
+
+msgid "truncates the current file at the given offset"
 msgstr ""
 
 #, c-format
@@ -803,6 +1202,22 @@ msgstr ""
 msgid "MD array %s not in clean state\n"
 msgstr ""
 
+#, c-format
+msgid "%s: error opening the device special file \"%s\": %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: can't tell if \"%s\" is writable: %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: cannot stat the device file \"%s\": %s\n"
+msgstr ""
+
+#, c-format
+msgid "%s: can't determine device size: %s\n"
+msgstr ""
+
 #, c-format
 msgid "%s: %s: device %lld is not open\n"
 msgstr ""
@@ -927,14 +1342,6 @@ msgstr ""
 msgid "%s: warning - cannot set blocksize on block device %s: %s\n"
 msgstr ""
 
-#, c-format
-msgid "%s: cannot stat the device file \"%s\": %s\n"
-msgstr ""
-
-#, c-format
-msgid "%s: error opening the device special file \"%s\": %s\n"
-msgstr ""
-
 #, c-format
 msgid "%s: can't determine device size\n"
 msgstr ""
@@ -3245,9 +3652,6 @@ msgstr ""
 msgid "couldn't allocate realtime summary inode, error = %d\n"
 msgstr ""
 
-msgid "dev_zero of rtbitmap failed\n"
-msgstr ""
-
 #, c-format
 msgid "allocation of the realtime summary ino failed, error = %d\n"
 msgstr ""
index 353f3a480a387c996ed77ff3e87ee7425381fb26..e739d95d555bedef25cbf31fc6fc0003710fb03c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 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
@@ -31,8 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
 int rtcp(char *, char *, int);
 int xfsrtextsize(char *path);
@@ -210,7 +208,7 @@ rtcp( char *source, char *target, int fextsize)
                else
                        fsxattr.fsx_extsize = 0;
 
-               if ( ioctl( tofd, XFS_IOC_FSSETXATTR, &fsxattr) ) { 
+               if ( xfsctl(tbuf, tofd, XFS_IOC_FSSETXATTR, &fsxattr) ) { 
                        fprintf(stderr,
                                _("%s: set attributes on %s failed: %s\n"),
                                progname, tbuf, strerror(errno));
@@ -228,7 +226,7 @@ rtcp( char *source, char *target, int fextsize)
                        return( -1 );
                }
                
-               if ( ioctl( tofd, XFS_IOC_FSGETXATTR, &fsxattr) ) {
+               if ( xfsctl(tbuf, tofd, XFS_IOC_FSGETXATTR, &fsxattr) ) {
                        fprintf(stderr,
                                _("%s: get attributes of %s failed: %s\n"),
                                progname, tbuf, strerror(errno));
@@ -271,7 +269,7 @@ rtcp( char *source, char *target, int fextsize)
 
        fsxattr.fsx_xflags = 0;
        fsxattr.fsx_extsize = 0;
-       if ( ioctl( fromfd, XFS_IOC_FSGETXATTR, &fsxattr) ) {
+       if ( xfsctl(source, fromfd, XFS_IOC_FSGETXATTR, &fsxattr) ) {
                reopen = 1;
        } else {
                if (! (fsxattr.fsx_xflags & XFS_XFLAG_REALTIME) ){
@@ -296,7 +294,7 @@ rtcp( char *source, char *target, int fextsize)
        /*
         * get direct I/O parameters
         */
-       if ( ioctl( tofd, XFS_IOC_DIOINFO, &dioattr) ) {
+       if ( xfsctl(tbuf, tofd, XFS_IOC_DIOINFO, &dioattr) ) {
                fprintf(stderr,
                        _("%s: couldn't get direct I/O information: %s\n"),
                        progname, strerror(errno));
@@ -405,7 +403,7 @@ xfsrtextsize( char *path)
                        progname, path, strerror(errno));
                return -1;
        }
-       rval = ioctl( fd, XFS_IOC_FSGEOMETRY_V1, &geo );
+       rval = xfsctl( path, fd, XFS_IOC_FSGEOMETRY_V1, &geo );
        close(fd);
        if ( rval < 0 )
                return -1;