Whamcloud - gitweb
Land b_release_1_4_6 onto HEAD (20060223_1455)
[fs/lustre-release.git] / libsysio / tests / test_regions.c
index c6120da..ded2c83 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#ifndef REDSTORM
-#include <getopt.h>
-#endif
 #include <limits.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <sys/queue.h>
+#include <sys/uio.h>
 
+#if defined(SYSIO_LABEL_NAMES)
 #include "sysio.h"
-#include "mount.h"
-
+#endif
+#include "xtio.h"
 #include "test.h"
 
 /*
@@ -202,7 +200,7 @@ main(int argc, char * const argv[])
        if (use64)
                flags |= O_LARGEFILE;
 #endif
-       fd = open(path, flags, 0666);
+       fd = SYSIO_INTERFACE_NAME(open)(path, flags, 0666);
        if (fd < 0) {
                perror(path);
                err = 1;
@@ -210,11 +208,11 @@ main(int argc, char * const argv[])
        }
 #ifdef GO64
        if (use64)
-               off64 = lseek64(fd, off64, SEEK_SET);
+               off64 = SYSIO_INTERFACE_NAME(lseek64)(fd, off64, SEEK_SET);
        else
                off64 =
 #endif
-                 off = lseek(fd, off, SEEK_SET);
+                 off = SYSIO_INTERFACE_NAME(lseek)(fd, off, SEEK_SET);
 #ifdef GO64
        if ((use64 && off64 < 0) || (!use64 && off < 0)) {
                perror(use64 ? "lseek64" : "lseek");
@@ -229,9 +227,9 @@ main(int argc, char * const argv[])
        }
 #endif
        if (which == 'r')
-               cc = read(fd, buf, nbytes);
+               cc = SYSIO_INTERFACE_NAME(read)(fd, buf, nbytes);
        else
-               cc = write(fd, buf, nbytes);
+               cc = SYSIO_INTERFACE_NAME(write)(fd, buf, nbytes);
        if (cc < 0) {
                perror(path);
                err = 1;
@@ -239,11 +237,11 @@ main(int argc, char * const argv[])
        }
 #ifdef GO64
        if (use64) {
-               off64 = lseek64(fd, 0, SEEK_CUR);
+               off64 = SYSIO_INTERFACE_NAME(lseek64)(fd, 0, SEEK_CUR);
        } else
                off64 =
 #endif
-                 off = lseek(fd, 0, SEEK_CUR);
+                 off = SYSIO_INTERFACE_NAME(lseek)(fd, 0, SEEK_CUR);
        (void )printf(("%s%s@"
 #ifdef GO64
                       "%lld"
@@ -274,11 +272,11 @@ main(int argc, char * const argv[])
                      );
 
 error:
-       if (fd > 0 && close(fd) != 0)
+       if (fd > 0 && SYSIO_INTERFACE_NAME(close)(fd) != 0)
                perror(path);
        free(buf);
 out:
-       _sysio_shutdown();
+       _test_sysio_shutdown();
 
        return err;
 }