[Pvfs2-cvs] commit by slang in pvfs2/test/kernel/linux-2.6: aio_test_append.c aio_test_correctness.c aio_test_sparse.c file_fsync.c file_open.c file_write.c io-hole-test.c module.mk.in threaded_write.c

CVS commit program cvs at parl.clemson.edu
Thu Oct 19 18:17:26 EDT 2006


Update of /projects/cvsroot/pvfs2/test/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv5758/test/kernel/linux-2.6

Modified Files:
      Tag: WALT3
	aio_test_append.c aio_test_correctness.c aio_test_sparse.c 
	file_fsync.c file_open.c file_write.c io-hole-test.c 
	module.mk.in threaded_write.c 
Log Message:
reverse merge of HEAD to WALT3 branch.


Index: aio_test_append.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/aio_test_append.c,v
diff -p -u -r1.1 -r1.1.24.1
--- aio_test_append.c	19 Oct 2005 18:38:58 -0000	1.1
+++ aio_test_append.c	19 Oct 2006 22:17:26 -0000	1.1.24.1
@@ -8,6 +8,7 @@
 
 #define _GNU_SOURCE
 
+#include "pvfs2-test-config.h"
 #include <sys/types.h>
 #include <stdlib.h>
 #include <signal.h>
@@ -16,12 +17,14 @@
 #include <unistd.h>
 #include <sys/wait.h>
 
+#ifdef HAVE_LIBAIO_H
 #include <libaio.h>
+#endif
 
 #define NUM_CHILDREN 8
 
 
-int check_zero(char *buf, int size)
+static int check_zero(char *buf, int size)
 {
 	int *iptr;
 
@@ -30,7 +33,7 @@ int check_zero(char *buf, int size)
 	while (size > 0) {
 		if (*iptr++ != 0) {
 			fprintf(stderr, "non zero buffer at buf[%d]\n",
-				((char *)iptr) - buf);
+				(int)(((char *)iptr) - buf));
 			return 1;
 		}
 		size -= 4;
@@ -38,7 +41,7 @@ int check_zero(char *buf, int size)
 	return 0;	/* all zeros */
 }
 
-int read_eof(char *filename)
+static int read_eof(char *filename)
 {
 	int fd;
 	int i;
@@ -58,7 +61,7 @@ int read_eof(char *filename)
 		if (r > 0) {
 			if ((bufoff = check_zero(buf, 4096))) {
 				fprintf(stderr, "non-zero read at offset %ld\n",
-					offset + bufoff);
+					(long)(offset + bufoff));
 				exit(1);
 			}
 		}
@@ -72,7 +75,7 @@ int read_eof(char *filename)
 /*
  * append to the end of a file using AIO DIRECT.
  */
