* GPL HEADER END
*/
/*
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
* Use is subject to license terms.
*
* Author: Johann Lombardi <johann.lombardi@intel.com>
if (fid_is_acct(fid)) {
seq_printf(p, "%s:\n", oid2name(fid_oid(fid)));
} else if (fid_seq(fid) == FID_SEQ_QUOTA_GLB) {
- int poolid, rtype, qtype;
+ int rtype, qtype;
- rc = lquota_extract_fid(fid, &poolid, &rtype, &qtype);
+ rc = lquota_extract_fid(fid, &rtype, &qtype);
if (rc)
return rc;
- seq_printf(p, "global_pool%d_%s_%s\n", poolid,
+ seq_printf(p, "global_pool%d_%s_%s\n", 0,
RES_NAME(rtype), qtype_name(qtype));
} else if (fid_seq(fid) == FID_SEQ_LOCAL_NAME) {
/* global index copy object */
seq_printf(p, "- %-8s %llu\n", "id:", *((__u64 *)key));
if (fid_is_acct(fid))
- seq_printf(p, " %-8s { inodes: %20llu, kbytes: %20llu }\n", "usage:",
- ((struct lquota_acct_rec *)rec)->ispace,
+ seq_printf(p, " %-8s { inodes: %12llu, kbytes: %12llu }\n",
+ "usage:", ((struct lquota_acct_rec *)rec)->ispace,
toqb(((struct lquota_acct_rec *)rec)->bspace));
else if (fid_seq(fid) == FID_SEQ_QUOTA_GLB ||
fid_seq(fid) == FID_SEQ_LOCAL_NAME)
- seq_printf(p, " %-8s { hard: %20llu, soft: %20llu, granted: %20llu, time: %20llu }\n",
+ seq_printf(p, " %-8s { hard: %12llu, soft: %12llu, granted: %12llu, time: %15llu }\n",
"limits:",
((struct lquota_glb_rec *)rec)->qbr_hardlimit,
((struct lquota_glb_rec *)rec)->qbr_softlimit,
return 0;
}
-struct seq_operations lprocfs_quota_seq_sops = {
+static const struct seq_operations lprocfs_quota_seq_sops = {
.start = lprocfs_quota_seq_start,
.stop = lprocfs_quota_seq_stop,
.next = lprocfs_quota_seq_next,
return -ENOMEM;
/* store pointer to object we would like to iterate over */
- lqp->lqp_obj = (struct dt_object *)PDE_DATA(inode);
+ lqp->lqp_obj = (struct dt_object *)pde_data(inode);
/* Initialize the common environment to be used in the seq operations */
rc = lu_env_init(&lqp->lqp_env, LCT_LOCAL);
goto out_lqp;
}
- rc = LPROCFS_ENTRY_CHECK(inode);
- if (rc < 0)
- goto out_env;
-
rc = seq_open(file, &lprocfs_quota_seq_sops);
if (rc)
goto out_env;
+ if (!lqp->lqp_obj) {
+ lqp->lqp_it = NULL;
+ goto out_seq;
+ }
+
/* initialize iterator */
iops = &lqp->lqp_obj->do_index_ops->dio_it;
it = iops->init(&lqp->lqp_env, lqp->lqp_obj, 0);
lqp->lqp_it = it;
lqp->lqp_cookie = 0;
+out_seq:
seq = file->private_data;
seq->private = lqp;
return 0;
const struct dt_it_ops *iops;
LASSERT(lqp);
- iops = &lqp->lqp_obj->do_index_ops->dio_it;
- if (lqp->lqp_it != NULL)
+ if (lqp->lqp_it != NULL) {
+ iops = &lqp->lqp_obj->do_index_ops->dio_it;
iops->fini(&lqp->lqp_env, lqp->lqp_it);
+ }
lu_env_fini(&lqp->lqp_env);
OBD_FREE_PTR(lqp);
return seq_release(inode, file);
}
-struct file_operations lprocfs_quota_seq_fops = {
- .owner = THIS_MODULE,
- .open = lprocfs_quota_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = lprocfs_quota_seq_release,
+const struct proc_ops lprocfs_quota_seq_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lprocfs_quota_seq_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_quota_seq_release,
};
#endif /* CONFIG_PROC_FS */