]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Merge over several portability changes from xfstest update.
authorNathan Scott <nathans@sgi.com>
Thu, 17 Jun 2004 07:22:11 +0000 (07:22 +0000)
committerNathan Scott <nathans@sgi.com>
Thu, 17 Jun 2004 07:22:11 +0000 (07:22 +0000)
21 files changed:
VERSION
aclocal.m4
db/command.c
debian/changelog
doc/CHANGES
include/Makefile
include/darwin.h [new file with mode: 0644]
include/freebsd.h [new file with mode: 0644]
include/irix.h [new file with mode: 0644]
include/linux.h [new file with mode: 0644]
include/platform_defs.h.in
include/xfs_fs.h
io/Makefile
io/bmap.c
io/command.c
io/command.h
io/mmap.c
io/open.c
m4/package_utilies.m4
m4/package_uuiddev.m4
man/man8/xfs_io.8

diff --git a/VERSION b/VERSION
index d822914baa9be7050b1b2b796a690fcdf8823cbe..85dd2ad26aa1e27ca9d751086019d862a2f19fcf 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=6
-PKG_REVISION=15
+PKG_REVISION=16
 PKG_BUILD=1
index 138dbe628aa1ffa51cfa4f01f567e62efe41c680..7d07819fff04d8d002125d29169c5fb539121e3c 100644 (file)
@@ -76,59 +76,69 @@ AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
 #  MSGFMT MSGMERGE RPM
 #
 AC_DEFUN([AC_PACKAGE_UTILITIES],
-  [ if test -z "$CC"; then
-        AC_PROG_CC
-    fi
+  [ AC_PROG_CC
     cc="$CC"
     AC_SUBST(cc)
     AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
 
     if test -z "$MAKE"; then
-        AC_PATH_PROG(MAKE, make, /usr/bin/make)
+        AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/freeware/bin)
+    fi
+    if test -z "$MAKE"; then
+        AC_PATH_PROG(MAKE, make,, /usr/bin)
     fi
     make=$MAKE
     AC_SUBST(make)
     AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
 
     if test -z "$LIBTOOL"; then
-       AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin:/usr/local/bin)
+       AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
+    fi
+    if test -z "$LIBTOOL"; then
+       AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
     fi
     libtool=$LIBTOOL
     AC_SUBST(libtool)
     AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
 
     if test -z "$TAR"; then
-        AC_PATH_PROG(TAR, tar)
+        AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
     fi
     tar=$TAR
     AC_SUBST(tar)
     if test -z "$ZIP"; then
-        AC_PATH_PROG(ZIP, gzip, /bin/gzip)
+        AC_PATH_PROG(ZIP, gzip,, /bin:/usr/local/bin:/usr/freeware/bin)
     fi
+
     zip=$ZIP
     AC_SUBST(zip)
+
     if test -z "$MAKEDEPEND"; then
         AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
     fi
     makedepend=$MAKEDEPEND
     AC_SUBST(makedepend)
+
     if test -z "$AWK"; then
-        AC_PATH_PROG(AWK, awk, /bin/awk)
+        AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
     fi
     awk=$AWK
     AC_SUBST(awk)
+
     if test -z "$SED"; then
-        AC_PATH_PROG(SED, sed, /bin/sed)
+        AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
     fi
     sed=$SED
     AC_SUBST(sed)
+
     if test -z "$ECHO"; then
-        AC_PATH_PROG(ECHO, echo, /bin/echo)
+        AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
     fi
     echo=$ECHO
     AC_SUBST(echo)
+
     if test -z "$SORT"; then
-        AC_PATH_PROG(SORT, sort, /bin/sort)
+        AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
     fi
     sort=$SORT
     AC_SUBST(sort)
@@ -138,13 +148,14 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
 
     if test "$enable_gettext" = yes; then
         if test -z "$MSGFMT"; then
-                AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
+                AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/freeware/bin)
         fi
         msgfmt=$MSGFMT
         AC_SUBST(msgfmt)
         AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
+
         if test -z "$MSGMERGE"; then
-                AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge)
+                AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/freeware/bin)
         fi
         msgmerge=$MSGMERGE
         AC_SUBST(msgmerge)
@@ -152,10 +163,11 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
     fi
 
     if test -z "$RPM"; then
-        AC_PATH_PROG(RPM, rpm, /bin/rpm)
+        AC_PATH_PROG(RPM, rpm,, /bin:/usr/freeware/bin)
     fi
     rpm=$RPM
     AC_SUBST(rpm)
