From patchwork Tue Nov 20 21:56:59 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: 10691309 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 6264814BD for ; Tue, 20 Nov 2018 21:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F1D928723 for ; Tue, 20 Nov 2018 21:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4330D2ACBB; Tue, 20 Nov 2018 21:57:06 +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 75C1728723 for ; Tue, 20 Nov 2018 21:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725999AbeKUI2U (ORCPT ); Wed, 21 Nov 2018 03:28:20 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:48610 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbeKUI2U (ORCPT ); Wed, 21 Nov 2018 03:28:20 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAKLrQiY113566; Tue, 20 Nov 2018 21:57:01 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=s3v3Gov5cIhfOOXiXDm3biCpQKO96FxTJunf3AAA4QM=; b=mGU1k0CavxaYyXRb8l6BagAy/BcuJDt4VqSeRCbFKuOcGy1dUxwL7IRChculQ0lgBd5H 1w89nV2xXxuZGTvrpZN3B4uwUtt7n2przvsZFUFJewyHZvnPeS+4crr9s57NcyQ1dxoi 0dyTj2e2O2kq7Ij7Mrm0d1SU479DHqeo4EsLezrNfW+o+jbfX0uDG5n20UCK6F/P4Hrx v6FNHwkrDQRdmEC8twoiOFPcABXuMpz8tX35U0YNf8R5vB8N6/aE2tYqMPidIkuwB6+R ohxS8MW5D8axGqZda2JKOsmqSTOGWhc9SQanEA4JIPSK5zCaa5g52Uj2bMm66QPW1frF WQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2ntbmqp9jp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Nov 2018 21:57:00 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAKLv09L028762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Nov 2018 21:57:00 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAKLv0EB020974; Tue, 20 Nov 2018 21:57:00 GMT Received: from localhost (/10.145.178.163) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Nov 2018 13:57:00 -0800 Subject: [PATCH 03/10] 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, fstests@vger.kernel.org Date: Tue, 20 Nov 2018 13:56:59 -0800 Message-ID: <154275101979.8611.5920262961282352956.stgit@magnolia> In-Reply-To: <154275100143.8611.10235098565750994724.stgit@magnolia> References: <154275100143.8611.10235098565750994724.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9083 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=801 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811200192 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 --- ltp/fsx.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 4b3a5d5a..290b42f6 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()