Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Move proplib bits for QUOTACTL_QUOTAOFF out of the ufs c...



details:   https://anonhg.NetBSD.org/src/rev/4840d05194b1
branches:  trunk
changeset: 773203:4840d05194b1
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jan 29 07:11:55 2012 +0000

description:
Move proplib bits for QUOTACTL_QUOTAOFF out of the ufs code.

This change requires a kernel version bump.

diffstat:

 sys/kern/vfs_quotactl.c |  16 ++++++++++------
 sys/sys/quotactl.h      |   8 ++++++--
 sys/ufs/ufs/ufs_quota.c |  22 ++++++----------------
 3 files changed, 22 insertions(+), 24 deletions(-)

diffs (128 lines):

diff -r d96047907d3d -r 4840d05194b1 sys/kern/vfs_quotactl.c
--- a/sys/kern/vfs_quotactl.c   Sun Jan 29 07:11:12 2012 +0000
+++ b/sys/kern/vfs_quotactl.c   Sun Jan 29 07:11:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $       */
+/*     $NetBSD: vfs_quotactl.c,v 1.32 2012/01/29 07:11:55 dholland Exp $       */
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.32 2012/01/29 07:11:55 dholland Exp $");
 
 #include <sys/malloc.h> /* XXX: temporary */
 #include <sys/mount.h>
@@ -174,10 +174,14 @@
 {
        struct vfs_quotactl_args args;
 
-       args.qc_type = QCT_PROPLIB;
-       args.u.proplib.qc_cmddict = cmddict;
-       args.u.proplib.qc_q2type = q2type;
-       args.u.proplib.qc_datas = datas;
+       KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
+       KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+
+       if (prop_array_count(datas) != 0)
+               return EINVAL;
+
+       args.qc_type = QCT_QUOTAOFF;
+       args.u.quotaoff.qc_idtype = q2type;
        return VFS_QUOTACTL(mp, QUOTACTL_QUOTAOFF, &args);
 }
 
diff -r d96047907d3d -r 4840d05194b1 sys/sys/quotactl.h
--- a/sys/sys/quotactl.h        Sun Jan 29 07:11:12 2012 +0000
+++ b/sys/sys/quotactl.h        Sun Jan 29 07:11:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quotactl.h,v 1.27 2012/01/29 07:11:12 dholland Exp $   */
+/*     $NetBSD: quotactl.h,v 1.28 2012/01/29 07:11:55 dholland Exp $   */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -67,7 +67,7 @@
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
-       QCT_PROPLIB,    /* quotaoff */
+       QCT_PROPLIB,    /* unused */
        QCT_GETVERSION, /* getversion */
        QCT_GET,        /* get */
        QCT_PUT,        /* put */
@@ -79,6 +79,7 @@
        QCT_CURSORATEND,/* test cursor */
        QCT_CURSORREWIND,/* reset cursor */
        QCT_QUOTAON,    /* quotaon */
+       QCT_QUOTAOFF,   /* quotaoff */
 };
 struct vfs_quotactl_args {
        enum vfs_quotactl_argtypes qc_type;
@@ -130,6 +131,9 @@
                        int qc_idtype;
                        const char *qc_quotafile;
                } quotaon;
+               struct {
+                       int qc_idtype;
+               } quotaoff;
        } u;
 };
 
diff -r d96047907d3d -r 4840d05194b1 sys/ufs/ufs/ufs_quota.c
--- a/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 07:11:12 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 07:11:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 dholland Exp $  */
+/*     $NetBSD: ufs_quota.c,v 1.100 2012/01/29 07:11:55 dholland Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.100 2012/01/29 07:11:55 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -571,32 +571,22 @@
     struct vfs_quotactl_args *args)
 {
        struct ufsmount *ump = VFSTOUFS(mp);
+       int idtype;
        int error;
-       prop_dictionary_t cmddict;
-       int q2type;
-       prop_array_t datas;
 
-       KASSERT(args->qc_type == QCT_PROPLIB);
-       cmddict = args->u.proplib.qc_cmddict;
-       q2type = args->u.proplib.qc_q2type;
-       datas = args->u.proplib.qc_datas;
-
-       KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
-       KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+       KASSERT(args->qc_type == QCT_QUOTAOFF);
+       idtype = args->u.quotaoff.qc_idtype;
 
        if ((ump->um_flags & UFS_QUOTA2) != 0)
                return EOPNOTSUPP;
        
-       if (prop_array_count(datas) != 0)
-               return EINVAL;
-
        error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA,
            KAUTH_REQ_SYSTEM_FS_QUOTA_ONOFF, mp, NULL, NULL);
        if (error != 0) {
                return error;
        }
 #ifdef QUOTA
-       error = quota1_handle_cmd_quotaoff(l, ump, q2type);
+       error = quota1_handle_cmd_quotaoff(l, ump, idtype);
 #else
        error = EOPNOTSUPP;
 #endif



Home | Main Index | Thread Index | Old Index