xfs
[Top] [All Lists]

[PATCH] xfstests: use native definition of O_DIRECT flag

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfstests: use native definition of O_DIRECT flag
From: Eric Whitney <enwlinux@xxxxxxxxx>
Date: Tue, 26 Feb 2013 16:03:22 -0500
Cc: linux-ext4@xxxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=pbYvaxhaRBHSiXmutH2lc2mQMqLA6fnviWK6ahbnx4M=; b=OG57QcuqrRWInExhm9tuaDkuwpcLDGMJ8WG8g8yazlTNkfxJa16wYvMiaRpwUux6pD DVOVHdds1/SMEmDCejxmiNXK6yHSFPOpskbaaM6yG+cM6+oPEE9n+/GYhbSdC/0Wxode GeZcYKjPMXmL6bWobrZbBghgsW4khk6qDL+WrMxFFX4IMGXqPRShCQcY0Xf6c/HiKmyc yqQ9lzqMyv33oqr0dKkKWswqXzRmrFjCHiIjql41iOWilTVgrI28ScXw/5b3flCjNCkK 96I122sruIAlQeBaKHJHlo8mKqN9vqbSRinVkSJV30X1kYB+extoSwL8jnYVijbumm1q 2Wtg==
User-agent: Mutt/1.5.21 (2010-09-15)
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@xxxxxxxxx>
---
 src/trunc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/trunc.c b/src/trunc.c
index 7539532..38fb21f 100644
--- a/src/trunc.c
+++ b/src/trunc.c
@@ -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 */
 
-- 
1.7.10.4

<Prev in Thread] Current Thread [Next in Thread>