Source-Changes-HG archive

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

[src/trunk]: src/sys Package up the args of QUOTACTL_DELETE as a struct quota...



details:   https://anonhg.NetBSD.org/src/rev/662d04a0fb49
branches:  trunk
changeset: 773188:662d04a0fb49
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jan 29 06:55:44 2012 +0000

description:
Package up the args of QUOTACTL_DELETE as a struct quotakey.

diffstat:

 sys/kern/vfs_quotactl.c  |  23 +++++++++++++----------
 sys/sys/quotactl.h       |   7 ++-----
 sys/ufs/ufs/ufs_quota.c  |  26 +++++++++++++-------------
 sys/ufs/ufs/ufs_quota.h  |   4 ++--
 sys/ufs/ufs/ufs_quota2.c |  16 +++++++++++-----
 5 files changed, 41 insertions(+), 35 deletions(-)

diffs (205 lines):

diff -r 605f790c0202 -r 662d04a0fb49 sys/kern/vfs_quotactl.c
--- a/sys/kern/vfs_quotactl.c   Sun Jan 29 06:54:34 2012 +0000
+++ b/sys/kern/vfs_quotactl.c   Sun Jan 29 06:55:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_quotactl.c,v 1.19 2012/01/29 06:54:34 dholland Exp $       */
+/*     $NetBSD: vfs_quotactl.c,v 1.20 2012/01/29 06:55:44 dholland Exp $       */
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.19 2012/01/29 06:54:34 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.20 2012/01/29 06:55:44 dholland Exp $");
 
 #include <sys/mount.h>
 #include <sys/quota.h>
@@ -462,6 +462,7 @@
        uint32_t id;
        int defaultq;
        const char *idstr;
+       struct quotakey qk;
        struct vfs_quotactl_args args;
        int error;
 
@@ -491,21 +492,23 @@
                        defaultq = 0;
                }
 
+               qk.qk_idtype = q2type;
+               qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
+               qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+
                args.qc_type = QCT_DELETE;
-               args.u.delete.qc_idtype = q2type;
-               args.u.delete.qc_id = id;
-               args.u.delete.qc_defaultq = defaultq;
-               args.u.delete.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+               args.u.delete.qc_key = &qk;
                error = VFS_QUOTACTL(mp, QUOTACTL_DELETE, &args);
                if (error) {
                        goto err;
                }
 
+               qk.qk_idtype = q2type;
+               qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
+               qk.qk_objtype = QUOTA_OBJTYPE_FILES;
+
                args.qc_type = QCT_DELETE;
-               args.u.delete.qc_idtype = q2type;
-               args.u.delete.qc_id = id;
-               args.u.delete.qc_defaultq = defaultq;
-               args.u.delete.qc_objtype = QUOTA_OBJTYPE_FILES;
+               args.u.delete.qc_key = &qk;
                error = VFS_QUOTACTL(mp, QUOTACTL_DELETE, &args);
                if (error) {
                        goto err;
diff -r 605f790c0202 -r 662d04a0fb49 sys/sys/quotactl.h
--- a/sys/sys/quotactl.h        Sun Jan 29 06:54:34 2012 +0000
+++ b/sys/sys/quotactl.h        Sun Jan 29 06:55:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quotactl.h,v 1.17 2012/01/29 06:54:34 dholland Exp $   */
+/*     $NetBSD: quotactl.h,v 1.18 2012/01/29 06:55:44 dholland Exp $   */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -74,10 +74,7 @@
                        const struct quotaval *qc_val;
                } put;
                struct {
-                       int qc_idtype;
-                       id_t qc_id;
-                       int qc_defaultq;
-                       int qc_objtype;
+                       const struct quotakey *qc_key;
                } delete;
        } u;
 };
diff -r 605f790c0202 -r 662d04a0fb49 sys/ufs/ufs/ufs_quota.c
--- a/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 06:54:34 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 06:55:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_quota.c,v 1.91 2012/01/29 06:54:34 dholland Exp $  */
+/*     $NetBSD: ufs_quota.c,v 1.92 2012/01/29 06:55:44 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.91 2012/01/29 06:54:34 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.92 2012/01/29 06:55:44 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -316,17 +316,17 @@
     struct vfs_quotactl_args *args)
 {
        struct ufsmount *ump = VFSTOUFS(mp);
-       int idtype;
-       id_t id;
-       int defaultq;
-       int objtype;
+       const struct quotakey *qk;
+       id_t kauth_id;
        int error;
 
        KASSERT(args->qc_type == QCT_DELETE);
-       idtype = args->u.delete.qc_idtype;
-       id = args->u.delete.qc_id;
-       defaultq = args->u.delete.qc_defaultq;
-       objtype = args->u.delete.qc_objtype;
+       qk = args->u.delete.qc_key;
+
+       kauth_id = qk->qk_id;
+       if (kauth_id == QUOTA_DEFAULTID) {
+               kauth_id = 0;
+       }
 
        if ((ump->um_flags & UFS_QUOTA2) == 0)
                return EOPNOTSUPP;
@@ -334,13 +334,13 @@
        /* avoid whitespace changes */
        {
                error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA,
-                   KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(id), NULL);
+                   KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id),
+                   NULL);
                if (error != 0)
                        goto err;
 #ifdef QUOTA2
                if (ump->um_flags & UFS_QUOTA2) {
-                       error = quota2_handle_cmd_delete(ump, idtype, id,
-                           defaultq, objtype);
+                       error = quota2_handle_cmd_delete(ump, qk);
                } else
 #endif
                        panic("quota_handle_cmd_get: no support ?");
diff -r 605f790c0202 -r 662d04a0fb49 sys/ufs/ufs/ufs_quota.h
--- a/sys/ufs/ufs/ufs_quota.h   Sun Jan 29 06:54:34 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.h   Sun Jan 29 06:55:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_quota.h,v 1.13 2012/01/29 06:54:34 dholland Exp $  */
+/*     $NetBSD: ufs_quota.h,v 1.14 2012/01/29 06:55:44 dholland Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -127,7 +127,7 @@
     struct quotaval *);
 int quota2_handle_cmd_put(struct ufsmount *, const struct quotakey *,
     const struct quotaval *);
-int quota2_handle_cmd_delete(struct ufsmount *, int, int, int, int);
+int quota2_handle_cmd_delete(struct ufsmount *, const struct quotakey *);
 int quota2_handle_cmd_getall(struct ufsmount *, int, prop_array_t);
 int q2sync(struct mount *);
 int dq2get(struct vnode *, u_long, struct ufsmount *, int, struct dquot *);
diff -r 605f790c0202 -r 662d04a0fb49 sys/ufs/ufs/ufs_quota2.c
--- a/sys/ufs/ufs/ufs_quota2.c  Sun Jan 29 06:54:34 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota2.c  Sun Jan 29 06:55:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.14 2012/01/29 06:54:34 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.15 2012/01/29 06:55:44 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.14 2012/01/29 06:54:34 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.15 2012/01/29 06:55:44 dholland Exp $");
 
 #include <sys/buf.h>
 #include <sys/param.h>
@@ -708,9 +708,11 @@
        return 0;
 }
 int
-quota2_handle_cmd_delete(struct ufsmount *ump, int idtype, int id,
-    int defaultq, int objtype)
+quota2_handle_cmd_delete(struct ufsmount *ump, const struct quotakey *qk)
 {
+       int idtype;
+       id_t id;
+       int objtype;
        int error, i, canfree;
        struct dquot *dq;
        struct quota2_header *q2h;
@@ -719,9 +721,13 @@
        u_long hash_mask;
        struct dq2clear_callback c;
 
+       idtype = qk->qk_idtype;
+       id = qk->qk_id;
+       objtype = qk->qk_objtype;
+
        if (ump->um_quotas[idtype] == NULLVP)
                return ENODEV;
-       if (defaultq)
+       if (id == QUOTA_DEFAULTID)
                return EOPNOTSUPP;
 
        /* get the default entry before locking the entry's buffer */



Home | Main Index | Thread Index | Old Index