-void aiodio_append(char *filename)
+static void aiodio_append(char *filename)
 {
 	int fd;
 	void *bufptr;

Index: aio_test_correctness.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/aio_test_correctness.c,v
diff -p -u -r1.1 -r1.1.24.1
--- aio_test_correctness.c	19 Oct 2005 18:38:58 -0000	1.1
+++ aio_test_correctness.c	19 Oct 2006 22:17:26 -0000	1.1.24.1
@@ -11,6 +11,7 @@
  */
 
 #define _GNU_SOURCE
+#include "pvfs2-test-config.h"
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -25,58 +26,13 @@
 
 
 
-int check_zero(char *buf, int size)
-{
-	int *iptr;
-
-	iptr = (int *)buf;
-
-	while (size > 0) {
-		if (*iptr++ != 0) {
-			fprintf(stderr, "non zero buffer at buf[%d]\n",
-				((char *)iptr) - buf);
-			return 1;
-		}
-		size -= 4;
-	}
-	return 0;	/* all zeros */
-}
-
-int read_eof(char *filename)
-{
-	int fd;
-	int i;
-	int r;
-	char buf[4096];
-
-	while ((fd = open(filename, O_RDONLY)) < 0) {
-		sleep(1);	/* wait for file to be created */
-	}
-
-	for (i = 0 ; i < 1000000; i++) {
-		off_t offset;
-		int bufoff;
-
-		offset = lseek(fd, SEEK_END, 0);
-		r = read(fd, buf, 4096);
-		if (r > 0) {
-			if ((bufoff = check_zero(buf, 4096))) {
-				fprintf(stderr, "non-zero read at offset %ld\n",
-					offset + bufoff);
-				exit(1);
-			}
-		}
-	}
-	return 0;
-}
-
 #define NUM_AIO 18
 #define AIO_SIZE 64*1024
 
 /*
  * write to the different portions of a file using AIO.
  */
-void aiodio_write(char *filename, void **all_bufs)
+static void aiodio_write(char *filename, void **all_bufs)
 {
 	int fd;
 	void *bufptr;
@@ -128,7 +84,7 @@ void aiodio_write(char *filename, void *
 /*
  * read from different parts of the file using AIO.
  */
-void aiodio_read(char *filename, void **all_bufs)
+static void aiodio_read(char *filename, void **all_bufs)
 {
 	int fd;
 	void *bufptr;

Index: aio_test_sparse.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/aio_test_sparse.c,v
diff -p -u -r1.1 -r1.1.24.1
--- aio_test_sparse.c	19 Oct 2005 18:38:58 -0000	1.1
+++ aio_test_sparse.c	19 Oct 2006 22:17:26 -0000	1.1.24.1
@@ -12,6 +12,7 @@
 
 
 #define _GNU_SOURCE
+#include "pvfs2-test-config.h"
 #include <stdlib.h>
 #include <sys/types.h>
 #include <errno.h>
@@ -34,7 +35,7 @@ int debug;
  *	uninitailized data.
  */
 
-char *check_zero(char *buf, int size)
+static char *check_zero(char *buf, int size)
 {
 	char *p;
 
@@ -43,7 +44,7 @@ char *check_zero(char *buf, int size)
 	while (size > 0) {
 		if (*buf != 0) {
 			fprintf(stderr, "non zero buffer at buf[%d] => 0x%02x,%02x,%02x,%02x\n",
-				buf - p, (unsigned int)buf[0],
+				(int)(buf - p), (unsigned int)buf[0],
 				size > 1 ? (unsigned int)buf[1] : 0,
 				size > 2 ? (unsigned int)buf[2] : 0,
 				size > 3 ? (unsigned int)buf[3] : 0);
@@ -57,7 +58,7 @@ char *check_zero(char *buf, int size)
 	return 0;	/* all zeros */
 }
 
-int read_sparse(char *filename, int filesize)
+static int read_sparse(char *filename, int filesize)
 {
 	int fd;
 	int i;
@@ -83,7 +84,7 @@ int read_sparse(char *filename, int file
 			if (r > 0) {
 				if ((badbuf = check_zero(buf, sizeof(buf)))) {
 					fprintf(stderr, "non-zero read at offset %d\n",
-						offset + badbuf - buf);
+						(int)(offset + badbuf - buf));
 					kill(getppid(), SIGTERM);
 					exit(10);
 				}
@@ -96,8 +97,7 @@ int read_sparse(char *filename, int file
 
 volatile int got_signal;
 
-void
-sig_term_func(int i, siginfo_t *si, void *p)
+static void sig_term_func(int i, siginfo_t *si, void *p)
 {
 	if (debug)
 		fprintf(stderr, "sig(%d, %p, %p)\n", i, si, p);
@@ -107,7 +107,7 @@ sig_term_func(int i, siginfo_t *si, void
 /*
  * do async writes to a sparse file
  */
-void aio_sparse(char *filename, int align, int writesize, int filesize, int num_aio)
+static void aio_sparse(char *filename, int align, int writesize, int filesize, int num_aio)
 {
 	int fd;
 	int i;
@@ -188,7 +188,7 @@ void aio_sparse(char *filename, int alig
 
 		if (debug)
 			fprintf(stderr, "aio_test_sparse: offset %ld filesize %d inflight %d\n",
-				offset, filesize, aio_inflight);
+				(long) offset, filesize, aio_inflight);
 
 		if ((n = io_getevents(myctx, 1, 1, &event, 0)) != 1) {
 			if (-n != EINTR)
@@ -220,7 +220,7 @@ void aio_sparse(char *filename, int alig
 		offset += writesize;
 		if ((w = io_submit(myctx, 1, &iocbp)) < 0) {
 			fprintf(stderr, "io_submit failed at offset %ld\n",
-				offset);
+				(long) offset);
 			perror("");
 			break;
 		}
@@ -259,7 +259,7 @@ void aio_sparse(char *filename, int alig
 }
 
 
-int usage(void)
+static int usage(void)
 {
 	fprintf(stderr, "usage: aio_test_sparse [-n children] [-s filesize]"
 		" [-w writesize] [-r readsize] [-f fname] \n");
@@ -269,7 +269,7 @@ int usage(void)
 /*
  * Scale value by kilo, mega, or giga.
  */
-long long scale_by_kmg(long long value, char scale)
+static long long scale_by_kmg(long long value, char scale)
 {
 	switch (scale) {
 	case 'g':

Index: file_fsync.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/file_fsync.c,v
diff -p -u -r1.1 -r1.1.36.1
--- file_fsync.c	3 Dec 2004 19:16:11 -0000	1.1
+++ file_fsync.c	19 Oct 2006 22:17:26 -0000	1.1.36.1
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -11,7 +12,6 @@ int main(int argc, char **argv)	
     int ret = -1, fd = -1;
     int buf_size = 2*1024*1024;
     char* buffer = NULL;
-    off_t pos = 0;
 
     if (argc != 2)
     {

Index: file_open.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/file_open.c,v
diff -p -u -r1.2 -r1.2.36.1
--- file_open.c	20 Jul 2004 15:17:59 -0000	1.2
+++ file_open.c	19 Oct 2006 22:17:26 -0000	1.2.36.1
@@ -16,6 +16,7 @@
   ext2/ext3
 */
 #include <stdio.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -116,7 +117,7 @@ static open_info_t oinfo[] =
 
 int main(int argc, char **argv)	
 {
-    int ret = -1, fd = -1, i = 0;
+    int fd = -1, i = 0;
 
     if (argc != 2)
     {

Index: file_write.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/file_write.c,v
diff -p -u -r1.2 -r1.2.36.1
--- file_write.c	8 Jul 2004 16:17:15 -0000	1.2
+++ file_write.c	19 Oct 2006 22:17:26 -0000	1.2.36.1
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -13,7 +14,6 @@ int main(int argc, char **argv)	
     int ret = -1, fd = -1, i = 0;
     int buf_size = 2*1024*1024;
     char* buffer = NULL;
-    off_t pos = 0;
 
     if (argc != 2)
     {

Index: io-hole-test.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/io-hole-test.c,v
diff -p -u -r1.1 -r1.1.36.1
--- io-hole-test.c	18 Oct 2004 19:35:22 -0000	1.1
+++ io-hole-test.c	19 Oct 2006 22:17:26 -0000	1.1.36.1
@@ -46,7 +46,7 @@ int main(int argc, char **argv)
         fprintf(stderr, "Failed to seek\n");
         return 1;
     }
-    fprintf(stderr, "lseek() returned %ld\n", pos);
+    fprintf(stderr, "lseek() returned %ld\n", (long) pos);
 
     n_written = write(fd, buf, MAX_BUF_LEN);
     if (n_written != MAX_BUF_LEN)
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
         fprintf(stderr, "Failed to seek\n");
         return 1;
     }
-    fprintf(stderr, "lseek() returned %ld\n", pos);
+    fprintf(stderr, "lseek() returned %ld\n", (long) pos);
 
     n_read = read(fd, buf, MAX_BUF_LEN);
     if (n_read != MAX_BUF_LEN)

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/module.mk.in,v
diff -p -u -r1.10 -r1.10.38.1
--- module.mk.in	15 Apr 2004 00:20:05 -0000	1.10
+++ module.mk.in	19 Oct 2006 22:17:26 -0000	1.10.38.1
@@ -1,2 +1,15 @@
 DIR := kernel/linux-2.6
 
+
+TESTSRC += \
+	$(DIR)/aio_test_append.c \
+	$(DIR)/aio_test_correctness.c \
+	$(DIR)/aio_test_sparse.c \
+	$(DIR)/file_fsync.c \
+	$(DIR)/file_open.c \
+	$(DIR)/file_read.c \
+	$(DIR)/file_write.c \
+	$(DIR)/io-hole-test.c \
+	$(DIR)/threaded_write.c
+
+MODLDFLAGS_$(DIR) := -laio

Index: threaded_write.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/threaded_write.c,v
diff -p -u -r1.4 -r1.4.36.1
--- threaded_write.c	20 Jul 2004 16:13:12 -0000	1.4
+++ threaded_write.c	19 Oct 2006 22:17:26 -0000	1.4.36.1
@@ -11,6 +11,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
+#include <string.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/uio.h>
@@ -28,7 +30,7 @@ typedef struct
     int index;
 } threaded_write_info_t;
 
-void *write_file(void *ptr)
+static void *write_file(void *ptr)
 {
     char *buf = NULL;
     threaded_write_info_t *info = (threaded_write_info_t *)ptr;



More information about the Pvfs2-cvs mailing list