Whamcloud - gitweb
b=22458 move lcw_dump out of softirq context.
[fs/lustre-release.git] / libsysio / tests / test_stats.c
index 2865a02..e604d9d 100644 (file)
  * lee@sandia.gov
  */
 
-#define _BSD_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#ifndef REDSTORM
-#include <getopt.h>
-#endif
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <sys/queue.h>
 #ifdef notdef
 #include <sys/statvfs.h>
 #endif
+#include <sys/uio.h>
+#include <getopt.h>
 
+#if defined(SYSIO_LABEL_NAMES)
 #include "sysio.h"
-#include "mount.h"
-
+#endif
+#include "xtio.h"
 #include "test.h"
 
 /*
@@ -96,7 +93,7 @@ main(int argc, char * const argv[])
                exit(1);
        }       
 
-       (void )umask(022);
+       (void )SYSIO_INTERFACE_NAME(umask)(022);
 
        while (optind < argc)
                do_stats(argv[optind++]);
@@ -104,7 +101,7 @@ main(int argc, char * const argv[])
        /*
         * Clean up.
         */
-       _sysio_shutdown();
+       _test_sysio_shutdown();
 
        return 0;
 }
@@ -129,19 +126,19 @@ do_stats(const char *path)
        struct statvfs stvfsbuf1, stvfsbuf2;
 #endif
 
-       fd = open(path, O_RDONLY);
+       fd = SYSIO_INTERFACE_NAME(open)(path, O_RDONLY);
        if (fd < 0) {
                perror(path);
                return;
        }
-       err = fstat(fd, &stbuf1);
+       err = SYSIO_INTERFACE_NAME(fstat)(fd, &stbuf1);
        if (!err)
-               err = stat(path, &stbuf2);
+               err = SYSIO_INTERFACE_NAME(stat)(path, &stbuf2);
 #ifdef notdef
        if (!err)
-               err = fstatvfs(fd, &stvfsbuf1);
+               err = SYSIO_INTERFACE_NAME(fstatvfs)(fd, &stvfsbuf1);
        if (!err)
-               err = statvfs(path, &stvfsbuf1);
+               err = SYSIO_INTERFACE_NAME(statvfs)(path, &stvfsbuf1);
 #endif
        if (err) {
                perror(path);
@@ -187,6 +184,6 @@ do_stats(const char *path)
               (unsigned long )stbuf1.st_mtime,
               (unsigned long )stbuf1.st_ctime);
 out:
-       if (close(fd) != 0)
+       if (SYSIO_INTERFACE_NAME(close)(fd) != 0)
                perror("closing file");
 }