Source-Changes-HG archive

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

[src/trunk]: src/sys Pass the cursor to QUOTACTL_GETALL. Don't pass unused pr...



details:   https://anonhg.NetBSD.org/src/rev/975916fe991c
branches:  trunk
changeset: 773190:975916fe991c
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jan 29 07:00:39 2012 +0000

description:
Pass the cursor to QUOTACTL_GETALL. Don't pass unused proplib items.

Note: this change requires a kernel version bump.

diffstat:

 sys/kern/vfs_quotactl.c  |  12 ++++++------
 sys/sys/quotactl.h       |  10 ++++++++--
 sys/ufs/ufs/ufs_quota.c  |  21 ++++++++++-----------
 sys/ufs/ufs/ufs_quota.h  |   5 +++--
 sys/ufs/ufs/ufs_quota2.c |  30 +++++++++++++++++++-----------
 5 files changed, 46 insertions(+), 32 deletions(-)

diffs (216 lines):

diff -r 7787fba004d4 -r 975916fe991c sys/kern/vfs_quotactl.c
--- a/sys/kern/vfs_quotactl.c   Sun Jan 29 06:57:15 2012 +0000
+++ b/sys/kern/vfs_quotactl.c   Sun Jan 29 07:00:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_quotactl.c,v 1.21 2012/01/29 06:57:15 dholland Exp $       */
+/*     $NetBSD: vfs_quotactl.c,v 1.22 2012/01/29 07:00:39 dholland Exp $       */
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.21 2012/01/29 06:57:15 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.22 2012/01/29 07:00:39 dholland Exp $");
 
 #include <sys/mount.h>
 #include <sys/quota.h>
@@ -453,10 +453,10 @@
                return error;
        }
 
-       args.qc_type = QCT_PROPLIB;
-       args.u.proplib.qc_cmddict = cmddict;
-       args.u.proplib.qc_q2type = q2type;
-       args.u.proplib.qc_datas = datas;
+       args.qc_type = QCT_GETALL;
+       args.u.getall.qc_cursor = &cursor;
+       args.u.getall.qc_idtype = q2type;
+       args.u.getall.qc_cmddict = cmddict;
        error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, &args);
 
        args.qc_type = QCT_CURSORCLOSE;
diff -r 7787fba004d4 -r 975916fe991c sys/sys/quotactl.h
--- a/sys/sys/quotactl.h        Sun Jan 29 06:57:15 2012 +0000
+++ b/sys/sys/quotactl.h        Sun Jan 29 07:00:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quotactl.h,v 1.19 2012/01/29 06:57:15 dholland Exp $   */
+/*     $NetBSD: quotactl.h,v 1.20 2012/01/29 07:00:39 dholland Exp $   */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -64,13 +64,14 @@
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
-       QCT_PROPLIB,    /* quotaon/off, getall */
+       QCT_PROPLIB,    /* quotaon/off */
        QCT_GETVERSION, /* getversion */
        QCT_GET,        /* get */
        QCT_PUT,        /* put */
        QCT_DELETE,     /* delete */
        QCT_CURSOROPEN, /* open cursor */
        QCT_CURSORCLOSE,/* close cursor */
+       QCT_GETALL,     /* get all */
 };
 struct vfs_quotactl_args {
        enum vfs_quotactl_argtypes qc_type;
@@ -100,6 +101,11 @@
                struct {
                        struct quotakcursor *qc_cursor;
                } cursorclose;
+               struct {
+                       struct quotakcursor *qc_cursor;
+                       int qc_idtype;
+                       prop_dictionary_t qc_cmddict;
+               } getall;
        } u;
 };
 