+
     dnl .. and what version is rpm
     rpm_version=0
     test -x $RPM && rpm_version=`$RPM --version \
@@ -174,13 +186,14 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
   ])
 
 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
-  [ AC_CHECK_HEADERS(uuid.h)
-    if test $ac_cv_header_uuid_h = no; then
-       AC_CHECK_HEADERS(uuid/uuid.h,, [
+  [ AC_CHECK_HEADERS([uuid.h sys/uuid.h uuid/uuid.h])
+    if test $ac_cv_header_uuid_h = no -a \
+           $ac_cv_header_sys_uuid_h = no -a \
+           $ac_cv_header_uuid_uuid_h = no; then
        echo
        echo 'FATAL ERROR: could not find a valid UUID header.'
        echo 'Install the Universally Unique Identifiers development package.'
-       exit 1])
+       exit 1
     fi
   ])
 
index 0571101e4330d0f70b9fd8a88103b4834b4fa8fd..a1f02ceb8127bfa6a8448f536b7caac264c2b8c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2001,2004 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
@@ -105,7 +105,7 @@ command(
                dbprintf(" arguments\n");
                return 0;
        }
-       optind = 0;
+       platform_getoptreset();
        return ct->cfunc(argc, argv);
 }
 
index e37313014c39a4dee2f467f6673ecf501d743736..a43290fbb87b49e19ef5e6e9dfa4c208f396a8c0 100644 (file)
@@ -1,3 +1,9 @@
+xfsprogs (2.6.16-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Nathan Scott <nathans@debian.org>  Thu, 17 Jun 2004 15:16:25 +1000
+
 xfsprogs (2.6.15-1) unstable; urgency=low
 
   * New upstream release.
index 841c2944b952bea15e78c88458b5c9ced3bc6b99..4a81b460d3b842494f76408e5c7ac54be798ff1c 100644 (file)
@@ -1,3 +1,14 @@
+xfsprogs-2.6.16 (17 June 2004)
+       - Add sendfile command into xfs_io(8) to exercise that
+         functionality.
+       - Remove maxtrres program that was used in the build
+         to generate a header for mkfs' consumption.
+       - This allows cross-compiles to be greatly simplified.
+       - Portability tweaks for building on other platforms.
+       - Fix obscure bug in log size lower boundary checks for
+         auto-sized logs when stripe alignment is in effect;
+         the enforced lower bound could have been set too low.
+
 xfsprogs-2.6.15 (09 June 2004)
        - Make xfs_check test for a dirty log before proceeding to
          check the filesystem.
index 7e0ed581b18b817215a3ef9792bce45ec2da8e29..aeb54188ccfda93367000a7c4b7aa2094fd517d6 100644 (file)
@@ -44,8 +44,11 @@ HFILES = handle.h jdm.h libxfs.h libxlog.h swab.h xqm.h \
        xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_mount.h xfs_quota.h \
        xfs_rtalloc.h xfs_sb.h xfs_trans.h xfs_trans_space.h xfs_types.h
 
+HFILES += $(PKG_PLATFORM).c
+PHFILES = darwin.h freebsd.h irix.h linux.h
 DKHFILES = volume.h fstyp.h dvh.h
-LSRCFILES = platform_defs.h.in builddefs.in buildmacros buildrules $(DKHFILES)
+LSRCFILES = $(shell echo $(PHFILES) | sed -e "s/$(PKG_PLATFORM).c//g")
+LSRCFILES += platform_defs.h.in builddefs.in buildmacros buildrules $(DKHFILES)
 LDIRT = xfs disk
 
 default install :
diff --git a/include/darwin.h b/include/darwin.h
new file mode 100644 (file)
index 0000000..887d0e9
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2004 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/
+ *
+ */
+#ifndef __XFS_DARWIN_H__
+#define __XFS_DARWIN_H__
+
+#include <uuid/uuid.h>
+#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_test_xfs_path(const char *path)
+{
+       struct statfs buf;
+       if (statfs(path, &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);
+}
+
+static __inline__ void platform_getoptreset(void)
+{
+       extern int optreset;
+       optreset = 0;
+}
+
+#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) valloc(sz)
+
+#include <machine/endian.h>
+#define __BYTE_ORDER   BYTE_ORDER
+#define __BIG_ENDIAN   BIG_ENDIAN
+#define __LITTLE_ENDIAN        LITTLE_ENDIAN
+#include <xfs/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
+
+#endif /* __XFS_DARWIN_H__ */
diff --git a/include/freebsd.h b/include/freebsd.h
new file mode 100644 (file)
index 0000000..56daf5c
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2004 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/
+ *
+ */
+#ifndef __XFS_FREEBSD_H__
+#define __XFS_FREEBSD_H__
+
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/ioccom.h>
+#include <sys/mount.h>
+#include <ctype.h>
+#include <libgen.h>
+#include <paths.h>
+#include <uuid.h>
+
+#include <machine/endian.h>
+
+/* FreeBSD file API is 64-bit aware */
+#define        fstat64         fstat
+#define        ftruncate64     ftruncate
+#define lseek64                lseek
+#define        stat64          stat
+#define        pwrite64        pwrite
+#define        pread64         pread
+#define        fdatasync       fsync
+#define memalign(a,size)       valloc(size)
+
+typedef u_int8_t       __u8;
+typedef int8_t         __s8;
+typedef u_int16_t      __u16;
+typedef int16_t                __s16;
+typedef u_int32_t      __u32;
+typedef int32_t                __s32;
+typedef u_int64_t      __u64;
+typedef int64_t                __s64;
+
+#define constpp        char * const *
+
+#define EFSCORRUPTED   990     /* Filesystem is corrupted */
+
+typedef off_t          xfs_off_t;
+typedef off_t          off64_t;
+typedef __uint64_t     xfs_ino_t;
+typedef __uint32_t     xfs_dev_t;
+typedef __int64_t      xfs_daddr_t;
+typedef char*          xfs_caddr_t;
+typedef off_t          loff_t;
+
+#ifndef        _UCHAR_T_DEFINED
+typedef unsigned char  uchar_t;
+#define        _UCHAR_T_DEFINED        1
+#endif
+typedef enum { B_FALSE,B_TRUE }        boolean_t;
+
+#define        O_LARGEFILE     0
+
+#define HAVE_FID       1
+#define HAVE_SWABMACROS        1
+#define INT_SWAP16(type,var) ((typeof(type))(__bswap16((__u16)(var))))
+#define INT_SWAP32(type,var) ((typeof(type))(__bswap32((__u32)(var))))
+#define INT_SWAP64(type,var) ((typeof(type))(__bswap64((__u64)(var))))
+
+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 strcpy(buf.f_fstypename, "xfs") == 0;
+}
+
+static __inline__ int platform_test_xfs_path(const char *path)
+{
+       struct statfs buf;
+       if (statfs(path, &buf) < 0)
+               return 0;
+       return strcpy(buf.f_fstypename, "xfs") == 0;
+}
+
+static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
+{
+       return fstatfs(fd, buf);
+}
+
+static __inline__ void platform_getoptreset(void)
+{
+       extern int optind;
+       optind = 0;
+}
+
+/*
+ * Implement Linux libuuid functions in terms of DEC DCE's uuid
+ * functions from FreeBSD libc.
+ */
+
+static __inline__ int gnu_uuid_compare(uuid_t a, uuid_t b)
+{
+       return uuid_compare(&a, &b, NULL);
+}
+#define        uuid_compare    gnu_uuid_compare
+
+static __inline__ int uuid_is_null(uuid_t uid)
+{
+       return uuid_is_nil(&uid, NULL);
+}
+
+static __inline__ void uuid_unparse(uuid_t uid, char *buf)
+{
+       uint32_t status;
+       char *str;
+       uuid_to_string(&uid, &str, &status);
+       if (status == uuid_s_ok)
+               strcpy(buf, str);
+       else *buf = '\0';
+       free(str);
+}
+
+static __inline__ int gnu_uuid_parse(const char *buf, uuid_t *uid)
+{
+       uint32_t status;
+       uuid_from_string(buf, uid, &status);
+       return (status == uuid_s_ok);
+}
+#define        uuid_parse(s,u) gnu_uuid_parse((s), &(u))
+
+#define uuid_generate(uid)  uuid_create(&(uid), NULL)
+#define uuid_clear(uid)  uuid_create_nil(&(uid), NULL)
+#define uuid_copy(dst, src)  memcpy(&(dst), &(src), sizeof(uuid_t))
+
+#endif /* __XFS_FREEBSD_H__ */
diff --git a/include/irix.h b/include/irix.h
new file mode 100644 (file)
index 0000000..732dadc
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2000-2004 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/
+ *
+ */
+#ifndef __XFS_IRIX_H__
+#define __XFS_IRIX_H__
+
+#include <libgen.h>
+#include <values.h>
+#include <strings.h>
+#include <inttypes.h>
+#include <sys/stat.h>
+#include <sys/uuid.h>
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+#include <sys/syssgi.h>
+#include <sys/sysmacros.h>
+#include <sys/fs/xfs_fsops.h>
+//#include <sys/fs/xfs_itable.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;
+typedef flock64_t      xfs_flock64_t;
+
+#include <sys/endian.h>
+#define __BYTE_ORDER   BYTE_ORDER
+#define __BIG_ENDIAN   BIG_ENDIAN
+#define __LITTLE_ENDIAN        LITTLE_ENDIAN
+#include <xfs/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)
+{
+       if (cmd >= 0 && cmd < XFS_FSOPS_COUNT)
+               return syssgi(SGI_XFS_FSOPERATIONS, fd, cmd, (void *)0, p);
+       return fcntl(fd, cmd, p);
+}
+
+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_test_xfs_path(const char *path)
+{
+       struct statvfs sbuf;
+       if (statvfs(path, &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__ void platform_getoptreset(void)
+{
+       getoptreset();
+}
+
+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_IOCMACROS 1
+#define HAVE_BBMACROS  1
+
+#define __XFS_FS_H__
+
+#define XFS_IOC_DIOINFO                        F_DIOINFO
+#define XFS_IOC_FSGETXATTR             F_FSGETXATTR
+#define XFS_IOC_FSSETXATTR             F_FSSETXATTR
+#define XFS_IOC_ALLOCSP64              F_ALLOCSP64
+#define XFS_IOC_FREESP64               F_FREESP64
+#define XFS_IOC_GETBMAP                        F_GETBMAP
+#define XFS_IOC_FSSETDM                        F_FSSETDM
+#define XFS_IOC_RESVSP64               F_RESVSP64
+#define XFS_IOC_UNRESVSP64             F_UNRESVSP64
+#define XFS_IOC_GETBMAPA               F_GETBMAPA
+#define XFS_IOC_FSGETXATTRA            F_FSGETXATTRA
+#define XFS_IOC_GETBMAPX               F_GETBMAPX
+
+#define XFS_IOC_FSGEOMETRY_V1          XFS_FS_GEOMETRY
+#define XFS_IOC_FSBULKSTAT             /* TODO */
+#define XFS_IOC_FSBULKSTAT_SINGLE      /* TODO */
+#define XFS_IOC_FSINUMBERS             /* TODO */
+#define XFS_IOC_PATH_TO_FSHANDLE       /* TODO */
+#define XFS_IOC_PATH_TO_HANDLE         /* TODO */
+#define XFS_IOC_FD_TO_HANDLE           /* TODO */
+#define XFS_IOC_OPEN_BY_HANDLE         /* TODO */
+#define XFS_IOC_READLINK_BY_HANDLE     /* TODO */
+#define XFS_IOC_SWAPEXT                        /* TODO */
+#define XFS_IOC_FSGROWFSDATA           XFS_GROWFS_DATA
+#define XFS_IOC_FSGROWFSLOG            XFS_GROWFS_LOG
+#define XFS_IOC_FSGROWFSRT             XFS_GROWFS_RT
+#define XFS_IOC_FSCOUNTS               XFS_FS_COUNTS
+#define XFS_IOC_SET_RESBLKS            XFS_SET_RESBLKS
+#define XFS_IOC_GET_RESBLKS            XFS_GET_RESBLKS
+#define XFS_IOC_ERROR_INJECTION                /* TODO */
+#define XFS_IOC_ERROR_CLEARALL         /* TODO */
+#define XFS_IOC_FREEZE                 XFS_FS_FREEZE
+#define XFS_IOC_THAW                   XFS_FS_THAW
+#define XFS_IOC_FSSETDM_BY_HANDLE      /* TODO */
+#define XFS_IOC_ATTRLIST_BY_HANDLE     /* TODO */
+#define XFS_IOC_ATTRMULTI_BY_HANDLE    /* TODO */
+#define XFS_IOC_FSGEOMETRY             XFS_FS_GEOMETRY
+#define XFS_IOC_GOINGDOWN              XFS_FS_GOINGDOWN
+
+#define XFS_XFLAG_REALTIME      0x00000001      /* data in realtime volume */
+#define XFS_XFLAG_PREALLOC      0x00000002      /* preallocated file extents */
+#define XFS_XFLAG_IMMUTABLE     0x00000008      /* file cannot be modified */
+#define XFS_XFLAG_APPEND        0x00000010      /* all writes append */
+#define XFS_XFLAG_SYNC          0x00000020      /* all writes synchronous */
+#define XFS_XFLAG_NOATIME       0x00000040      /* do not update access time */
+#define XFS_XFLAG_NODUMP        0x00000080      /* do not include in backups */
+#define XFS_XFLAG_RTINHERIT     0x00000100      /* new files have rt bit set */
+#define XFS_XFLAG_HASATTR       0x80000000      /* no DIFLAG for this   */
+
+
+#endif /* __XFS_IRIX_H__ */
diff --git a/include/linux.h b/include/linux.h
new file mode 100644 (file)
index 0000000..5da8586
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2004 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/
+ *
+ */
+#ifndef __XFS_LINUX_H__
+#define __XFS_LINUX_H__
+
+#include <uuid/uuid.h>
+#include <sys/vfs.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+#include <linux/types.h>
+#include <malloc.h>
+#include <getopt.h>
+#include <endian.h>
+#include <xfs/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_test_xfs_path(const char *path)
+{
+       struct statfs buf;
+       if (statfs(path, &buf) < 0)
+               return 0;
+       return (buf.f_type == 0x58465342);      /* XFSB */
+}
+
+static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
+{
+       return fstatfs(fd, buf);
+}
+
+static __inline__ void platform_getoptreset(void)
+{
+       extern int optind;
+       optind = 0;
+}
+
+#ifndef O_DIRECT
+# if defined (__powerpc__)
+#  define O_DIRECT     0400000
+# elif defined (__sparc__)
+#  define O_DIRECT     0x100000
+# endif
+#endif
+
+#if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
+# define constpp       const char * const *
+#else
+# define constpp       char * const *
+#endif
+
+#define ENOATTR                ENODATA /* Attribute not found */
+#define EFSCORRUPTED   990     /* Filesystem is corrupted */
+
+typedef loff_t         xfs_off_t;
+typedef __uint64_t     xfs_ino_t;
+typedef __uint32_t     xfs_dev_t;
+typedef __int64_t      xfs_daddr_t;
+typedef char*          xfs_caddr_t;
+
+#ifndef        _UCHAR_T_DEFINED
+typedef unsigned char  uchar_t;
+#define        _UCHAR_T_DEFINED        1
+#endif
+
+#ifndef _BOOLEAN_T_DEFINED
+typedef enum {B_FALSE, B_TRUE} boolean_t;
+#define _BOOLEAN_T_DEFINED     1
+#endif
+
+#endif /* __XFS_IRIX_H__ */
index 3fa49789cde1e23760bb4522956abd43f4c12cb0..d8210405aa7f9d8983036b21ded421b29bcb172f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 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
 
 
 #if defined(__linux__)
-
-#include <uuid/uuid.h>
-#include <sys/vfs.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <linux/types.h>
-#include <malloc.h>
-#include <getopt.h>
-#include <endian.h>
-#include <xfs/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_test_xfs_path(const char *path)
-{
-       struct statfs buf;
-       if (statfs(path, &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
-# elif defined (__sparc__)
-#  define O_DIRECT     0x100000
-# endif
-#endif
-
-#if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
-# define constpp       const char * const *
-#else
-# define constpp       char * const *
-#endif
-
-#define ENOATTR                ENODATA /* Attribute not found */
-#define EFSCORRUPTED   990     /* Filesystem is corrupted */
-
-typedef loff_t         xfs_off_t;
-typedef __uint64_t     xfs_ino_t;
-typedef __uint32_t     xfs_dev_t;
-typedef __int64_t      xfs_daddr_t;
-typedef char*          xfs_caddr_t;
-
-#ifndef        _UCHAR_T_DEFINED
-typedef unsigned char  uchar_t;
-#define        _UCHAR_T_DEFINED        1
-#endif
-
-#ifndef _BOOLEAN_T_DEFINED
-typedef enum {B_FALSE, B_TRUE} boolean_t;
-#define _BOOLEAN_T_DEFINED     1
-#endif
-
+#include <xfs/linux.h>
 #elif defined(__FreeBSD__)
-
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <sys/ioccom.h>
-#include <sys/mount.h>
-#include <ctype.h>
-#include <libgen.h>
-#include <paths.h>
-#include <uuid.h>
-
-#include <machine/endian.h>
-
-/* FreeBSD file API is 64-bit aware */
-#define        fstat64         fstat
-#define        ftruncate64     ftruncate
-#define lseek64                lseek
-#define        stat64          stat
-#define        pwrite64        pwrite
-#define        pread64         pread
-#define        fdatasync       fsync
-#define memalign(a,size)       valloc(size)
-
-typedef u_int8_t       __u8;
-typedef int8_t         __s8;
-typedef u_int16_t      __u16;
-typedef int16_t                __s16;
-typedef u_int32_t      __u32;
-typedef int32_t                __s32;
-typedef u_int64_t      __u64;
-typedef int64_t                __s64;
-
-#define constpp        char * const *
-
-#define EFSCORRUPTED   990     /* Filesystem is corrupted */
-
-typedef off_t          xfs_off_t;
-typedef off_t          off64_t;
-typedef __uint64_t     xfs_ino_t;
-typedef __uint32_t     xfs_dev_t;
-typedef __int64_t      xfs_daddr_t;
-typedef char*          xfs_caddr_t;
-typedef off_t          loff_t;
-
-#ifndef        _UCHAR_T_DEFINED
-typedef unsigned char  uchar_t;
-#define        _UCHAR_T_DEFINED        1
-#endif
-typedef enum { B_FALSE,B_TRUE }        boolean_t;
-
-#define        O_LARGEFILE     0
-
-#define HAVE_FID       1
-#define HAVE_SWABMACROS        1
-#define INT_SWAP16(type,var) ((typeof(type))(__bswap16((__u16)(var))))
-#define INT_SWAP32(type,var) ((typeof(type))(__bswap32((__u32)(var))))
-#define INT_SWAP64(type,var) ((typeof(type))(__bswap64((__u64)(var))))
-
-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 strcpy(buf.f_fstypename, "xfs") == 0;
-}
-
-static __inline__ int platform_test_xfs_path(const char *path)
-{
-       struct statfs buf;
-       if (statfs(path, &buf) < 0)
-               return 0;
-       return strcpy(buf.f_fstypename, "xfs") == 0;
-}
-
-static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
-{
-       return fstatfs(fd, buf);
-}
-
-/*
- * Implement Linux libuuid functions in terms of DEC DCE's uuid 
- * functions from FreeBSD libc.
- */
-
-static __inline__ int gnu_uuid_compare(uuid_t a, uuid_t b)
-{
-       return uuid_compare(&a, &b, NULL);
-}
-#define        uuid_compare    gnu_uuid_compare
-
-static __inline__ int uuid_is_null(uuid_t uid)
-{
-       return uuid_is_nil(&uid, NULL);
-}
-
-static __inline__ void uuid_unparse(uuid_t uid, char *buf)
-{
-       uint32_t status;
-       char *str;
-       uuid_to_string(&uid, &str, &status);
-       if (status == uuid_s_ok)
-               strcpy(buf, str);
-       else *buf = '\0';
-       free(str);
-}
-
-static __inline__ int gnu_uuid_parse(const char *buf, uuid_t *uid)
-{
-       uint32_t status;
-       uuid_from_string(buf, uid, &status);
-       return (status == uuid_s_ok);
-}
-#define        uuid_parse(s,u) gnu_uuid_parse((s), &(u))
-
-#define uuid_generate(uid)  uuid_create(&(uid), NULL)
-#define uuid_clear(uid)  uuid_create_nil(&(uid), NULL)
-#define uuid_copy(dst, src)  memcpy(&(dst), &(src), sizeof(uuid_t))
-
-#elif defined(__APPLE__)       /* Darwin */
-#include <uuid/uuid.h>
-#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_test_xfs_path(const char *path)
-{
-       struct statfs buf;
-       if (statfs(path, &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) valloc(sz)
-
-#include <machine/endian.h>
-#define __BYTE_ORDER   BYTE_ORDER
-#define __BIG_ENDIAN   BIG_ENDIAN
-#define __LITTLE_ENDIAN        LITTLE_ENDIAN
-#include <xfs/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>
-#include <uuid/uuid.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 <xfs/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_test_xfs_path(const char *path)
-{
-       struct statvfs sbuf;
-       if (statvfs(path, &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
-
-
+#include <xfs/freebsd.h>
+#elif defined(__APPLE__)
+#include <xfs/darwin.h>
+#elif defined(__sgi__)
+#include <xfs/irix.h>
 #else
 # error unknown platform... have fun porting!
 #endif
index 1ed650e902d2589e850ef941b0a5df70c73fc1cf..8b7b3ebc90d22bd70ffae724778752bfe8414e6d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 1995-2004 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
@@ -444,6 +444,7 @@ typedef struct xfs_handle {
 #define XFS_FSOP_GOING_FLAGS_LOGFLUSH          0x1     /* flush log but not data */
 #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH                0x2     /* don't flush log nor data */
 
+#ifndef HAVE_IOCMACROS
 /*
  * ioctl commands that replace IRIX fcntl()'s
  * For 'documentation' purposed more than anything else,
@@ -498,7 +499,7 @@ typedef struct xfs_handle {
 #define XFS_IOC_FSGEOMETRY          _IOR ('X', 124, struct xfs_fsop_geom)
 #define XFS_IOC_GOINGDOWN           _IOR ('X', 125, __uint32_t)
 /*     XFS_IOC_GETFSUUID ---------- deprecated 140      */
-
+#endif
 
 #ifndef HAVE_BBMACROS
 /*
index dd637fff357c3c3ad40b0fa706e717b904275a2f..da5d69eabf7e5210576e46d899da8ee02ec3811e 100644 (file)
@@ -37,15 +37,22 @@ LTCOMMAND = xfs_io
 LSRCFILES = xfs_bmap.sh xfs_freeze.sh
 HFILES = command.h input.h init.h io.h
 CFILES = command.c input.c init.c \
-       bmap.c file.c freeze.c fsync.c help.c inject.c \
+       bmap.c file.c freeze.c fsync.c help.c \
        mmap.c open.c pread.c prealloc.c pwrite.c quit.c \
-       resblks.c shutdown.c truncate.c
+       truncate.c
 
 ifeq ($(PKG_PLATFORM),linux)
-CFILES += fadvise.c
-LCFLAGS += -DHAVE_FADVISE
+CFILES += fadvise.c sendfile.c
+LCFLAGS += -DHAVE_FADVISE -DHAVE_SENDFILE
 else
-LSRCFILES += fadvise.c
+LSRCFILES += fadvise.c sendfile.c
+endif
+
+ifneq ($(PKG_PLATFORM),irix)
+CFILES += inject.c resblks.c shutdown.c
+LCFLAGS += -DHAVE_INJECT -DHAVE_RESBLKS -DHAVE_SHUTDOWN
+else
+LSRCFILES += inject.c resblks.c shutdown.c
 endif
 
 ifeq ($(ENABLE_READLINE),yes)
index 1fa5060f7104f0a4b4fe8b641ef0e7b1db9b36d1..75fc32e9d7d9774275e348e2c8ad77c6d95a784d 100644 (file)
--- a/io/bmap.c
+++ b/io/bmap.c
@@ -81,7 +81,7 @@ bmap_f(
 {
        struct fsxattr          fsx;
        struct getbmapx         *map;
-       struct xfs_fsop_geom_v1 fsgeo;
+       struct xfs_fsop_geom    fsgeo;
        int                     map_size;
        int                     loop = 0;
        int                     flg = 0;
index 2b89807b4dab99894dd862b55405e6466f594c5d..9370d5583baa75728e02f9696ec7e88b7a0fadf7 100644 (file)
@@ -106,7 +106,7 @@ command(
                        argc-1, cmd, ct->argmin, ct->argmax);
                return 0;
        }
-       optind = 0;
+       platform_getoptreset();
        return ct->cfunc(argc, argv);
 }
 
@@ -141,6 +141,7 @@ init_commands(void)
        pwrite_init();
        quit_init();
        resblks_init();
+       sendfile_init();
        shutdown_init();
        truncate_init();
 }
index 7562af1d9a53cb334254e0c704e4773c26a23e4a..4f331560ac6f8f0e18a146eaa0c5701e74bb4e33 100644 (file)
@@ -62,11 +62,6 @@ extern const cmdinfo_t       *find_command(const char *cmd);
 extern void            init_commands(void);
 
 extern void            bmap_init(void);
-#ifdef HAVE_FADVISE
-extern void            fadvise_init(void);
-#else
-# define fadvise_init()        do { } while (0)
-#endif
 extern void            file_init(void);
 extern void            freeze_init(void);
 extern void            fsync_init(void);
@@ -78,7 +73,34 @@ extern void          pread_init(void);
 extern void            prealloc_init(void);
 extern void            pwrite_init(void);
 extern void            quit_init(void);
-extern void            resblks_init(void);
-extern void            shutdown_init(void);
 extern void            truncate_init(void);
 
+#ifdef HAVE_FADVISE
+extern void            fadvise_init(void);
+#else
+#define fadvise_init() do { } while (0)
+#endif
+
+#ifdef HAVE_INJECT
+extern void            inject_init(void);
+#else
+#define inject_init()  do { } while (0)
+#endif
+
+#ifdef HAVE_RESBLKS
+extern void            resblks_init(void);
+#else
+#define resblks_init() do { } while (0)
+#endif
+
+#ifdef HAVE_SENDFILE
+extern void            sendfile_init(void);
+#else
+#define sendfile_init()        do { } while (0)
+#endif
+
+#ifdef HAVE_SHUTDOWN
+extern void            shutdown_init(void);
+#else
+#define shutdown_init()        do { } while (0)
+#endif
index b6a32ca457f82630a85daccacce0404f506a4342..af7c3504b3e86e44cd9cf5a344cf1ae68059ba37 100644 (file)
--- a/io/mmap.c
+++ b/io/mmap.c
@@ -679,6 +679,10 @@ madvise_f(
        return 0;
 }
 
+#if defined(__sgi__)
+int mincore(caddr_t p, size_t s, char *v) { errno = ENOSYS; return -1; }
+#endif
+
 int
 mincore_f(
        int             argc,
index d27fee20aa47db5395185b06e46043de4032aa0a..206174733409b68bce19cd87bdc508de0ada42da 100644 (file)
--- a/io/open.c
+++ b/io/open.c
@@ -618,7 +618,7 @@ statfs_f(
        int                     argc,
        char                    **argv)
 {
-       struct xfs_fsop_geom_v1 fsgeo;
+       struct xfs_fsop_geom    fsgeo;
        struct statfs           st;
 
        printf(_("fd.path = \"%s\"\n"), file->name);
@@ -629,7 +629,7 @@ statfs_f(
                printf(_("statfs.f_blocks = %lld\n"), (long long) st.f_blocks);
 #if defined(__sgi__)
                printf(_("statfs.f_frsize = %lld\n"), (long long) st.f_frsize);
-else
+#else
                printf(_("statfs.f_bavail = %lld\n"), (long long) st.f_bavail);
 #endif
                printf(_("statfs.f_files = %lld\n"), (long long) st.f_files);
index e0116ce9a1e36af2fbd4cf345bbf50b8495ec8bb..5ddafedcf9c332ac3c95393db8f8e9d2136b3984 100644 (file)
@@ -17,59 +17,69 @@ AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
 #  MSGFMT MSGMERGE RPM
 #
 AC_DEFUN([AC_PACKAGE_UTILITIES],
-  [ if test -z "$CC"; then
-        AC_PROG_CC
-    fi
+  [ AC_PROG_CC
     cc="$CC"
     AC_SUBST(cc)
     AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
 
     if test -z "$MAKE"; then
-        AC_PATH_PROG(MAKE, make, /usr/bin/make)
+        AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/freeware/bin)
+    fi
+    if test -z "$MAKE"; then
+        AC_PATH_PROG(MAKE, make,, /usr/bin)
     fi
     make=$MAKE
     AC_SUBST(make)
     AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
 
     if test -z "$LIBTOOL"; then
-       AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin:/usr/local/bin)
+       AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
+    fi
+    if test -z "$LIBTOOL"; then
+       AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
     fi
     libtool=$LIBTOOL
     AC_SUBST(libtool)
     AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
 
     if test -z "$TAR"; then
-        AC_PATH_PROG(TAR, tar)
+        AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
     fi
     tar=$TAR
     AC_SUBST(tar)
     if test -z "$ZIP"; then
-        AC_PATH_PROG(ZIP, gzip, /bin/gzip)
+        AC_PATH_PROG(ZIP, gzip,, /bin:/usr/local/bin:/usr/freeware/bin)
     fi
+
     zip=$ZIP
     AC_SUBST(zip)
+
     if test -z "$MAKEDEPEND"; then
         AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
     fi
     makedepend=$MAKEDEPEND
     AC_SUBST(makedepend)
+
     if test -z "$AWK"; then
-        AC_PATH_PROG(AWK, awk, /bin/awk)
+        AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
     fi
     awk=$AWK
     AC_SUBST(awk)
+
     if test -z "$SED"; then
-        AC_PATH_PROG(SED, sed, /bin/sed)
+        AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
     fi
     sed=$SED
     AC_SUBST(sed)
+
     if test -z "$ECHO"; then
-        AC_PATH_PROG(ECHO, echo, /bin/echo)
+        AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
     fi
     echo=$ECHO
     AC_SUBST(echo)
+
     if test -z "$SORT"; then
-        AC_PATH_PROG(SORT, sort, /bin/sort)
+        AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
     fi
     sort=$SORT
     AC_SUBST(sort)
@@ -79,13 +89,14 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
 
     if test "$enable_gettext" = yes; then
         if test -z "$MSGFMT"; then
-                AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
+                AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/freeware/bin)
         fi
         msgfmt=$MSGFMT
         AC_SUBST(msgfmt)
         AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
+
         if test -z "$MSGMERGE"; then
-                AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge)
+                AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/freeware/bin)
         fi
         msgmerge=$MSGMERGE
         AC_SUBST(msgmerge)
@@ -93,10 +104,11 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
     fi
 
     if test -z "$RPM"; then
-        AC_PATH_PROG(RPM, rpm, /bin/rpm)
+        AC_PATH_PROG(RPM, rpm,, /bin:/usr/freeware/bin)
     fi
     rpm=$RPM
     AC_SUBST(rpm)
+
     dnl .. and what version is rpm
     rpm_version=0
     test -x $RPM && rpm_version=`$RPM --version \
