aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-10-08 09:56:21 -0400
committerJan Kara <jack@suse.cz>2015-01-30 06:49:40 -0500
commit38e478c4489a845a5e8baf7849c286af5fed5b66 (patch)
treef001a8e58e17e32d3969ad3069621919ea4b9dcf /fs/quota
parent1cd6b7be92016538ea1f2a8e1f955e9b974d93ea (diff)
quota: Split ->set_xstate callback into two
Split ->set_xstate callback into two callbacks - one for turning quotas on (->quota_enable) and one for turning quotas off (->quota_disable). That way we don't have to pass quotactl command into the callback which seems cleaner. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota')
-rw-r--r--fs/quota/quota.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 6f3856328eea..e2ae2b99e555 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -208,15 +208,26 @@ static int quota_setquota(struct super_block *sb, int type, qid_t id,
208 return sb->s_qcop->set_dqblk(sb, qid, &fdq); 208 return sb->s_qcop->set_dqblk(sb, qid, &fdq);
209} 209}
210 210
211static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) 211static int quota_enable(struct super_block *sb, void __user *addr)
212{ 212{
213 __u32 flags; 213 __u32 flags;
214 214
215 if (copy_from_user(&flags, addr, sizeof(flags))) 215 if (copy_from_user(&flags, addr, sizeof(flags)))
216 return -EFAULT; 216 return -EFAULT;
217 if (!sb->s_qcop->set_xstate) 217 if (!sb->s_qcop->quota_enable)
218 return -ENOSYS; 218 return -ENOSYS;
219 return sb->s_qcop->set_xstate(sb, flags, cmd); 219 return sb->s_qcop->quota_enable(sb, flags);
220}
221
222static int quota_disable(struct super_block *sb, void __user *addr)
223{
224 __u32 flags;
225
226 if (copy_from_user(&flags, addr, sizeof(flags)))
227 return -EFAULT;
228 if (!sb->s_qcop->quota_disable)
229 return -ENOSYS;
230 return sb->s_qcop->quota_disable(sb, flags);
220} 231}
221 232
222static int quota_getxstate(struct super_block *sb, void __user *addr) 233static int quota_getxstate(struct super_block *sb, void __user *addr)
@@ -447,8 +458,9 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
447 return -ENOSYS; 458 return -ENOSYS;
448 return sb->s_qcop->quota_sync(sb, type); 459 return sb->s_qcop->quota_sync(sb, type);
449 case Q_XQUOTAON: 460 case Q_XQUOTAON:
461 return quota_enable(sb, addr);
450 case Q_XQUOTAOFF: 462 case Q_XQUOTAOFF:
451 return quota_setxstate(sb, cmd, addr); 463 return quota_disable(sb, addr);
452 case Q_XQUOTARM: 464 case Q_XQUOTARM:
453 return quota_rmxquota(sb, addr); 465 return quota_rmxquota(sb, addr);
454 case Q_XGETQSTAT: 466 case Q_XGETQSTAT: