# 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.
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
# 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.
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
/*
- * 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
}
-int fd;
-int blocksize = 0;
+int fd = -1;
+int blocksize;
+char *filename;
/* params are in bytes */
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;
}
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;
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) {
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;
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 */
}
/*
- * 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)
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)
close(fsfd);
if (ret < 0 )
- perror("ioctl(XFS_IOC_FSBULKSTAT)");
+ perror("xfsctl(XFS_IOC_FSBULKSTAT)");
if (verbose)
printf(
/*
- * 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 <malloc.h>
+#include <xfs/libxfs.h>
int
main(int argc, char **argv)
/*
- * 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 <sys/ioctl.h>
+#include <xfs/libxfs.h>
void expect_error(int r, int err)
{
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);
/*
- * 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;
/*
- * 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]))
/*
- * 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
/*
- * 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()
/* 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)
{
/*
- * 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
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);
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 ||
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) {
}
}
printf(test?"write (skipped)\n":"write\n");
- writeblks(fd);
+ writeblks(filename, fd);
printf("readback\n");
r=readblks(fd);
if (close(fd) < 0) {
}
void
-writeblks(int fd)
+writeblks(char *fname, int fd)
{
__uint64_t offset;
char *buffer;
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;