2 * Implementation of handling of quotafiles which are hidden
4 * Jan Kara <jack@suse.cz>
12 #include <sys/types.h>
17 #include "quotaio_generic.h"
19 static int meta_init_io(struct quota_handle *h)
21 if (!QIO_ENABLED(h)) {
22 errstr(_("Metadata init_io called when kernel support is not enabled.\n"));
25 if (kernel_iface != IFACE_GENERIC) {
26 errstr(_("Metadata init_io called when kernel does not support generic quota interface!\n"));
29 return vfs_get_info(h);
32 static int meta_write_info(struct quota_handle *h)
34 return vfs_set_info(h, IIF_BGRACE | IIF_IGRACE);
37 static struct dquot *meta_read_dquot(struct quota_handle *h, qid_t id)
39 struct dquot *dquot = get_empty_dquot();
43 memset(&dquot->dq_dqb, 0, sizeof(struct util_dqblk));
44 if (vfs_get_dquot(dquot) < 0) {
51 static int meta_commit_dquot(struct dquot *dquot, int flags)
53 return vfs_set_dquot(dquot, flags);
56 static int meta_scan_dquots(struct quota_handle *h, int (*process_dquot)(struct dquot *dquot, char *dqname))
58 return generic_scan_dquots(h, process_dquot, vfs_get_dquot);
61 struct quotafile_ops quotafile_ops_meta = {
62 init_io: meta_init_io,
63 write_info: meta_write_info,
64 read_dquot: meta_read_dquot,
65 commit_dquot: meta_commit_dquot,
66 scan_dquots: meta_scan_dquots,