[V2,02/16] src/locktest: Remove OPEN macro
diff mbox series

Message ID 20190923175204.2139-3-ira.weiny@intel.com
State New
Headers show
Series
  • Fix locktest and add lease testing to it
Related show

Commit Message

Ira Weiny Sept. 23, 2019, 5:51 p.m. UTC
From: Ira Weiny <ira.weiny@intel.com>

The code is much cleaner without this macro.  While here add extra debug
output as well.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 src/locktest.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/src/locktest.c b/src/locktest.c
index 29e914febdf9..b5e1cf7669d8 100644
--- a/src/locktest.c
+++ b/src/locktest.c
@@ -61,7 +61,6 @@  extern int h_errno;
        
 #define HANDLE              int
 #define INVALID_HANDLE      -1
-#define OPEN(N,F)           (open(N, F|O_CREAT|O_BINARY, 0644))
 #define SEEK(H, O)          (lseek(H, O, SEEK_SET))
 #define READ(H, B, L)       (read(H, B, L))
 #define WRITE(H, B, L)      (write(H, B, L))
@@ -598,12 +597,16 @@  initialize(HANDLE fd)
 
 int do_open(int flag)
 {
-    if ((f_fd = OPEN(filename, flag)) == INVALID_HANDLE) {
+    int flags = flag|O_CREAT|O_BINARY;
+
+    if(debug > 1)
+	fprintf(stderr, "do_open %s 0x%x\n", filename, flags);
+
+    if ((f_fd = open(filename, flags, 0666)) == INVALID_HANDLE) {
 	perror("shared file create");
 	return FAIL;
 	/*NOTREACHED*/
     }
-
     return PASS;
 }