#include "debugfs.h"
-const char *quota_type[] = { "user", "group", NULL };
+const char *quota_type[] = { "user", "group", "project", NULL };
static int load_quota_ctx(char *progname)
{
if (check_fs_open(progname))
return 1;
- if (!EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super,
- EXT4_FEATURE_RO_COMPAT_QUOTA)) {
- com_err(progname, 0, "quota feature not eanbled");
+ if (!ext2fs_has_feature_quota(current_fs->super)) {
+ com_err(progname, 0, "quota feature not enabled");
return 1;
}
if (current_qctx)
return 0;
- retval = quota_init_context(¤t_qctx, current_fs, -1);
+ retval = quota_init_context(¤t_qctx, current_fs, 0);
if (retval) {
com_err(current_fs->device_name, retval,
"while trying to load quota information");
}
-static int list_quota_callback(struct dquot *dq, void *cb_data)
+static int list_quota_callback(struct dquot *dq,
+ void *cb_data EXT2FS_ATTR((unused)))
{
- printf("%8u %8lld %8lld %8lld %8lld %8lld %8lld\n",
- dq->dq_id, dq->dq_dqb.dqb_curspace,
- dq->dq_dqb.dqb_bsoftlimit, dq->dq_dqb.dqb_bhardlimit,
- dq->dq_dqb.dqb_curinodes,
- dq->dq_dqb.dqb_isoftlimit, dq->dq_dqb.dqb_ihardlimit);
+ printf("%10u %8lld %8lld %8lld %8lld %8lld %8lld\n",
+ dq->dq_id, (long long)dq->dq_dqb.dqb_curspace,
+ (long long)dq->dq_dqb.dqb_bsoftlimit,
+ (long long)dq->dq_dqb.dqb_bhardlimit,
+ (long long)dq->dq_dqb.dqb_curinodes,
+ (long long)dq->dq_dqb.dqb_isoftlimit,
+ (long long)dq->dq_dqb.dqb_ihardlimit);
return 0;
}
-void do_list_quota(int argc, char *argv[])
+void do_list_quota(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+ void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
- int i, type;
- int flags = 0;
+ int type;
struct quota_handle *qh;
if (load_quota_ctx(argv[0]))
if (type < 0)
return;
- printf("%8s %8s %8s %8s %8s %8s %8s\n",
- (type == 0) ? "user id" : "group id",
+ printf("%7s %2s %8s %8s %8s %8s %8s %8s\n",
+ quota_type[type], "id",
"blocks", "quota", "limit", "inodes", "quota", "limit");
qh = current_qctx->quota_file[type];
retval = qh->qh_ops->scan_dquots(qh, list_quota_callback, NULL);
}
}
-void do_get_quota(int argc, char *argv[])
+void do_get_quota(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+ void *infop EXT2FS_ATTR((unused)))
{
- errcode_t retval;
- int i, err, type;
- int flags = 0;
+ int err, type;
struct quota_handle *qh;
struct dquot *dq;
qid_t id;
if (err)
return;
- printf("%8s %8s %8s %8s %8s %8s %8s\n",
- (type == 0) ? "user id" : "group id",
+ printf("%7s %2s %8s %8s %8s %8s %8s %8s\n",
+ quota_type[type], "id",
"blocks", "quota", "limit", "inodes", "quota", "limit");
qh = current_qctx->quota_file[type];
if (dq) {
list_quota_callback(dq, NULL);
ext2fs_free_mem(&dq);
- } else
+ } else {
com_err(argv[0], 0, "couldn't read quota record");
-
+ }
}