From patchwork Wed Aug 23 15:49:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9917661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7630603FA for ; Wed, 23 Aug 2017 15:49:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9138281C3 for ; Wed, 23 Aug 2017 15:49:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADF3F284E3; Wed, 23 Aug 2017 15:49:05 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 559EF281C3 for ; Wed, 23 Aug 2017 15:49:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932262AbdHWPs4 (ORCPT ); Wed, 23 Aug 2017 11:48:56 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:37993 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932245AbdHWPsz (ORCPT ); Wed, 23 Aug 2017 11:48:55 -0400 Received: by mail-wr0-f193.google.com with SMTP id k10so305241wre.5; Wed, 23 Aug 2017 08:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/F5zwKq5bG9gpIkvCv05N/BJP1v1hh4tyzatdx06Of0=; b=KMDwAM6RKlhnAAIn7jZoTHK2LxHQysWfvPZ0i7ppBuYv04xKkQ3tBdTBWPLOAKv5y6 DMegePWbIjcmob6tRMo5qyirLqEu3/eRd5u/X5CvcH9h+dNry1Qpme8MpD5RaIQCS4dH boXeIU/DFhA5bzls5uJR+EyH5r+IYcPbAMDTY2dMntm67In2Nxc9W4eflNOudOLr1QB1 vFTM1//TfKeNOs32w/i3Vv20+3zBjIiRhn7vGjV3bvJhaIP0HCMqfPitS9oMxj0s2cIC wMU2toPEuMFUk8Y7w6k2vnWuNG6VfMdQTVJbebZcXf/kZ8NohiBl9QhSFaGdVWZ+By0I j+CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/F5zwKq5bG9gpIkvCv05N/BJP1v1hh4tyzatdx06Of0=; b=SDCnT+Gsh3DJoSFUnIShMi1Zi5Bxa3s9cJx0/OELRlkS6kFXyIJnlh5yJSIUsf68vg aOm2SSA/ujNzf+HweIvDMesKnRI7YYTpvMyWqxZYz/p59NMXyVYlHP6oeC0qmiyvVYkd fNn0HyzxutrK80PpMwhO7+wZlOvE/EkkilH68sUbvYjiUQeBCPla9DAu7FW6YDMqnLAx wH5axxUDHWuZWfdf4sgqoBLGQ1lCMjI7+GIAqxY5YUJFe43vx2pPm4tmtRGjSZ7CNwh+ gzv7yJFsgp3kS+T7KNGhZzdr5PApVOOqvqCU0d3zQ7U+I+vEa5NYZCFcNbxAsKnHQ17t pTcg== X-Gm-Message-State: AHYfb5iRWUVLwUYZkpywhA3U2C6UZ2uQEJJKuTJ5mUDCXtpkQATip79b iADbf+xNinmDKg== X-Received: by 10.223.167.145 with SMTP id j17mr1923377wrc.46.1503503334267; Wed, 23 Aug 2017 08:48:54 -0700 (PDT) Received: from localhost.localdomain (bzq-79-182-137-119.red.bezeqint.net. [79.182.137.119]) by smtp.gmail.com with ESMTPSA id a6sm1938879wrh.51.2017.08.23.08.48.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Aug 2017 08:48:53 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Josef Bacik , Christoph Hellwig , fstests@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC][PATCH 4/8] fsx: fix path of .fsx* files Date: Wed, 23 Aug 2017 18:49:13 +0300 Message-Id: <1503503357-26234-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503503357-26234-1-git-send-email-amir73il@gmail.com> References: <1503503357-26234-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When command line arg -P is used, compose the path for .fsxgood .fsxlog .fsxops files from dirpath and work file basename. This fix is ported from LTP. Signed-off-by: Amir Goldstein --- ltp/fsx.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 572df75..1502905 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -1581,7 +1581,7 @@ usage(void) " -L: fsxLite - no file creations & no file size changes\n\ -N numops: total # operations to do (default infinity)\n\ -O: use oplen (see -o flag) for every op (default random)\n\ - -P: save .fsxlog and .fsxgood files in dirpath (default ./)\n\ + -P: save .fsxlog .fsxops and .fsxgood files in dirpath (default ./)\n\ -S seed: for random # generator (default 1) 0 gets timestamp\n\ -W: mapped write operations DISabled\n\ -R: read() system calls only (mapped reads disabled)\n\ @@ -1761,6 +1761,7 @@ main(int argc, char **argv) char *endp; char goodfile[1024]; char logfile[1024]; + int dirpath = 0; struct stat statbuf; goodfile[0] = 0; @@ -1902,6 +1903,9 @@ main(int argc, char **argv) strcat(goodfile, "/"); strncpy(logfile, optarg, sizeof(logfile)); strcat(logfile, "/"); + strncpy(opsfile, optarg, sizeof(logfile)); + strcat(opsfile, "/"); + dirpath = 1; break; case 'R': mapped_reads = 0; @@ -1978,21 +1982,21 @@ main(int argc, char **argv) } } #endif - strncat(goodfile, fname, 256); + strncat(goodfile, dirpath ? basename(fname) : fname, 256); strcat (goodfile, ".fsxgood"); fsxgoodfd = open(goodfile, O_RDWR|O_CREAT|O_TRUNC, 0666); if (fsxgoodfd < 0) { prterr(goodfile); exit(92); } - strncat(logfile, fname, 256); + strncat(logfile, dirpath ? basename(fname) : fname, 256); strcat (logfile, ".fsxlog"); fsxlogf = fopen(logfile, "w"); if (fsxlogf == NULL) { prterr(logfile); exit(93); } - strncat(opsfile, fname, 256); + strncat(opsfile, dirpath ? basename(fname) : fname, 256); strcat(opsfile, ".fsxops"); unlink(opsfile);