xfs_quotaops.c (b7d3622a39fde7658170b7f3cf6c6889bb8db30d) xfs_quotaops.c (9da93f9b7cdf8ab28da6b364cdc1fafc8670b4dc)
1/*
2 * Copyright (c) 2008, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 86 unchanged lines hidden (view full) ---

95
96 switch (op) {
97 case Q_XQUOTAON:
98 return -xfs_qm_scall_quotaon(mp, flags);
99 case Q_XQUOTAOFF:
100 if (!XFS_IS_QUOTA_ON(mp))
101 return -EINVAL;
102 return -xfs_qm_scall_quotaoff(mp, flags);
1/*
2 * Copyright (c) 2008, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 86 unchanged lines hidden (view full) ---

95
96 switch (op) {
97 case Q_XQUOTAON:
98 return -xfs_qm_scall_quotaon(mp, flags);
99 case Q_XQUOTAOFF:
100 if (!XFS_IS_QUOTA_ON(mp))
101 return -EINVAL;
102 return -xfs_qm_scall_quotaoff(mp, flags);
103 case Q_XQUOTARM:
104 if (XFS_IS_QUOTA_ON(mp))
105 return -EINVAL;
106 return -xfs_qm_scall_trunc_qfiles(mp, flags);
107 }
108
109 return -EINVAL;
110}
111
112STATIC int
103 }
104
105 return -EINVAL;
106}
107
108STATIC int
109xfs_fs_rm_xquota(
110 struct super_block *sb,
111 unsigned int uflags)
112{
113 struct xfs_mount *mp = XFS_M(sb);
114 unsigned int flags = 0;
115
116 if (sb->s_flags & MS_RDONLY)
117 return -EROFS;
118
119 if (XFS_IS_QUOTA_ON(mp))
120 return -EINVAL;
121
122 if (uflags & FS_USER_QUOTA)
123 flags |= XFS_DQ_USER;
124 if (uflags & FS_GROUP_QUOTA)
125 flags |= XFS_DQ_GROUP;
126 if (uflags & FS_USER_QUOTA)
127 flags |= XFS_DQ_PROJ;
128
129 return -xfs_qm_scall_trunc_qfiles(mp, flags);
130}
131
132STATIC int
113xfs_fs_get_dqblk(
114 struct super_block *sb,
115 struct kqid qid,
116 struct fs_disk_quota *fdq)
117{
118 struct xfs_mount *mp = XFS_M(sb);
119
120 if (!XFS_IS_QUOTA_RUNNING(mp))

--- 23 unchanged lines hidden (view full) ---

144 return -xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid),
145 xfs_quota_type(qid.type), fdq);
146}
147
148const struct quotactl_ops xfs_quotactl_operations = {
149 .get_xstatev = xfs_fs_get_xstatev,
150 .get_xstate = xfs_fs_get_xstate,
151 .set_xstate = xfs_fs_set_xstate,
133xfs_fs_get_dqblk(
134 struct super_block *sb,
135 struct kqid qid,
136 struct fs_disk_quota *fdq)
137{
138 struct xfs_mount *mp = XFS_M(sb);
139
140 if (!XFS_IS_QUOTA_RUNNING(mp))

--- 23 unchanged lines hidden (view full) ---

164 return -xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid),
165 xfs_quota_type(qid.type), fdq);
166}
167
168const struct quotactl_ops xfs_quotactl_operations = {
169 .get_xstatev = xfs_fs_get_xstatev,
170 .get_xstate = xfs_fs_get_xstate,
171 .set_xstate = xfs_fs_set_xstate,
172 .rm_xquota = xfs_fs_rm_xquota,
152 .get_dqblk = xfs_fs_get_dqblk,
153 .set_dqblk = xfs_fs_set_dqblk,
154};
173 .get_dqblk = xfs_fs_get_dqblk,
174 .set_dqblk = xfs_fs_set_dqblk,
175};