Move the proplib bits for QUOTACTL_QUOTAON out of the ufs code.
This change requires a kernel version bump.
This commit is contained in:
parent
6fc26625df
commit
7302da533e
|
@ -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 @@ vfs_quotactl_quotaon(struct mount *mp,
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 @@ struct quotakcursor {
|
|||
|
||||
/* 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 @@ enum vfs_quotactl_argtypes {
|
|||
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 vfs_quotactl_args {
|
|||
struct {
|
||||
struct quotakcursor *qc_cursor;
|
||||
} cursorrewind;
|
||||
struct {
|
||||
int qc_idtype;
|
||||
const char *qc_quotafile;
|
||||
} quotaon;
|
||||
} u;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 @@ static int
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue