QA source updates and some associated test changes
authorNathan Scott <nathans@sgi.com>
Mon, 19 May 2003 04:56:35 +0000 (04:56 +0000)
committerNathan Scott <nathans@sgi.com>
Mon, 19 May 2003 04:56:35 +0000 (04:56 +0000)
13 files changed:
034
048
048.out
src/alloc.c
src/bstat.c
src/devzero.c
src/fault.c
src/feature.c
src/fill2.c
src/global.h
src/loggen.c
src/mmapcat.c
src/randholes.c

diff --git a/034 b/034
index f2bcbcd2441a71d500802e865b4a69bceb4936e5..36fcd0205be1bb6b083b82ea82b3440e8060b045 100755 (executable)
--- a/034
+++ b/034
@@ -2,7 +2,7 @@
 # XFS QA Test No. 034
 # $Id: 1.1 $
 #
-# pv 801241 - check for reference leaks from the *handle ioctls
+# pv 801241 - check for reference leaks from the *handle xfsctls
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
@@ -82,9 +82,9 @@ then
     exit
 fi
 
-if ! src/ioctl $SCRATCH_MNT $SCRATCH_MNT/fish >/dev/null 2>&1
+if ! src/xfsctl $SCRATCH_MNT $SCRATCH_MNT/fish >/dev/null 2>&1
 then
-    echo "!!! failed to run ioctl test program"
+    echo "!!! failed to run xfsctl test program"
     exit
 fi
 
diff --git a/048 b/048
index c56952364f4e99f725fa47ccc50f1c38d004da6e..bab0d16cc20de30b4d8d2b818f76ec8f44a99aec 100755 (executable)
--- a/048
+++ b/048
@@ -2,7 +2,7 @@
 # XFS QA Test No. 048
 # $Id: 1.1 $
 #
-# test return codes from ioctl on bad userspace address
+# test return codes from xfsctl on bad userspace address
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
diff --git a/048.out b/048.out
index e6feb5f567c535dc121e025664705d327debdd24..76278b601cbd813987ace333743dbf67678110e8 100644 (file)
--- a/048.out
+++ b/048.out
@@ -1,5 +1,5 @@
 QA output created by 048
---- ioctl with bad output address
+--- xfsctl with bad output address
    --- got error 14 as expected
---- ioctl with bad input address
+--- xfsctl with bad input address
    --- got error 14 as expected
index 07fa68b9ae3d3996f70d9acc2b568ccbb1b0143c..17359fdf038467d76545b4e4eacf3a68beb2fecd 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
@@ -78,8 +78,9 @@ void usage(void)
            
 }
 
-int            fd;
-int            blocksize = 0;
+int            fd = -1;
+int            blocksize;
+char           *filename;
 
 /* params are in bytes */
 void map(off64_t off, off64_t len)
@@ -103,7 +104,7 @@ void map(off64_t off, off64_t len)
     
     printf("        [ofs,count]: start..end\n");
     for (;;) {
-           if (ioctl(fd, XFS_IOC_GETBMAP, bm) < 0) {
+           if (xfsctl(filename, fd, XFS_IOC_GETBMAP, bm) < 0) {
                    perror("getbmap");
                    break;
            }
@@ -129,8 +130,8 @@ main(int argc, char **argv)
        int             c;
        char            *dirname = NULL;
        int             done = 0;
+       int             status = 0;
        struct flock64  f;
-       char            *filename = NULL;
        off64_t         len;
        char            line[1024];
        off64_t         off;
@@ -201,31 +202,33 @@ main(int argc, char **argv)
                perror(filename);
                exit(1);
        }
-       if (unlinkit)
-               unlink(filename);
        if (!blocksize) {
-               if (fstatvfs64(fd, &svfs) < 0) {
-                       perror(filename);
-                       exit(1);
-               }
+               if (fstatvfs64(fd, &svfs) < 0) {
+                       perror(filename);
+                       status = 1;
+                       goto done;
+               }
                blocksize = (int)svfs.f_bsize;
-        }
-        if (blocksize<0) {
-                fprintf(stderr,"illegal blocksize %d\n", blocksize);
-                exit(1);
-        }
+       }
+       if (blocksize<0) {
+               fprintf(stderr,"illegal blocksize %d\n", blocksize);
+               status = 1;
+               goto done;
+       }
        printf("    blocksize %d\n", blocksize);
        if (rflag) {
                struct fsxattr a;
 
-               if (ioctl(fd, XFS_IOC_FSGETXATTR, &a) < 0) {
+               if (xfsctl(filename, fd, XFS_IOC_FSGETXATTR, &a) < 0) {
                        perror("XFS_IOC_FSGETXATTR");
-                       exit(1);
+                       status = 1;
+                       goto done;
                }
                a.fsx_xflags |= XFS_XFLAG_REALTIME;
-               if (ioctl(fd, XFS_IOC_FSSETXATTR, &a) < 0) {
+               if (xfsctl(filename, fd, XFS_IOC_FSSETXATTR, &a) < 0) {
                        perror("XFS_IOC_FSSETXATTR");
-                       exit(1);
+                       status = 1;
+                       goto done;
                }
        }
        while (!done) {
@@ -269,7 +272,7 @@ main(int argc, char **argv)
                                 opnames[opno], (__s64)off, (__s64)len);
                         
                        f.l_len = len;
-                       c = ioctl(fd, optab[opno], &f);
+                       c = xfsctl(filename, fd, optab[opno], &f);
                        if (c < 0) {
                                perror(opnames[opno]);
                                break;
@@ -327,8 +330,12 @@ main(int argc, char **argv)
                        break;
                }
        }
-        if (!nflag) printf("\n");
-       close(fd);
-       exit(0);
+       if (!nflag) printf("\n");
+done:
+       if (fd != -1)
+               close(fd);
+       if (unlinkit)
+               unlink(filename);
+       exit(status);
        /* NOTREACHED */
 }
index aee1b1b68d3212af234da78bbdb8536f713c60f3..f8939c76756539f728b6f7d264b257595dffb13f 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
  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  */
 
-#include <libxfs.h>
-#include <jdm.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
+#include <xfs/libxfs.h>
+#include <xfs/jdm.h>
 
 void
 dotime(void *ti, char *s)
@@ -171,7 +169,7 @@ main(int argc, char **argv)
        bulkreq.ubuffer = t;
        bulkreq.ocount  = &count;
 
-       while ((ret = ioctl(fsfd, XFS_IOC_FSBULKSTAT, &bulkreq)) == 0) {
+       while ((ret = xfsctl(name, fsfd, XFS_IOC_FSBULKSTAT, &bulkreq)) == 0) {
                total += count;
 
                if (verbose)
@@ -269,7 +267,7 @@ main(int argc, char **argv)
                close(fsfd);
 
        if (ret < 0 )
-               perror("ioctl(XFS_IOC_FSBULKSTAT)");
+               perror("xfsctl(XFS_IOC_FSBULKSTAT)");
 
        if (verbose)
                printf(
index c172c47b1770b1b5d0dc7e516a1023ac828df173..920290a85fca32e661dff248c5881c27cc645539 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
@@ -30,8 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  */
 
-#include <libxfs.h>
-#include <malloc.h>
+#include <xfs/libxfs.h>
 
 int
 main(int argc, char **argv)
index 011a9076cfd3fdc824adb48bb616b90d88a7200d..bfeb0a8b00cb011f8cb0c1f068321f9d56259918 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
@@ -30,8 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  */
 
-#include <libxfs.h>
-#include <sys/ioctl.h>
+#include <xfs/libxfs.h>
 
 void expect_error(int r, int err)
 {
@@ -63,10 +62,10 @@ main(int argc, char **argv)
        exit(1);
     }
     
-    printf("--- ioctl with bad output address\n");
-    expect_error(ioctl(fsfd, XFS_IOC_FSCOUNTS, NULL), EFAULT);
-    printf("--- ioctl with bad input address\n");
-    expect_error(ioctl(fsfd, XFS_IOC_SET_RESBLKS, NULL), EFAULT);
+    printf("--- xfsctl with bad output address\n");
+    expect_error(xfsctl(argv[1], fsfd, XFS_IOC_FSCOUNTS, NULL), EFAULT);
+    printf("--- xfsctl with bad input address\n");
+    expect_error(xfsctl(argv[1], fsfd, XFS_IOC_SET_RESBLKS, NULL), EFAULT);
     
     close(fsfd);
     
index 9e9ade6b133a096ccefabcde62209f1f8d483c14..57b3a2f9224af3945ebf5ee1e5c6dba054486ae7 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
  * Return code: 0 is true, anything else is error/not supported
  */
 
-#include <libxfs.h>
+#include <xfs/libxfs.h>
 #include <sys/quota.h>
 #include <sys/resource.h>
 #include <signal.h>
-#include <xqm.h>
+#include <xfs/xqm.h>
 
 int verbose = 0;
 
index 1d77530d066c2552e6c9e3934f0740e9db8417e6..78260d44f5405a7d4c29a6a737ef6200af76f1c1 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
  *   and is more careful about checking when write operations fail - this is 
  *   needed by fill2fs to ensure that the number of bytes written is accurately
  *   determined.
- *
- *   To compile standalone on IRIX: cc -DTOOL_ONLY -o fill2 fill2.c -lgen
- *
- *   $Id$
  */
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <libgen.h>
-#include <assert.h>
-
-#ifndef TOOL_ONLY
-#include <platform_defs.h>
-#else
-#define constpp char * const *
-#endif /* TOOL_ONLY */
+#include <xfs/libxfs.h>
 
 #define N(x) (sizeof(x)/sizeof(x[0]))
 
index 2227ff0435841581c049ac6c577312bec641bf32..5120c12c04633b5da58c45b31a2ee5a9bcdccb87 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
 
 /* xfs-specific includes */
 
-#include <libxfs.h>
-#include <attributes.h>
+#include <xfs/libxfs.h>
+#include <attr/attributes.h>
 
 /* libc includes */
 
-#include <sys/stat.h>
 #include <sys/statvfs.h>
 #include <sys/time.h>
-#include <sys/ioctl.h>
 #include <sys/wait.h>
-#include <malloc.h>
 #include <dirent.h>
 
 #endif
index 9c0108764f90f4b51ac6428df4a12b8b31f104e7..3dfab9de95b1cf3c1f04c8d87bff98592db2ec60 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
  *                                                  - dxm 29/09/00
  */
 
-#include <libxfs.h>
-#include <malloc.h>
-#include <xfs_log.h>
-#include <xfs_log_priv.h>
+#include <xfs/libxfs.h>
+#include <xfs/xfs_log.h>
+#include <xfs/xfs_log_priv.h>
 
 void
 usage()
index c42427050b66c2c8ba4cca1551dbdba0ed880e29..f40b207834383690995e0f3511c1a159bc90f439 100644 (file)
@@ -1,10 +1,11 @@
 /* mmapcat.c - derived from source by misiek@pld.ORG.PL */
 
-#include<fcntl.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <stdio.h>
 
 int main(int argc, char **argv)
 {
index a75ebac2efaf763d4006c7ae9a8c0a58a838c5fb..cf290cf7c60fb6404c1c839c5acdac4a013a7d09 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
@@ -56,7 +56,7 @@ struct fsxattr rtattr;
 
 void usage(char *progname);
 int findblock(void);
-void writeblks(int fd);
+void writeblks(char *fname, int fd);
 int readblks(int fd);
 void dumpblock(int *buffer, __uint64_t offset, int blocksize);
 
@@ -154,8 +154,8 @@ main(int argc, char *argv[])
                return 1;
        }
        if (rt) {
-               if (ioctl(fd, XFS_IOC_FSGETXATTR, &rtattr) < 0) {
-                       perror("ioctl(XFS_IOC_FSGETXATTR)");
+               if (xfsctl(filename, fd, XFS_IOC_FSGETXATTR, &rtattr) < 0) {
+                       perror("xfsctl(XFS_IOC_FSGETXATTR)");
                        return 1;
                }
                if ((rtattr.fsx_xflags & XFS_XFLAG_REALTIME) == 0 ||
@@ -163,15 +163,15 @@ main(int argc, char *argv[])
                        rtattr.fsx_xflags |= XFS_XFLAG_REALTIME;
                        if (extsize)
                                rtattr.fsx_extsize = extsize * blocksize;
-                       if (ioctl(fd, XFS_IOC_FSSETXATTR, &rtattr) < 0) {
-                               perror("ioctl(XFS_IOC_FSSETXATTR)");
+                       if (xfsctl(filename, fd, XFS_IOC_FSSETXATTR, &rtattr) < 0) {
+                               perror("xfsctl(XFS_IOC_FSSETXATTR)");
                                return 1;
                        }
                }
        }
        if (direct) {
-               if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) {
-                       perror("ioctl(XFS_IOC_FIOINFO)");
+               if (xfsctl(filename, fd, XFS_IOC_DIOINFO, &diob) < 0) {
+                       perror("xfsctl(XFS_IOC_FIOINFO)");
                        return 1;
                }
                if (blocksize % diob.d_miniosz) {
@@ -180,7 +180,7 @@ main(int argc, char *argv[])
                }
        }
         printf(test?"write (skipped)\n":"write\n");
-       writeblks(fd);
+       writeblks(filename, fd);
         printf("readback\n");
        r=readblks(fd);
        if (close(fd) < 0) {
@@ -199,7 +199,7 @@ main(int argc, char *argv[])
 }
 
 void
-writeblks(int fd)
+writeblks(char *fname, int fd)
 {
        __uint64_t offset;
        char *buffer;
@@ -229,8 +229,8 @@ writeblks(int fd)
                        fl.l_start = offset;
                        fl.l_len = blocksize;
                        fl.l_whence = 0;
-                       if (ioctl(fd, XFS_IOC_RESVSP64, &fl) < 0) {
-                               perror("ioctl(XFS_IOC_RESVSP64)");
+                       if (xfsctl(fname, fd, XFS_IOC_RESVSP64, &fl) < 0) {
+                               perror("xfsctl(XFS_IOC_RESVSP64)");
                                exit(1);
                        }
                        continue;