Skip to content
Snippets Groups Projects
Commit 488fffaa authored by Cliff White's avatar Cliff White
Browse files

b=13457
i=brian
i=nathan
parent 03365f9f
No related branches found
No related tags found
No related merge requests found
...@@ -142,7 +142,7 @@ command_t cmdlist[] = { ...@@ -142,7 +142,7 @@ command_t cmdlist[] = {
"usage: setquota [ -u | -g ] <name> <block-softlimit> <block-hardlimit> <inode-softlimit> <inode-hardlimit> <filesystem>\n" "usage: setquota [ -u | -g ] <name> <block-softlimit> <block-hardlimit> <inode-softlimit> <inode-hardlimit> <filesystem>\n"
" setquota -t [ -u | -g ] <block-grace> <inode-grace> <filesystem>"}, " setquota -t [ -u | -g ] <block-grace> <inode-grace> <filesystem>"},
{"quota", lfs_quota, 0, "Display disk usage and limits.\n" {"quota", lfs_quota, 0, "Display disk usage and limits.\n"
"usage: quota [ -o obd_uuid ] [ -u | -g ] [name] <filesystem>"}, "usage: quota [ -o obd_uuid ] [{-u|-g <name>}|-t] <filesystem>"},
#endif #endif
{"flushctx", lfs_flushctx, 0, "Flush security context for current user.\n" {"flushctx", lfs_flushctx, 0, "Flush security context for current user.\n"
"usage: flushctx [-k] [mountpoint...]"}, "usage: flushctx [-k] [mountpoint...]"},
...@@ -1393,7 +1393,7 @@ static void print_quota_title(char *name, struct if_quotactl *qctl) ...@@ -1393,7 +1393,7 @@ static void print_quota_title(char *name, struct if_quotactl *qctl)
*type2name(qctl->qc_type), qctl->qc_id); *type2name(qctl->qc_type), qctl->qc_id);
printf("%15s%8s %7s%8s%8s%8s %7s%8s%8s\n", printf("%15s%8s %7s%8s%8s%8s %7s%8s%8s\n",
"Filesystem", "Filesystem",
"blocks", "quota", "limit", "grace", "kbytes", "quota", "limit", "grace",
"files", "quota", "limit", "grace"); "files", "quota", "limit", "grace");
} }
...@@ -1536,22 +1536,20 @@ static int lfs_quota(int argc, char **argv) ...@@ -1536,22 +1536,20 @@ static int lfs_quota(int argc, char **argv)
{ {
int c; int c;
char *name = NULL, *mnt; char *name = NULL, *mnt;
struct if_quotactl qctl; struct if_quotactl qctl = { .qc_cmd = LUSTRE_Q_GETQUOTA,
.qc_type = 0x01 };
char *obd_type = qctl.obd_type; char *obd_type = qctl.obd_type;
char *obd_uuid = qctl.obd_uuid.uuid; char *obd_uuid = qctl.obd_uuid.uuid;
int rc; int rc;
memset(&qctl, 0, sizeof(qctl));
qctl.qc_cmd = LUSTRE_Q_GETQUOTA;
optind = 0; optind = 0;
while ((c = getopt(argc, argv, "ugto:")) != -1) { while ((c = getopt(argc, argv, "ugto:")) != -1) {
switch (c) { switch (c) {
case 'u': case 'u':
qctl.qc_type |= 0x01; qctl.qc_type = 0x01;
break; break;
case 'g': case 'g':
qctl.qc_type |= 0x02; qctl.qc_type = 0x02;
break; break;
case 't': case 't':
qctl.qc_cmd = LUSTRE_Q_GETINFO; qctl.qc_cmd = LUSTRE_Q_GETINFO;
...@@ -1569,25 +1567,23 @@ static int lfs_quota(int argc, char **argv) ...@@ -1569,25 +1567,23 @@ static int lfs_quota(int argc, char **argv)
if (qctl.qc_type) if (qctl.qc_type)
qctl.qc_type--; qctl.qc_type--;
if (qctl.qc_type == UGQUOTA) {
fprintf(stderr, "error: user or group can't be specified"
"both\n");
return CMD_HELP;
}
if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) { if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) {
if (optind + 2 != argc) if (optind + 2 != argc) {
fprintf(stderr, "error: missing quota argument(s)\n");
return CMD_HELP; return CMD_HELP;
}
name = argv[optind++]; name = argv[optind++];
rc = name2id(&qctl.qc_id, name, qctl.qc_type); rc = name2id(&qctl.qc_id, name, qctl.qc_type);
if (rc) { if (rc) {
fprintf(stderr, "error: find id for name %s failed: %s\n", fprintf(stderr,"error: can't find id for name %s: %s\n",
name, strerror(errno)); name, strerror(errno));
return CMD_HELP; return CMD_HELP;
} }
print_quota_title(name, &qctl); print_quota_title(name, &qctl);
} else if (optind + 1 != argc) { } else if (optind + 1 != argc) {
fprintf(stderr, "error: missing quota info argument(s)\n");
return CMD_HELP; return CMD_HELP;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment