]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfstests: use native definition of O_DIRECT flag
authorEric Whitney <enwlinux@gmail.com>
Tue, 26 Feb 2013 21:03:22 +0000 (21:03 +0000)
committerRich Johnston <rjohnston@sgi.com>
Tue, 5 Mar 2013 20:05:52 +0000 (14:05 -0600)
The definition of O_DIRECT in src/trunc.c causes xfstest 125 to fail
when run on a Pandaboard.  On ARM, the value used (0x040000) is
O_DIRECTORY rather than O_DIRECT as it is on x86.  Prefer the platform's
native definition of O_DIRECT supplied by fcntl.h if available.  Also,
fix a couple of error messages to properly reflect their context.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
src/trunc.c

index 75395322a2d3d8b8a188ea8ad9c389921b27cf04..38fb21f6689b9285f3f08b05acb622134f2c0e04 100644 (file)
@@ -26,7 +26,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef O_DIRECT
 #define O_DIRECT       040000
+#endif
 
 #define WAITTIME       60
 #define BUFSIZE                4096
@@ -82,7 +84,7 @@ while((c=getopt(argc,argv,"f:"))!=EOF) {
 
        printf("direct write of 1's into file\n");      
        err = write(fd, buf, BUFSIZE);
-       if (err < 0) perror("buffered write failed");
+       if (err < 0) perror("direct write failed");
 
        close(fd);
        
@@ -96,7 +98,7 @@ while((c=getopt(argc,argv,"f:"))!=EOF) {
 
        printf("buffered write of 2's into file\n");    
        err = write(fd, buf, BUFSIZE);
-       if (err < 0) perror("direct write failed");
+       if (err < 0) perror("buffered write failed");
 
        /* 1 now on disk, but 2 data is buffered */