index 71c9d57bd85192357fb3a9d3dd3298bb6eb53eb1..2fd8af170c2242cc7453fbc74cf1e19558c1f63d 100644 (file)
@@ -1,11 +1,12 @@
 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
-  [ AC_CHECK_HEADERS(uuid.h)
-    if test $ac_cv_header_uuid_h = no; then
-       AC_CHECK_HEADERS(uuid/uuid.h,, [
+  [ AC_CHECK_HEADERS([uuid.h sys/uuid.h uuid/uuid.h])
+    if test $ac_cv_header_uuid_h = no -a \
+           $ac_cv_header_sys_uuid_h = no -a \
+           $ac_cv_header_uuid_uuid_h = no; then
        echo
        echo 'FATAL ERROR: could not find a valid UUID header.'
        echo 'Install the Universally Unique Identifiers development package.'
-       exit 1])
+       exit 1
     fi
   ])
 
index 78990b6b12783f9c891209cb01a2533a0ead4f3f..d3ba780128df54938aea781cfeec81cf26b3bed4 100644 (file)
@@ -23,7 +23,7 @@ Set the program name for prompts and some error messages,
 the default value is \f2xfs_io\f1.
 .TP
 \f3\-F\f1
-Allow \f2file\f1 to be ``foreign'', i.e. not in an XFS filesystem.
+Allow \f2file\f1 to reside in non-XFS (foreign) filesystems.
 This mode has a restricted set of commands.
 .TP
 \f3\-f\f1
