]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Updates mainly to get a clean xfs_io compile on IRIX (non-gcc), and to
authorNathan Scott <nathans@sgi.com>
Fri, 10 Sep 2004 02:23:29 +0000 (02:23 +0000)
committerNathan Scott <nathans@sgi.com>
Fri, 10 Sep 2004 02:23:29 +0000 (02:23 +0000)
add a couple more inode flags needed initially on IRIX (Linux soon).
Bump version number.

12 files changed:
VERSION
db/inode.c
debian/changelog
doc/CHANGES
include/irix.h
include/platform_defs.h.in
include/xfs_dinode.h
include/xfs_fs.h
io/mmap.c
io/open.c
io/pread.c
io/pwrite.c

diff --git a/VERSION b/VERSION
index 244a1b429e0bf0490260c5c8ccdc36c440248559..0743ecc9609e23a69046233ef233f738d5473bb6 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=6
-PKG_REVISION=21
+PKG_REVISION=22
 PKG_BUILD=1
index 6302dde86f7fe7b89c6cf7ff4306d503f0e3e580..10c4fb23e89733292de1b15873437a9f01705318 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 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
@@ -140,6 +140,12 @@ const field_t      inode_core_flds[] = {
        { "rtinherit", FLDT_UINT1,
          OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_RTINHERIT_BIT-1), C1,
          0, TYP_NONE },
+       { "projinherit", FLDT_UINT1,
+         OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_PROJINHERIT_BIT-1),C1,
+         0, TYP_NONE },
+       { "nosymlinks", FLDT_UINT1,
+         OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_NOSYMLINKS_BIT-1), C1,
+         0, TYP_NONE },
        { "gen", FLDT_UINT32D, OI(COFF(gen)), C1, 0, TYP_NONE },
        { NULL }
 };
