Module Name: src
Committed By: dholland
Date: Sun Jan 29 07:00:40 UTC 2012
Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c
Log Message:
Pass the cursor to QUOTACTL_GETALL. Don't pass unused proplib items.
Note: this change requires a kernel version bump.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/quotactl.h
cvs rdiff -u -r1.93 -r1.94 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/ufs/ufs_quota2.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.21 src/sys/kern/vfs_quotactl.c:1.22
--- src/sys/kern/vfs_quotactl.c:1.21 Sun Jan 29 06:57:15 2012
+++ src/sys/kern/vfs_quotactl.c Sun Jan 29 07:00:39 2012
@@ -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 @@ vfs_quotactl_getall(struct mount *mp,
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;
Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.19 src/sys/sys/quotactl.h:1.20
--- src/sys/sys/quotactl.h:1.19 Sun Jan 29 06:57:15 2012
+++ src/sys/sys/quotactl.h Sun Jan 29 07:00:39 2012
@@ -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 @@ struct quotakcursor {
/* 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 vfs_quotactl_args {
struct {
struct quotakcursor *qc_cursor;
} cursorclose;
+ struct {
+ struct quotakcursor *qc_cursor;
+ int qc_idtype;
+ prop_dictionary_t qc_cmddict;
+ } getall;
} u;
};
Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.93 src/sys/ufs/ufs/ufs_quota.c:1.94
--- src/sys/ufs/ufs/ufs_quota.c:1.93 Sun Jan 29 06:57:15 2012
+++ src/sys/ufs/ufs/ufs_quota.c Sun Jan 29 07:00:39 2012
@@ -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 @@ quota_handle_cmd_getall(struct mount *mp
{
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 @@ quota_handle_cmd_getall(struct mount *mp
#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 ?");
Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.15 src/sys/ufs/ufs/ufs_quota.h:1.16
--- src/sys/ufs/ufs/ufs_quota.h:1.15 Sun Jan 29 06:57:15 2012
+++ src/sys/ufs/ufs/ufs_quota.h Sun Jan 29 07:00:40 2012
@@ -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_get(struct ufsmoun
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 *);
Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.16 src/sys/ufs/ufs/ufs_quota2.c:1.17
--- src/sys/ufs/ufs/ufs_quota2.c:1.16 Sun Jan 29 06:57:15 2012
+++ src/sys/ufs/ufs/ufs_quota2.c Sun Jan 29 07:00:40 2012
@@ -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 @@ quota2_handle_cmd_get(struct ufsmount *u
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 @@ quota2_getuids_callback(struct ufsmount
}
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 @@ quota2_handle_cmd_getall(struct ufsmount
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 @@ error_bp:
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)
{