Commit fcafb71b57a039f2113b0321b3b5535fea3a0aca
Committed by
Christoph Hellwig
1 parent
c9a192dcf9
Exists in
master
and in
7 other branches
xfs: get rid of indirections in the quotaops implementation
Currently we call from the nicely abstracted linux quotaops into a ugly multiplexer just to split the calls out at the same boundary again. Rewrite the quota ops handling to remove that obfucation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com>
Showing 12 changed files with 181 additions and 262 deletions Side-by-side Diff
fs/xfs/Makefile
fs/xfs/linux-2.6/xfs_linux.h
... | ... | @@ -147,17 +147,6 @@ |
147 | 147 | #define SYNCHRONIZE() barrier() |
148 | 148 | #define __return_address __builtin_return_address(0) |
149 | 149 | |
150 | -/* | |
151 | - * IRIX (BSD) quotactl makes use of separate commands for user/group, | |
152 | - * whereas on Linux the syscall encodes this information into the cmd | |
153 | - * field (see the QCMD macro in quota.h). These macros help keep the | |
154 | - * code portable - they are not visible from the syscall interface. | |
155 | - */ | |
156 | -#define Q_XSETGQLIM XQM_CMD(8) /* set groups disk limits */ | |
157 | -#define Q_XGETGQUOTA XQM_CMD(9) /* get groups disk limits */ | |
158 | -#define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */ | |
159 | -#define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */ | |
160 | - | |
161 | 150 | #define dfltprid 0 |
162 | 151 | #define MAXPATHLEN 1024 |
163 | 152 |
fs/xfs/linux-2.6/xfs_quotaops.c
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 | + * | |
9 | + * This program is distributed in the hope that it would be useful, | |
10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | + * GNU General Public License for more details. | |
13 | + * | |
14 | + * You should have received a copy of the GNU General Public License | |
15 | + * along with this program; if not, write the Free Software Foundation, | |
16 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | + */ | |
18 | +#include "xfs.h" | |
19 | +#include "xfs_dmapi.h" | |
20 | +#include "xfs_sb.h" | |
21 | +#include "xfs_inum.h" | |
22 | +#include "xfs_ag.h" | |
23 | +#include "xfs_mount.h" | |
24 | +#include "xfs_quota.h" | |
25 | +#include "xfs_log.h" | |
26 | +#include "xfs_trans.h" | |
27 | +#include "xfs_bmap_btree.h" | |
28 | +#include "xfs_inode.h" | |
29 | +#include "quota/xfs_qm.h" | |
30 | +#include <linux/quota.h> | |
31 | + | |
32 | + | |
33 | +STATIC int | |
34 | +xfs_quota_type(int type) | |
35 | +{ | |
36 | + switch (type) { | |
37 | + case USRQUOTA: | |
38 | + return XFS_DQ_USER; | |
39 | + case GRPQUOTA: | |
40 | + return XFS_DQ_GROUP; | |
41 | + default: | |
42 | + return XFS_DQ_PROJ; | |
43 | + } | |
44 | +} | |
45 | + | |
46 | +STATIC int | |
47 | +xfs_fs_quota_sync( | |
48 | + struct super_block *sb, | |
49 | + int type) | |
50 | +{ | |
51 | + struct xfs_mount *mp = XFS_M(sb); | |
52 | + | |
53 | + if (!XFS_IS_QUOTA_RUNNING(mp)) | |
54 | + return -ENOSYS; | |
55 | + return -xfs_sync_inodes(mp, SYNC_DELWRI); | |
56 | +} | |
57 | + | |
58 | +STATIC int | |
59 | +xfs_fs_get_xstate( | |
60 | + struct super_block *sb, | |
61 | + struct fs_quota_stat *fqs) | |
62 | +{ | |
63 | + struct xfs_mount *mp = XFS_M(sb); | |
64 | + | |
65 | + if (!XFS_IS_QUOTA_RUNNING(mp)) | |
66 | + return -ENOSYS; | |
67 | + return -xfs_qm_scall_getqstat(mp, fqs); | |
68 | +} | |
69 | + | |
70 | +STATIC int | |
71 | +xfs_fs_set_xstate( | |
72 | + struct super_block *sb, | |
73 | + unsigned int uflags, | |
74 | + int op) | |
75 | +{ | |
76 | + struct xfs_mount *mp = XFS_M(sb); | |
77 | + unsigned int flags = 0; | |
78 | + | |
79 | + if (sb->s_flags & MS_RDONLY) | |
80 | + return -EROFS; | |
81 | + if (!XFS_IS_QUOTA_RUNNING(mp)) | |
82 | + return -ENOSYS; | |
83 | + if (!capable(CAP_SYS_ADMIN)) | |
84 | + return -EPERM; | |
85 | + | |
86 | + if (uflags & XFS_QUOTA_UDQ_ACCT) | |
87 | + flags |= XFS_UQUOTA_ACCT; | |
88 | + if (uflags & XFS_QUOTA_PDQ_ACCT) | |
89 | + flags |= XFS_PQUOTA_ACCT; | |
90 | + if (uflags & XFS_QUOTA_GDQ_ACCT) | |
91 | + flags |= XFS_GQUOTA_ACCT; | |
92 | + if (uflags & XFS_QUOTA_UDQ_ENFD) | |
93 | + flags |= XFS_UQUOTA_ENFD; | |
94 | + if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD)) | |
95 | + flags |= XFS_OQUOTA_ENFD; | |
96 | + | |
97 | + switch (op) { | |
98 | + case Q_XQUOTAON: | |
99 | + return -xfs_qm_scall_quotaon(mp, flags); | |
100 | + case Q_XQUOTAOFF: | |
101 | + if (!XFS_IS_QUOTA_ON(mp)) | |
102 | + return -EINVAL; | |
103 | + return -xfs_qm_scall_quotaoff(mp, flags); | |
104 | + case Q_XQUOTARM: | |
105 | + if (XFS_IS_QUOTA_ON(mp)) | |
106 | + return -EINVAL; | |
107 | + return -xfs_qm_scall_trunc_qfiles(mp, flags); | |
108 | + } | |
109 | + | |
110 | + return -EINVAL; | |
111 | +} | |
112 | + | |
113 | +STATIC int | |
114 | +xfs_fs_get_xquota( | |
115 | + struct super_block *sb, | |
116 | + int type, | |
117 | + qid_t id, | |
118 | + struct fs_disk_quota *fdq) | |
119 | +{ | |
120 | + struct xfs_mount *mp = XFS_M(sb); | |
121 | + | |
122 | + if (!XFS_IS_QUOTA_RUNNING(mp)) | |
123 | + return -ENOSYS; | |
124 | + if (!XFS_IS_QUOTA_ON(mp)) | |
125 | + return -ESRCH; | |
126 | + | |
127 | + return -xfs_qm_scall_getquota(mp, id, xfs_quota_type(type), fdq); | |
128 | +} | |
129 | + | |
130 | +STATIC int | |
131 | +xfs_fs_set_xquota( | |
132 | + struct super_block *sb, | |
133 | + int type, | |
134 | + qid_t id, | |
135 | + struct fs_disk_quota *fdq) | |
136 | +{ | |
137 | + struct xfs_mount *mp = XFS_M(sb); | |
138 | + | |
139 | + if (sb->s_flags & MS_RDONLY) | |
140 | + return -EROFS; | |
141 | + if (!XFS_IS_QUOTA_RUNNING(mp)) | |
142 | + return -ENOSYS; | |
143 | + if (!XFS_IS_QUOTA_ON(mp)) | |
144 | + return -ESRCH; | |
145 | + if (!capable(CAP_SYS_ADMIN)) | |
146 | + return -EPERM; | |
147 | + | |
148 | + return -xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq); | |
149 | +} | |
150 | + | |
151 | +struct quotactl_ops xfs_quotactl_operations = { | |
152 | + .quota_sync = xfs_fs_quota_sync, | |
153 | + .get_xstate = xfs_fs_get_xstate, | |
154 | + .set_xstate = xfs_fs_set_xstate, | |
155 | + .get_xquota = xfs_fs_get_xquota, | |
156 | + .set_xquota = xfs_fs_set_xquota, | |
157 | +}; |
fs/xfs/linux-2.6/xfs_super.c
... | ... | @@ -68,7 +68,6 @@ |
68 | 68 | #include <linux/freezer.h> |
69 | 69 | #include <linux/parser.h> |
70 | 70 | |
71 | -static struct quotactl_ops xfs_quotactl_operations; | |
72 | 71 | static struct super_operations xfs_super_operations; |
73 | 72 | static kmem_zone_t *xfs_ioend_zone; |
74 | 73 | mempool_t *xfs_ioend_pool; |
... | ... | @@ -1333,57 +1332,6 @@ |
1333 | 1332 | return -xfs_showargs(XFS_M(mnt->mnt_sb), m); |
1334 | 1333 | } |
1335 | 1334 | |
1336 | -STATIC int | |
1337 | -xfs_fs_quotasync( | |
1338 | - struct super_block *sb, | |
1339 | - int type) | |
1340 | -{ | |
1341 | - return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL); | |
1342 | -} | |
1343 | - | |
1344 | -STATIC int | |
1345 | -xfs_fs_getxstate( | |
1346 | - struct super_block *sb, | |
1347 | - struct fs_quota_stat *fqs) | |
1348 | -{ | |
1349 | - return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs); | |
1350 | -} | |
1351 | - | |
1352 | -STATIC int | |
1353 | -xfs_fs_setxstate( | |
1354 | - struct super_block *sb, | |
1355 | - unsigned int flags, | |
1356 | - int op) | |
1357 | -{ | |
1358 | - return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags); | |
1359 | -} | |
1360 | - | |
1361 | -STATIC int | |
1362 | -xfs_fs_getxquota( | |
1363 | - struct super_block *sb, | |
1364 | - int type, | |
1365 | - qid_t id, | |
1366 | - struct fs_disk_quota *fdq) | |
1367 | -{ | |
1368 | - return -XFS_QM_QUOTACTL(XFS_M(sb), | |
1369 | - (type == USRQUOTA) ? Q_XGETQUOTA : | |
1370 | - ((type == GRPQUOTA) ? Q_XGETGQUOTA : | |
1371 | - Q_XGETPQUOTA), id, (caddr_t)fdq); | |
1372 | -} | |
1373 | - | |
1374 | -STATIC int | |
1375 | -xfs_fs_setxquota( | |
1376 | - struct super_block *sb, | |
1377 | - int type, | |
1378 | - qid_t id, | |
1379 | - struct fs_disk_quota *fdq) | |
1380 | -{ | |
1381 | - return -XFS_QM_QUOTACTL(XFS_M(sb), | |
1382 | - (type == USRQUOTA) ? Q_XSETQLIM : | |
1383 | - ((type == GRPQUOTA) ? Q_XSETGQLIM : | |
1384 | - Q_XSETPQLIM), id, (caddr_t)fdq); | |
1385 | -} | |
1386 | - | |
1387 | 1335 | /* |
1388 | 1336 | * This function fills in xfs_mount_t fields based on mount args. |
1389 | 1337 | * Note: the superblock _has_ now been read in. |
1390 | 1338 | |
... | ... | @@ -1466,7 +1414,9 @@ |
1466 | 1414 | sb_min_blocksize(sb, BBSIZE); |
1467 | 1415 | sb->s_xattr = xfs_xattr_handlers; |
1468 | 1416 | sb->s_export_op = &xfs_export_operations; |
1417 | +#ifdef CONFIG_XFS_QUOTA | |
1469 | 1418 | sb->s_qcop = &xfs_quotactl_operations; |
1419 | +#endif | |
1470 | 1420 | sb->s_op = &xfs_super_operations; |
1471 | 1421 | |
1472 | 1422 | error = xfs_dmops_get(mp); |
... | ... | @@ -1607,14 +1557,6 @@ |
1607 | 1557 | .statfs = xfs_fs_statfs, |
1608 | 1558 | .remount_fs = xfs_fs_remount, |
1609 | 1559 | .show_options = xfs_fs_show_options, |
1610 | -}; | |
1611 | - | |
1612 | -static struct quotactl_ops xfs_quotactl_operations = { | |
1613 | - .quota_sync = xfs_fs_quotasync, | |
1614 | - .get_xstate = xfs_fs_getxstate, | |
1615 | - .set_xstate = xfs_fs_setxstate, | |
1616 | - .get_xquota = xfs_fs_getxquota, | |
1617 | - .set_xquota = xfs_fs_setxquota, | |
1618 | 1560 | }; |
1619 | 1561 | |
1620 | 1562 | static struct file_system_type xfs_fs_type = { |
fs/xfs/linux-2.6/xfs_super.h
fs/xfs/linux-2.6/xfs_sync.h
fs/xfs/quota/xfs_qm.h
... | ... | @@ -173,6 +173,16 @@ |
173 | 173 | extern int xfs_qm_dqpurge_all(xfs_mount_t *, uint); |
174 | 174 | extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); |
175 | 175 | |
176 | +/* quota ops */ | |
177 | +extern int xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint); | |
178 | +extern int xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint, | |
179 | + fs_disk_quota_t *); | |
180 | +extern int xfs_qm_scall_setqlim(xfs_mount_t *, xfs_dqid_t, uint, | |
181 | + fs_disk_quota_t *); | |
182 | +extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); | |
183 | +extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); | |
184 | +extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); | |
185 | + | |
176 | 186 | /* vop stuff */ |
177 | 187 | extern int xfs_qm_vop_dqalloc(xfs_mount_t *, xfs_inode_t *, |
178 | 188 | uid_t, gid_t, prid_t, uint, |
... | ... | @@ -189,10 +199,6 @@ |
189 | 199 | /* list stuff */ |
190 | 200 | extern void xfs_qm_freelist_append(xfs_frlist_t *, xfs_dquot_t *); |
191 | 201 | extern void xfs_qm_freelist_unlink(xfs_dquot_t *); |
192 | - | |
193 | -/* system call interface */ | |
194 | -extern int xfs_qm_quotactl(struct xfs_mount *, int, int, | |
195 | - xfs_caddr_t); | |
196 | 202 | |
197 | 203 | #ifdef DEBUG |
198 | 204 | extern int xfs_qm_internalqcheck(xfs_mount_t *); |
fs/xfs/quota/xfs_qm_bhv.c
fs/xfs/quota/xfs_qm_syscalls.c
... | ... | @@ -57,135 +57,16 @@ |
57 | 57 | # define qdprintk(s, args...) do { } while (0) |
58 | 58 | #endif |
59 | 59 | |
60 | -STATIC int xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint); | |
61 | -STATIC int xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint, | |
62 | - fs_disk_quota_t *); | |
63 | -STATIC int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); | |
64 | -STATIC int xfs_qm_scall_setqlim(xfs_mount_t *, xfs_dqid_t, uint, | |
65 | - fs_disk_quota_t *); | |
66 | -STATIC int xfs_qm_scall_quotaon(xfs_mount_t *, uint); | |
67 | -STATIC int xfs_qm_scall_quotaoff(xfs_mount_t *, uint, boolean_t); | |
68 | 60 | STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint); |
69 | 61 | STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *, |
70 | 62 | uint); |
71 | -STATIC uint xfs_qm_import_flags(uint); | |
72 | 63 | STATIC uint xfs_qm_export_flags(uint); |
73 | -STATIC uint xfs_qm_import_qtype_flags(uint); | |
74 | 64 | STATIC uint xfs_qm_export_qtype_flags(uint); |
75 | 65 | STATIC void xfs_qm_export_dquot(xfs_mount_t *, xfs_disk_dquot_t *, |
76 | 66 | fs_disk_quota_t *); |
77 | 67 | |
78 | 68 | |
79 | 69 | /* |
80 | - * The main distribution switch of all XFS quotactl system calls. | |
81 | - */ | |
82 | -int | |
83 | -xfs_qm_quotactl( | |
84 | - xfs_mount_t *mp, | |
85 | - int cmd, | |
86 | - int id, | |
87 | - xfs_caddr_t addr) | |
88 | -{ | |
89 | - int error; | |
90 | - | |
91 | - ASSERT(addr != NULL || cmd == Q_XQUOTASYNC); | |
92 | - | |
93 | - /* | |
94 | - * The following commands are valid even when quotaoff. | |
95 | - */ | |
96 | - switch (cmd) { | |
97 | - case Q_XQUOTARM: | |
98 | - /* | |
99 | - * Truncate quota files. quota must be off. | |
100 | - */ | |
101 | - if (XFS_IS_QUOTA_ON(mp)) | |
102 | - return XFS_ERROR(EINVAL); | |
103 | - if (mp->m_flags & XFS_MOUNT_RDONLY) | |
104 | - return XFS_ERROR(EROFS); | |
105 | - return (xfs_qm_scall_trunc_qfiles(mp, | |
106 | - xfs_qm_import_qtype_flags(*(uint *)addr))); | |
107 | - | |
108 | - case Q_XGETQSTAT: | |
109 | - /* | |
110 | - * Get quota status information. | |
111 | - */ | |
112 | - return (xfs_qm_scall_getqstat(mp, (fs_quota_stat_t *)addr)); | |
113 | - | |
114 | - case Q_XQUOTAON: | |
115 | - /* | |
116 | - * QUOTAON - enabling quota enforcement. | |
117 | - * Quota accounting must be turned on at mount time. | |
118 | - */ | |
119 | - if (mp->m_flags & XFS_MOUNT_RDONLY) | |
120 | - return XFS_ERROR(EROFS); | |
121 | - return (xfs_qm_scall_quotaon(mp, | |
122 | - xfs_qm_import_flags(*(uint *)addr))); | |
123 | - | |
124 | - case Q_XQUOTAOFF: | |
125 | - if (mp->m_flags & XFS_MOUNT_RDONLY) | |
126 | - return XFS_ERROR(EROFS); | |
127 | - break; | |
128 | - | |
129 | - case Q_XQUOTASYNC: | |
130 | - return xfs_sync_inodes(mp, SYNC_DELWRI); | |
131 | - | |
132 | - default: | |
133 | - break; | |
134 | - } | |
135 | - | |
136 | - if (! XFS_IS_QUOTA_ON(mp)) | |
137 | - return XFS_ERROR(ESRCH); | |
138 | - | |
139 | - switch (cmd) { | |
140 | - case Q_XQUOTAOFF: | |
141 | - if (mp->m_flags & XFS_MOUNT_RDONLY) | |
142 | - return XFS_ERROR(EROFS); | |
143 | - error = xfs_qm_scall_quotaoff(mp, | |
144 | - xfs_qm_import_flags(*(uint *)addr), | |
145 | - B_FALSE); | |
146 | - break; | |
147 | - | |
148 | - case Q_XGETQUOTA: | |
149 | - error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER, | |
150 | - (fs_disk_quota_t *)addr); | |
151 | - break; | |
152 | - case Q_XGETGQUOTA: | |
153 | - error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, | |
154 | - (fs_disk_quota_t *)addr); | |
155 | - break; | |
156 | - case Q_XGETPQUOTA: | |
157 | - error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_PROJ, | |
158 | - (fs_disk_quota_t *)addr); | |
159 | - break; | |
160 | - | |
161 | - case Q_XSETQLIM: | |
162 | - if (mp->m_flags & XFS_MOUNT_RDONLY) | |
163 | - return XFS_ERROR(EROFS); | |
164 | - error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER, | |
165 | - (fs_disk_quota_t *)addr); | |
166 | - break; | |
167 | - case Q_XSETGQLIM: | |
168 | - if (mp->m_flags & XFS_MOUNT_RDONLY) | |
169 | - return XFS_ERROR(EROFS); | |
170 | - error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, | |
171 | - (fs_disk_quota_t *)addr); | |
172 | - break; | |
173 | - case Q_XSETPQLIM: | |
174 | - if (mp->m_flags & XFS_MOUNT_RDONLY) | |
175 | - return XFS_ERROR(EROFS); | |
176 | - error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ, | |
177 | - (fs_disk_quota_t *)addr); | |
178 | - break; | |
179 | - | |
180 | - default: | |
181 | - error = XFS_ERROR(EINVAL); | |
182 | - break; | |
183 | - } | |
184 | - | |
185 | - return (error); | |
186 | -} | |
187 | - | |
188 | -/* | |
189 | 70 | * Turn off quota accounting and/or enforcement for all udquots and/or |
190 | 71 | * gdquots. Called only at unmount time. |
191 | 72 | * |
192 | 73 | |
... | ... | @@ -193,11 +74,10 @@ |
193 | 74 | * incore, and modifies the ondisk dquot directly. Therefore, for example, |
194 | 75 | * it is an error to call this twice, without purging the cache. |
195 | 76 | */ |
196 | -STATIC int | |
77 | +int | |
197 | 78 | xfs_qm_scall_quotaoff( |
198 | 79 | xfs_mount_t *mp, |
199 | - uint flags, | |
200 | - boolean_t force) | |
80 | + uint flags) | |
201 | 81 | { |
202 | 82 | uint dqtype; |
203 | 83 | int error; |
... | ... | @@ -205,8 +85,6 @@ |
205 | 85 | xfs_qoff_logitem_t *qoffstart; |
206 | 86 | int nculprits; |
207 | 87 | |
208 | - if (!force && !capable(CAP_SYS_ADMIN)) | |
209 | - return XFS_ERROR(EPERM); | |
210 | 88 | /* |
211 | 89 | * No file system can have quotas enabled on disk but not in core. |
212 | 90 | * Note that quota utilities (like quotaoff) _expect_ |
... | ... | @@ -375,7 +253,7 @@ |
375 | 253 | return (error); |
376 | 254 | } |
377 | 255 | |
378 | -STATIC int | |
256 | +int | |
379 | 257 | xfs_qm_scall_trunc_qfiles( |
380 | 258 | xfs_mount_t *mp, |
381 | 259 | uint flags) |
... | ... | @@ -383,8 +261,6 @@ |
383 | 261 | int error = 0, error2 = 0; |
384 | 262 | xfs_inode_t *qip; |
385 | 263 | |
386 | - if (!capable(CAP_SYS_ADMIN)) | |
387 | - return XFS_ERROR(EPERM); | |
388 | 264 | if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) { |
389 | 265 | qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags); |
390 | 266 | return XFS_ERROR(EINVAL); |
... | ... | @@ -416,7 +292,7 @@ |
416 | 292 | * effect immediately. |
417 | 293 | * (Switching on quota accounting must be done at mount time.) |
418 | 294 | */ |
419 | -STATIC int | |
295 | +int | |
420 | 296 | xfs_qm_scall_quotaon( |
421 | 297 | xfs_mount_t *mp, |
422 | 298 | uint flags) |
... | ... | @@ -426,9 +302,6 @@ |
426 | 302 | uint accflags; |
427 | 303 | __int64_t sbflags; |
428 | 304 | |
429 | - if (!capable(CAP_SYS_ADMIN)) | |
430 | - return XFS_ERROR(EPERM); | |
431 | - | |
432 | 305 | flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD); |
433 | 306 | /* |
434 | 307 | * Switching on quota accounting must be done at mount time. |
... | ... | @@ -517,7 +390,7 @@ |
517 | 390 | /* |
518 | 391 | * Return quota status information, such as uquota-off, enforcements, etc. |
519 | 392 | */ |
520 | -STATIC int | |
393 | +int | |
521 | 394 | xfs_qm_scall_getqstat( |
522 | 395 | xfs_mount_t *mp, |
523 | 396 | fs_quota_stat_t *out) |
... | ... | @@ -582,7 +455,7 @@ |
582 | 455 | /* |
583 | 456 | * Adjust quota limits, and start/stop timers accordingly. |
584 | 457 | */ |
585 | -STATIC int | |
458 | +int | |
586 | 459 | xfs_qm_scall_setqlim( |
587 | 460 | xfs_mount_t *mp, |
588 | 461 | xfs_dqid_t id, |
... | ... | @@ -595,9 +468,6 @@ |
595 | 468 | int error; |
596 | 469 | xfs_qcnt_t hard, soft; |
597 | 470 | |
598 | - if (!capable(CAP_SYS_ADMIN)) | |
599 | - return XFS_ERROR(EPERM); | |
600 | - | |
601 | 471 | if ((newlim->d_fieldmask & |
602 | 472 | (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK|FS_DQ_WARNS_MASK)) == 0) |
603 | 473 | return (0); |
... | ... | @@ -742,7 +612,7 @@ |
742 | 612 | return error; |
743 | 613 | } |
744 | 614 | |
745 | -STATIC int | |
615 | +int | |
746 | 616 | xfs_qm_scall_getquota( |
747 | 617 | xfs_mount_t *mp, |
748 | 618 | xfs_dqid_t id, |
... | ... | @@ -935,30 +805,6 @@ |
935 | 805 | } |
936 | 806 | |
937 | 807 | STATIC uint |
938 | -xfs_qm_import_qtype_flags( | |
939 | - uint uflags) | |
940 | -{ | |
941 | - uint oflags = 0; | |
942 | - | |
943 | - /* | |
944 | - * Can't be more than one, or none. | |
945 | - */ | |
946 | - if (((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) == | |
947 | - (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) || | |
948 | - ((uflags & (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) == | |
949 | - (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) || | |
950 | - ((uflags & (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) == | |
951 | - (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) || | |
952 | - ((uflags & (XFS_GROUP_QUOTA|XFS_USER_QUOTA|XFS_PROJ_QUOTA)) == 0)) | |
953 | - return (0); | |
954 | - | |
955 | - oflags |= (uflags & XFS_USER_QUOTA) ? XFS_DQ_USER : 0; | |
956 | - oflags |= (uflags & XFS_PROJ_QUOTA) ? XFS_DQ_PROJ : 0; | |
957 | - oflags |= (uflags & XFS_GROUP_QUOTA) ? XFS_DQ_GROUP: 0; | |
958 | - return oflags; | |
959 | -} | |
960 | - | |
961 | -STATIC uint | |
962 | 808 | xfs_qm_export_qtype_flags( |
963 | 809 | uint flags) |
964 | 810 | { |
... | ... | @@ -977,26 +823,6 @@ |
977 | 823 | XFS_USER_QUOTA : (flags & XFS_DQ_PROJ) ? |
978 | 824 | XFS_PROJ_QUOTA : XFS_GROUP_QUOTA; |
979 | 825 | } |
980 | - | |
981 | -STATIC uint | |
982 | -xfs_qm_import_flags( | |
983 | - uint uflags) | |
984 | -{ | |
985 | - uint flags = 0; | |
986 | - | |
987 | - if (uflags & XFS_QUOTA_UDQ_ACCT) | |
988 | - flags |= XFS_UQUOTA_ACCT; | |
989 | - if (uflags & XFS_QUOTA_PDQ_ACCT) | |
990 | - flags |= XFS_PQUOTA_ACCT; | |
991 | - if (uflags & XFS_QUOTA_GDQ_ACCT) | |
992 | - flags |= XFS_GQUOTA_ACCT; | |
993 | - if (uflags & XFS_QUOTA_UDQ_ENFD) | |
994 | - flags |= XFS_UQUOTA_ENFD; | |
995 | - if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD)) | |
996 | - flags |= XFS_OQUOTA_ENFD; | |
997 | - return (flags); | |
998 | -} | |
999 | - | |
1000 | 826 | |
1001 | 827 | STATIC uint |
1002 | 828 | xfs_qm_export_flags( |
fs/xfs/xfs_mount.h
... | ... | @@ -136,7 +136,6 @@ |
136 | 136 | struct xfs_dquot *, struct xfs_dquot *, uint); |
137 | 137 | typedef void (*xfs_dqstatvfs_t)(struct xfs_inode *, struct kstatfs *); |
138 | 138 | typedef int (*xfs_dqsync_t)(struct xfs_mount *, int flags); |
139 | -typedef int (*xfs_quotactl_t)(struct xfs_mount *, int, int, xfs_caddr_t); | |
140 | 139 | |
141 | 140 | typedef struct xfs_qmops { |
142 | 141 | xfs_qminit_t xfs_qminit; |
... | ... | @@ -154,7 +153,6 @@ |
154 | 153 | xfs_dqvopchownresv_t xfs_dqvopchownresv; |
155 | 154 | xfs_dqstatvfs_t xfs_dqstatvfs; |
156 | 155 | xfs_dqsync_t xfs_dqsync; |
157 | - xfs_quotactl_t xfs_quotactl; | |
158 | 156 | struct xfs_dqtrxops *xfs_dqtrxops; |
159 | 157 | } xfs_qmops_t; |
160 | 158 | |
... | ... | @@ -188,8 +186,6 @@ |
188 | 186 | (*(ip)->i_mount->m_qm_ops->xfs_dqstatvfs)(ip, statp) |
189 | 187 | #define XFS_QM_DQSYNC(mp, flags) \ |
190 | 188 | (*(mp)->m_qm_ops->xfs_dqsync)(mp, flags) |
191 | -#define XFS_QM_QUOTACTL(mp, cmd, id, addr) \ | |
192 | - (*(mp)->m_qm_ops->xfs_quotactl)(mp, cmd, id, addr) | |
193 | 189 | |
194 | 190 | #ifdef HAVE_PERCPU_SB |
195 | 191 |
fs/xfs/xfs_qmops.c