From patchwork Thu Nov 22 17:59:06 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: 10694651 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 8E49A5A4 for ; Thu, 22 Nov 2018 17:59:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8708E2CF9B for ; Thu, 22 Nov 2018 17:59:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B5632CFA5; Thu, 22 Nov 2018 17:59:12 +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 20D2F2CF9B for ; Thu, 22 Nov 2018 17:59:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406364AbeKWEjh (ORCPT ); Thu, 22 Nov 2018 23:39:37 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:37878 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406388AbeKWEjh (ORCPT ); Thu, 22 Nov 2018 23:39:37 -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 wAMHx960100985; Thu, 22 Nov 2018 17:59:09 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=Zk2X4KrnTofiE1uFF9tE5ZVNGZkNJ/j+1y/v8vRBnuQ=; b=UFKmTid6nWSV4fwVvUR7pzkYO3cGJFHMwc6VWHVWGtth5sxysBK1IZ0T+4dNyrn7ry/w Y38jEvuHe0eDYw+SUNqcG9BCj0MfPtdIyDSP/AL9ZIieAUXQ3nPjqdnVdB9tPfAOXjBw MIq9NI+l8LMD5ekZICxwPcmgqbzQRL2IW9XI53c/Nm8hU7UXe33kYOGnHrlL+sewGp6V N58miiXb7wlZoTWffpfq05ylIHhysdIJC/EHDkJNfTBcfuXNWhPAdi6uJonTKOya6ZWN bl0Kkje3GsUozorQfwEbeJguPlrTd9IsGATVI1wjGxzm3cUM6x/sYQ7iun37zl/Kd+// LA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2ntbmqyx7g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Nov 2018 17:59:08 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAMHx7cs015374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Nov 2018 17:59:08 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAMHx7x8025791; Thu, 22 Nov 2018 17:59:07 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Nov 2018 09:59:07 -0800 Subject: [PATCH 06/12] 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: Thu, 22 Nov 2018 09:59:06 -0800 Message-ID: <154290954603.1218.7246941650070239499.stgit@magnolia> In-Reply-To: <154290950237.1218.9937108728673485814.stgit@magnolia> References: <154290950237.1218.9937108728673485814.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9085 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=951 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811220161 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 Reviewed-By: Allison Henderson --- ltp/fsx.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index dabad302..c525ba13 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");