From patchwork Mon Sep 23 17:53:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 11157443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C07917D4 for ; Mon, 23 Sep 2019 17:53:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF16820882 for ; Mon, 23 Sep 2019 17:53:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502227AbfIWRxk (ORCPT ); Mon, 23 Sep 2019 13:53:40 -0400 Received: from mga06.intel.com ([134.134.136.31]:32885 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394221AbfIWRxk (ORCPT ); Mon, 23 Sep 2019 13:53:40 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 10:53:40 -0700 X-IronPort-AV: E=Sophos;i="5.64,541,1559545200"; d="scan'208";a="179208342" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 10:53:39 -0700 From: ira.weiny@intel.com To: fstests@vger.kernel.org, Eryu Guan Cc: john.hubbard@gmail.com, Dave Chinner , Jan Kara , Jason Gunthorpe , dan.j.williams@intel.com, Jeff Layton , Ira Weiny Subject: [PATCH V2 02/16] src/locktest: Remove OPEN macro Date: Mon, 23 Sep 2019 10:53:22 -0700 Message-Id: <20190923175336.2287-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923175336.2287-1-ira.weiny@intel.com> References: <20190923175336.2287-1-ira.weiny@intel.com> MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Ira Weiny The code is much cleaner without this macro. While here add extra debug output as well. Reviewed-by: Jeff Layton Signed-off-by: Ira Weiny --- src/locktest.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; }