From 4b62b7d4e1c261ae1c134662f05de370780b6eca Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 30 Mar 2016 14:19:03 +0200 Subject: edquota: Project quota support Signed-off-by: Li Xi Signed-off-by: Jan Kara --- edquota.8 | 34 ++++++++++++++++++++++------------ edquota.c | 17 ++++++++++++----- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/edquota.8 b/edquota.8 index fefb5d4..85ad762 100644 --- a/edquota.8 +++ b/edquota.8 @@ -8,7 +8,8 @@ edquota \- edit user quotas .I protoname ] [ .BR \-u \ | -.B \-g +.BR \-g \ | +.B \-P ] [ .B \-rm ] [ @@ -18,12 +19,15 @@ edquota \- edit user quotas .B \-f .I filesystem ] -.IR username .\|.\|. +.IR username \ | +.IR groupname \ | +.IR projectname .\|.\|. .LP .B edquota [ .BR \-u \ | -.B \-g +.BR \-g \ | +.B \-P ] [ .B \-F .I format-name @@ -36,7 +40,8 @@ edquota \- edit user quotas .B edquota [ .BR \-u \ | -.B \-g +.BR \-g \ | +.B \-P ] [ .B \-F .I format-name @@ -46,7 +51,8 @@ edquota \- edit user quotas ] .B \-T .IR username \ | -.IR groupname .\|.\|. +.IR groupname \ | +.IR projectname .\|.\|. .SH DESCRIPTION .IX "edquota command" "" "\fLedquota\fP \(em edit user quotas" .IX edit "user quotas \(em \fLedquota\fP" @@ -55,16 +61,17 @@ edquota \- edit user quotas .IX "quotas" "edquota command" "" "\fLedquota\fP \(em edit user quotas" .IX "filesystem" "edquota command" "" "\fLedquota\fP \(em edit user quotas" .B edquota -is a quota editor. One or more users or groups may be specified on the command -line. If a number is given in the place of user/group name it is treated as -an UID/GID. For each user or group a temporary file is created with an +is a quota editor. One or more users, groups, or projects may be specified +on the command line. If a number is given in the place of user/group/project +name it is treated as an UID/GID/Project ID. For each user, group, or project +a temporary file is created with an .SM ASCII -representation of the current disk quotas for that user or group and an editor -is then invoked on the file. The quotas may then be modified, new +representation of the current disk quotas for that user, group, or project and +an editor is then invoked on the file. The quotas may then be modified, new quotas added, etc. Setting a quota to zero indicates that no quota should be imposed. .PP -Block usage and limits are reported and interpereted as multiples of kibibyte +Block usage and limits are reported and interpreted as multiples of kibibyte (1024 bytes) blocks by default. Symbols K, M, G, and T can be appended to numeric value to express kibibytes, mebibytes, gibibytes, and tebibytes. .PP @@ -119,6 +126,9 @@ Edit the user quota. This is the default. .B -g, --group Edit the group quota. .TP +.B -P, --project +Edit the project quota. +.TP .B -p, --prototype=\f2protoname\f1 Duplicate the quotas of the prototypical user specified for each user specified. This is the normal @@ -156,7 +166,7 @@ are understood. Time limits are printed in the greatest possible time unit such the value is greater than or equal to one. .TP .B \-T, --edit-times -Edit time for the user/group when softlimit is enforced. Possible values +Edit time for the user/group/project when softlimit is enforced. Possible values are 'unset' or number and unit. Units are the same as in .B \-t option. diff --git a/edquota.c b/edquota.c index f161bf3..71b28b6 100644 --- a/edquota.c +++ b/edquota.c @@ -80,11 +80,14 @@ static void usage(void) #endif errstr(_("Usage:\n\tedquota %1$s[-u] [-F formatname] [-p username] [-f filesystem] username ...\n\ \tedquota %1$s-g [-F formatname] [-p groupname] [-f filesystem] groupname ...\n\ -\tedquota [-u|g] [-F formatname] [-f filesystem] -t\n\ -\tedquota [-u|g] [-F formatname] [-f filesystem] -T username|groupname ...\n"), rpcflag); +\tedquota %1$s-P [-F formatname] [-p projectname] [-f filesystem] projectname ...\n\ +\tedquota [-u|g|-P] [-F formatname] [-f filesystem] -t\n\ +\tedquota [-u|g|-P] [-F formatname] [-f filesystem] -T username|groupname|projectname ...\n"), rpcflag); fputs(_("\n\ -u, --user edit user data\n\ --g, --group edit group data\n"), stderr); +-g, --group edit group data\n\ +-P, --project edit project data\n\ +"), stderr); #if defined(RPC_SETQUOTA) fputs(_("-r, --remote edit remote quota (via RPC)\n\ -m, --no-mixed-pathnames trim leading slashes from NFSv4 mountpoints\n"), stderr); @@ -111,6 +114,7 @@ static int parse_options(int argc, char **argv) { "prototype", 1, NULL, 'p' }, { "user", 0, NULL, 'u' }, { "group", 0, NULL, 'g' }, + { "project", 0, NULL, 'P' }, { "format", 1, NULL, 'F' }, { "filesystem", 1, NULL, 'f' }, #if defined(RPC_SETQUOTA) @@ -128,9 +132,9 @@ static int parse_options(int argc, char **argv) quotatype = USRQUOTA; #if defined(RPC_SETQUOTA) - while ((ret = getopt_long(argc, argv, "ughrmntTVp:F:f:", long_opts, NULL)) != -1) { + while ((ret = getopt_long(argc, argv, "ugPhrmntTVp:F:f:", long_opts, NULL)) != -1) { #else - while ((ret = getopt_long(argc, argv, "ughtTVp:F:f:", long_opts, NULL)) != -1) { + while ((ret = getopt_long(argc, argv, "ugPhtTVp:F:f:", long_opts, NULL)) != -1) { #endif switch (ret) { case 'p': @@ -139,6 +143,9 @@ static int parse_options(int argc, char **argv) case 'g': quotatype = GRPQUOTA; break; + case 'P': + quotatype = PRJQUOTA; + break; #if defined(RPC_SETQUOTA) case 'n': case 'r': -- cgit v1.2.3