xfs_quotaops.c (8a2fdd4a49d40017b3fca42beb2e1c8c0174a743) xfs_quotaops.c (14bf61ffe6ac54afcd1e888a4407fe16054483db)
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 *

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

70 unsigned int uflags,
71 int op)
72{
73 struct xfs_mount *mp = XFS_M(sb);
74 unsigned int flags = 0;
75
76 if (sb->s_flags & MS_RDONLY)
77 return -EROFS;
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 *

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

70 unsigned int uflags,
71 int op)
72{
73 struct xfs_mount *mp = XFS_M(sb);
74 unsigned int flags = 0;
75
76 if (sb->s_flags & MS_RDONLY)
77 return -EROFS;
78 if (!XFS_IS_QUOTA_RUNNING(mp))
78 if (op != Q_XQUOTARM && !XFS_IS_QUOTA_RUNNING(mp))
79 return -ENOSYS;
80
81 if (uflags & FS_QUOTA_UDQ_ACCT)
82 flags |= XFS_UQUOTA_ACCT;
83 if (uflags & FS_QUOTA_PDQ_ACCT)
84 flags |= XFS_PQUOTA_ACCT;
85 if (uflags & FS_QUOTA_GDQ_ACCT)
86 flags |= XFS_GQUOTA_ACCT;

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

126
127 return xfs_qm_scall_trunc_qfiles(mp, flags);
128}
129
130STATIC int
131xfs_fs_get_dqblk(
132 struct super_block *sb,
133 struct kqid qid,
79 return -ENOSYS;
80
81 if (uflags & FS_QUOTA_UDQ_ACCT)
82 flags |= XFS_UQUOTA_ACCT;
83 if (uflags & FS_QUOTA_PDQ_ACCT)
84 flags |= XFS_PQUOTA_ACCT;
85 if (uflags & FS_QUOTA_GDQ_ACCT)
86 flags |= XFS_GQUOTA_ACCT;

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

126
127 return xfs_qm_scall_trunc_qfiles(mp, flags);
128}
129
130STATIC int
131xfs_fs_get_dqblk(
132 struct super_block *sb,
133 struct kqid qid,
134 struct fs_disk_quota *fdq)
134 struct qc_dqblk *qdq)
135{
136 struct xfs_mount *mp = XFS_M(sb);
137
138 if (!XFS_IS_QUOTA_RUNNING(mp))
139 return -ENOSYS;
140 if (!XFS_IS_QUOTA_ON(mp))
141 return -ESRCH;
142
143 return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid),
135{
136 struct xfs_mount *mp = XFS_M(sb);
137
138 if (!XFS_IS_QUOTA_RUNNING(mp))
139 return -ENOSYS;
140 if (!XFS_IS_QUOTA_ON(mp))
141 return -ESRCH;
142
143 return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid),
144 xfs_quota_type(qid.type), fdq);
144 xfs_quota_type(qid.type), qdq);
145}
146
147STATIC int
148xfs_fs_set_dqblk(
149 struct super_block *sb,
150 struct kqid qid,
145}
146
147STATIC int
148xfs_fs_set_dqblk(
149 struct super_block *sb,
150 struct kqid qid,
151 struct fs_disk_quota *fdq)
151 struct qc_dqblk *qdq)
152{
153 struct xfs_mount *mp = XFS_M(sb);
154
155 if (sb->s_flags & MS_RDONLY)
156 return -EROFS;
157 if (!XFS_IS_QUOTA_RUNNING(mp))
158 return -ENOSYS;
159 if (!XFS_IS_QUOTA_ON(mp))
160 return -ESRCH;
161
162 return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid),
152{
153 struct xfs_mount *mp = XFS_M(sb);
154
155 if (sb->s_flags & MS_RDONLY)
156 return -EROFS;
157 if (!XFS_IS_QUOTA_RUNNING(mp))
158 return -ENOSYS;
159 if (!XFS_IS_QUOTA_ON(mp))
160 return -ESRCH;
161
162 return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid),
163 xfs_quota_type(qid.type), fdq);
163 xfs_quota_type(qid.type), qdq);
164}
165
166const struct quotactl_ops xfs_quotactl_operations = {
167 .get_xstatev = xfs_fs_get_xstatev,
168 .get_xstate = xfs_fs_get_xstate,
169 .set_xstate = xfs_fs_set_xstate,
170 .rm_xquota = xfs_fs_rm_xquota,
171 .get_dqblk = xfs_fs_get_dqblk,
172 .set_dqblk = xfs_fs_set_dqblk,
173};
164}
165
166const struct quotactl_ops xfs_quotactl_operations = {
167 .get_xstatev = xfs_fs_get_xstatev,
168 .get_xstate = xfs_fs_get_xstate,
169 .set_xstate = xfs_fs_set_xstate,
170 .rm_xquota = xfs_fs_rm_xquota,
171 .get_dqblk = xfs_fs_get_dqblk,
172 .set_dqblk = xfs_fs_set_dqblk,
173};