diff --git a/quota-4.05-quota-Add-filesystem-option.patch b/quota-4.05-quota-Add-filesystem-option.patch new file mode 100644 index 0000000..2914db2 --- /dev/null +++ b/quota-4.05-quota-Add-filesystem-option.patch @@ -0,0 +1,115 @@ +From 4aac5400dfd61416ffe7ff912f32061854e57e45 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Mon, 21 Sep 2020 13:28:45 +0200 +Subject: [PATCH] quota: Add --filesystem option +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add option --filesystem to specify filesystem to report quotas for while +still maintaining the capability of specifying also names to report +quotas for. + +Signed-off-by: Jan Kara +Signed-off-by: Petr Písař +--- + quota.1 | 9 +++++++++ + quota.c | 23 +++++++++++++++++++---- + 2 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/quota.1 b/quota.1 +index 8166853..f2195a1 100644 +--- a/quota.1 ++++ b/quota.1 +@@ -142,6 +142,15 @@ device. + .B -f, --filesystem-list + report quotas only for filesystems specified on command line. + .TP ++.B --filesystem=\f2path\f1 ++report quotas only for filesystem ++.BR path . ++This option can be specified multiple types and quota will be reported for each ++specified filesystem. Unlike command line option ++.B -f ++remaining command like arguments are still treated as user / group / project names ++to report. ++.TP + .B -m, --no-mixed-pathnames + Currently, pathnames of NFSv4 mountpoints are sent without leading slash in the path. + .BR rpc.rquotad +diff --git a/quota.c b/quota.c +index b453ee3..a6ed61f 100644 +--- a/quota.c ++++ b/quota.c +@@ -82,6 +82,9 @@ static void usage(void) + -F, --format=formatname display quota of a specific format\n\ + -f, --filesystem-list display quota information only for given\n\ + filesystems\n\ ++ --filesystem=path display quota information only for given\n\ ++ filesystem, remaining command line arguments\n\ ++ are still treated as user/group/project names\n\ + -A, --all-nfs display quota for all NFS mountpoints\n\ + -m, --no-mixed-pathnames trim leading slashes from NFSv4 mountpoints\n\ + --show-mntpoint show mount point of the file system in output\n\ +@@ -287,6 +290,8 @@ int main(int argc, char **argv) + { + int ngroups; + gid_t gidset[NGROUPS_MAX], *gidsetp; ++ char **fsnames = NULL; ++ int fscount = 0; + int i, ret, type = 0; + struct option long_opts[] = { + { "help", 0, NULL, 'h' }, +@@ -309,6 +314,7 @@ int main(int argc, char **argv) + { "no-mixed-pathnames", 0, NULL, 'm' }, + { "show-mntpoint", 0, NULL, 257 }, + { "hide-device", 0, NULL, 258 }, ++ { "filesystem", 1, NULL, 259 }, + { NULL, 0, NULL, 0 } + }; + +@@ -377,6 +383,13 @@ int main(int argc, char **argv) + case 258: + flags &= ~FL_SHOW_DEVICE; + break; ++ case 259: ++ fscount++; ++ fsnames = reallocarray(fsnames, fscount, sizeof(char *)); ++ if (!fsnames) ++ die(1, _("Not enough memory for filesystem names")); ++ fsnames[fscount - 1] = optarg; ++ break; + case 'V': + version(); + exit(0); +@@ -390,8 +403,10 @@ int main(int argc, char **argv) + + if (!(flags & FL_USER) && !(flags & FL_GROUP) && !(flags & FL_PROJECT)) + flags |= FL_USER; +- if (flags & FL_FSLIST && flags & (FL_LOCALONLY | FL_NOAUTOFS)) ++ if (((flags & FL_FSLIST) || fscount) && flags & (FL_LOCALONLY | FL_NOAUTOFS)) + errstr(_("Warning: Ignoring -%c when filesystem list specified.\n"), flags & FL_LOCALONLY ? 'l' : 'i'); ++ if (fscount && flags & FL_FSLIST) ++ die(1, "Cannot use both --filesystem and -f"); + + init_kernel_interface(); + +@@ -432,12 +447,12 @@ int main(int argc, char **argv) + + if (flags & FL_USER) + for (; argc > 0; argc--, argv++) +- ret |= showquotas(USRQUOTA, user2uid(*argv, !!(flags & FL_NUMNAMES), NULL), 0, NULL); ++ ret |= showquotas(USRQUOTA, user2uid(*argv, !!(flags & FL_NUMNAMES), NULL), fscount, fsnames); + else if (flags & FL_GROUP) + for (; argc > 0; argc--, argv++) +- ret |= showquotas(GRPQUOTA, group2gid(*argv, !!(flags & FL_NUMNAMES), NULL), 0, NULL); ++ ret |= showquotas(GRPQUOTA, group2gid(*argv, !!(flags & FL_NUMNAMES), NULL), fscount, fsnames); + else if (flags & FL_PROJECT) + for (; argc > 0; argc--, argv++) +- ret |= showquotas(PRJQUOTA, project2pid(*argv, !!(flags & FL_NUMNAMES), NULL), 0, NULL); ++ ret |= showquotas(PRJQUOTA, project2pid(*argv, !!(flags & FL_NUMNAMES), NULL), fscount, fsnames); + return ret; + } +-- +2.25.4 + diff --git a/quota.spec b/quota.spec index b575c63..78c7026 100644 --- a/quota.spec +++ b/quota.spec @@ -117,6 +117,8 @@ Patch23: quota-4.05-Handle-grace-time-overflows-for-XFS-quotas.patch # Add a synopsis for a project quota option in the quota tool, # in upstream after 4.05 Patch24: quota-4.05-quota-Add-synopsis-for-project-quota.patch +# Add a --filesystem option to the quota tool, in upstream after 4.05 +Patch25: quota-4.05-quota-Add-filesystem-option.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -262,6 +264,7 @@ Linux/UNIX environment. %patch22 -p1 %patch23 -p1 %patch24 -p1 +%patch25 -p1 # Regenerate build scripts autoreconf -f -i @@ -414,6 +417,7 @@ make check * Fri Nov 06 2020 Petr Pisar - 1:4.05-17 - Support grace period expirations past 2038 year for XFS - Add a synopsis for a project quota option in the quota tool +- Add a --filesystem option to the quota tool * Wed Sep 02 2020 Petr Pisar - 1:4.05-16 - Require libtirpc-devel by quota-devel because of rpc/rpc.h