Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Move what was second-layer proplib frobbing for QUOTACTL...
details: https://anonhg.NetBSD.org/src/rev/a0273da4585e
branches: trunk
changeset: 773170:a0273da4585e
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jan 29 06:39:36 2012 +0000
description:
Move what was second-layer proplib frobbing for QUOTACTL_GET to
FS-independent code. (Step 3 of probably 5 for QUOTACTL_GET.)
Note: this change requires a kernel version bump.
diffstat:
sys/kern/vfs_quotactl.c | 42 ++++++++++++++++++++++++++++++++++++++----
sys/sys/quotactl.h | 5 +++--
sys/ufs/ufs/ufs_quota.c | 45 +++++++--------------------------------------
3 files changed, 48 insertions(+), 44 deletions(-)
diffs (204 lines):
diff -r 071571fa0134 -r a0273da4585e sys/kern/vfs_quotactl.c
--- a/sys/kern/vfs_quotactl.c Sun Jan 29 06:38:23 2012 +0000
+++ b/sys/kern/vfs_quotactl.c Sun Jan 29 06:39:36 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $ */
+/* $NetBSD: vfs_quotactl.c,v 1.8 2012/01/29 06:39:36 dholland Exp $ */
/*
* Copyright (c) 1991, 1993, 1994
@@ -80,9 +80,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.8 2012/01/29 06:39:36 dholland Exp $");
#include <sys/mount.h>
+#include <sys/quota.h>
#include <sys/quotactl.h>
#include <quota/quotaprop.h>
@@ -166,17 +167,45 @@
}
static int
+vfs_quotactl_get_addreply(id_t id,
+ int defaultq,
+ const struct quotaval *blocks,
+ const struct quotaval *files,
+ prop_array_t replies)
+{
+ prop_dictionary_t dict;
+
+ /* XXX illegal casts */
+ uint64_t *valuesp[QUOTA_NLIMITS];
+ valuesp[QUOTA_LIMIT_BLOCK] = (void *)(intptr_t)&blocks->qv_hardlimit;
+ valuesp[QUOTA_LIMIT_FILE] = (void *)(intptr_t)&files->qv_hardlimit;
+
+ dict = quota64toprop(id, defaultq, valuesp,
+ ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
+ ufs_quota_limit_names, QUOTA_NLIMITS);
+ if (dict == NULL)
+ return ENOMEM;
+ if (!prop_array_add_and_rel(replies, dict)) {
+ prop_object_release(dict);
+ return ENOMEM;
+ }
+
+ return 0;
+}
+
+static int
vfs_quotactl_get(struct mount *mp,
prop_dictionary_t cmddict, int q2type,
prop_array_t datas)
{
prop_object_iterator_t iter;
prop_dictionary_t data;
+ prop_array_t replies;
uint32_t id;
int defaultq;
const char *idstr;
- prop_array_t replies;
struct vfs_quotactl_args args;
+ struct quotaval blocks, files;
int error;
KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
@@ -212,7 +241,8 @@
args.u.get.qc_q2type = q2type;
args.u.get.qc_id = id;
args.u.get.qc_defaultq = defaultq;
- args.u.get.qc_replies = replies;
+ args.u.get.qc_blocks_ret = &blocks;
+ args.u.get.qc_files_ret = &files;
error = VFS_QUOTACTL(mp, QUOTACTL_GET, &args);
if (error == EPERM) {
/* XXX does this make sense? */
@@ -223,6 +253,10 @@
} else if (error) {
goto fail;
}
+
+ error = vfs_quotactl_get_addreply(id, defaultq,
+ &blocks, &files,
+ replies);
}
prop_object_iterator_release(iter);
diff -r 071571fa0134 -r a0273da4585e sys/sys/quotactl.h
--- a/sys/sys/quotactl.h Sun Jan 29 06:38:23 2012 +0000
+++ b/sys/sys/quotactl.h Sun Jan 29 06:39:36 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: quotactl.h,v 1.5 2012/01/29 06:37:30 dholland Exp $ */
+/* $NetBSD: quotactl.h,v 1.6 2012/01/29 06:39:36 dholland Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -67,7 +67,8 @@
int qc_q2type;
id_t qc_id;
int qc_defaultq;
- prop_array_t qc_replies;
+ struct quotaval *qc_blocks_ret;
+ struct quotaval *qc_files_ret;
} get;
} u;
};
diff -r 071571fa0134 -r a0273da4585e sys/ufs/ufs/ufs_quota.c
--- a/sys/ufs/ufs/ufs_quota.c Sun Jan 29 06:38:23 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.c Sun Jan 29 06:39:36 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota.c,v 1.75 2012/01/29 06:38:24 dholland Exp $ */
+/* $NetBSD: ufs_quota.c,v 1.76 2012/01/29 06:39:37 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.75 2012/01/29 06:38:24 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.76 2012/01/29 06:39:37 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@@ -226,33 +226,6 @@
KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, KAUTH_ARG(id), NULL);
}
-static int
-quota_fill_cmd_get_reply(id_t id,
- int defaultq,
- const struct quotaval *blocks,
- const struct quotaval *files,
- prop_array_t replies)
-{
- prop_dictionary_t dict;
-
- /* XXX illegal casts */
- uint64_t *valuesp[QUOTA_NLIMITS];
- valuesp[QUOTA_LIMIT_BLOCK] = (void *)(intptr_t)&blocks->qv_hardlimit;
- valuesp[QUOTA_LIMIT_FILE] = (void *)(intptr_t)&files->qv_hardlimit;
-
- dict = quota64toprop(id, defaultq, valuesp,
- ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
- ufs_quota_limit_names, QUOTA_NLIMITS);
- if (dict == NULL)
- return ENOMEM;
- if (!prop_array_add_and_rel(replies, dict)) {
- prop_object_release(dict);
- return ENOMEM;
- }
-
- return 0;
-}
-
static int
quota_handle_cmd_get(struct mount *mp, struct lwp *l,
struct vfs_quotactl_args *args)
@@ -262,14 +235,14 @@
id_t id;
int q2type;
int defaultq;
- prop_array_t replies;
- struct quotaval blocks, files;
+ struct quotaval *blocks, *files;
KASSERT(args->qc_type == QCT_GET);
id = args->u.get.qc_id;
q2type = args->u.get.qc_q2type;
defaultq = args->u.get.qc_defaultq;
- replies = args->u.get.qc_replies;
+ blocks = args->u.get.qc_blocks_ret;
+ files = args->u.get.qc_files_ret;
if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0)
return EOPNOTSUPP;
@@ -281,23 +254,19 @@
#ifdef QUOTA
if (ump->um_flags & UFS_QUOTA) {
error = quota1_handle_cmd_get(ump, q2type, id, defaultq,
- &blocks, &files);
+ blocks, files);
} else
#endif
#ifdef QUOTA2
if (ump->um_flags & UFS_QUOTA2) {
error = quota2_handle_cmd_get(ump, q2type, id, defaultq,
- &blocks, &files);
+ blocks, files);
} else
#endif
panic("quota_handle_cmd_get: no support ?");
if (error != 0)
return error;
-
- error = quota_fill_cmd_get_reply(id, defaultq,
- &blocks, &files,
- replies);
}
return error;
Home |
Main Index |
Thread Index |
Old Index