From patchwork Fri Dec 7 06:23:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10717519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C65A17D5 for ; Fri, 7 Dec 2018 06:23:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 377592EB3B for ; Fri, 7 Dec 2018 06:23:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A08D2EB67; Fri, 7 Dec 2018 06:23:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC9B42EB3B for ; Fri, 7 Dec 2018 06:23:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725988AbeLGGX4 (ORCPT ); Fri, 7 Dec 2018 01:23:56 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41362 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbeLGGX4 (ORCPT ); Fri, 7 Dec 2018 01:23:56 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB76JxT9149778; Fri, 7 Dec 2018 06:23:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=tvstTNFjbsktVN9RfdK/uYKHx7MD5D3lWDWVT82paAo=; b=XhL0BA3Oq8yWvkEET4tATN/hsJ9FLfBYuF++e//cKc6ceYZY/PCwhul/x2e6/1iwt68T 9NZAF+OqLc9aPfrJfZMu5pCZpkyOP5EgqI/ecH4NdaNXV5/ZN+A89z37PC0oOrBEsSty 1qJgw7opW7kdTYE7/tdMaDX9kPND0pyBlTGcIPEi4z7NYgSZJHgtp/6khCKiib5B+jtJ DZvbaP/1rleU+dsMLWowxw4Ub6FMOcOb3K8io46iF+xV3BhMVt1sboL48rWBKvntL0F/ TktoE86Cq4POSYmjFQA0d2mrFYO+dwAvuv9IVr1TBQp68OfGKgRGoEk5ZLE4aqAQ3Gjm aw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2p3hquc4nw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Dec 2018 06:23:54 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wB76NrGR007581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Dec 2018 06:23:54 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wB76NrfQ016268; Fri, 7 Dec 2018 06:23:53 GMT Received: from localhost (/10.159.153.113) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 06 Dec 2018 22:23:53 -0800 Subject: [PATCH 05/12] fsx: use an enum to define the operation commands From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, Allison Henderson , fstests@vger.kernel.org Date: Thu, 06 Dec 2018 22:23:52 -0800 Message-ID: <154416383217.15344.12016288717012656827.stgit@magnolia> In-Reply-To: <154416379233.15344.4377231692638417530.stgit@magnolia> References: <154416379233.15344.4377231692638417530.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9099 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=921 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812070054 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Use an enum to define operation codes and the boundaries between operation classes so that we can add new commands without having to change a bunch of unrelated #defines. Signed-off-by: Darrick J. Wong Reviewed-By: Allison Henderson --- ltp/fsx.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 191a5936..c3db62e4 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -88,25 +88,27 @@ int logcount = 0; /* total ops */ * mode being run. */ -/* common operations */ -#define OP_READ 0 -#define OP_WRITE 1 -#define OP_MAPREAD 2 -#define OP_MAPWRITE 3 -#define OP_MAX_LITE 4 - -/* !lite operations */ -#define OP_TRUNCATE 4 -#define OP_FALLOCATE 5 -#define OP_PUNCH_HOLE 6 -#define OP_ZERO_RANGE 7 -#define OP_COLLAPSE_RANGE 8 -#define OP_INSERT_RANGE 9 -#define OP_MAX_FULL 10 - -/* integrity operations */ -#define OP_FSYNC 10 -#define OP_MAX_INTEGRITY 11 +enum { + /* common operations */ + OP_READ = 0, + OP_WRITE, + OP_MAPREAD, + OP_MAPWRITE, + OP_MAX_LITE, + + /* !lite operations */ + OP_TRUNCATE = OP_MAX_LITE, + OP_FALLOCATE, + OP_PUNCH_HOLE, + OP_ZERO_RANGE, + OP_COLLAPSE_RANGE, + OP_INSERT_RANGE, + OP_MAX_FULL, + + /* integrity operations */ + OP_FSYNC = OP_MAX_FULL, + OP_MAX_INTEGRITY, +}; #undef PAGE_SIZE #define PAGE_SIZE getpagesize()