summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-03-30 13:36:13 +0200
committerJan Kara <jack@suse.cz>2016-03-31 10:28:43 +0200
commit9e2f4616f30b55d442fdd7940824f265c172aac1 (patch)
tree0af717d1cfe143e866ee479984753612b2dcaac6
parentded2822490905c499375a4eef9432dba831950a8 (diff)
downloadquota-tools-9e2f4616f30b55d442fdd7940824f265c172aac1.tar.gz
quotasync: Add project quota support
Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--quotasync.17
-rw-r--r--quotasync.c15
2 files changed, 17 insertions, 5 deletions
diff --git a/quotasync.1 b/quotasync.1
index e968403..d2204be 100644
--- a/quotasync.1
+++ b/quotasync.1
@@ -4,13 +4,13 @@ quotasync \- synchronize in-kernel file system usage and limits to disk format
.SH SYNOPSIS
.B quotasync
[
-.B -ug
+.B -ugP
]
.IR mount-point ...
.br
.B quotasync
[
-.B -ug
+.B -ugP
]
.B -a
.br
@@ -34,6 +34,9 @@ Synchronize user usage and limits.
.B -g, --group
Synchronize group usage and limits.
.TP
+.B -P, --project
+Synchronize project usage and limits.
+.TP
.B -a, --all
Synchronize usage and limits on all file systems. You have to specify this
option or to specify desired file systems.
diff --git a/quotasync.c b/quotasync.c
index 99bb3a0..78a63c2 100644
--- a/quotasync.c
+++ b/quotasync.c
@@ -15,6 +15,7 @@
#define FL_USER 1 /* sync user quotas */
#define FL_GROUP 2 /* sync group quotas */
#define FL_ALL 4 /* sync quotas on all filesystems */
+#define FL_PROJECT 8 /* sync group quotas */
static int flags, fmt = -1;
static char **mnt;
@@ -25,8 +26,8 @@ static void usage(int status)
{
printf(_(
"%1$s: Utility for syncing quotas.\n"
-"Usage: %1$s [-ug] mount-point...\n"
-" or: %1$s [-ug] -a\n"
+"Usage: %1$s [-ugP] mount-point...\n"
+" or: %1$s [-ugP] -a\n"
" or: %1$s -h | -V\n"
"\n"
), progname);
@@ -34,6 +35,7 @@ static void usage(int status)
"Options:\n"
"-u, --user synchronize user quotas\n"
"-g, --group synchronize group quotas\n"
+"-P, --project synchronize project quotas\n"
"-a, --all synchronize quotas for all mounted file systems\n"
"-h, --help display this help message and exit\n"
"-V, --version display version information and exit\n"
@@ -49,13 +51,14 @@ static void parse_options(int argcnt, char **argstr)
struct option long_opts[] = {
{ "user", 0, NULL, 'u' },
{ "group", 0, NULL, 'g' },
+ { "project", 0, NULL, 'P' },
{ "all", 0, NULL, 'a' },
{ "version", 0, NULL, 'V' },
{ "help", 0, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
- while ((ret = getopt_long(argcnt, argstr, "ahugV", long_opts, NULL)) != -1) {
+ while ((ret = getopt_long(argcnt, argstr, "ahugPV", long_opts, NULL)) != -1) {
switch (ret) {
case '?':
usage(EXIT_FAILURE);
@@ -70,6 +73,9 @@ static void parse_options(int argcnt, char **argstr)
case 'g':
flags |= FL_GROUP;
break;
+ case 'P':
+ flags |= FL_PROJECT;
+ break;
case 'a':
flags |= FL_ALL;
break;
@@ -142,5 +148,8 @@ int main(int argc, char **argv)
if (flags & FL_GROUP)
if (syncquotas(GRPQUOTA))
ret = EXIT_FAILURE;
+ if (flags & FL_PROJECT)
+ if (syncquotas(PRJQUOTA))
+ ret = EXIT_FAILURE;
return ret;
}