From patchwork Tue Nov 20 21:57:05 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: 10691313 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 7F36916B1 for ; Tue, 20 Nov 2018 21:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C1F928723 for ; Tue, 20 Nov 2018 21:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6014C293DC; Tue, 20 Nov 2018 21:57:15 +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 03C6428723 for ; Tue, 20 Nov 2018 21:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725949AbeKUI2c (ORCPT ); Wed, 21 Nov 2018 03:28:32 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:33226 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbeKUI2c (ORCPT ); Wed, 21 Nov 2018 03:28:32 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAKLsG0N119410; Tue, 20 Nov 2018 21:57:12 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=5M5oK3+uvqeSey8L6oVwZ/cBa97FNCeDMMrRxeCQ7AE=; b=m7ZKMBNxYrwghk4n+3W1WBd7ShXUpI8zLp412HBlDtdfzm0cPmOMdLhvcV139U/D6qwm ylHjPkLz0aqWKadbNM/n71l1A96dGPcqc2k0AFLRULYevUMk0PP/BBRqc2GdEpRRhASl i2nLDjZb6nnhUdVhhaftHm3Ld1Aeak9xOcgyNOZYs/R5mFFiXxyqDjWpvP8/MS6lRJDF Rbqt4XqrNElxhwCmt5H3l4OBq8DoBmUy/i9XVhNyeNPxAGgrl5HE/7uHrO3ieK1UDuUE qr9Vt4lkYavrRMYrwFziLgXqtwpw5pXI+EmOH2kbb+wP8oypwZkhbbDxJsG3HZPIcMTy Gg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2ntaxq6buu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Nov 2018 21:57:12 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wAKLv6Pp017327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Nov 2018 21:57:07 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAKLv6cX021162; Tue, 20 Nov 2018 21:57:06 GMT Received: from localhost (/10.145.178.163) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Nov 2018 13:57:06 -0800 Subject: [PATCH 04/10] fsx: add five-argument logging function 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:57:05 -0800 Message-ID: <154275102589.8611.12239624125210101030.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=925 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 Add a five-argument logging function to support new operations. Signed-off-by: Darrick J. Wong --- ltp/fsx.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 290b42f6..2372964d 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -51,7 +51,8 @@ enum opflags { FL_NONE = 0, FL_SKIPPED = 1, FL_CLOSE_OPEN = 2, FL_KEEP_SIZE = 4 struct log_entry { int operation; - int args[3]; + int nr_args; + int args[4]; enum opflags flags; }; @@ -278,6 +279,27 @@ static int op_code(const char *name) return -1; } +void +log5(int operation, int arg0, int arg1, int arg2, enum opflags flags) +{ + struct log_entry *le; + + le = &oplog[logptr]; + le->operation = operation; + if (closeopen) + flags |= FL_CLOSE_OPEN; + le->args[0] = arg0; + le->args[1] = arg1; + le->args[2] = arg2; + le->args[3] = file_size; + le->nr_args = 4; + le->flags = flags; + logptr++; + logcount++; + if (logptr >= LOGSIZE) + logptr = 0; +} + void log4(int operation, int arg0, int arg1, enum opflags flags) { @@ -290,6 +312,7 @@ log4(int operation, int arg0, int arg1, enum opflags flags) le->args[0] = arg0; le->args[1] = arg1; le->args[2] = file_size; + le->nr_args = 3; le->flags = flags; logptr++; logcount++; @@ -439,11 +462,13 @@ logdump(void) i = 0; if (logopsf) { + int j; + if (lp->flags & FL_SKIPPED) fprintf(logopsf, "skip "); - fprintf(logopsf, "%s 0x%x 0x%x 0x%x", - op_name(lp->operation), - lp->args[0], lp->args[1], lp->args[2]); + fprintf(logopsf, "%s", op_name(lp->operation)); + for (j = 0; j < lp->nr_args; j++) + fprintf(logopsf, " 0x%x", lp->args[j]); if (lp->flags & FL_KEEP_SIZE) fprintf(logopsf, " keep_size"); if (lp->flags & FL_CLOSE_OPEN) @@ -1413,6 +1438,15 @@ cleanup(int sig) exit(sig); } +static int +op_args_count(int operation) +{ + switch (operation) { + default: + return 3; + } +} + static int read_op(struct log_entry *log_entry) { @@ -1445,7 +1479,8 @@ read_op(struct log_entry *log_entry) log_entry->operation = op_code(str); if (log_entry->operation == -1) goto fail; - for (i = 0; i < 3; i++) { + log_entry->nr_args = op_args_count(log_entry->operation); + for (i = 0; i < log_entry->nr_args; i++) { char *end; str = strtok(NULL, " \t\n");