- if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA && qctl.qc_type == UGQUOTA &&
- optind == argc - 1) {
-ug_output:
- memset(&qctl, 0, sizeof(qctl)); /* spoiled by print_*_quota */
- qctl.qc_cmd = LUSTRE_Q_GETQUOTA;
- qctl.qc_valid = valid;
- qctl.qc_idx = idx;
- if (pass++ == 0) {
- qctl.qc_type = USRQUOTA;
- qctl.qc_id = geteuid();
- } else {
- qctl.qc_type = GRPQUOTA;
- qctl.qc_id = getegid();
- }
- rc = id2name(&name, qctl.qc_id,
- (qctl.qc_type == USRQUOTA) ? USER : GROUP);
- if (rc)
- name = "<unknown>";
- /* lfs quota -u username /path/to/lustre/mount */
- } else if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) {
- /* options should be followed by u/g-name and mntpoint */
- if (optind + 2 != argc || qctl.qc_type == UGQUOTA) {
- fprintf(stderr, "error: missing quota argument(s)\n");
- return CMD_HELP;
- }
+ if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA && qctl.qc_type == ALLQUOTA &&
+ optind == argc - 1) {
+all_output:
+ memset(&qctl, 0, sizeof(qctl)); /* spoiled by print_*_quota */
+ qctl.qc_cmd = LUSTRE_Q_GETQUOTA;
+ qctl.qc_valid = valid;
+ qctl.qc_idx = idx;
+ qctl.qc_type = pass;
+ switch (qctl.qc_type) {
+ case USRQUOTA:
+ qctl.qc_id = geteuid();
+ rc = uid2name(&name, qctl.qc_id);
+ break;
+ case GRPQUOTA:
+ qctl.qc_id = getegid();
+ rc = gid2name(&name, qctl.qc_id);
+ break;
+ default:
+ rc = -ENOTSUP;
+ break;
+ }
+ if (rc)
+ name = "<unknown>";
+ pass++;
+ /* lfs quota -u username /path/to/lustre/mount */
+ } else if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) {
+ /* options should be followed by u/g-name and mntpoint */
+ if (optind + 2 != argc || qctl.qc_type == ALLQUOTA) {
+ fprintf(stderr, "error: missing quota argument(s)\n");
+ return CMD_HELP;
+ }