diff -r 7787fba004d4 -r 975916fe991c sys/ufs/ufs/ufs_quota.c
--- a/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 06:57:15 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 07:00:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_quota.c,v 1.93 2012/01/29 06:57:15 dholland Exp $  */
+/*     $NetBSD: ufs_quota.c,v 1.94 2012/01/29 07:00:39 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.93 2012/01/29 06:57:15 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.94 2012/01/29 07:00:39 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -370,18 +370,17 @@
 {
        prop_array_t replies;
        struct ufsmount *ump = VFSTOUFS(mp);
-       int error;
+       struct quotakcursor *cursor;
+       int idtype;
        prop_dictionary_t cmddict;
-       int q2type;
-       prop_array_t datas;
+       int error;
 
-       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(args->qc_type == QCT_GETALL);
+       cursor = args->u.getall.qc_cursor;
+       idtype = args->u.getall.qc_idtype;
+       cmddict = args->u.getall.qc_cmddict;
 
        KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
-       KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
 
        if ((ump->um_flags & UFS_QUOTA2) == 0)
                return EOPNOTSUPP;
@@ -397,7 +396,7 @@
 
 #ifdef QUOTA2
        if (ump->um_flags & UFS_QUOTA2) {
-               error = quota2_handle_cmd_getall(ump, q2type, replies);
+               error = quota2_handle_cmd_getall(ump, cursor, idtype, replies);
        } else
 #endif
                panic("quota_handle_cmd_getall: no support ?");
diff -r 7787fba004d4 -r 975916fe991c sys/ufs/ufs/ufs_quota.h
--- a/sys/ufs/ufs/ufs_quota.h   Sun Jan 29 06:57:15 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.h   Sun Jan 29 07:00:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_quota.h,v 1.15 2012/01/29 06:57:15 dholland Exp $  */
+/*     $NetBSD: ufs_quota.h,v 1.16 2012/01/29 07:00:40 dholland Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -131,7 +131,8 @@
 int quota2_handle_cmd_put(struct ufsmount *, const struct quotakey *,
     const struct quotaval *);
 int quota2_handle_cmd_delete(struct ufsmount *, const struct quotakey *);
-int quota2_handle_cmd_getall(struct ufsmount *, int, prop_array_t);
+int quota2_handle_cmd_getall(struct ufsmount *, struct quotakcursor *, int,
+    prop_array_t);
 int quota2_handle_cmd_cursoropen(struct ufsmount *, struct quotakcursor *);
 int quota2_handle_cmd_cursorclose(struct ufsmount *, struct quotakcursor *);
 int q2sync(struct mount *);
diff -r 7787fba004d4 -r 975916fe991c sys/ufs/ufs/ufs_quota2.c
--- a/sys/ufs/ufs/ufs_quota2.c  Sun Jan 29 06:57:15 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota2.c  Sun Jan 29 07:00:39 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.16 2012/01/29 06:57:15 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.17 2012/01/29 07:00:40 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.16 2012/01/29 06:57:15 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.17 2012/01/29 07:00:40 dholland Exp $");
 
 #include <sys/buf.h>
 #include <sys/param.h>
@@ -947,6 +947,15 @@
        return error;
 }
 
+struct ufsq2_cursor {
+       uint32_t q2c_magic;
+};
+
+#define Q2C_MAGIC (0xbeebe111)
+
+#define Q2CURSOR(qkc) ((struct ufsq2_cursor *)&qkc->u.qkc_space[0])
+
+
 struct getuids {
        long nuids; /* number of uids in array */
        long size;  /* size of array */
@@ -979,9 +988,11 @@
 }
 
 int
-quota2_handle_cmd_getall(struct ufsmount *ump, int type, prop_array_t replies)
+quota2_handle_cmd_getall(struct ufsmount *ump, struct quotakcursor *qkc,
+    int type, prop_array_t replies)
 {
        int error;
+       struct ufsq2_cursor *cursor;
        struct quota2_header *q2h;
        struct quota2_entry  q2e;
        struct buf *hbp;
@@ -992,6 +1003,11 @@
        const int needswap = UFS_MPNEEDSWAP(ump);
        struct getuids gu;
 
+       cursor = Q2CURSOR(qkc);
+       if (cursor->q2c_magic != Q2C_MAGIC) {
+               return EINVAL;
+       }
+
        if (ump->um_quotas[type] == NULLVP)
                return ENODEV;
        mutex_enter(&dqlock);
@@ -1039,14 +1055,6 @@
        return error;
 }
 
-struct ufsq2_cursor {
-       uint32_t q2c_magic;
-};
-
-#define Q2C_MAGIC (0xbeebe111)
-
-#define Q2CURSOR(qkc) ((struct ufsq2_cursor *)&qkc->u.qkc_space[0])
-
 int
 quota2_handle_cmd_cursoropen(struct ufsmount *ump, struct quotakcursor *qkc)
 {



Home | Main Index | Thread Index | Old Index