* iogen - a tool for generating file/sds io for a doio process
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-#ifdef CRAY
-#include <sys/file.h>
-#include <sys/iosw.h>
-#include <sys/listio.h>
+#include "global.h"
+
+#ifdef HAVE_SYS_SYSSGI_H
+#include <sys/syssgi.h>
#endif
-#ifdef sgi
-#include <sys/statvfs.h>
-#include <sys/fs/xfs_itable.h>
+
+#ifdef HAVE_SYS_UUID_H
+#include <sys/uuid.h>
#endif
-#ifndef NO_XFS
-#include <xfs/libxfs.h>
+#ifdef HAVE_SYS_FS_XFS_FSOPS_H
+#include <sys/fs/xfs_fsops.h>
#endif
-#ifdef CRAY
-#include "libkern.h"
+#ifdef HAVE_SYS_FS_XFS_ITABLE_H
+#include <sys/fs/xfs_itable.h>
#endif
+
#include "doio.h"
#include "str_to_bytes.h"
#include "string_to_tokens.h"
{ "llaread", LLAREAD, SY_ASYNC },
{ "llwrite", LLWRITE, 0 },
{ "llawrite", LLAWRITE, SY_ASYNC },
-#endif
{ "ffsync", DFFSYNC, SY_WRITE },
+#endif
#endif /* SGI */
#ifndef NO_XFS
{ "resvsp", RESVSP, SY_WRITE },
#endif
#ifndef NO_XFS
if( (fd = open(rec->f_path, O_RDWR|O_DIRECT, 0)) != -1 ) {
+#ifdef XFS_IOC_DIOINFO
if(xfsctl(rec->f_path, fd, XFS_IOC_DIOINFO, &finfo) != -1) {
+#else
+#ifdef F_DIOINFO
+ if(fcntl(fd, F_DIOINFO, &finfo) != -1) {
+#else
+bozo!
+#endif
+#endif
rec->f_riou = finfo.d_miniosz;
} else {
fprintf(stderr,
struct stat sbuf;
#ifndef NO_XFS
int nb;
- struct xfs_flock64 f;
+ struct flock64 f;
struct fsxattr xattr;
struct dioattr finfo;
char *b, *buf;
bzero(&xattr, sizeof(xattr));
xattr.fsx_xflags = XFS_XFLAG_REALTIME;
/*fprintf(stderr, "set: fsx_xflags = 0x%x\n", xattr.fsx_xflags);*/
+#ifdef XFS_IOC_FSSETXATTR
if( xfsctl(path, fd, XFS_IOC_FSSETXATTR, &xattr) == -1 ) {
+#else
+#ifdef F_FSSETXATTR
+ if (fcntl(fd, F_FSSETXATTR, &xattr) < 0) {
+#else
+bozo!
+#endif
+#endif
fprintf(stderr, "iogen%s: Error %s (%d) setting XFS XATTR->Realtime on file %s\n",
TagName, SYSERR, errno, path);
close(fd);
}
#ifdef DEBUG
+#ifdef XFS_IOC_FSGETXATTR
if( xfsctl(path, fd, XFS_IOC_FSGETXATTR, &xattr) == -1 ) {
+#else
+#ifdef F_FSGETXATTR
+ if (fcntl(fd, F_FSGETXATTR, &xattr) < 0) {
+#else
+bozo!
+#endif
+#endif
fprintf(stderr, "iogen%s: Error getting realtime flag %s (%d)\n",
TagName, SYSERR, errno);
close(fd);
fd, f.l_whence, (long long)f.l_start, (long long)f.l_len);*/
/* non-zeroing reservation */
+#ifdef XFS_IOC_RESVSP
if( xfsctl( path, fd, XFS_IOC_RESVSP, &f ) == -1) {
fprintf(stderr,
"iogen%s: Could not xfsctl(XFS_IOC_RESVSP) %d bytes in file %s: %s (%d)\n",
close(fd);
return -1;
}
+#else
+#ifdef F_RESVSP
+ if( fcntl( fd, F_RESVSP, &f ) == -1) {
+ fprintf(stderr,
+ "iogen%s: Could not fcntl(F_RESVSP) %d bytes in file %s: %s (%d)\n",
+ TagName, nbytes, path, SYSERR, errno);
+ close(fd);
+ return -1;
+ }
+#else
+bozo!
+#endif
+#endif
}
if( Oallocate ) {
(long long)f.l_len);*/
/* zeroing reservation */
+#ifdef XFS_IOC_ALLOCSP
if( xfsctl( path, fd, XFS_IOC_ALLOCSP, &f ) == -1) {
fprintf(stderr,
"iogen%s: Could not xfsctl(XFS_IOC_ALLOCSP) %d bytes in file %s: %s (%d)\n",
close(fd);
return -1;
}
+#else
+#ifdef F_ALLOCSP
+ if ( fcntl(fd, F_ALLOCSP, &f) < 0) {
+ fprintf(stderr,
+ "iogen%s: Could not fcntl(F_ALLOCSP) %d bytes in file %s: %s (%d)\n",
+ TagName, nbytes, path, SYSERR, errno);
+ close(fd);
+ return -1;
+ }
+#else
+bozo!
+#endif
+#endif
}
#endif
if(Owrite == 2) {
close(fd);
if( (fd = open(path, O_CREAT|O_RDWR|O_DIRECT, 0)) != -1 ) {
+#ifdef XFS_IOC_DIOINFO
if(xfsctl(path, fd, XFS_IOC_DIOINFO, &finfo) == -1) {
+#else
+#ifdef F_DIOINFO
+ if (fcntl(fd, F_DIOINFO, &finfo) < 0) {
+#else
+bozo!
+#endif
+#endif
fprintf(stderr,
"iogen%s: Error %s (%d) getting direct I/O info for file %s\n",
TagName, SYSERR, errno, path);