diff options
| -rw-r--r-- | fs/quota/quota.c | 20 | ||||
| -rw-r--r-- | fs/xfs/xfs_quotaops.c | 59 | ||||
| -rw-r--r-- | include/linux/quota.h | 3 |
3 files changed, 55 insertions, 27 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 | ||
| 211 | static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) | 211 | static 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 | |||
| 222 | static 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 | ||
| 222 | static int quota_getxstate(struct super_block *sb, void __user *addr) | 233 | static 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: |
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c index a226203fa46a..6923905ab33d 100644 --- a/fs/xfs/xfs_quotaops.c +++ b/fs/xfs/xfs_quotaops.c | |||
| @@ -64,19 +64,10 @@ xfs_fs_get_xstatev( | |||
| 64 | return xfs_qm_scall_getqstatv(mp, fqs); | 64 | return xfs_qm_scall_getqstatv(mp, fqs); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | STATIC int | 67 | static unsigned int |
| 68 | xfs_fs_set_xstate( | 68 | xfs_quota_flags(unsigned int uflags) |
| 69 | struct super_block *sb, | ||
| 70 | unsigned int uflags, | ||
| 71 | int op) | ||
| 72 | { | 69 | { |
| 73 | struct xfs_mount *mp = XFS_M(sb); | 70 | unsigned int flags = 0; |
| 74 | unsigned int flags = 0; | ||
| 75 | |||
| 76 | if (sb->s_flags & MS_RDONLY) | ||
| 77 | return -EROFS; | ||
| 78 | if (!XFS_IS_QUOTA_RUNNING(mp)) | ||
| 79 | return -ENOSYS; | ||
| 80 | 71 | ||
| 81 | if (uflags & FS_QUOTA_UDQ_ACCT) | 72 | if (uflags & FS_QUOTA_UDQ_ACCT) |
| 82 | flags |= XFS_UQUOTA_ACCT; | 73 | flags |= XFS_UQUOTA_ACCT; |
| @@ -91,16 +82,39 @@ xfs_fs_set_xstate( | |||
| 91 | if (uflags & FS_QUOTA_PDQ_ENFD) | 82 | if (uflags & FS_QUOTA_PDQ_ENFD) |
| 92 | flags |= XFS_PQUOTA_ENFD; | 83 | flags |= XFS_PQUOTA_ENFD; |
| 93 | 84 | ||
| 94 | switch (op) { | 85 | return flags; |
| 95 | case Q_XQUOTAON: | 86 | } |
| 96 | return xfs_qm_scall_quotaon(mp, flags); | 87 | |
| 97 | case Q_XQUOTAOFF: | 88 | STATIC int |
| 98 | if (!XFS_IS_QUOTA_ON(mp)) | 89 | xfs_quota_enable( |
| 99 | return -EINVAL; | 90 | struct super_block *sb, |
| 100 | return xfs_qm_scall_quotaoff(mp, flags); | 91 | unsigned int uflags) |
| 101 | } | 92 | { |
| 93 | struct xfs_mount *mp = XFS_M(sb); | ||
| 94 | |||
| 95 | if (sb->s_flags & MS_RDONLY) | ||
| 96 | return -EROFS; | ||
| 97 | if (!XFS_IS_QUOTA_RUNNING(mp)) | ||
| 98 | return -ENOSYS; | ||
| 99 | |||
| 100 | return xfs_qm_scall_quotaon(mp, xfs_quota_flags(uflags)); | ||
| 101 | } | ||
| 102 | |||
| 103 | STATIC int | ||
| 104 | xfs_quota_disable( | ||
| 105 | struct super_block *sb, | ||
| 106 | unsigned int uflags) | ||
| 107 | { | ||
| 108 | struct xfs_mount *mp = XFS_M(sb); | ||
| 109 | |||
| 110 | if (sb->s_flags & MS_RDONLY) | ||
| 111 | return -EROFS; | ||
| 112 | if (!XFS_IS_QUOTA_RUNNING(mp)) | ||
| 113 | return -ENOSYS; | ||
| 114 | if (!XFS_IS_QUOTA_ON(mp)) | ||
| 115 | return -EINVAL; | ||
| 102 | 116 | ||
| 103 | return -EINVAL; | 117 | return xfs_qm_scall_quotaoff(mp, xfs_quota_flags(uflags)); |
| 104 | } | 118 | } |
| 105 | 119 | ||
| 106 | STATIC int | 120 | STATIC int |
| @@ -166,7 +180,8 @@ xfs_fs_set_dqblk( | |||
| 166 | const struct quotactl_ops xfs_quotactl_operations = { | 180 | const struct quotactl_ops xfs_quotactl_operations = { |
| 167 | .get_xstatev = xfs_fs_get_xstatev, | 181 | .get_xstatev = xfs_fs_get_xstatev, |
| 168 | .get_xstate = xfs_fs_get_xstate, | 182 | .get_xstate = xfs_fs_get_xstate, |
| 169 | .set_xstate = xfs_fs_set_xstate, | 183 | .quota_enable = xfs_quota_enable, |
| 184 | .quota_disable = xfs_quota_disable, | ||
| 170 | .rm_xquota = xfs_fs_rm_xquota, | 185 | .rm_xquota = xfs_fs_rm_xquota, |
| 171 | .get_dqblk = xfs_fs_get_dqblk, | 186 | .get_dqblk = xfs_fs_get_dqblk, |
| 172 | .set_dqblk = xfs_fs_set_dqblk, | 187 | .set_dqblk = xfs_fs_set_dqblk, |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 227f37f463c9..4da497b807c4 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
| @@ -371,13 +371,14 @@ struct quotactl_ops { | |||
| 371 | int (*quota_on)(struct super_block *, int, int, struct path *); | 371 | int (*quota_on)(struct super_block *, int, int, struct path *); |
| 372 | int (*quota_on_meta)(struct super_block *, int, int); | 372 | int (*quota_on_meta)(struct super_block *, int, int); |
| 373 | int (*quota_off)(struct super_block *, int); | 373 | int (*quota_off)(struct super_block *, int); |
| 374 | int (*quota_enable)(struct super_block *, unsigned int); | ||
| 375 | int (*quota_disable)(struct super_block *, unsigned int); | ||
| 374 | int (*quota_sync)(struct super_block *, int); | 376 | int (*quota_sync)(struct super_block *, int); |
| 375 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); | 377 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); |
| 376 | int (*set_info)(struct super_block *, int, struct if_dqinfo *); | 378 | int (*set_info)(struct super_block *, int, struct if_dqinfo *); |
| 377 | int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); | 379 | int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); |
| 378 | int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); | 380 | int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); |
| 379 | int (*get_xstate)(struct super_block *, struct fs_quota_stat *); | 381 | int (*get_xstate)(struct super_block *, struct fs_quota_stat *); |
| 380 | int (*set_xstate)(struct super_block *, unsigned int, int); | ||
| 381 | int (*get_xstatev)(struct super_block *, struct fs_quota_statv *); | 382 | int (*get_xstatev)(struct super_block *, struct fs_quota_statv *); |
| 382 | int (*rm_xquota)(struct super_block *, unsigned int); | 383 | int (*rm_xquota)(struct super_block *, unsigned int); |
| 383 | }; | 384 | }; |
