QA source updates and some associated test changes

This commit is contained in:
Nathan Scott
2003-05-19 04:56:35 +00:00
parent 6a86ce7f04
commit 9fcfacdeb5
13 changed files with 77 additions and 93 deletions
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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
+22 -15
View 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);
status = 1;
goto done;
}
blocksize = (int)svfs.f_bsize;
}
if (blocksize<0) {
fprintf(stderr,"illegal blocksize %d\n", blocksize);
exit(1);
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;
@@ -328,7 +331,11 @@ main(int argc, char **argv)
}
}
if (!nflag) printf("\n");
done:
if (fd != -1)
close(fd);
exit(0);
if (unlinkit)
unlink(filename);
exit(status);
/* NOTREACHED */
}
+5 -7
View 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,10 +30,8 @@
* 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(
+2 -3
View 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)
+6 -7
View 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);
+3 -3
View 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
@@ -42,11 +42,11 @@
* 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;
+2 -18
View 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
@@ -42,25 +42,9 @@
* 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]))
+3 -6
View 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
@@ -35,17 +35,14 @@
/* 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
+4 -5
View 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
@@ -39,10 +39,9 @@
* - 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()
+2 -1
View File
@@ -1,10 +1,11 @@
/* mmapcat.c - derived from source by misiek@pld.ORG.PL */
#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)
{
+12 -12
View 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;