Sun Jan 29 06:46:50 2012 UTC ()
For QUOTACTL_SET in quota2, use the quotaval data instead of proplib.


(dholland)
diff -r1.81 -r1.82 src/sys/ufs/ufs/ufs_quota.c
diff -r1.6 -r1.7 src/sys/ufs/ufs/ufs_quota.h
diff -r1.7 -r1.8 src/sys/ufs/ufs/ufs_quota2.c

cvs diff -r1.81 -r1.82 src/sys/ufs/ufs/ufs_quota.c (expand / switch to context diff)
--- src/sys/ufs/ufs/ufs_quota.c 2012/01/29 06:46:16 1.81
+++ src/sys/ufs/ufs/ufs_quota.c 2012/01/29 06:46:49 1.82
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.81 2012/01/29 06:46:16 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.82 2012/01/29 06:46:49 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.81 2012/01/29 06:46:16 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.82 2012/01/29 06:46:49 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -304,7 +304,7 @@
 #ifdef QUOTA2
 		if (ump->um_flags & UFS_QUOTA2) {
 			error = quota2_handle_cmd_set(ump, q2type, id, defaultq,
-			    data);
+			    blocks, files);
 		} else
 #endif
 			panic("quota_handle_cmd_get: no support ?");

cvs diff -r1.6 -r1.7 src/sys/ufs/ufs/ufs_quota.h (expand / switch to context diff)
--- src/sys/ufs/ufs/ufs_quota.h 2012/01/29 06:46:16 1.6
+++ src/sys/ufs/ufs/ufs_quota.h 2012/01/29 06:46:50 1.7
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.h,v 1.6 2012/01/29 06:46:16 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.h,v 1.7 2012/01/29 06:46:50 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -125,7 +125,8 @@
 int chkiq2(struct inode *, int32_t, kauth_cred_t, int);
 int quota2_handle_cmd_get(struct ufsmount *, const struct quotakey *,
     struct quotaval *);
-int quota2_handle_cmd_set(struct ufsmount *, int, int, int, prop_dictionary_t);
+int quota2_handle_cmd_set(struct ufsmount *, int, int, int,
+    const struct quotaval *, const struct quotaval *);
 int quota2_handle_cmd_clear(struct ufsmount *, int, int, int, prop_dictionary_t);
 int quota2_handle_cmd_getall(struct ufsmount *, int, prop_array_t);
 int q2sync(struct mount *);

cvs diff -r1.7 -r1.8 src/sys/ufs/ufs/ufs_quota2.c (expand / switch to context diff)
--- src/sys/ufs/ufs/ufs_quota2.c 2012/01/29 06:41:42 1.7
+++ src/sys/ufs/ufs/ufs_quota2.c 2012/01/29 06:46:50 1.8
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.7 2012/01/29 06:41:42 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.8 2012/01/29 06:46:50 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.7 2012/01/29 06:41:42 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.8 2012/01/29 06:46:50 dholland Exp $");
 
 #include <sys/buf.h>
 #include <sys/param.h>
@@ -74,32 +74,24 @@
     int (*func)(struct ufsmount *, uint64_t *, struct quota2_entry *,
       uint64_t, void *));
 
-static int quota2_dict_update_q2e_limits(prop_dictionary_t,
-    struct quota2_entry *);
 static prop_dictionary_t q2etoprop(struct quota2_entry *, int);
 
 static const char *limnames[] = INITQLNAMES;
 
-static int
-quota2_dict_update_q2e_limits(prop_dictionary_t data,
+static void
+quota2_dict_update_q2e_limits(const struct quotaval *blocks,
+    const struct quotaval *files,
     struct quota2_entry *q2e)
 {
-	const char *val_limitsonly_names[] = INITQVNAMES_LIMITSONLY;
+	q2e->q2e_val[QL_BLOCK].q2v_hardlimit = blocks->qv_hardlimit;
+	q2e->q2e_val[QL_BLOCK].q2v_softlimit = blocks->qv_softlimit;
+	q2e->q2e_val[QL_BLOCK].q2v_grace = blocks->qv_grace;
 
-	int i, error;
-	prop_dictionary_t val;
-
-	for (i = 0; i < N_QL; i++) {
-		if (!prop_dictionary_get_dict(data, limnames[i], &val))
-			return EINVAL;
-		error = quotaprop_dict_get_uint64(val,
-		    &q2e->q2e_val[i].q2v_hardlimit,
-		    val_limitsonly_names, N_QV, true);
-		if (error)
-			return error;
-	}
-	return 0;
+	q2e->q2e_val[QL_FILE].q2v_hardlimit = blocks->qv_hardlimit;
+	q2e->q2e_val[QL_FILE].q2v_softlimit = blocks->qv_softlimit;
+	q2e->q2e_val[QL_FILE].q2v_grace = blocks->qv_grace;
 }
+
 static prop_dictionary_t
 q2etoprop(struct quota2_entry *q2e, int def)
 {
@@ -621,7 +613,7 @@
 
 int
 quota2_handle_cmd_set(struct ufsmount *ump, int type, int id,
-    int defaultq, prop_dictionary_t data)
+    int defaultq, const struct quotaval *blocks, const struct quotaval *files)
 {
 	int error;
 	struct dquot *dq;
@@ -644,12 +636,7 @@
 			goto out_wapbl;
 		}
 		quota2_ufs_rwq2e(&q2h->q2h_defentry, &q2e, needswap);
-		error = quota2_dict_update_q2e_limits(data, &q2e);
-		if (error) {
-			mutex_exit(&dqlock);
-			brelse(bp, 0);
-			goto out_wapbl;
-		}
+		quota2_dict_update_q2e_limits(blocks, files, &q2e);
 		quota2_ufs_rwq2e(&q2e, &q2h->q2h_defentry, needswap);
 		mutex_exit(&dqlock);
 		quota2_bwrite(ump->um_mountp, bp);
@@ -674,11 +661,7 @@
 		goto out_il;
 	
 	quota2_ufs_rwq2e(q2ep, &q2e, needswap);
-	error = quota2_dict_update_q2e_limits(data, &q2e);
-	if (error) {
-		brelse(bp, 0);
-		goto out_il;
-	}
+	quota2_dict_update_q2e_limits(blocks, files, &q2e);
 	quota2_ufs_rwq2e(&q2e, q2ep, needswap);
 	quota2_bwrite(ump->um_mountp, bp);