5 #include <linux/errno.h>
9 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/slab.h>
15 #include <asm/byteorder.h>
24 #define __QUOTA_V2_PARANOIA
26 static void v2r0_mem2diskdqb(
void *
dp,
struct dquot *
dquot);
27 static void v2r0_disk2memdqb(
struct dquot *
dquot,
void *
dp);
29 static void v2r1_mem2diskdqb(
void *
dp,
struct dquot *
dquot);
30 static void v2r1_disk2memdqb(
struct dquot *
dquot,
void *
dp);
34 .mem2disk_dqblk = v2r0_mem2diskdqb,
35 .disk2mem_dqblk = v2r0_disk2memdqb,
40 .mem2disk_dqblk = v2r1_mem2diskdqb,
41 .disk2mem_dqblk = v2r1_disk2memdqb,
45 #define QUOTABLOCK_BITS 10
46 #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
63 size = sb->
s_op->quota_read(sb, type, (
char *)dqhead,
66 quota_error(sb,
"Failed header read: expected=%zd got=%zd",
74 static int v2_check_quota_file(
struct super_block *sb,
int type)
80 if (!v2_read_header(sb, type, &dqhead))
89 static int v2_read_file_info(
struct super_block *sb,
int type)
98 if (!v2_read_header(sb, type, &dqhead))
105 size = sb->
s_op->quota_read(sb, type, (
char *)&dinfo,
108 quota_error(sb,
"Can't read info structure");
114 "Not enough memory for quota information structure.\n");
140 qinfo->
dqi_ops = &v2r0_qtree_ops;
143 qinfo->
dqi_ops = &v2r1_qtree_ops;
149 static int v2_write_file_info(
struct super_block *sb,
int type)
152 struct mem_dqinfo *info = sb_dqinfo(sb, type);
156 spin_lock(&dq_data_lock);
161 spin_unlock(&dq_data_lock);
165 size = sb->
s_op->quota_write(sb, type, (
char *)&dinfo,
168 quota_error(sb,
"Can't write info structure");
174 static void v2r0_disk2memdqb(
struct dquot *
dquot,
void *
dp)
194 static void v2r0_mem2diskdqb(
void *dp,
struct dquot *dquot)
214 static int v2r0_is_id(
void *dp,
struct dquot *dquot)
218 sb_dqinfo(dquot->
dq_sb, dquot->
dq_id.type)->dqi_priv;
227 static void v2r1_disk2memdqb(
struct dquot *dquot,
void *dp)
247 static void v2r1_mem2diskdqb(
void *dp,
struct dquot *dquot)
252 sb_dqinfo(dquot->
dq_sb, dquot->
dq_id.type)->dqi_priv;
267 static int v2r1_is_id(
void *dp,
struct dquot *dquot)
271 sb_dqinfo(dquot->
dq_sb, dquot->
dq_id.type)->dqi_priv;
280 static int v2_read_dquot(
struct dquot *dquot)
285 static int v2_write_dquot(
struct dquot *dquot)
290 static int v2_release_dquot(
struct dquot *dquot)
295 static int v2_free_file_info(
struct super_block *sb,
int type)
297 kfree(sb_dqinfo(sb, type)->dqi_priv);
302 .check_quota_file = v2_check_quota_file,
303 .read_file_info = v2_read_file_info,
304 .write_file_info = v2_write_file_info,
305 .free_file_info = v2_free_file_info,
306 .read_dqblk = v2_read_dquot,
307 .commit_dqblk = v2_write_dquot,
308 .release_dqblk = v2_release_dquot,
313 .qf_ops = &v2_format_ops,
319 .qf_ops = &v2_format_ops,
323 static int __init init_v2_quota_format(
void)
333 static void __exit exit_v2_quota_format(
void)