Sun Jan 29 06:50:54 2012 UTC ()
Tidy up a bit.


(dholland)
diff -r1.86 -r1.87 src/sys/ufs/ufs/ufs_quota.c

cvs diff -r1.86 -r1.87 src/sys/ufs/ufs/ufs_quota.c (expand / switch to unified diff)

--- src/sys/ufs/ufs/ufs_quota.c 2012/01/29 06:50:15 1.86
+++ src/sys/ufs/ufs/ufs_quota.c 2012/01/29 06:50:53 1.87
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ufs_quota.c,v 1.86 2012/01/29 06:50:15 dholland Exp $ */ 1/* $NetBSD: ufs_quota.c,v 1.87 2012/01/29 06:50:53 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.86 2012/01/29 06:50:15 dholland Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.87 2012/01/29 06:50:53 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>
@@ -278,45 +278,46 @@ quota_handle_cmd_put(struct mount *mp, s @@ -278,45 +278,46 @@ quota_handle_cmd_put(struct mount *mp, s
278 qv = args->u.put.qc_val; 278 qv = args->u.put.qc_val;
279 279
280 if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0) 280 if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0)
281 return EOPNOTSUPP; 281 return EOPNOTSUPP;
282 282
283 kauth_id = qk->qk_id; 283 kauth_id = qk->qk_id;
284 if (kauth_id == QUOTA_DEFAULTID) { 284 if (kauth_id == QUOTA_DEFAULTID) {
285 kauth_id = 0; 285 kauth_id = 0;
286 } 286 }
287 287
288 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA, 288 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA,
289 KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id), 289 KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id),
290 NULL); 290 NULL);
291 if (error != 0) 291 if (error != 0) {
292 goto err; 292 return error;
 293 }
 294
293#ifdef QUOTA 295#ifdef QUOTA
294 if (ump->um_flags & UFS_QUOTA) 296 if (ump->um_flags & UFS_QUOTA)
295 error = quota1_handle_cmd_put(ump, qk, qv); 297 error = quota1_handle_cmd_put(ump, qk, qv);
296 else 298 else
297#endif 299#endif
298#ifdef QUOTA2 300#ifdef QUOTA2
299 if (ump->um_flags & UFS_QUOTA2) { 301 if (ump->um_flags & UFS_QUOTA2) {
300 error = quota2_handle_cmd_put(ump, qk, qv); 302 error = quota2_handle_cmd_put(ump, qk, qv);
301 } else 303 } else
302#endif 304#endif
303 panic("quota_handle_cmd_get: no support ?"); 305 panic("quota_handle_cmd_get: no support ?");
304  306
305 if (error && error != ENOENT) 307 if (error == ENOENT) {
306 goto err; 308 error = 0;
 309 }
307 310
308 return 0; 
309 err: 
310 return error; 311 return error;
311} 312}
312 313
313static int  314static int
314quota_handle_cmd_clear(struct mount *mp, struct lwp *l,  315quota_handle_cmd_clear(struct mount *mp, struct lwp *l,
315 struct vfs_quotactl_args *args) 316 struct vfs_quotactl_args *args)
316{ 317{
317 prop_array_t replies; 318 prop_array_t replies;
318 prop_object_iterator_t iter; 319 prop_object_iterator_t iter;
319 prop_dictionary_t data; 320 prop_dictionary_t data;
320 uint32_t id; 321 uint32_t id;
321 struct ufsmount *ump = VFSTOUFS(mp); 322 struct ufsmount *ump = VFSTOUFS(mp);
322 int error, defaultq = 0; 323 int error, defaultq = 0;