Module Name: src
Committed By: dholland
Date: Sun Jan 29 06:46:50 UTC 2012
Modified Files:
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c
Log Message:
For QUOTACTL_SET in quota2, use the quotaval data instead of proplib.
To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.7 -r1.8 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/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.81 src/sys/ufs/ufs/ufs_quota.c:1.82
--- src/sys/ufs/ufs/ufs_quota.c:1.81 Sun Jan 29 06:46:16 2012
+++ src/sys/ufs/ufs/ufs_quota.c Sun Jan 29 06:46:49 2012
@@ -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 @@ quota_handle_cmd_set(struct mount *mp, s
#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 ?");
Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.6 src/sys/ufs/ufs/ufs_quota.h:1.7
--- src/sys/ufs/ufs/ufs_quota.h:1.6 Sun Jan 29 06:46:16 2012
+++ src/sys/ufs/ufs/ufs_quota.h Sun Jan 29 06:46:50 2012
@@ -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 chkdq2(struct inode *, int64_t, kaut
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 *);
Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.7 src/sys/ufs/ufs/ufs_quota2.c:1.8
--- src/sys/ufs/ufs/ufs_quota2.c:1.7 Sun Jan 29 06:41:42 2012
+++ src/sys/ufs/ufs/ufs_quota2.c Sun Jan 29 06:46:50 2012
@@ -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 @@ static int quota2_walk_list(struct ufsmo
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;
-
- 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_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;
+
+ 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 @@ chkiq2(struct inode *ip, int32_t change,
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 @@ quota2_handle_cmd_set(struct ufsmount *u
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 @@ quota2_handle_cmd_set(struct ufsmount *u
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);