@@ -58,6 +58,10 @@ where they reside.
 Many commands have extensive online help.
 Use the \f3help\f1 command for more details on any command.
 .SH FILE I/O COMMANDS
+.TP
+\f3file\f1 [ \f2N\f1 ]
+Display a list of all open files and (optionally) switch to an alternate
+current open file.
 .TP 10
 \f3open\f1 [ \f2\-FacdfrstR\f1 ] [ \f2path\f1 ]
 Closes the current file, and opens the file specified by \f2path\f1 instead.
@@ -166,10 +170,16 @@ system call described in \f2xfs\f1(5).
 .TP
 \f3truncate\f1 \f2offset\f1
 Truncates the current file at the given offset using \f2ftruncate\f1(2).
+.TP
+\f3sendfile\f1 \f2\-i infile\f1 | \f2\-f N\f1 [ \f2offset\f1 \f2length\f1 ]
+On platforms which support it, allows a direct in-kernel copy between
+two file descriptors.
+The current open file is the target, the source must be specified as
+another open file (\f2-f\f1) or by path (\f2-i\f2).
 
 .SH MEMORY MAPPED I/O COMMANDS
 .TP
-\f3mmap\f1 [ \f2-rwx\f1 ] [ \f2offset\f1 \f2length\f1 ]
+\f3mmap\f1 [ \f2-rwx\f1 ] [[ N ] | [ \f2offset\f1 \f2length\f1 ]]
 With no arguments, \f3mmap\f1 shows the current mappings.
 Specifying a single numeric argument sets the current mapping.
 If two arguments are specified (a range), a new mapping is created