From patchwork Mon Apr 12 11:57:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 12197853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91BA2C43460 for ; Mon, 12 Apr 2021 11:58:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66ACF6128C for ; Mon, 12 Apr 2021 11:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240792AbhDLL6o (ORCPT ); Mon, 12 Apr 2021 07:58:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:40510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240420AbhDLL6o (ORCPT ); Mon, 12 Apr 2021 07:58:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ACEF36128B; Mon, 12 Apr 2021 11:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618228706; bh=UGB/c0FLOH0LtgEKSj56k9Nox+XBtY6QJ1YphoghAnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HOWFTRryuQqjqBGIXJeYqY3stR9j2v/IJnJCfcJUsuwNp4N8c2RUtZ2ZmgxJvXerd AgbgYZrIp5iM92jRn4sAjqfMXDzQPm1w39a1fISnrA8cvdETi0Vjj0ScTXFoS11KWU RORJnC5txfPHXP/k9XPEnRku+n732d5Tmgc6/tQ8zh0GCbChH4lXh5V25Zs/wLECma 7nIp4Ssv+p3DW9pAMawJvFqVP0DgzHYyb5sK4s4MUxcp7Oq+08UfPSO234s9qRGX5z i4ZysThgtUr0vaYEyOpgiPxkFJpeQsj4DpkcQmuqJ4yDV6boG2WXRWwRkYZNGeoamC 9UWvhQ+01tIaw== From: Christian Brauner To: Eryu Guan , fstests@vger.kernel.org, Christoph Hellwig Cc: "Darrick J . Wong" , David Howells , Christian Brauner Subject: [PATCH v13 4/6] common/quota: move _qsetup() helper to common code Date: Mon, 12 Apr 2021 13:57:06 +0200 Message-Id: <20210412115708.1628386-5-brauner@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210412115708.1628386-1-brauner@kernel.org> References: <20210412115708.1628386-1-brauner@kernel.org> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=wM9Q2AdFuvVYmj1+BgTxu13NVAXYIAuRDfZKkOg26xw=; m=G9up2oLwo++96UH6tgmgi4o4ese0pNaEOzVzPn2cm5o=; p=WU5/GGIh2yNDrbksNUPmm2Bl9QB12TJxW4HV+CzVmqw=; g=03a67e8d3f5d58609a3b5e24479cc8492106b35a X-Patch-Sig: m=pgp; i=christian.brauner@ubuntu.com; s=0x0x91C61BC06578DCA2; b=iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCYHQ1gwAKCRCRxhvAZXjcohaqAQDrYJ8 8zUGwZDw0Ks4sqRxlCkCs/a9YAm6hLgbqnV33uQD7BVWzs51we+jN3w0ca+IlIU+9xHxFMA6mropI W5wHHgI= Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Christian Brauner It's already used in two tests and will be used in a third. Cc: Eryu Guan Cc: Christoph Hellwig Cc: Darrick J. Wong Cc: fstests@vger.kernel.org Suggested-by: Eryu Guan Signed-off-by: Christian Brauner --- /* v1 - v9 */ patch not present /* v10 */ patch introduced /* v11 */ unchanged /* v12 */ unchanged /* v13 */ unchanged --- common/quota | 20 ++++++++++++++++++++ tests/xfs/050 | 19 ------------------- tests/xfs/299 | 19 ------------------- 3 files changed, 20 insertions(+), 38 deletions(-) diff --git a/common/quota b/common/quota index 1437d5f7..32a9a555 100644 --- a/common/quota +++ b/common/quota @@ -329,5 +329,25 @@ _report_quota_inodes() { repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}' | sort -r } +# Determine which type of quota we're using +_qsetup() +{ + opt=$1 + enforce=0 + if [ $opt = "u" -o $opt = "uno" ]; then + type=u + eval `_choose_uid` + elif [ $opt = "g" -o $opt = "gno" ]; then + type=g + eval `_choose_gid` + elif [ $opt = "p" -o $opt = "pno" ]; then + type=p + eval `_choose_prid` + fi + [ $opt = "u" -o $opt = "g" -o $opt = "p" ] && enforce=1 + + echo "Using type=$type id=$id" >> $seqres.full +} + # make sure this script returns success /bin/true diff --git a/tests/xfs/050 b/tests/xfs/050 index 1df97537..e7c81d0a 100755 --- a/tests/xfs/050 +++ b/tests/xfs/050 @@ -69,25 +69,6 @@ _filter_and_check_blks() ' | _filter_quota_report } -_qsetup() -{ - opt=$1 - enforce=0 - if [ $opt = "u" -o $opt = "uno" ]; then - type=u - eval `_choose_uid` - elif [ $opt = "g" -o $opt = "gno" ]; then - type=g - eval `_choose_gid` - elif [ $opt = "p" -o $opt = "pno" ]; then - type=p - eval `_choose_prid` - fi - [ $opt = "u" -o $opt = "g" -o $opt = "p" ] && enforce=1 - - echo "Using type=$type id=$id" >> $seqres.full -} - _exercise() { _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs diff --git a/tests/xfs/299 b/tests/xfs/299 index b862e67e..26b7fcfd 100755 --- a/tests/xfs/299 +++ b/tests/xfs/299 @@ -62,25 +62,6 @@ _filter_and_check_blks() ' | _filter_quota_report } -_qsetup() -{ - opt=$1 - enforce=0 - if [ $opt = "u" -o $opt = "uno" ]; then - type=u - eval `_choose_uid` - elif [ $opt = "g" -o $opt = "gno" ]; then - type=g - eval `_choose_gid` - elif [ $opt = "p" -o $opt = "pno" ]; then - type=p - eval `_choose_prid` - fi - [ $opt = "u" -o $opt = "g" -o $opt = "p" ] && enforce=1 - - echo "Using type=$type id=$id" >> $seqres.full -} - _exercise() {