index 4be9976f85561d4a2b0a3be09e1d630e8d1e10ff..8c6ad651e136dd1dc519c25fec1135d63d63628b 100644 (file)
@@ -1,3 +1,9 @@
+xfsprogs (2.6.22-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Nathan Scott <nathans@debian.org>  Fri, 10 Sep 2004 11:10:57 +1000
+
 xfsprogs (2.6.21-1) unstable; urgency=low
 
   * New upstream release.
index 95d1a3baacdae8aa818928b3bf32139f4fd7d939..a40a193925c8b5bae85fde0dc828d637c47a5b9c 100644 (file)
@@ -1,5 +1,13 @@
-[cvs]
+xfsprogs-2.6.22 (10 September 2004)
+       - Update xfs_io to get a clean compile on IRIX with the
+         MIPSPro compilers.
        - Add documentation about additional XFS inode flags.
+       - Add xfs_io write options to include fsync/fdatasync
+         in the timing results it displays.
+       - Add xfs_fsop_counts output to the xfs_io statfs data,
+         which also shows free realtime space, etc.
+       - Add knowledge of additional inode flags for nosymlinks
+         and project ID inheritance.
 
 xfsprogs-2.6.21 (09 August 2004)
        - Support realtime bit inheritance on directories.
index 8d61b30091d34ba4d31f1b32b18676b2ccdff2c9..37d92eb353d9227d690ee5d0e42f1c70ab35451c 100644 (file)
@@ -47,7 +47,7 @@
 #include <sys/syssgi.h>
 #include <sys/sysmacros.h>
 #include <sys/fs/xfs_fsops.h>
-//#include <sys/fs/xfs_itable.h>
+#include <sys/fs/xfs_itable.h>
 
 #define __s8           char
 #define __s16          short
@@ -73,7 +73,15 @@ typedef flock64_t    xfs_flock64_t;
 #define __BYTE_ORDER   BYTE_ORDER
 #define __BIG_ENDIAN   BIG_ENDIAN
 #define __LITTLE_ENDIAN        LITTLE_ENDIAN
-#include <xfs/swab.h>
+#define __fswab16(x)   (x)
+#define __fswab32(x)   (x)
+#define __fswab64(x)   (x)
+
+/* Map some gcc macros for the MipsPRO compiler */
+#ifndef __GNUC__
+#define __sgi__                __sgi
+#define __inline__     __inline
+#endif
 
 #define INT_MAX                INT32_MAX
 #define UINT_MAX       UINT32_MAX
@@ -135,7 +143,7 @@ static __inline__ char * strsep(char **s, const char *ct)
 #define HAVE_IOCMACROS 1
 #define HAVE_BBMACROS  1
 
-#define __XFS_FS_H__
+#define __XFS_FS_H__   1
 
 #define XFS_IOC_DIOINFO                        F_DIOINFO
 #define XFS_IOC_FSGETXATTR             F_FSGETXATTR
@@ -176,15 +184,4 @@ static __inline__ char * strsep(char **s, const char *ct)
 #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__ */
index d8210405aa7f9d8983036b21ded421b29bcb172f..902be05bb1ac54c5dd7e8c11ebbc63a1fa7f89ca 100644 (file)
@@ -52,7 +52,7 @@
 #include <xfs/freebsd.h>
 #elif defined(__APPLE__)
 #include <xfs/darwin.h>
-#elif defined(__sgi__)
+#elif defined(__sgi__) || defined(___sgi)
 #include <xfs/irix.h>
 #else
 # error unknown platform... have fun porting!
index a8f9b42dfd0504b12b95657a255940d479956db2..f43530fdce9f19eb90abd310824d9cfd4b72a901 100644 (file)
@@ -457,6 +457,8 @@ xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
 #define XFS_DIFLAG_NOATIME_BIT   6     /* do not update atime */
 #define XFS_DIFLAG_NODUMP_BIT    7     /* do not dump */
 #define XFS_DIFLAG_RTINHERIT_BIT 8     /* create with realtime bit set */
+#define XFS_DIFLAG_PROJINHERIT_BIT  9  /* create with parents project id */
+#define XFS_DIFLAG_NOSYMLINKS_BIT  10  /* disallow symlink creation */
 #define XFS_DIFLAG_REALTIME      (1 << XFS_DIFLAG_REALTIME_BIT)
 #define XFS_DIFLAG_PREALLOC      (1 << XFS_DIFLAG_PREALLOC_BIT)
 #define XFS_DIFLAG_NEWRTBM       (1 << XFS_DIFLAG_NEWRTBM_BIT)
@@ -466,10 +468,13 @@ xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
 #define XFS_DIFLAG_NOATIME       (1 << XFS_DIFLAG_NOATIME_BIT)
 #define XFS_DIFLAG_NODUMP        (1 << XFS_DIFLAG_NODUMP_BIT)
 #define XFS_DIFLAG_RTINHERIT     (1 << XFS_DIFLAG_RTINHERIT_BIT)
+#define XFS_DIFLAG_PROJINHERIT   (1 << XFS_DIFLAG_PROJINHERIT_BIT)
+#define XFS_DIFLAG_NOSYMLINKS    (1 << XFS_DIFLAG_NOSYMLINKS_BIT)
 
 #define XFS_DIFLAG_ANY \
        (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
         XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
-        XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT)
+        XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
+        XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS)
 
 #endif /* __XFS_DINODE_H__ */
