Sun Jan 29 11:59:14 2012 UTC ()
sprinkel some #ifdef QUOTA2 to avoid unused variables


(para)
diff -r1.104 -r1.105 src/sys/ufs/ufs/ufs_quota.c

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

--- src/sys/ufs/ufs/ufs_quota.c 2012/01/29 07:16:53 1.104
+++ src/sys/ufs/ufs/ufs_quota.c 2012/01/29 11:59:14 1.105
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ufs_quota.c,v 1.104 2012/01/29 07:16:53 dholland Exp $ */ 1/* $NetBSD: ufs_quota.c,v 1.105 2012/01/29 11:59:14 para 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.104 2012/01/29 07:16:53 dholland Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.105 2012/01/29 11:59:14 para 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>
@@ -420,125 +420,135 @@ quota_handle_cmd_cursorget(struct mount  @@ -420,125 +420,135 @@ quota_handle_cmd_cursorget(struct mount
420 error = quota2_handle_cmd_cursorget(ump, cursor, keys, vals, 420 error = quota2_handle_cmd_cursorget(ump, cursor, keys, vals,
421 maxnum, ret); 421 maxnum, ret);
422 } else 422 } else
423#endif 423#endif
424 panic("quota_handle_cmd_cursorget: no support ?"); 424 panic("quota_handle_cmd_cursorget: no support ?");
425 425
426 return error; 426 return error;
427} 427}
428 428
429static int  429static int
430quota_handle_cmd_cursoropen(struct mount *mp, struct lwp *l,  430quota_handle_cmd_cursoropen(struct mount *mp, struct lwp *l,
431 struct vfs_quotactl_args *args) 431 struct vfs_quotactl_args *args)
432{ 432{
 433#ifdef QUOTA2
433 struct ufsmount *ump = VFSTOUFS(mp); 434 struct ufsmount *ump = VFSTOUFS(mp);
 435#endif
434 struct quotakcursor *cursor; 436 struct quotakcursor *cursor;
435 int error; 437 int error;
436 438
437 KASSERT(args->qc_op == QUOTACTL_CURSOROPEN); 439 KASSERT(args->qc_op == QUOTACTL_CURSOROPEN);
438 cursor = args->u.cursoropen.qc_cursor; 440 cursor = args->u.cursoropen.qc_cursor;
439 441
440 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA, 442 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA,
441 KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, NULL, NULL); 443 KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, NULL, NULL);
442 if (error) 444 if (error)
443 return error; 445 return error;
444 446
445#ifdef QUOTA2 447#ifdef QUOTA2
446 if (ump->um_flags & UFS_QUOTA2) { 448 if (ump->um_flags & UFS_QUOTA2) {
447 error = quota2_handle_cmd_cursoropen(ump, cursor); 449 error = quota2_handle_cmd_cursoropen(ump, cursor);
448 } else 450 } else
449#endif 451#endif
450 error = EOPNOTSUPP; 452 error = EOPNOTSUPP;
451 453
452 return error; 454 return error;
453} 455}
454 456
455static int  457static int
456quota_handle_cmd_cursorclose(struct mount *mp, struct lwp *l,  458quota_handle_cmd_cursorclose(struct mount *mp, struct lwp *l,
457 struct vfs_quotactl_args *args) 459 struct vfs_quotactl_args *args)
458{ 460{
 461#ifdef QUOTA2
459 struct ufsmount *ump = VFSTOUFS(mp); 462 struct ufsmount *ump = VFSTOUFS(mp);
 463#endif
460 struct quotakcursor *cursor; 464 struct quotakcursor *cursor;
461 int error; 465 int error;
462 466
463 KASSERT(args->qc_op == QUOTACTL_CURSORCLOSE); 467 KASSERT(args->qc_op == QUOTACTL_CURSORCLOSE);
464 cursor = args->u.cursorclose.qc_cursor; 468 cursor = args->u.cursorclose.qc_cursor;
465 469
466 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA, 470 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA,
467 KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, NULL, NULL); 471 KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, NULL, NULL);
468 if (error) 472 if (error)
469 return error; 473 return error;
470 474
471#ifdef QUOTA2 475#ifdef QUOTA2
472 if (ump->um_flags & UFS_QUOTA2) { 476 if (ump->um_flags & UFS_QUOTA2) {
473 error = quota2_handle_cmd_cursorclose(ump, cursor); 477 error = quota2_handle_cmd_cursorclose(ump, cursor);
474 } else 478 } else
475#endif 479#endif
476 error = EOPNOTSUPP; 480 error = EOPNOTSUPP;
477 481
478 return error; 482 return error;
479} 483}
480 484
481static int  485static int
482quota_handle_cmd_cursorskipidtype(struct mount *mp, struct lwp *l,  486quota_handle_cmd_cursorskipidtype(struct mount *mp, struct lwp *l,
483 struct vfs_quotactl_args *args) 487 struct vfs_quotactl_args *args)
484{ 488{
 489#ifdef QUOTA2
485 struct ufsmount *ump = VFSTOUFS(mp); 490 struct ufsmount *ump = VFSTOUFS(mp);
 491#endif
486 struct quotakcursor *cursor; 492 struct quotakcursor *cursor;
487 int idtype; 493 int idtype;
488 int error; 494 int error;
489 495
490 KASSERT(args->qc_op == QUOTACTL_CURSORSKIPIDTYPE); 496 KASSERT(args->qc_op == QUOTACTL_CURSORSKIPIDTYPE);
491 cursor = args->u.cursorskipidtype.qc_cursor; 497 cursor = args->u.cursorskipidtype.qc_cursor;
492 idtype = args->u.cursorskipidtype.qc_idtype; 498 idtype = args->u.cursorskipidtype.qc_idtype;
493 499
494#ifdef QUOTA2 500#ifdef QUOTA2
495 if (ump->um_flags & UFS_QUOTA2) { 501 if (ump->um_flags & UFS_QUOTA2) {
496 error = quota2_handle_cmd_cursorskipidtype(ump, cursor, idtype); 502 error = quota2_handle_cmd_cursorskipidtype(ump, cursor, idtype);
497 } else 503 } else
498#endif 504#endif
499 error = EOPNOTSUPP; 505 error = EOPNOTSUPP;
500 506
501 return error; 507 return error;
502} 508}
503 509
504static int  510static int
505quota_handle_cmd_cursoratend(struct mount *mp, struct lwp *l,  511quota_handle_cmd_cursoratend(struct mount *mp, struct lwp *l,
506 struct vfs_quotactl_args *args) 512 struct vfs_quotactl_args *args)
507{ 513{
 514#ifdef QUOTA2
508 struct ufsmount *ump = VFSTOUFS(mp); 515 struct ufsmount *ump = VFSTOUFS(mp);
 516#endif
509 struct quotakcursor *cursor; 517 struct quotakcursor *cursor;
510 int *ret; 518 int *ret;
511 int error; 519 int error;
512 520
513 KASSERT(args->qc_op == QUOTACTL_CURSORATEND); 521 KASSERT(args->qc_op == QUOTACTL_CURSORATEND);
514 cursor = args->u.cursoratend.qc_cursor; 522 cursor = args->u.cursoratend.qc_cursor;
515 ret = args->u.cursoratend.qc_ret; 523 ret = args->u.cursoratend.qc_ret;
516 524
517#ifdef QUOTA2 525#ifdef QUOTA2
518 if (ump->um_flags & UFS_QUOTA2) { 526 if (ump->um_flags & UFS_QUOTA2) {
519 error = quota2_handle_cmd_cursoratend(ump, cursor, ret); 527 error = quota2_handle_cmd_cursoratend(ump, cursor, ret);
520 } else 528 } else
521#endif 529#endif
522 error = EOPNOTSUPP; 530 error = EOPNOTSUPP;
523 531
524 return error; 532 return error;
525} 533}
526 534
527static int  535static int
528quota_handle_cmd_cursorrewind(struct mount *mp, struct lwp *l,  536quota_handle_cmd_cursorrewind(struct mount *mp, struct lwp *l,
529 struct vfs_quotactl_args *args) 537 struct vfs_quotactl_args *args)
530{ 538{
 539#ifdef QUOTA2
531 struct ufsmount *ump = VFSTOUFS(mp); 540 struct ufsmount *ump = VFSTOUFS(mp);
 541#endif
532 struct quotakcursor *cursor; 542 struct quotakcursor *cursor;
533 int error; 543 int error;
534 544
535 KASSERT(args->qc_op == QUOTACTL_CURSORREWIND); 545 KASSERT(args->qc_op == QUOTACTL_CURSORREWIND);
536 cursor = args->u.cursorrewind.qc_cursor; 546 cursor = args->u.cursorrewind.qc_cursor;
537 547
538#ifdef QUOTA2 548#ifdef QUOTA2
539 if (ump->um_flags & UFS_QUOTA2) { 549 if (ump->um_flags & UFS_QUOTA2) {
540 error = quota2_handle_cmd_cursorrewind(ump, cursor); 550 error = quota2_handle_cmd_cursorrewind(ump, cursor);
541 } else 551 } else
542#endif 552#endif
543 error = EOPNOTSUPP; 553 error = EOPNOTSUPP;
544 554