[PATCH 2/3] xfs_quota: print and path output formatting: maintain reverse compatibility
Bill O'Donnell
billodo at redhat.com
Wed Sep 14 10:19:40 CDT 2016
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 <billodo at redhat.com>
---
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
--
2.7.4
More information about the xfs
mailing list