Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ufs For QUOTACTL_SET in quota2, use the quotaval dat...



details:   https://anonhg.NetBSD.org/src/rev/9fab141eaaf8
branches:  trunk
changeset: 773178:9fab141eaaf8
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jan 29 06:46:49 2012 +0000

description:
For QUOTACTL_SET in quota2, use the quotaval data instead of proplib.

diffstat:

 sys/ufs/ufs/ufs_quota.c  |   6 +++---
 sys/ufs/ufs/ufs_quota.h  |   5 +++--
 sys/ufs/ufs/ufs_quota2.c |  47 +++++++++++++++--------------------------------
 3 files changed, 21 insertions(+), 37 deletions(-)

diffs (143 lines):

diff -r c9edcf80b95c -r 9fab141eaaf8 sys/ufs/ufs/ufs_quota.c
--- a/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 06:46:16 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.c   Sun Jan 29 06:46:49 2012 +0000
@@ -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 ?");
diff -r c9edcf80b95c -r 9fab141eaaf8 sys/ufs/ufs/ufs_quota.h
--- a/sys/ufs/ufs/ufs_quota.h   Sun Jan 29 06:46:16 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.h   Sun Jan 29 06:46:49 2012 +0000
@@ -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 *);
diff -r c9edcf80b95c -r 9fab141eaaf8 sys/ufs/ufs/ufs_quota2.c
--- a/sys/ufs/ufs/ufs_quota2.c  Sun Jan 29 06:46:16 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota2.c  Sun Jan 29 06:46:49 2012 +0000
@@ -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;
-
-       int i, error;
-       prop_dictionary_t val;
+       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;
 
-       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);
 



Home | Main Index | Thread Index | Old Index