Move first-layer proplib frobbing for QUOTACTL_GET to FS-independent code. (step 1 of several) Note: this change requires a kernel version bump.diff -r1.6 -r1.7 src/sys/kern/vfs_quotactl.c
(dholland)
--- src/sys/kern/vfs_quotactl.c 2012/01/29 06:36:50 1.6
+++ src/sys/kern/vfs_quotactl.c 2012/01/29 06:37:30 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vfs_quotactl.c,v 1.6 2012/01/29 06:36:50 dholland Exp $ */ | 1 | /* $NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1991, 1993, 1994 | 4 | * Copyright (c) 1991, 1993, 1994 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * (c) UNIX System Laboratories, Inc. | 6 | * (c) UNIX System Laboratories, Inc. | |
7 | * All or some portions of this file are derived from material licensed | 7 | * All or some portions of this file are derived from material licensed | |
8 | * to the University of California by American Telephone and Telegraph | 8 | * to the University of California by American Telephone and Telegraph | |
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
10 | * the permission of UNIX System Laboratories, Inc. | 10 | * the permission of UNIX System Laboratories, Inc. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -70,27 +70,27 @@ | @@ -70,27 +70,27 @@ | |||
70 | * | 70 | * | |
71 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 | 71 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 | |
72 | * From NetBSD: ufs_quota.c,v 1.70 2011/03/24 17:05:46 bouyer Exp | 72 | * From NetBSD: ufs_quota.c,v 1.70 2011/03/24 17:05:46 bouyer Exp | |
73 | */ | 73 | */ | |
74 | 74 | |||
75 | /* | 75 | /* | |
76 | * Note that both of the copyrights above are moderately spurious; | 76 | * Note that both of the copyrights above are moderately spurious; | |
77 | * this code should almost certainly have the Copyright 2010 Manuel | 77 | * this code should almost certainly have the Copyright 2010 Manuel | |
78 | * Bouyer notice and license found in e.g. sys/ufs/ufs/quota2_subr.c. | 78 | * Bouyer notice and license found in e.g. sys/ufs/ufs/quota2_subr.c. | |
79 | * However, they're what was on the files this code was sliced out of. | 79 | * However, they're what was on the files this code was sliced out of. | |
80 | */ | 80 | */ | |
81 | 81 | |||
82 | #include <sys/cdefs.h> | 82 | #include <sys/cdefs.h> | |
83 | __KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.6 2012/01/29 06:36:50 dholland Exp $"); | 83 | __KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $"); | |
84 | 84 | |||
85 | #include <sys/mount.h> | 85 | #include <sys/mount.h> | |
86 | #include <sys/quotactl.h> | 86 | #include <sys/quotactl.h> | |
87 | #include <quota/quotaprop.h> | 87 | #include <quota/quotaprop.h> | |
88 | 88 | |||
89 | static int | 89 | static int | |
90 | vfs_quotactl_getversion(struct mount *mp, | 90 | vfs_quotactl_getversion(struct mount *mp, | |
91 | prop_dictionary_t cmddict, int q2type, | 91 | prop_dictionary_t cmddict, int q2type, | |
92 | prop_array_t datas) | 92 | prop_array_t datas) | |
93 | { | 93 | { | |
94 | prop_array_t replies; | 94 | prop_array_t replies; | |
95 | prop_dictionary_t data; | 95 | prop_dictionary_t data; | |
96 | int q2version; | 96 | int q2version; | |
@@ -160,33 +160,94 @@ vfs_quotactl_quotaoff(struct mount *mp, | @@ -160,33 +160,94 @@ vfs_quotactl_quotaoff(struct mount *mp, | |||
160 | 160 | |||
161 | args.qc_type = QCT_PROPLIB; | 161 | args.qc_type = QCT_PROPLIB; | |
162 | args.u.proplib.qc_cmddict = cmddict; | 162 | args.u.proplib.qc_cmddict = cmddict; | |
163 | args.u.proplib.qc_q2type = q2type; | 163 | args.u.proplib.qc_q2type = q2type; | |
164 | args.u.proplib.qc_datas = datas; | 164 | args.u.proplib.qc_datas = datas; | |
165 | return VFS_QUOTACTL(mp, QUOTACTL_QUOTAOFF, &args); | 165 | return VFS_QUOTACTL(mp, QUOTACTL_QUOTAOFF, &args); | |
166 | } | 166 | } | |
167 | 167 | |||
168 | static int | 168 | static int | |
169 | vfs_quotactl_get(struct mount *mp, | 169 | vfs_quotactl_get(struct mount *mp, | |
170 | prop_dictionary_t cmddict, int q2type, | 170 | prop_dictionary_t cmddict, int q2type, | |
171 | prop_array_t datas) | 171 | prop_array_t datas) | |
172 | { | 172 | { | |
173 | prop_object_iterator_t iter; | |||
174 | prop_dictionary_t data; | |||
175 | uint32_t id; | |||
176 | int defaultq; | |||
177 | const char *idstr; | |||
178 | prop_array_t replies; | |||
173 | struct vfs_quotactl_args args; | 179 | struct vfs_quotactl_args args; | |
180 | int error; | |||
174 | 181 | |||
175 | args.qc_type = QCT_PROPLIB; | 182 | KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY); | |
176 | args.u.proplib.qc_cmddict = cmddict; | 183 | KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY); | |
177 | args.u.proplib.qc_q2type = q2type; | 184 | ||
178 | args.u.proplib.qc_datas = datas; | 185 | replies = prop_array_create(); | |
179 | return VFS_QUOTACTL(mp, QUOTACTL_GET, &args); | 186 | if (replies == NULL) { | |
187 | return ENOMEM; | |||
188 | } | |||
189 | ||||
190 | iter = prop_array_iterator(datas); | |||
191 | if (iter == NULL) { | |||
192 | prop_object_release(replies); | |||
193 | return ENOMEM; | |||
194 | } | |||
195 | ||||
196 | while ((data = prop_object_iterator_next(iter)) != NULL) { | |||
197 | if (!prop_dictionary_get_uint32(data, "id", &id)) { | |||
198 | if (!prop_dictionary_get_cstring_nocopy(data, "id", | |||
199 | &idstr)) | |||
200 | continue; | |||
201 | if (strcmp(idstr, "default")) { | |||
202 | error = EINVAL; | |||
203 | goto fail; | |||
204 | } | |||
205 | id = 0; | |||
206 | defaultq = 1; | |||
207 | } else { | |||
208 | defaultq = 0; | |||
209 | } | |||
210 | ||||
211 | args.qc_type = QCT_GET; | |||
212 | args.u.get.qc_q2type = q2type; | |||
213 | args.u.get.qc_id = id; | |||
214 | args.u.get.qc_defaultq = defaultq; | |||
215 | args.u.get.qc_replies = replies; | |||
216 | error = VFS_QUOTACTL(mp, QUOTACTL_GET, &args); | |||
217 | if (error == EPERM) { | |||
218 | /* XXX does this make sense? */ | |||
219 | continue; | |||
220 | } else if (error == ENOENT) { | |||
221 | /* XXX does *this* make sense? */ | |||
222 | continue; | |||
223 | } else if (error) { | |||
224 | goto fail; | |||
225 | } | |||
226 | } | |||
227 | ||||
228 | prop_object_iterator_release(iter); | |||
229 | if (!prop_dictionary_set_and_rel(cmddict, "data", replies)) { | |||
230 | error = ENOMEM; | |||
231 | } else { | |||
232 | error = 0; | |||
233 | } | |||
234 | ||||
235 | return error; | |||
236 | ||||
237 | fail: | |||
238 | prop_object_iterator_release(iter); | |||
239 | prop_object_release(replies); | |||
240 | return error; | |||
180 | } | 241 | } | |
181 | 242 | |||
182 | static int | 243 | static int | |
183 | vfs_quotactl_set(struct mount *mp, | 244 | vfs_quotactl_set(struct mount *mp, | |
184 | prop_dictionary_t cmddict, int q2type, | 245 | prop_dictionary_t cmddict, int q2type, | |
185 | prop_array_t datas) | 246 | prop_array_t datas) | |
186 | { | 247 | { | |
187 | struct vfs_quotactl_args args; | 248 | struct vfs_quotactl_args args; | |
188 | 249 | |||
189 | args.qc_type = QCT_PROPLIB; | 250 | args.qc_type = QCT_PROPLIB; | |
190 | args.u.proplib.qc_cmddict = cmddict; | 251 | args.u.proplib.qc_cmddict = cmddict; | |
191 | args.u.proplib.qc_q2type = q2type; | 252 | args.u.proplib.qc_q2type = q2type; | |
192 | args.u.proplib.qc_datas = datas; | 253 | args.u.proplib.qc_datas = datas; |
--- src/sys/sys/quotactl.h 2012/01/29 06:36:50 1.4
+++ src/sys/sys/quotactl.h 2012/01/29 06:37:30 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: quotactl.h,v 1.4 2012/01/29 06:36:50 dholland Exp $ */ | 1 | /* $NetBSD: quotactl.h,v 1.5 2012/01/29 06:37:30 dholland Exp $ */ | |
2 | /*- | 2 | /*- | |
3 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by David A. Holland. | 7 | * by David A. Holland. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -40,29 +40,36 @@ | @@ -40,29 +40,36 @@ | |||
40 | /* Command codes. */ | 40 | /* Command codes. */ | |
41 | #define QUOTACTL_GETVERSION 0 | 41 | #define QUOTACTL_GETVERSION 0 | |
42 | #define QUOTACTL_QUOTAON 1 | 42 | #define QUOTACTL_QUOTAON 1 | |
43 | #define QUOTACTL_QUOTAOFF 2 | 43 | #define QUOTACTL_QUOTAOFF 2 | |
44 | #define QUOTACTL_GET 3 | 44 | #define QUOTACTL_GET 3 | |
45 | #define QUOTACTL_SET 4 | 45 | #define QUOTACTL_SET 4 | |
46 | #define QUOTACTL_GETALL 5 | 46 | #define QUOTACTL_GETALL 5 | |
47 | #define QUOTACTL_CLEAR 6 | 47 | #define QUOTACTL_CLEAR 6 | |
48 | 48 | |||
49 | /* Argument encoding. */ | 49 | /* Argument encoding. */ | |
50 | enum vfs_quotactl_argtypes { | 50 | enum vfs_quotactl_argtypes { | |
51 | QCT_PROPLIB, /* quotaon/off, get, set, getall, clear */ | 51 | QCT_PROPLIB, /* quotaon/off, get, set, getall, clear */ | |
52 | QCT_GETVERSION, /* getversion */ | 52 | QCT_GETVERSION, /* getversion */ | |
53 | QCT_GET, /* get */ | |||
53 | }; | 54 | }; | |
54 | struct vfs_quotactl_args { | 55 | struct vfs_quotactl_args { | |
55 | enum vfs_quotactl_argtypes qc_type; | 56 | enum vfs_quotactl_argtypes qc_type; | |
56 | union { | 57 | union { | |
57 | struct { | 58 | struct { | |
58 | prop_dictionary_t qc_cmddict; | 59 | prop_dictionary_t qc_cmddict; | |
59 | int qc_q2type; | 60 | int qc_q2type; | |
60 | prop_array_t qc_datas; | 61 | prop_array_t qc_datas; | |
61 | } proplib; | 62 | } proplib; | |
62 | struct { | 63 | struct { | |
63 | int *qc_version_ret; | 64 | int *qc_version_ret; | |
64 | } getversion; | 65 | } getversion; | |
66 | struct { | |||
67 | int qc_q2type; | |||
68 | id_t qc_id; | |||
69 | int qc_defaultq; | |||
70 | prop_array_t qc_replies; | |||
71 | } get; | |||
65 | } u; | 72 | } u; | |
66 | }; | 73 | }; | |
67 | 74 | |||
68 | #endif /* _SYS_QUOTACTL_H_ */ | 75 | #endif /* _SYS_QUOTACTL_H_ */ |
--- src/sys/ufs/ufs/ufs_quota.c 2012/01/29 06:36:51 1.73
+++ src/sys/ufs/ufs/ufs_quota.c 2012/01/29 06:37:30 1.74
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ufs_quota.c,v 1.73 2012/01/29 06:36:51 dholland Exp $ */ | 1 | /* $NetBSD: ufs_quota.c,v 1.74 2012/01/29 06:37:30 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1982, 1986, 1990, 1993, 1995 | 4 | * Copyright (c) 1982, 1986, 1990, 1993, 1995 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Robert Elz at The University of Melbourne. | 8 | * Robert Elz at The University of Melbourne. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
32 | * SUCH DAMAGE. | 32 | * SUCH DAMAGE. | |
33 | * | 33 | * | |
34 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 | 34 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.73 2012/01/29 06:36:51 dholland Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.74 2012/01/29 06:37:30 dholland Exp $"); | |
39 | 39 | |||
40 | #if defined(_KERNEL_OPT) | 40 | #if defined(_KERNEL_OPT) | |
41 | #include "opt_quota.h" | 41 | #include "opt_quota.h" | |
42 | #endif | 42 | #endif | |
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/kernel.h> | 44 | #include <sys/kernel.h> | |
45 | #include <sys/systm.h> | 45 | #include <sys/systm.h> | |
46 | #include <sys/namei.h> | 46 | #include <sys/namei.h> | |
47 | #include <sys/file.h> | 47 | #include <sys/file.h> | |
48 | #include <sys/proc.h> | 48 | #include <sys/proc.h> | |
49 | #include <sys/vnode.h> | 49 | #include <sys/vnode.h> | |
50 | #include <sys/mount.h> | 50 | #include <sys/mount.h> | |
51 | #include <sys/kauth.h> | 51 | #include <sys/kauth.h> | |
@@ -220,105 +220,64 @@ quota_handle_cmd_get_version(struct moun | @@ -220,105 +220,64 @@ quota_handle_cmd_get_version(struct moun | |||
220 | static int | 220 | static int | |
221 | quota_get_auth(struct mount *mp, struct lwp *l, uid_t id) { | 221 | quota_get_auth(struct mount *mp, struct lwp *l, uid_t id) { | |
222 | /* The user can always query about his own quota. */ | 222 | /* The user can always query about his own quota. */ | |
223 | if (id == kauth_cred_getuid(l->l_cred)) | 223 | if (id == kauth_cred_getuid(l->l_cred)) | |
224 | return 0; | 224 | return 0; | |
225 | return kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA, | 225 | return kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA, | |
226 | KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, KAUTH_ARG(id), NULL); | 226 | KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, KAUTH_ARG(id), NULL); | |
227 | } | 227 | } | |
228 | 228 | |||
229 | static int | 229 | static int | |
230 | quota_handle_cmd_get(struct mount *mp, struct lwp *l, | 230 | quota_handle_cmd_get(struct mount *mp, struct lwp *l, | |
231 | struct vfs_quotactl_args *args) | 231 | struct vfs_quotactl_args *args) | |
232 | { | 232 | { | |
233 | prop_array_t replies; | |||
234 | prop_object_iterator_t iter; | |||
235 | prop_dictionary_t data; | |||
236 | uint32_t id; | |||
237 | struct ufsmount *ump = VFSTOUFS(mp); | 233 | struct ufsmount *ump = VFSTOUFS(mp); | |
238 | int error, defaultq = 0; | 234 | int error; | |
239 | const char *idstr; | 235 | id_t id; | |
240 | prop_dictionary_t cmddict; | |||
241 | int q2type; | 236 | int q2type; | |
242 | prop_array_t datas; | 237 | int defaultq; | |
243 | 238 | prop_array_t replies; | ||
244 | KASSERT(args->qc_type == QCT_PROPLIB); | |||
245 | cmddict = args->u.proplib.qc_cmddict; | |||
246 | q2type = args->u.proplib.qc_q2type; | |||
247 | datas = args->u.proplib.qc_datas; | |||
248 | 239 | |||
249 | KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY); | 240 | KASSERT(args->qc_type == QCT_GET); | |
250 | KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY); | 241 | id = args->u.get.qc_id; | |
242 | q2type = args->u.get.qc_q2type; | |||
243 | defaultq = args->u.get.qc_defaultq; | |||
244 | replies = args->u.get.qc_replies; | |||
251 | 245 | |||
252 | if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0) | 246 | if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0) | |
253 | return EOPNOTSUPP; | 247 | return EOPNOTSUPP; | |
254 | 248 | |||
255 | replies = prop_array_create(); | 249 | /* avoid whitespace diffs */ { | |
256 | if (replies == NULL) | |||
257 | return ENOMEM; | |||
258 | ||||
259 | iter = prop_array_iterator(datas); | |||
260 | if (iter == NULL) { | |||
261 | prop_object_release(replies); | |||
262 | return ENOMEM; | |||
263 | } | |||
264 | while ((data = prop_object_iterator_next(iter)) != NULL) { | |||
265 | if (!prop_dictionary_get_uint32(data, "id", &id)) { | |||
266 | if (!prop_dictionary_get_cstring_nocopy(data, "id", | |||
267 | &idstr)) | |||
268 | continue; | |||
269 | if (strcmp(idstr, "default")) { | |||
270 | error = EINVAL; | |||
271 | goto err; | |||
272 | } | |||
273 | id = 0; | |||
274 | defaultq = 1; | |||
275 | } else { | |||
276 | defaultq = 0; | |||
277 | } | |||
278 | error = quota_get_auth(mp, l, id); | 250 | error = quota_get_auth(mp, l, id); | |
279 | if (error == EPERM) | |||
280 | continue; | |||
281 | if (error != 0) | 251 | if (error != 0) | |
282 | goto err; | 252 | return error; | |
283 | #ifdef QUOTA | 253 | #ifdef QUOTA | |
284 | if (ump->um_flags & UFS_QUOTA) | 254 | if (ump->um_flags & UFS_QUOTA) | |
285 | error = quota1_handle_cmd_get(ump, q2type, id, defaultq, | 255 | error = quota1_handle_cmd_get(ump, q2type, id, defaultq, | |
286 | replies); | 256 | replies); | |
287 | else | 257 | else | |
288 | #endif | 258 | #endif | |
289 | #ifdef QUOTA2 | 259 | #ifdef QUOTA2 | |
290 | if (ump->um_flags & UFS_QUOTA2) { | 260 | if (ump->um_flags & UFS_QUOTA2) { | |
291 | error = quota2_handle_cmd_get(ump, q2type, id, defaultq, | 261 | error = quota2_handle_cmd_get(ump, q2type, id, defaultq, | |
292 | replies); | 262 | replies); | |
293 | } else | 263 | } else | |
294 | #endif | 264 | #endif | |
295 | panic("quota_handle_cmd_get: no support ?"); | 265 | panic("quota_handle_cmd_get: no support ?"); | |
296 | 266 | |||
297 | if (error == ENOENT) | |||
298 | continue; | |||
299 | if (error != 0) | 267 | if (error != 0) | |
300 | goto err; | 268 | return error; | |
301 | } | |||
302 | prop_object_iterator_release(iter); | |||
303 | if (!prop_dictionary_set_and_rel(cmddict, "data", replies)) { | |||
304 | error = ENOMEM; | |||
305 | } else { | |||
306 | error = 0; | |||
307 | } | 269 | } | |
308 | return error; | 270 | ||
309 | err: | |||
310 | prop_object_iterator_release(iter); | |||
311 | prop_object_release(replies); | |||
312 | return error; | 271 | return error; | |
313 | } | 272 | } | |
314 | 273 | |||
315 | static int | 274 | static int | |
316 | quota_handle_cmd_set(struct mount *mp, struct lwp *l, | 275 | quota_handle_cmd_set(struct mount *mp, struct lwp *l, | |
317 | struct vfs_quotactl_args *args) | 276 | struct vfs_quotactl_args *args) | |
318 | { | 277 | { | |
319 | prop_array_t replies; | 278 | prop_array_t replies; | |
320 | prop_object_iterator_t iter; | 279 | prop_object_iterator_t iter; | |
321 | prop_dictionary_t data; | 280 | prop_dictionary_t data; | |
322 | uint32_t id; | 281 | uint32_t id; | |
323 | struct ufsmount *ump = VFSTOUFS(mp); | 282 | struct ufsmount *ump = VFSTOUFS(mp); | |
324 | int error, defaultq = 0; | 283 | int error, defaultq = 0; |