Sun Jan 29 07:11:55 2012 UTC ()
Move proplib bits for QUOTACTL_QUOTAOFF out of the ufs code.

This change requires a kernel version bump.


(dholland)
diff -r1.31 -r1.32 src/sys/kern/vfs_quotactl.c
diff -r1.27 -r1.28 src/sys/sys/quotactl.h
diff -r1.99 -r1.100 src/sys/ufs/ufs/ufs_quota.c

cvs diff -r1.31 -r1.32 src/sys/kern/vfs_quotactl.c (expand / switch to context diff)
--- src/sys/kern/vfs_quotactl.c 2012/01/29 07:11:12 1.31
+++ src/sys/kern/vfs_quotactl.c 2012/01/29 07:11:55 1.32
@@ -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);
 }
 

cvs diff -r1.27 -r1.28 src/sys/sys/quotactl.h (expand / switch to context diff)
--- src/sys/sys/quotactl.h 2012/01/29 07:11:12 1.27
+++ src/sys/sys/quotactl.h 2012/01/29 07:11:55 1.28
@@ -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;
 };
 

cvs diff -r1.99 -r1.100 src/sys/ufs/ufs/ufs_quota.c (expand / switch to context diff)
--- src/sys/ufs/ufs/ufs_quota.c 2012/01/29 07:11:12 1.99
+++ src/sys/ufs/ufs/ufs_quota.c 2012/01/29 07:11:55 1.100
@@ -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(args->qc_type == QCT_QUOTAOFF);
+	idtype = args->u.quotaoff.qc_idtype;
 
-	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;
 	
-	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