index 096c1f9784060c1f4cb08295bd64d94646c77d5b..4c95ee8ecbf4dfbfb66047b912d4ce229bdd2249 100644 (file)
@@ -77,6 +77,8 @@ struct fsxattr {
 #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      /* create with rt bit set */
+#define XFS_XFLAG_PROJINHERIT  0x00000200      /* create with parents projid */
+#define XFS_XFLAG_NOSYMLINKS   0x00000400      /* disallow symlink creation */
 #define XFS_XFLAG_HASATTR      0x80000000      /* no DIFLAG for this   */
 
 /*
index 300eff08339a44e91f132c04112556fa74ab2b08..3d49e785f4b4fd6b54aa3064d77b94bb1a08eeb9 100644 (file)
--- a/io/mmap.c
+++ b/io/mmap.c
@@ -72,7 +72,7 @@ print_mapping(
        printf("%c%d%c 0x%lx - 0x%lx %s  %14s (%lld : %ld)\n",
                braces? '[' : ' ', index, braces? ']' : ' ',
                (unsigned long)map->addr,
-               (unsigned long)(map->addr + map->length),
+               (unsigned long)((char *)map->addr + map->length),
                buffer, map->name ? map->name : "???",
                (long long)map->offset, (long)map->length);
 }
@@ -103,13 +103,13 @@ check_mapping_range(
                        (long long)mapping->offset, (long)mapping->length);
                return NULL;
        }
-       if (pagealign && (long)(mapping->addr + relative) % pagesize) {
+       if (pagealign && (long)((char *)mapping->addr + relative) % pagesize) {
                printf(_("offset address (%p) is not page aligned\n"),
-                       mapping->addr + relative);
+                       (char *)mapping->addr + relative);
                return NULL;
        }
 
-       return mapping->addr + relative;
+       return (char *)mapping->addr + relative;
 }
 
 int
@@ -168,7 +168,7 @@ mmap_f(
        char            **argv)
 {
        off64_t         offset;
-       size_t          length;
+       ssize_t         length;
        void            *address;
        char            *filename;
        int             blocksize, sectsize;
@@ -284,7 +284,7 @@ msync_f(
        char            **argv)
 {
        off64_t         offset;
-       size_t          length;
+       ssize_t         length;
        void            *start;
        int             c, flags = 0, blocksize, sectsize;
 
@@ -387,7 +387,8 @@ mread_f(
        char            **argv)
 {
        off64_t         offset, tmp;
-       size_t          length, dumplen;
+       ssize_t         length;
+       size_t          dumplen;
        char            *bp;
        void            *start;
        int             dump = 0, rflag = 0;
@@ -476,7 +477,7 @@ munmap_f(
        int             argc,
        char            **argv)
 {
-       size_t          length;
+       ssize_t         length;
        unsigned int    offset;
 
        if (munmap(mapping->addr, mapping->length) < 0) {
@@ -531,7 +532,7 @@ mwrite_f(
        char            **argv)
 {
        off64_t         offset, tmp;
-       size_t          length;
+       ssize_t         length;
        void            *start;
        char            *sp;
        int             seed = 'X';
index dcf9398cf5dc6507d9d6e8ef8721321afa648521..40d3de3cbc7d0e0108190230bb97f0fc7919dffd 100644 (file)
--- a/io/open.c
+++ b/io/open.c
@@ -43,6 +43,8 @@ static cmdinfo_t setfl_cmd;
 static cmdinfo_t statfs_cmd;
 static cmdinfo_t chattr_cmd;
 static cmdinfo_t lsattr_cmd;
+static cmdinfo_t chproj_cmd;
+static cmdinfo_t lsproj_cmd;
 static cmdinfo_t extsize_cmd;
 
 off64_t
@@ -95,6 +97,8 @@ printxattr(int flags, int verbose, int dofname, int dobraces, int doeol)
                { XFS_XFLAG_NOATIME,    "A", "no-atime" },
                { XFS_XFLAG_NODUMP,     "d", "no-dump" },
                { XFS_XFLAG_RTINHERIT,  "R", "rt-inherit" },
+               { XFS_XFLAG_PROJINHERIT,"P", "proj-inherit" },
+               { XFS_XFLAG_NOSYMLINKS, "S", "nosymlinks" },
                { 0, NULL, NULL }
        };
        int     first = 1;
@@ -450,6 +454,9 @@ lsattr_help(void)
 " s -- all updates are synchronous\n"
 " A -- the access time is not updated for this inode\n"
 " d -- do not include this file in a dump of the filesystem\n"
+" R -- child created in this directory has realtime bit set by default\n"
+" P -- child created in this directory has parents project ID by default\n"
+" S -- symbolic links cannot be created in this directory\n"
 "\n"
 " Options:\n"
 " -a -- show all flags which can be set alongside those which are set\n"
@@ -473,6 +480,8 @@ chattr_f(
                { XFS_XFLAG_NOATIME,    'A' },
                { XFS_XFLAG_NODUMP,     'd' },
                { XFS_XFLAG_RTINHERIT,  'R' },
+               { XFS_XFLAG_PROJINHERIT,'P' },
+               { XFS_XFLAG_NOSYMLINKS, 'S' },
                { 0, '\0' }
        };
        struct fsxattr  attr;
@@ -540,6 +549,9 @@ chattr_help(void)
 " +/-s -- set/clear the sync flag\n"
 " +/-A -- set/clear the no-atime flag\n"
 " +/-d -- set/clear the no-dump flag\n"
+" +/-R -- set/clear the realtime inheritance flag\n"
+" +/-P -- set/clear the project ID inheritance flag\n"
+" +/-S -- set/clear the no-symbolic-links flag\n"
 " Note1: user must have certain capabilities to modify immutable/append-only.\n"
 " Note2: immutable/append-only files cannot be deleted; removing these files\n"
 "        requires the immutable/append-only flag to be cleared first.\n"
@@ -548,6 +560,49 @@ chattr_help(void)
 "\n"));
 }
 
+static int
+lsproj_f(
+       int             argc,
+       char            **argv)
+{
+       __uint32_t      id;
+
+#if defined(__sgi__)
+       struct stat64   st;
+       if (fstat64(file->fd, &st) < 0) {
+               perror("fstat64");
+               return 0;
+       }
+       id = st.st_projid;
+#else
+       id = 0;
+#endif
+       printf("projid = %u\n", (unsigned int)id);
+       return 0;
+}
+
+static int
+chproj_f(
+       int             argc,
+       char            **argv)
+{
+       __uint32_t      id;
+       char            *sp;
+
+       id = (__uint32_t) strtoul(argv[1], &sp, 0);
+       if (!sp || sp == argv[1]) {
+               printf(_("non-numeric project ID -- %s\n"), argv[1]);
+               return 0;
+       }
+#if defined(__sgi__)
+       if (fchproj(file->fd, id) < 0)
+               perror("fchproj");
+#else
+       printf(_("Not yet implemented\n"));
+#endif
+       return 0;
+}
+
 static int
 setfl_f(
        int                     argc,
@@ -620,6 +675,7 @@ statfs_f(
        int                     argc,
        char                    **argv)
 {
+       struct xfs_fsop_counts  fscounts;
        struct xfs_fsop_geom    fsgeo;
        struct statfs           st;
 
@@ -655,6 +711,18 @@ statfs_f(
                printf(_("geom.sunit = %u\n"), fsgeo.sunit);
                printf(_("geom.swidth = %u\n"), fsgeo.swidth);
        }
+       if ((xfsctl(file->name, file->fd, XFS_IOC_FSCOUNTS, &fscounts)) < 0) {
+               perror("XFS_IOC_FSCOUNTS");
+       } else {
+               printf(_("counts.freedata = %llu\n"),
+                       (unsigned long long) fscounts.freedata);
+               printf(_("counts.freertx = %llu\n"),
+                       (unsigned long long) fscounts.freertx);
+               printf(_("counts.freeino = %llu\n"),
+                       (unsigned long long) fscounts.freeino);
+               printf(_("counts.allocino = %llu\n"),
+                       (unsigned long long) fscounts.allocino);
+       }
        return 0;
 }
 
@@ -720,6 +788,23 @@ open_init(void)
                _("list extended inode flags set on the currently open file");
        lsattr_cmd.help = lsattr_help;
 
+       chproj_cmd.name = _("chproj");
+       chproj_cmd.cfunc = chproj_f;
+       chproj_cmd.args = _("projid");
+       chproj_cmd.argmin = 1;
+       chproj_cmd.argmax = 1;
+       chproj_cmd.flags = CMD_NOMAP_OK;
+       chproj_cmd.oneline =
+               _("change project identifier on the currently open file");
+
+       lsproj_cmd.name = _("lsproj");
+       lsproj_cmd.cfunc = lsproj_f;
+       lsproj_cmd.argmin = 0;
+       lsproj_cmd.argmax = 0;
+       lsproj_cmd.flags = CMD_NOMAP_OK;
+       lsproj_cmd.oneline =
+               _("list project identifier set on the currently open file");
+
        extsize_cmd.name = _("extsize");
        extsize_cmd.cfunc = extsize_f;
        extsize_cmd.argmin = 1;
@@ -735,6 +820,8 @@ open_init(void)
        add_command(&statfs_cmd);
        add_command(&chattr_cmd);
        add_command(&lsattr_cmd);
+       add_command(&chproj_cmd);
+       add_command(&lsproj_cmd);
 
        if (expert)
                add_command(&extsize_cmd);
index 5be9f25e83c1d3c142913475702e9ff8282cf6ad..ed0d20e6c75dc01816981d90bdb7944a5a8c7c4d 100644 (file)
@@ -146,7 +146,7 @@ pread_f(
 {
        off64_t         offset;
        long long       count, total;
-       unsigned int    blocksize, sectsize;
+       int             blocksize, sectsize;
        struct timeval  t1, t2;
        char            s1[64], s2[64], ts[64];
        int             uflag = 0, vflag = 0;
index 9a69b9757dae6306659bc8298fc639dde349e53f..88c62222e3f80db2971ce3363e792b164ea2808c 100644 (file)
@@ -54,6 +54,8 @@ pwrite_help(void)
 " -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"
+" -w -- call fdatasync(2) at the end (included in timing results)\n"
+" -W -- call fsync(2) at the end (included in timing results)\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"));
@@ -104,14 +106,14 @@ pwrite_f(
        off64_t         offset, skip = 0;
        long long       count, total;
        unsigned int    seed = 0xcdcdcdcd;
-       unsigned int    blocksize, sectsize;
+       int             blocksize, sectsize;
        struct timeval  t1, t2;
        char            s1[64], s2[64], ts[64];
        char            *sp, *infile = NULL;
-       int             c, fd = -1, uflag = 0, dflag = 0;
+       int             c, fd = -1, uflag = 0, dflag = 0, wflag = 0, Wflag = 0;
 
        init_cvtnum(&blocksize, &sectsize);
-       while ((c = getopt(argc, argv, "b:df:i:s:S:u")) != EOF) {
+       while ((c = getopt(argc, argv, "b:df:i:s:S:uwW")) != EOF) {
                switch (c) {
                case 'b':
                        blocksize = cvtnum(blocksize, sectsize, optarg);
@@ -144,6 +146,12 @@ pwrite_f(
                case 'u':
                        uflag = 1;
                        break;
+               case 'w':
+                       wflag = 1;
+                       break;
+               case 'W':
+                       Wflag = 1;
+                       break;
                default:
                        return command_usage(&pwrite_cmd);
                }
@@ -175,6 +183,10 @@ pwrite_f(
                close(fd);
                return 0;
        }
+       if (Wflag)
+               fsync(file->fd);
+       if (wflag)
+               fdatasync(file->fd);
        gettimeofday(&t2, NULL);
        t2 = tsub(t2, t1);
 
@@ -199,7 +211,7 @@ pwrite_init(void)
        pwrite_cmd.argmax = -1;
        pwrite_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
        pwrite_cmd.args =
-               _("[-i infile [-d] [-s skip]] [-b bs] [-S seed] off len");
+               _("[-i infile [-d] [-s skip]] [-b bs] [-S seed] [-wW] off len");
        pwrite_cmd.oneline =
                _("writes a number of bytes at a specified offset");
        pwrite_cmd.help = pwrite_help;