From patchwork Wed Sep 14 15:19:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill O'Donnell X-Patchwork-Id: 9331865 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 80CEE607FD for ; Wed, 14 Sep 2016 15:20:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 730E4284A6 for ; Wed, 14 Sep 2016 15:20:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6582D29F1E; Wed, 14 Sep 2016 15:20:24 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 02D1A2A12A for ; Wed, 14 Sep 2016 15:20:23 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 2E4D67CAE; Wed, 14 Sep 2016 10:20:17 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (Postfix) with ESMTP id 041677CA0 for ; Wed, 14 Sep 2016 10:20:15 -0500 (CDT) Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by relay1.corp.sgi.com (Postfix) with ESMTP id C88BE8F8040 for ; Wed, 14 Sep 2016 08:20:14 -0700 (PDT) X-ASG-Debug-ID: 1473866413-0bf57b0f53296180001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id QVzHBAz626aYyP4T (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 14 Sep 2016 08:20:13 -0700 (PDT) X-Barracuda-Envelope-From: billodo@redhat.com X-Barracuda-Effective-Source-IP: mx1.redhat.com[209.132.183.28] X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-ASG-Whitelist: Client Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A2744E4EF; Wed, 14 Sep 2016 15:20:13 +0000 (UTC) Received: from localhost.localdomain.com (unused [10.10.50.234] (may be forged)) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8EFKADO028181; Wed, 14 Sep 2016 11:20:12 -0400 From: "Bill O'Donnell" To: linux-xfs@vger.kernel.org Subject: [PATCH 2/3] xfs_quota: print and path output formatting: maintain reverse compatibility Date: Wed, 14 Sep 2016 10:19:40 -0500 X-ASG-Orig-Subj: [PATCH 2/3] xfs_quota: print and path output formatting: maintain reverse compatibility Message-Id: <1473866381-28975-3-git-send-email-billodo@redhat.com> In-Reply-To: <1473866381-28975-1-git-send-email-billodo@redhat.com> References: <1473866381-28975-1-git-send-email-billodo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 14 Sep 2016 15:20:13 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1473866413 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.176.25:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 3320 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 Cc: xfs@oss.sgi.com X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP This patch adjusts the formatting of the xfs_quota print and path outputs, in order to maintain reverse compatability: when -f flag isn't used, need to keep the output same as in previous version. Signed-off-by: Bill O'Donnell --- quota/path.c | 67 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/quota/path.c b/quota/path.c index aa3d33e..ed9c044 100644 --- a/quota/path.c +++ b/quota/path.c @@ -36,39 +36,50 @@ printpath( int c; if (index == 0) { - printf(_("%sFilesystem Pathname\n"), - number ? _(" ") : ""); + if (foreign_allowed) + printf(_("%s Filesystem Pathname\n"), + number ? _(" ") : ""); + else + printf(_("%sFilesystem Pathname\n"), + number ? _(" ") : ""); } if (number) { printf(_("%c%03d%c "), braces? '[':' ', index, braces? ']':' '); } - printf("%s ", (path->fs_flags & FS_FOREIGN) ? "(F)" : " "); - printf(_("%-19s %s"), path->fs_dir, path->fs_name); - if (path->fs_flags & FS_PROJECT_PATH) { - prj = getprprid(path->fs_prid); - printf(_(" (project %u"), path->fs_prid); - if (prj) - printf(_(", %s"), prj->pr_name); - printf(")"); - } else if (xfsquotactl(XFS_GETQSTAT, path->fs_name, 0, 0, - (void *)&qstat) == 0 && qstat.qs_flags) { - c = 0; - printf(" ("); - if (qstat.qs_flags & XFS_QUOTA_UDQ_ENFD) - c = printf("uquota"); - else if (qstat.qs_flags & XFS_QUOTA_UDQ_ACCT) - c = printf("uqnoenforce"); - if (qstat.qs_flags & XFS_QUOTA_GDQ_ENFD) - c = printf("%sgquota", c ? ", " : ""); - else if (qstat.qs_flags & XFS_QUOTA_GDQ_ACCT) - c = printf("%sgqnoenforce", c ? ", " : ""); - if (qstat.qs_flags & XFS_QUOTA_PDQ_ENFD) - printf("%spquota", c ? ", " : ""); - else if (qstat.qs_flags & XFS_QUOTA_PDQ_ACCT) - printf("%spqnoenforce", c ? ", " : ""); - printf(")"); + if (!((path->fs_flags & FS_FOREIGN) && !foreign_allowed)) { + printf("%s", (path->fs_flags & FS_FOREIGN) ? "(F) " : ""); + if (path->fs_flags & FS_FOREIGN) + printf(_("%-19s %s"), path->fs_dir, path->fs_name); + else if (foreign_allowed) + printf(_(" %-19s %s"), path->fs_dir, path->fs_name); + else + printf(_("%-19s %s"), path->fs_dir, path->fs_name); + if (path->fs_flags & FS_PROJECT_PATH) { + prj = getprprid(path->fs_prid); + printf(_(" (project %u"), path->fs_prid); + if (prj) + printf(_(", %s"), prj->pr_name); + printf(")"); + } else if (xfsquotactl(XFS_GETQSTAT, path->fs_name, 0, 0, + (void *)&qstat) == 0 && qstat.qs_flags) { + c = 0; + printf(" ("); + if (qstat.qs_flags & XFS_QUOTA_UDQ_ENFD) + c = printf("uquota"); + else if (qstat.qs_flags & XFS_QUOTA_UDQ_ACCT) + c = printf("uqnoenforce"); + if (qstat.qs_flags & XFS_QUOTA_GDQ_ENFD) + c = printf("%sgquota", c ? ", " : ""); + else if (qstat.qs_flags & XFS_QUOTA_GDQ_ACCT) + c = printf("%sgqnoenforce", c ? ", " : ""); + if (qstat.qs_flags & XFS_QUOTA_PDQ_ENFD) + printf("%spquota", c ? ", " : ""); + else if (qstat.qs_flags & XFS_QUOTA_PDQ_ACCT) + printf("%spqnoenforce", c ? ", " : ""); + printf(")"); + } + printf("\n"); } - printf("\n"); } static int