Received: by 2002:a6b:7707:0:0:0:0:0 with SMTP id n7csp971510iom; Thu, 9 Jun 2022 15:04:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeb9Et2MdFiRe+P/Ipkucfe5GPCMwIOWzOqachhK1KK1oYAhGEwuEYPzpFcKA1rJgZ89ki X-Received: by 2002:a17:906:7254:b0:6fe:5637:cbe6 with SMTP id n20-20020a170906725400b006fe5637cbe6mr37494332ejk.612.1654812285970; Thu, 09 Jun 2022 15:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654812285; cv=none; d=google.com; s=arc-20160816; b=tMgTxmzuQow8wHR0Dy7Km/kTCxIiNkNzvUft0nWUoHgL+HkOAk6/xdLIndspfRDrB3 NKlJm9goKT/kRd/6VgVOFp5X5XCcBC56zfJCmLPrE+mBVBXRmYTGYwTyA67VHrmRqRNG pqf7ADH2PGj4++rA9o5oMrc1agf8nQy6hp+hgfG7fIMjIsPizZHIPcwxJ02vVgkRO8kV IiVgroKie+57QeAcnry0mAdyewVk7rwtFbqsgipc1dc6UrleetjN61BbwUPmzWRnKPhZ h8q6KBUOqh1DPBx1/PwhzCAe3VQCZnwWPXWxuoOcvzoxB0fDU7jgNwFljgBx1SAz+QUW sP2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=1hrv4TBYgQiiDQzAMJuRcEJYK6Fsk+bBkGixpkqTdrg=; b=a1FjOPGaf5X3uiUPU2+yq/MK5wgYzdy23Eg0eGZUfvHqUxl69d+kBK83VUk+tLxTCu WSxSkxMI9+VHL5nwMBWC5MeqUqXHxd21PHU/ahq+XkLYkCBkxHmrvDcc+mfKDeLGki88 5KS/jMw19HKk1CAme3bAE2Uk4C07QSDY6dpMyHHxuscwv8yZ6L7eABpEKF1b6goRlfi8 Ug3HLj40dCo0h9gcoGi/zERnjcANHcFEBy0r5XkBDhpopDkXtB67w2XMuuRBs1Hz5dHa xx94l+qYdO6wcnl7YSkvj33GJMkWi2roe615FbZUkUl61LbYtDplmnFhL4eGhtJpSRTI 7OEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=beFHBqPD; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bn7-20020a170906c0c700b006fdeef08e53si5551754ejb.380.2022.06.09.15.04.18; Thu, 09 Jun 2022 15:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=beFHBqPD; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239775AbiFIVmn (ORCPT + 99 others); Thu, 9 Jun 2022 17:42:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239526AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5360E66CAA for ; Thu, 9 Jun 2022 14:42:35 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D4B4A22091; Thu, 9 Jun 2022 21:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810953; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1hrv4TBYgQiiDQzAMJuRcEJYK6Fsk+bBkGixpkqTdrg=; b=beFHBqPDfNmv747aSXkHCkv1rumqF8ZzGLOCggc1TQP6YWlWzjVR2mB/uTf04fMC7CWR6u l8LItaUc3nLgfWJS4V9igdNN3ktjW1O38YDftqJjikN3Icj5ELdwyjpsAJzEtkYsS/+dqI NJM+UhMOaMN7Ipl54WmI7rqIQfdt3c4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810953; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1hrv4TBYgQiiDQzAMJuRcEJYK6Fsk+bBkGixpkqTdrg=; b=sdF0lNGtPoLZUjeDpeuleInQvcctbpC9vXZmgVbZ+yCiyZYwz+UowM4ly0ZcU1o/xnn0ti A+SUpuIL+jS9CEBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3CD0E13A8C; Thu, 9 Jun 2022 21:42:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aAa2DUlpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:33 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , Steve Dickson , linux-nfs@vger.kernel.org, Chuck Lever , "J . Bruce Fields" , Trond Myklebust , Alexey Kodanev Subject: [PATCH v2 7/9] tst_device: Add clear command Date: Thu, 9 Jun 2022 23:42:21 +0200 Message-Id: <20220609214223.4608-8-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org clearing block device will be needed for TST_ALL_FILESYSTEMS implementation in shell API. Now we clear device during acquire, but we will reuse this device for each tested filesystem, thus we need a separate command for it. Signed-off-by: Petr Vorel --- testcases/lib/tst_device.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c index d6b74a5ff..45f77a38b 100644 --- a/testcases/lib/tst_device.c +++ b/testcases/lib/tst_device.c @@ -18,8 +18,10 @@ static struct tst_test test = { static void print_help(void) { - fprintf(stderr, "\nUsage: tst_device acquire [size [filename]]\n"); - fprintf(stderr, " or: tst_device release /path/to/device\n\n"); + fprintf(stderr, "\nUsage:\n"); + fprintf(stderr, "tst_device acquire [size [filename]]\n"); + fprintf(stderr, "tst_device release /path/to/device\n"); + fprintf(stderr, "tst_device clear /path/to/device\n\n"); } static int acquire_device(int argc, char *argv[]) @@ -72,6 +74,17 @@ static int release_device(int argc, char *argv[]) return tst_detach_device(argv[2]); } +static int clear_device(int argc, char *argv[]) +{ + if (argc != 3) + return 1; + + if (tst_clear_device(argv[2])) + return 1; + + return 0; +} + int main(int argc, char *argv[]) { /* @@ -94,6 +107,9 @@ int main(int argc, char *argv[]) } else if (!strcmp(argv[1], "release")) { if (release_device(argc, argv)) goto help; + } else if (!strcmp(argv[1], "clear")) { + if (clear_device(argc, argv)) + goto help; } else { fprintf(stderr, "ERROR: Invalid COMMAND '%s'\n", argv[1]); goto help; -- 2.36.1