Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Move the proplib bits for QUOTACTL_QUOTAON out of the uf...
details: https://anonhg.NetBSD.org/src/rev/d96047907d3d
branches: trunk
changeset: 773202:d96047907d3d
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jan 29 07:11:12 2012 +0000
description:
Move the proplib bits for QUOTACTL_QUOTAON out of the ufs code.
This change requires a kernel version bump.
diffstat:
sys/kern/vfs_quotactl.c | 26 ++++++++++++++++++++------
sys/sys/quotactl.h | 9 +++++++--
sys/ufs/ufs/ufs_quota.c | 33 ++++++++-------------------------
3 files changed, 35 insertions(+), 33 deletions(-)
diffs (153 lines):
diff -r 358cb9939b7b -r d96047907d3d sys/kern/vfs_quotactl.c
--- a/sys/kern/vfs_quotactl.c Sun Jan 29 07:10:24 2012 +0000
+++ b/sys/kern/vfs_quotactl.c Sun Jan 29 07:11:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_quotactl.c,v 1.30 2012/01/29 07:10:24 dholland Exp $ */
+/* $NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $ */
/*
* Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.30 2012/01/29 07:10:24 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $");
#include <sys/malloc.h> /* XXX: temporary */
#include <sys/mount.h>
@@ -144,12 +144,26 @@
prop_dictionary_t cmddict, int q2type,
prop_array_t datas)
{
+ prop_dictionary_t data;
+ const char *qfile;
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) != 1)
+ return EINVAL;
+
+ data = prop_array_get(datas, 0);
+ if (data == NULL)
+ return ENOMEM;
+ if (!prop_dictionary_get_cstring_nocopy(data, "quotafile",
+ &qfile))
+ return EINVAL;
+
+ args.qc_type = QCT_QUOTAON;
+ args.u.quotaon.qc_idtype = q2type;
+ args.u.quotaon.qc_quotafile = qfile;
return VFS_QUOTACTL(mp, QUOTACTL_QUOTAON, &args);
}
diff -r 358cb9939b7b -r d96047907d3d sys/sys/quotactl.h
--- a/sys/sys/quotactl.h Sun Jan 29 07:10:24 2012 +0000
+++ b/sys/sys/quotactl.h Sun Jan 29 07:11:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: quotactl.h,v 1.26 2012/01/29 07:09:52 dholland Exp $ */
+/* $NetBSD: quotactl.h,v 1.27 2012/01/29 07:11:12 dholland Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -67,7 +67,7 @@
/* Argument encoding. */
enum vfs_quotactl_argtypes {
- QCT_PROPLIB, /* quotaon/off */
+ QCT_PROPLIB, /* quotaoff */
QCT_GETVERSION, /* getversion */
QCT_GET, /* get */
QCT_PUT, /* put */
@@ -78,6 +78,7 @@
QCT_CURSORSKIPIDTYPE, /* iteration hint */
QCT_CURSORATEND,/* test cursor */
QCT_CURSORREWIND,/* reset cursor */
+ QCT_QUOTAON, /* quotaon */
};
struct vfs_quotactl_args {
enum vfs_quotactl_argtypes qc_type;
@@ -125,6 +126,10 @@
struct {
struct quotakcursor *qc_cursor;
} cursorrewind;
+ struct {
+ int qc_idtype;
+ const char *qc_quotafile;
+ } quotaon;
} u;
};
diff -r 358cb9939b7b -r d96047907d3d sys/ufs/ufs/ufs_quota.c
--- a/sys/ufs/ufs/ufs_quota.c Sun Jan 29 07:10:24 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.c Sun Jan 29 07:11:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota.c,v 1.98 2012/01/29 07:09:52 dholland Exp $ */
+/* $NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 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.98 2012/01/29 07:09:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@@ -540,42 +540,25 @@
quota_handle_cmd_quotaon(struct mount *mp, struct lwp *l,
struct vfs_quotactl_args *args)
{
- prop_dictionary_t data;
struct ufsmount *ump = VFSTOUFS(mp);
- int error;
+ int idtype;
const char *qfile;
- prop_dictionary_t cmddict;
- int q2type;
- prop_array_t datas;
+ int error;
- 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(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
- KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+ KASSERT(args->qc_type == QCT_QUOTAON);
+ idtype = args->u.quotaon.qc_idtype;
+ qfile = args->u.quotaon.qc_quotafile;
if ((ump->um_flags & UFS_QUOTA2) != 0)
return EBUSY;
- if (prop_array_count(datas) != 1)
- return EINVAL;
-
- data = prop_array_get(datas, 0);
- if (data == NULL)
- return ENOMEM;
- if (!prop_dictionary_get_cstring_nocopy(data, "quotafile",
- &qfile))
- 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_quotaon(l, ump, q2type, qfile);
+ error = quota1_handle_cmd_quotaon(l, ump, idtype, qfile);
#else
error = EOPNOTSUPP;
#endif
Home |
Main Index |
Thread Index |
Old Index