Change the VFS_MOUNT() interface so that the 'data' buffer passed to the

fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.
This commit is contained in:
dsl 2007-07-12 19:35:32 +00:00
parent c2c660d00f
commit 2721ab6c7b
40 changed files with 706 additions and 625 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: advfsops.c,v 1.36 2007/06/30 09:37:55 pooka Exp $ */
/* $NetBSD: advfsops.c,v 1.37 2007/07/12 19:35:32 dsl Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.36 2007/06/30 09:37:55 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.37 2007/07/12 19:35:32 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -61,8 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.36 2007/06/30 09:37:55 pooka Exp $");
void adosfs_init __P((void));
void adosfs_reinit __P((void));
void adosfs_done __P((void));
int adosfs_mount __P((struct mount *, const char *, void *, struct nameidata *,
struct lwp *));
int adosfs_mount __P((struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *));
int adosfs_start __P((struct mount *, int, struct lwp *));
int adosfs_unmount __P((struct mount *, int, struct lwp *));
int adosfs_root __P((struct mount *, struct vnode **));
@ -91,44 +91,46 @@ static const struct genfs_ops adosfs_genfsops = {
int (**adosfs_vnodeop_p) __P((void *));
int
adosfs_mount(mp, path, data, ndp, l)
adosfs_mount(mp, path, data, data_len, ndp, l)
struct mount *mp;
const char *path;
void *data;
size_t *data_len;
struct nameidata *ndp;
struct lwp *l;
{
struct vnode *devvp;
struct adosfs_args args;
struct adosfs_args *args = data;
struct adosfsmount *amp;
int error;
mode_t accessmode;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
amp = VFSTOADOSFS(mp);
if (amp == NULL)
return EIO;
args.uid = amp->uid;
args.gid = amp->gid;
args.mask = amp->mask;
args.fspec = NULL;
return copyout(&args, data, sizeof(args));
args->uid = amp->uid;
args->gid = amp->gid;
args->mask = amp->mask;
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
}
error = copyin(data, &args, sizeof(struct adosfs_args));
if (error)
return(error);
if ((mp->mnt_flag & MNT_RDONLY) == 0)
return (EROFS);
if ((mp->mnt_flag & MNT_UPDATE) && args.fspec == NULL)
if ((mp->mnt_flag & MNT_UPDATE) && args->fspec == NULL)
return EOPNOTSUPP;
/*
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible block device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@ -163,10 +165,10 @@ adosfs_mount(mp, path, data, ndp, l)
return (error);
}
amp = VFSTOADOSFS(mp);
amp->uid = args.uid;
amp->gid = args.gid;
amp->mask = args.mask;
return set_statvfs_info(path, UIO_USERSPACE, args.fspec, UIO_USERSPACE,
amp->uid = args->uid;
amp->gid = args->gid;
amp->mask = args->mask;
return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
mp, l);
}
@ -844,6 +846,7 @@ const struct vnodeopv_desc *adosfs_vnodeopv_descs[] = {
struct vfsops adosfs_vfsops = {
MOUNT_ADOSFS,
sizeof (struct adosfs_args),
adosfs_mount,
adosfs_start,
adosfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_extern.h,v 1.20 2006/07/13 12:00:25 martin Exp $ */
/* $NetBSD: cd9660_extern.h,v 1.21 2007/07/12 19:35:32 dsl Exp $ */
/*-
* Copyright (c) 1994
@ -99,7 +99,7 @@ extern struct pool cd9660_node_pool;
extern int cd9660_utf8_joliet;
int cd9660_mount(struct mount *,
const char *, void *, struct nameidata *, struct lwp *);
const char *, void *, size_t *, struct nameidata *, struct lwp *);
int cd9660_start(struct mount *, int, struct lwp *);
int cd9660_unmount(struct mount *, int, struct lwp *);
int cd9660_root(struct mount *, struct vnode **);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_vfsops.c,v 1.42 2007/07/09 00:01:42 pooka Exp $ */
/* $NetBSD: cd9660_vfsops.c,v 1.43 2007/07/12 19:35:32 dsl Exp $ */
/*-
* Copyright (c) 1994
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.42 2007/07/09 00:01:42 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.43 2007/07/12 19:35:32 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -87,6 +87,7 @@ const struct vnodeopv_desc * const cd9660_vnodeopv_descs[] = {
struct vfsops cd9660_vfsops = {
MOUNT_CD9660,
sizeof (struct iso_args),
cd9660_mount,
cd9660_start,
cd9660_unmount,
@ -163,40 +164,42 @@ cd9660_mountroot()
* mount system call
*/
int
cd9660_mount(mp, path, data, ndp, l)
cd9660_mount(mp, path, data, data_len, ndp, l)
struct mount *mp;
const char *path;
void *data;
size_t *data_len;
struct nameidata *ndp;
struct lwp *l;
{
struct vnode *devvp;
struct iso_args args;
struct iso_args *args = data;
int error;
struct iso_mnt *imp = VFSTOISOFS(mp);
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
if (imp == NULL)
return EIO;
args.fspec = NULL;
args.flags = imp->im_flags;
return copyout(&args, data, sizeof(args));
args->fspec = NULL;
args->flags = imp->im_flags;
*data_len = sizeof (*args);
return 0;
}
error = copyin(data, &args, sizeof (struct iso_args));
if (error)
return (error);
if ((mp->mnt_flag & MNT_RDONLY) == 0)
return (EROFS);
if ((mp->mnt_flag & MNT_UPDATE) && args.fspec == NULL)
if ((mp->mnt_flag & MNT_UPDATE) && args->fspec == NULL)
return EINVAL;
/*
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible block device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@ -239,7 +242,7 @@ cd9660_mount(mp, path, data, ndp, l)
error = VOP_OPEN(devvp, FREAD, FSCRED, l);
if (error)
goto fail;
error = iso_mountfs(devvp, mp, l, &args);
error = iso_mountfs(devvp, mp, l, args);
if (error) {
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
(void)VOP_CLOSE(devvp, FREAD, NOCRED, l);
@ -251,7 +254,7 @@ cd9660_mount(mp, path, data, ndp, l)
if (devvp != imp->im_devvp)
return (EINVAL); /* needs translation */
}
return set_statvfs_info(path, UIO_USERSPACE, args.fspec, UIO_USERSPACE,
return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
mp, l);
fail:

View File

@ -1,4 +1,4 @@
/* $NetBSD: efs_vfsops.c,v 1.3 2007/07/04 19:24:09 rumble Exp $ */
/* $NetBSD: efs_vfsops.c,v 1.4 2007/07/12 19:35:32 dsl Exp $ */
/*
* Copyright (c) 2006 Stephen M. Rumble <rumble@ephemeral.org>
@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: efs_vfsops.c,v 1.3 2007/07/04 19:24:09 rumble Exp $");
__KERNEL_RCSID(0, "$NetBSD: efs_vfsops.c,v 1.4 2007/07/12 19:35:32 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -164,32 +164,33 @@ efs_mount_common(struct mount *mp, const char *path, struct vnode *devvp,
* Returns 0 on success.
*/
static int
efs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
struct lwp *l)
efs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct efs_args args;
struct efs_args *args = data;
struct nameidata devndp;
struct efs_mount *emp;
struct vnode *devvp;
int err, mode;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
if ((emp = VFSTOEFS(mp)) == NULL)
return (EIO);
args.fspec = NULL;
args.version = EFS_MNT_VERSION;
return (copyout(&args, data, sizeof(args)));
args->fspec = NULL;
args->version = EFS_MNT_VERSION;
*data_len = sizeof *args;
return 0;
}
if ((err = copyin(data, &args, sizeof(struct efs_args))))
return (err);
if (mp->mnt_flag & MNT_UPDATE)
return (EOPNOTSUPP); /* XXX read-only */
/* look up our device's vnode. it is returned locked */
NDINIT(&devndp, LOOKUP, FOLLOW | LOCKLEAF,
UIO_USERSPACE, args.fspec, l);
UIO_USERSPACE, args->fspec, l);
if ((err = namei(&devndp)))
return (err);
@ -219,7 +220,7 @@ efs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
return (err);
}
err = efs_mount_common(mp, path, devvp, &args, l);
err = efs_mount_common(mp, path, devvp, args, l);
if (err) {
VOP_CLOSE(devvp, mode, l->l_cred, l);
vput(devvp);
@ -561,6 +562,7 @@ const struct vnodeopv_desc * const efs_vnodeopv_descs[] = {
struct vfsops efs_vfsops = {
.vfs_name = MOUNT_EFS,
.vfs_min_mount_data = sizeof (struct efs_args),
.vfs_mount = efs_mount,
.vfs_start = efs_start,
.vfs_unmount = efs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: filecore_extern.h,v 1.14 2006/07/13 12:00:25 martin Exp $ */
/* $NetBSD: filecore_extern.h,v 1.15 2007/07/12 19:35:32 dsl Exp $ */
/*-
* Copyright (c) 1994 The Regents of the University of California.
@ -107,8 +107,8 @@ struct filecore_mnt {
extern struct pool filecore_node_pool;
int filecore_mount __P((struct mount *,
const char *, void *, struct nameidata *, struct lwp *));
int filecore_mount __P((struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *));
int filecore_start __P((struct mount *, int, struct lwp *));
int filecore_unmount __P((struct mount *, int, struct lwp *));
int filecore_root __P((struct mount *, struct vnode **));

View File

@ -1,4 +1,4 @@
/* $NetBSD: filecore_vfsops.c,v 1.35 2007/07/09 00:01:42 pooka Exp $ */
/* $NetBSD: filecore_vfsops.c,v 1.36 2007/07/12 19:35:32 dsl Exp $ */
/*-
* Copyright (c) 1994 The Regents of the University of California.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.35 2007/07/09 00:01:42 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.36 2007/07/12 19:35:32 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -106,6 +106,7 @@ const struct vnodeopv_desc * const filecore_vnodeopv_descs[] = {
struct vfsops filecore_vfsops = {
MOUNT_FILECORE,
sizeof (struct filecore_args),
filecore_mount,
filecore_start,
filecore_unmount,
@ -186,43 +187,45 @@ filecore_mountroot()
* mount system call
*/
int
filecore_mount(mp, path, data, ndp, l)
filecore_mount(mp, path, data, data_len, ndp, l)
struct mount *mp;
const char *path;
void *data;
size_t *data_len;
struct nameidata *ndp;
struct lwp *l;
{
struct vnode *devvp;
struct filecore_args args;
struct filecore_args *args = data;
int error;
struct filecore_mnt *fcmp = NULL;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
fcmp = VFSTOFILECORE(mp);
if (fcmp == NULL)
return EIO;
args.flags = fcmp->fc_mntflags;
args.uid = fcmp->fc_uid;
args.gid = fcmp->fc_gid;
args.fspec = NULL;
return copyout(&args, data, sizeof(args));
args->flags = fcmp->fc_mntflags;
args->uid = fcmp->fc_uid;
args->gid = fcmp->fc_gid;
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
}
error = copyin(data, &args, sizeof (struct filecore_args));
if (error)
return (error);
if ((mp->mnt_flag & MNT_RDONLY) == 0)
return (EROFS);
if ((mp->mnt_flag & MNT_UPDATE) && args.fspec == NULL)
if ((mp->mnt_flag & MNT_UPDATE) && args->fspec == NULL)
return EINVAL;
/*
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible block device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@ -249,7 +252,7 @@ filecore_mount(mp, path, data, ndp, l)
}
}
if ((mp->mnt_flag & MNT_UPDATE) == 0)
error = filecore_mountfs(devvp, mp, l, &args);
error = filecore_mountfs(devvp, mp, l, args);
else {
if (devvp != fcmp->fc_devvp)
error = EINVAL; /* needs translation */
@ -261,7 +264,7 @@ filecore_mount(mp, path, data, ndp, l)
return error;
}
fcmp = VFSTOFILECORE(mp);
return set_statvfs_info(path, UIO_USERSPACE, args.fspec, UIO_USERSPACE,
return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
mp, l);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hfs.h,v 1.3 2007/03/22 13:21:28 dillo Exp $ */
/* $NetBSD: hfs.h,v 1.4 2007/07/12 19:35:32 dsl Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@ -184,8 +184,8 @@ uint64_t be64tohp(void**);
/* hfs_vfsops.c */
int hfs_mount (struct mount *, const char *, void *, struct nameidata *,
struct lwp *);
int hfs_mount (struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int hfs_mountfs (struct vnode *, struct mount *, struct lwp *, const char *);
int hfs_start (struct mount *, int, struct lwp *);
int hfs_unmount (struct mount *, int, struct lwp *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hfs_vfsops.c,v 1.5 2007/06/30 09:37:55 pooka Exp $ */
/* $NetBSD: hfs_vfsops.c,v 1.6 2007/07/12 19:35:33 dsl Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.5 2007/06/30 09:37:55 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.6 2007/07/12 19:35:33 dsl Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -146,6 +146,7 @@ const struct vnodeopv_desc * const hfs_vnodeopv_descs[] = {
struct vfsops hfs_vfsops = {
MOUNT_HFS,
sizeof (struct hfs_args),
hfs_mount,
hfs_start,
hfs_unmount,
@ -174,16 +175,19 @@ static const struct genfs_ops hfs_genfsops = {
};
int
hfs_mount(struct mount *mp, const char *path, void *data,
hfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct hfs_args args;
struct hfs_args *args = data;
struct vnode *devvp;
struct hfsmount *hmp;
int error;
int update;
mode_t accessmode;
if (*data_len < sizeof *args)
return EINVAL;
#ifdef HFS_DEBUG
printf("vfsop = hfs_mount()\n");
#endif /* HFS_DEBUG */
@ -192,16 +196,14 @@ hfs_mount(struct mount *mp, const char *path, void *data,
hmp = VFSTOHFS(mp);
if (hmp == NULL)
return EIO;
args.fspec = NULL;
return copyout(&args, data, sizeof(args));
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
}
if (data == NULL)
return EINVAL;
if ((error = copyin(data, &args, sizeof (struct hfs_args))) != 0)
return error;
/* FIXME: For development ONLY - disallow remounting for now */
#if 0
update = mp->mnt_flag & MNT_UPDATE;
@ -210,11 +212,11 @@ hfs_mount(struct mount *mp, const char *path, void *data,
#endif
/* Check arguments */
if (args.fspec != NULL) {
if (args->fspec != NULL) {
/*
* Look up the name and verify that it's sane.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return error;
devvp = ndp->ni_vp;
@ -287,10 +289,10 @@ hfs_mount(struct mount *mp, const char *path, void *data,
goto error;
}
if ((error = hfs_mountfs(devvp, mp, l, args.fspec)) != 0)
if ((error = hfs_mountfs(devvp, mp, l, args->fspec)) != 0)
goto error;
error = set_statvfs_info(path, UIO_USERSPACE, args.fspec, UIO_USERSPACE,
error = set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
mp, l);
#ifdef HFS_DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vfsops.c,v 1.45 2007/06/30 09:37:56 pooka Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.46 2007/07/12 19:35:33 dsl Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.45 2007/06/30 09:37:56 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.46 2007/07/12 19:35:33 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -93,7 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.45 2007/06/30 09:37:56 pooka Ex
(pmp)->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12
int msdosfs_mountroot(void);
int msdosfs_mount(struct mount *, const char *, void *,
int msdosfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int msdosfs_start(struct mount *, int, struct lwp *);
int msdosfs_unmount(struct mount *, int, struct lwp *);
@ -124,6 +124,7 @@ const struct vnodeopv_desc * const msdosfs_vnodeopv_descs[] = {
struct vfsops msdosfs_vfsops = {
MOUNT_MSDOS,
sizeof (struct msdosfs_args),
msdosfs_mount,
msdosfs_start,
msdosfs_unmount,
@ -246,54 +247,54 @@ msdosfs_mountroot()
* special file to treat as a filesystem.
*/
int
msdosfs_mount(mp, path, data, ndp, l)
msdosfs_mount(mp, path, data, data_len, ndp, l)
struct mount *mp;
const char *path;
void *data;
size_t *data_len;
struct nameidata *ndp;
struct lwp *l;
{
struct vnode *devvp; /* vnode for blk device to mount */
struct msdosfs_args args; /* will hold data from mount request */
struct msdosfs_args *args = data; /* holds data from mount request */
/* msdosfs specific mount control block */
struct msdosfsmount *pmp = NULL;
int error, flags;
mode_t accessmode;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
pmp = VFSTOMSDOSFS(mp);
if (pmp == NULL)
return EIO;
args.fspec = NULL;
args.uid = pmp->pm_uid;
args.gid = pmp->pm_gid;
args.mask = pmp->pm_mask;
args.flags = pmp->pm_flags;
args.version = MSDOSFSMNT_VERSION;
args.dirmask = pmp->pm_dirmask;
args.gmtoff = pmp->pm_gmtoff;
return copyout(&args, data, sizeof(args));
}
error = copyin(data, &args, sizeof(struct msdosfs_args));
if (error) {
DPRINTF(("copyin %d\n", error));
return (error);
args->fspec = NULL;
args->uid = pmp->pm_uid;
args->gid = pmp->pm_gid;
args->mask = pmp->pm_mask;
args->flags = pmp->pm_flags;
args->version = MSDOSFSMNT_VERSION;
args->dirmask = pmp->pm_dirmask;
args->gmtoff = pmp->pm_gmtoff;
*data_len = sizeof *args;
return 0;
}
/*
* If not versioned (i.e. using old mount_msdos(8)), fill in
* the additional structure items with suitable defaults.
*/
if ((args.flags & MSDOSFSMNT_VERSIONED) == 0) {
args.version = 1;
args.dirmask = args.mask;
if ((args->flags & MSDOSFSMNT_VERSIONED) == 0) {
args->version = 1;
args->dirmask = args->mask;
}
/*
* Reset GMT offset for pre-v3 mount structure args.
*/
if (args.version < 3)
args.gmtoff = 0;
if (args->version < 3)
args->gmtoff = 0;
/*
* If updating, check whether changing from read-only to
@ -333,7 +334,7 @@ msdosfs_mount(mp, path, data, ndp, l)
}
pmp->pm_flags &= ~MSDOSFSMNT_RONLY;
}
if (args.fspec == NULL) {
if (args->fspec == NULL) {
DPRINTF(("missing fspec\n"));
return EINVAL;
}
@ -342,7 +343,7 @@ msdosfs_mount(mp, path, data, ndp, l)
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible block device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0) {
DPRINTF(("namei %d\n", error));
return (error);
@ -404,7 +405,7 @@ msdosfs_mount(mp, path, data, ndp, l)
DPRINTF(("VOP_OPEN %d\n", error));
goto fail;
}
error = msdosfs_mountfs(devvp, mp, l, &args);
error = msdosfs_mountfs(devvp, mp, l, args);
if (error) {
DPRINTF(("msdosfs_mountfs %d\n", error));
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
@ -423,7 +424,7 @@ msdosfs_mount(mp, path, data, ndp, l)
return (EINVAL); /* needs translation */
}
}
if ((error = update_mp(mp, &args)) != 0) {
if ((error = update_mp(mp, args)) != 0) {
msdosfs_unmount(mp, MNT_FORCE, l);
DPRINTF(("update_mp %d\n", error));
return error;
@ -432,7 +433,7 @@ msdosfs_mount(mp, path, data, ndp, l)
#ifdef MSDOSFS_DEBUG
printf("msdosfs_mount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap);
#endif
return set_statvfs_info(path, UIO_USERSPACE, args.fspec, UIO_USERSPACE,
return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
mp, l);
fail:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_vfsops.c,v 1.50 2007/06/30 09:37:56 pooka Exp $ */
/* $NetBSD: ntfs_vfsops.c,v 1.51 2007/07/12 19:35:33 dsl Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.50 2007/06/30 09:37:56 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.51 2007/07/12 19:35:33 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -70,7 +70,7 @@ MALLOC_JUSTDEFINE(M_NTFSDIR,"NTFS dir", "NTFS dir buffer");
static int ntfs_mount(struct mount *, char *, void *,
struct nameidata *, struct proc *);
#else
static int ntfs_mount(struct mount *, const char *, void *,
static int ntfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
#endif
static int ntfs_quotactl(struct mount *, int, uid_t, void *,
@ -230,6 +230,7 @@ ntfs_mount (
#else
const char *path,
void *data,
size_t *data_len,
#endif
struct nameidata *ndp,
#if defined(__FreeBSD__)
@ -240,18 +241,30 @@ ntfs_mount (
{
int err = 0, flags;
struct vnode *devvp;
struct ntfs_args args;
#if defined(__FreeBSD__)
struct ntfs_args *args = args_buf;
#else
struct ntfs_args *args = data;
if (*data_len < sizeof *args)
return EINVAL;
#endif
if (mp->mnt_flag & MNT_GETARGS) {
struct ntfsmount *ntmp = VFSTONTFS(mp);
if (ntmp == NULL)
return EIO;
args.fspec = NULL;
args.uid = ntmp->ntm_uid;
args.gid = ntmp->ntm_gid;
args.mode = ntmp->ntm_mode;
args.flag = ntmp->ntm_flag;
return copyout(&args, data, sizeof(args));
args->fspec = NULL;
args->uid = ntmp->ntm_uid;
args->gid = ntmp->ntm_gid;
args->mode = ntmp->ntm_mode;
args->flag = ntmp->ntm_flag;
#if defined(__FreeBSD__)
return copyout(args, data, sizeof(args));
#else
*data_len = sizeof *args;
return 0;
#endif
}
/*
***
@ -259,10 +272,12 @@ ntfs_mount (
***
*/
#if defined(__FreeBSD__)
/* copy in user arguments*/
err = copyin(data, &args, sizeof (struct ntfs_args));
err = copyin(data, args, sizeof (struct ntfs_args));
if (err)
return (err); /* can't get arguments*/
#endif
/*
* If updating, check whether changing from read-only to
@ -278,9 +293,9 @@ ntfs_mount (
* and verify that it refers to a sensible block device.
*/
#ifdef __FreeBSD__
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, p);
#else
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
#endif
err = namei(ndp);
if (err) {
@ -318,7 +333,7 @@ ntfs_mount (
/*
* Update device name only on success
*/
err = set_statvfs_info(NULL, UIO_USERSPACE, args.fspec,
err = set_statvfs_info(NULL, UIO_USERSPACE, args->fspec,
UIO_USERSPACE, mp, p);
if (err)
goto fail;
@ -340,7 +355,7 @@ ntfs_mount (
*/
/* Save "last mounted on" info for mount point (NULL pad)*/
err = set_statvfs_info(path, UIO_USERSPACE, args.fspec,
err = set_statvfs_info(path, UIO_USERSPACE, args->fspec,
UIO_USERSPACE, mp, l);
if (err)
goto fail;
@ -365,7 +380,7 @@ ntfs_mount (
err = VOP_OPEN(devvp, flags, FSCRED, l);
if (err)
goto fail;
err = ntfs_mountfs(devvp, mp, &args, l);
err = ntfs_mountfs(devvp, mp, args, l);
if (err) {
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
(void)VOP_CLOSE(devvp, flags, NOCRED, l);
@ -1002,6 +1017,9 @@ const struct vnodeopv_desc * const ntfs_vnodeopv_descs[] = {
struct vfsops ntfs_vfsops = {
MOUNT_NTFS,
#if !defined(__FreeBSD__)
sizeof (struct ntfs_args),
#endif
ntfs_mount,
ntfs_start,
ntfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ptyfs_vfsops.c,v 1.24 2007/06/30 09:37:56 pooka Exp $ */
/* $NetBSD: ptyfs_vfsops.c,v 1.25 2007/07/12 19:35:33 dsl Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.24 2007/06/30 09:37:56 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.25 2007/07/12 19:35:33 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -66,8 +66,8 @@ MALLOC_JUSTDEFINE(M_PTYFSMNT, "ptyfs mount", "ptyfs mount structures");
void ptyfs_init(void);
void ptyfs_reinit(void);
void ptyfs_done(void);
int ptyfs_mount(struct mount *, const char *, void *, struct nameidata *,
struct lwp *);
int ptyfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int ptyfs_start(struct mount *, int, struct lwp *);
int ptyfs_unmount(struct mount *, int, struct lwp *);
int ptyfs_statvfs(struct mount *, struct statvfs *, struct lwp *);
@ -211,12 +211,15 @@ ptyfs_done(void)
* Mount the Pseudo tty params filesystem
*/
int
ptyfs_mount(struct mount *mp, const char *path, void *data,
ptyfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
int error = 0;
struct ptyfsmount *pmnt;
struct ptyfs_args args;
struct ptyfs_args *args = data;
if (*data_len < sizeof *args)
return EINVAL;
if (UIO_MX & (UIO_MX - 1)) {
log(LOG_ERR, "ptyfs: invalid directory entry size");
@ -227,10 +230,11 @@ ptyfs_mount(struct mount *mp, const char *path, void *data,
pmnt = VFSTOPTY(mp);
if (pmnt == NULL)
return EIO;
args.version = PTYFS_ARGSVERSION;
args.mode = pmnt->pmnt_mode;
args.gid = pmnt->pmnt_gid;
return copyout(&args, data, sizeof(args));
args->version = PTYFS_ARGSVERSION;
args->mode = pmnt->pmnt_mode;
args->gid = pmnt->pmnt_gid;
*data_len = sizeof *args;
return 0;
}
/* Don't allow more than one mount */
@ -240,25 +244,14 @@ ptyfs_mount(struct mount *mp, const char *path, void *data,
if (mp->mnt_flag & MNT_UPDATE)
return EOPNOTSUPP;
if (data != NULL) {
error = copyin(data, &args, sizeof args);
if (error != 0)
return error;
if (args.version != PTYFS_ARGSVERSION)
return EINVAL;
} else {
/*
* Arguments are mandatory.
*/
if (args->version != PTYFS_ARGSVERSION)
return EINVAL;
}
pmnt = malloc(sizeof(struct ptyfsmount), M_UFSMNT, M_WAITOK);
mp->mnt_data = pmnt;
pmnt->pmnt_gid = args.gid;
pmnt->pmnt_mode = args.mode;
pmnt->pmnt_gid = args->gid;
pmnt->pmnt_mode = args->mode;
mp->mnt_flag |= MNT_LOCAL;
vfs_getnewfsid(mp);
@ -398,6 +391,7 @@ const struct vnodeopv_desc * const ptyfs_vnodeopv_descs[] = {
struct vfsops ptyfs_vfsops = {
MOUNT_PTYFS,
sizeof (struct ptyfs_args),
ptyfs_mount,
ptyfs_start,
ptyfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vfsops.c,v 1.47 2007/07/09 21:10:49 ad Exp $ */
/* $NetBSD: puffs_vfsops.c,v 1.48 2007/07/12 19:35:33 dsl Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.47 2007/07/09 21:10:49 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.48 2007/07/12 19:35:33 dsl Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@ -64,7 +64,7 @@ int puffs_pnodebuckets_default = PUFFS_PNODEBUCKETS;
int puffs_maxpnodebuckets = PUFFS_MAXPNODEBUCKETS;
int
puffs_mount(struct mount *mp, const char *path, void *data,
puffs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct puffs_mount *pmp = NULL;
@ -72,9 +72,14 @@ puffs_mount(struct mount *mp, const char *path, void *data,
char namebuf[PUFFSNAMESIZE+sizeof(PUFFS_NAMEPREFIX)+1]; /* spooky */
int error = 0, i;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
pmp = MPTOPUFFSMP(mp);
return copyout(&pmp->pmp_args,data,sizeof(struct puffs_kargs));
*(struct puffs_kargs *)data = pmp->pmp_args;
*data_len = sizeof *args;
return 0;
}
/* update is not supported currently */
@ -90,9 +95,7 @@ puffs_mount(struct mount *mp, const char *path, void *data,
MALLOC(args, struct puffs_kargs *, sizeof(struct puffs_kargs),
M_PUFFS, M_WAITOK);
error = copyin(data, args, sizeof(struct puffs_kargs));
if (error)
goto out;
*args = *(struct puffs_kargs *)data;
/* devel phase */
if (args->pa_vers != (PUFFSVERSION | PUFFSDEVELVERS)) {
@ -712,6 +715,7 @@ const struct vnodeopv_desc * const puffs_vnodeopv_descs[] = {
struct vfsops puffs_vfsops = {
MOUNT_PUFFS,
sizeof (struct puffs_kargs),
puffs_mount, /* mount */
puffs_start, /* start */
puffs_unmount, /* unmount */

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_vfsops.c,v 1.65 2007/06/30 09:37:57 pooka Exp $ */
/* $NetBSD: smbfs_vfsops.c,v 1.66 2007/07/12 19:35:33 dsl Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.65 2007/06/30 09:37:57 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.66 2007/07/12 19:35:33 dsl Exp $");
#ifdef _KERNEL_OPT
#include "opt_quota.h"
@ -96,7 +96,7 @@ SYSCTL_SETUP(sysctl_vfs_samba_setup, "sysctl vfs.samba subtree setup")
static MALLOC_JUSTDEFINE(M_SMBFSHASH, "SMBFS hash", "SMBFS hash table");
int smbfs_mount(struct mount *, const char *, void *,
int smbfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int smbfs_quotactl(struct mount *, int, uid_t, void *, struct lwp *);
int smbfs_root(struct mount *, struct vnode **);
@ -121,6 +121,7 @@ static const struct vnodeopv_desc *smbfs_vnodeopv_descs[] = {
struct vfsops smbfs_vfsops = {
MOUNT_SMBFS,
sizeof (struct smbfs_args),
smbfs_mount,
smbfs_start,
smbfs_unmount,
@ -145,10 +146,10 @@ struct vfsops smbfs_vfsops = {
VFS_ATTACH(smbfs_vfsops);
int
smbfs_mount(struct mount *mp, const char *path, void *data,
smbfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct smbfs_args args; /* will hold data from mount request */
struct smbfs_args *args = data; /* holds data from mount request */
struct smbmount *smp = NULL;
struct smb_vc *vcp;
struct smb_share *ssp = NULL;
@ -156,28 +157,29 @@ smbfs_mount(struct mount *mp, const char *path, void *data,
struct proc *p;
int error;
if (*data_len < sizeof *args)
return EINVAL;
p = l->l_proc;
if (mp->mnt_flag & MNT_GETARGS) {
smp = VFSTOSMBFS(mp);
if (smp == NULL)
return EIO;
return copyout(&smp->sm_args, data, sizeof(smp->sm_args));
*args = smp->sm_args;
*data_len = sizeof *args;
return 0;
}
if (mp->mnt_flag & MNT_UPDATE)
return EOPNOTSUPP;
error = copyin(data, &args, sizeof(struct smbfs_args));
if (error)
return error;
if (args.version != SMBFS_VERSION) {
if (args->version != SMBFS_VERSION) {
SMBVDEBUG("mount version mismatch: kernel=%d, mount=%d\n",
SMBFS_VERSION, args.version);
SMBFS_VERSION, args->version);
return EINVAL;
}
smb_makescred(&scred, l, l->l_cred);
error = smb_dev2share(args.dev_fd, SMBM_EXEC, &scred, &ssp);
error = smb_dev2share(args->dev_fd, SMBM_EXEC, &scred, &ssp);
if (error)
return error;
smb_share_unlock(ssp, 0); /* keep ref, but unlock */
@ -196,8 +198,8 @@ smbfs_mount(struct mount *mp, const char *path, void *data,
lockinit(&smp->sm_hashlock, PVFS, "smbfsh", 0, 0);
smp->sm_share = ssp;
smp->sm_root = NULL;
smp->sm_args = args;
smp->sm_caseopt = args.caseopt;
smp->sm_args = *args;
smp->sm_caseopt = args->caseopt;
smp->sm_args.file_mode = (smp->sm_args.file_mode &
(S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFREG;
smp->sm_args.dir_mode = (smp->sm_args.dir_mode &

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs.c,v 1.4 2007/01/19 14:49:10 hannken Exp $ */
/* $NetBSD: sysvbfs.c,v 1.5 2007/07/12 19:35:34 dsl Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysvbfs.c,v 1.4 2007/01/19 14:49:10 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysvbfs.c,v 1.5 2007/07/12 19:35:34 dsl Exp $");
#include <sys/resource.h>
#include <sys/param.h>
@ -115,6 +115,7 @@ const struct genfs_ops sysvbfs_genfsops = {
struct vfsops sysvbfs_vfsops = {
MOUNT_SYSVBFS,
sizeof (struct sysvbfs_args),
sysvbfs_mount,
sysvbfs_start,
sysvbfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs.h,v 1.4 2006/10/06 02:40:58 chs Exp $ */
/* $NetBSD: sysvbfs.h,v 1.5 2007/07/12 19:35:34 dsl Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -96,8 +96,8 @@ int sysvbfs_advlock(void *);
int sysvbfs_pathconf(void *);
/* vfs ops. */
int sysvbfs_mount(struct mount *, const char *, void *, struct nameidata *,
struct lwp *);
int sysvbfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int sysvbfs_start(struct mount *, int, struct lwp *);
int sysvbfs_unmount(struct mount *, int, struct lwp *);
int sysvbfs_root(struct mount *, struct vnode **);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs_vfsops.c,v 1.11 2007/06/30 09:37:57 pooka Exp $ */
/* $NetBSD: sysvbfs_vfsops.c,v 1.12 2007/07/12 19:35:34 dsl Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.11 2007/06/30 09:37:57 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.12 2007/07/12 19:35:34 dsl Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -74,10 +74,10 @@ struct pool sysvbfs_node_pool;
int sysvbfs_mountfs(struct vnode *, struct mount *, struct lwp *);
int
sysvbfs_mount(struct mount *mp, const char *path, void *data,
sysvbfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct sysvbfs_args args;
struct sysvbfs_args *args = data;
struct sysvbfs_mount *bmp = NULL;
struct vnode *devvp = NULL;
int error;
@ -85,26 +85,28 @@ sysvbfs_mount(struct mount *mp, const char *path, void *data,
DPRINTF("%s: mnt_flag=%x\n", __FUNCTION__, mp->mnt_flag);
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
if ((bmp = (void *)mp->mnt_data) == NULL)
return EIO;
args.fspec = NULL;
return copyout(&args, data, sizeof(args));
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
}
if ((error = copyin(data, &args, sizeof(args))) != 0)
return error;
DPRINTF("%s: args.fspec=%s\n", __FUNCTION__, args.fspec);
DPRINTF("%s: args->fspec=%s\n", __FUNCTION__, args->fspec);
update = mp->mnt_flag & MNT_UPDATE;
if (args.fspec == NULL) {
if (args->fspec == NULL) {
/* nothing to do. */
return EINVAL;
}
if (args.fspec != NULL) {
if (args->fspec != NULL) {
/* Look up the name and verify that it's sane. */
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@ -158,7 +160,7 @@ sysvbfs_mount(struct mount *mp, const char *path, void *data,
/* XXX: r/w -> read only */
}
return set_statvfs_info(path, UIO_USERSPACE, args.fspec, UIO_USERSPACE,
return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
mp, l);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tmpfs_vfsops.c,v 1.22 2007/07/09 21:10:50 ad Exp $ */
/* $NetBSD: tmpfs_vfsops.c,v 1.23 2007/07/12 19:35:34 dsl Exp $ */
/*
* Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.22 2007/07/09 21:10:50 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.23 2007/07/12 19:35:34 dsl Exp $");
#include <sys/param.h>
#include <sys/types.h>
@ -66,7 +66,7 @@ MALLOC_JUSTDEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures");
/* --------------------------------------------------------------------- */
static int tmpfs_mount(struct mount *, const char *, void *,
static int tmpfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
static int tmpfs_start(struct mount *, int, struct lwp *);
static int tmpfs_unmount(struct mount *, int, struct lwp *);
@ -86,7 +86,7 @@ static int tmpfs_snapshot(struct mount *, struct vnode *,
/* --------------------------------------------------------------------- */
static int
tmpfs_mount(struct mount *mp, const char *path, void *data,
tmpfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
int error;
@ -94,7 +94,10 @@ tmpfs_mount(struct mount *mp, const char *path, void *data,
size_t pages;
struct tmpfs_mount *tmp;
struct tmpfs_node *root;
struct tmpfs_args args;
struct tmpfs_args *args = data;
if (*data_len < sizeof *args)
return EINVAL;
/* Handle retrieval of mount point arguments. */
if (mp->mnt_flag & MNT_GETARGS) {
@ -102,27 +105,19 @@ tmpfs_mount(struct mount *mp, const char *path, void *data,
return EIO;
tmp = VFS_TO_TMPFS(mp);
args.ta_version = TMPFS_ARGS_VERSION;
args.ta_nodes_max = tmp->tm_nodes_max;
args.ta_size_max = tmp->tm_pages_max * PAGE_SIZE;
args->ta_version = TMPFS_ARGS_VERSION;
args->ta_nodes_max = tmp->tm_nodes_max;
args->ta_size_max = tmp->tm_pages_max * PAGE_SIZE;
root = tmp->tm_root;
args.ta_root_uid = root->tn_uid;
args.ta_root_gid = root->tn_gid;
args.ta_root_mode = root->tn_mode;
args->ta_root_uid = root->tn_uid;
args->ta_root_gid = root->tn_gid;
args->ta_root_mode = root->tn_mode;
return copyout(&args, data, sizeof(args));
*data_len = sizeof *args;
return 0;
}
/* Verify that we have parameters, as they are required. */
if (data == NULL)
return EINVAL;
/* Get the mount parameters. */
error = copyin(data, &args, sizeof(args));
if (error != 0)
return error;
if (mp->mnt_flag & MNT_UPDATE) {
/* XXX: There is no support yet to update file system
* settings. Should be added. */
@ -130,7 +125,7 @@ tmpfs_mount(struct mount *mp, const char *path, void *data,
return EOPNOTSUPP;
}
if (args.ta_version != TMPFS_ARGS_VERSION)
if (args->ta_version != TMPFS_ARGS_VERSION)
return EINVAL;
/* Do not allow mounts if we do not have enough memory to preserve
@ -142,17 +137,17 @@ tmpfs_mount(struct mount *mp, const char *path, void *data,
* allowed to use, based on the maximum size the user passed in
* the mount structure. A value of zero is treated as if the
* maximum available space was requested. */
if (args.ta_size_max < PAGE_SIZE || args.ta_size_max >= SIZE_MAX)
if (args->ta_size_max < PAGE_SIZE || args->ta_size_max >= SIZE_MAX)
pages = SIZE_MAX;
else
pages = args.ta_size_max / PAGE_SIZE +
(args.ta_size_max % PAGE_SIZE == 0 ? 0 : 1);
pages = args->ta_size_max / PAGE_SIZE +
(args->ta_size_max % PAGE_SIZE == 0 ? 0 : 1);
KASSERT(pages > 0);
if (args.ta_nodes_max <= 3)
if (args->ta_nodes_max <= 3)
nodes = 3 + pages * PAGE_SIZE / 1024;
else
nodes = args.ta_nodes_max;
nodes = args->ta_nodes_max;
KASSERT(nodes >= 3);
/* Allocate the tmpfs mount structure and fill it. */
@ -174,8 +169,8 @@ tmpfs_mount(struct mount *mp, const char *path, void *data,
tmpfs_str_pool_init(&tmp->tm_str_pool, tmp);
/* Allocate the root node. */
error = tmpfs_alloc_node(tmp, VDIR, args.ta_root_uid,
args.ta_root_gid, args.ta_root_mode & ALLPERMS, NULL, NULL,
error = tmpfs_alloc_node(tmp, VDIR, args->ta_root_uid,
args->ta_root_gid, args->ta_root_mode & ALLPERMS, NULL, NULL,
VNOVAL, l->l_proc, &root);
KASSERT(error == 0 && root != NULL);
tmp->tm_root = root;
@ -453,6 +448,7 @@ const struct vnodeopv_desc * const tmpfs_vnodeopv_descs[] = {
struct vfsops tmpfs_vfsops = {
MOUNT_TMPFS, /* vfs_name */
sizeof (struct tmpfs_args),
tmpfs_mount, /* vfs_mount */
tmpfs_start, /* vfs_start */
tmpfs_unmount, /* vfs_unmount */

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf_vfsops.c,v 1.25 2007/06/30 09:37:57 pooka Exp $ */
/* $NetBSD: udf_vfsops.c,v 1.26 2007/07/12 19:35:34 dsl Exp $ */
/*
* Copyright (c) 2006 Reinoud Zandijk
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: udf_vfsops.c,v 1.25 2007/06/30 09:37:57 pooka Exp $");
__RCSID("$NetBSD: udf_vfsops.c,v 1.26 2007/07/12 19:35:34 dsl Exp $");
#endif /* not lint */
@ -84,7 +84,8 @@ struct pool udf_node_pool;
/* supported functions predefined */
int udf_mountroot(void);
int udf_mount(struct mount *, const char *, void *, struct nameidata *, struct lwp *);
int udf_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int udf_start(struct mount *, int, struct lwp *);
int udf_unmount(struct mount *, int, struct lwp *);
int udf_root(struct mount *, struct vnode **);
@ -127,6 +128,7 @@ const struct vnodeopv_desc * const udf_vnodeopv_descs[] = {
/* vfsops descriptor linked in as anchor point for the filingsystem */
struct vfsops udf_vfsops = {
MOUNT_UDF, /* vfs_name */
sizeof (struct udf_args),
udf_mount,
udf_start,
udf_unmount,
@ -254,21 +256,26 @@ free_udf_mountinfo(struct mount *mp)
int
udf_mount(struct mount *mp, const char *path,
void *data, struct nameidata *ndp, struct lwp *l)
void *data, size_t *data_len, struct nameidata *ndp, struct lwp *l)
{
struct udf_args args;
struct udf_args *args = data;
struct udf_mount *ump;
struct vnode *devvp;
int openflags, accessmode, error;
DPRINTF(CALL, ("udf_mount called\n"));
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
/* request for the mount arguments */
ump = VFSTOUDF(mp);
if (ump == NULL)
return EINVAL;
return copyout(&ump->mount_args, data, sizeof(args));
*args = ump->mount_args;
*data_len = sizeof *args;
return 0;
}
/* handle request for updating mount parameters */
@ -278,19 +285,16 @@ udf_mount(struct mount *mp, const char *path,
}
/* OK, so we are asked to mount the device */
error = copyin(data, &args, sizeof(struct udf_args));
if (error)
return error;
/* check/translate struct version */
/* TODO sanity checking other mount arguments */
if (args.version != 1) {
if (args->version != 1) {
printf("mount_udf: unrecognized argument structure version\n");
return EINVAL;
}
/* lookup name to get its vnode */
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
error = namei(ndp);
if (error)
return error;
@ -357,7 +361,7 @@ udf_mount(struct mount *mp, const char *path,
error = VOP_OPEN(devvp, openflags, FSCRED, l);
if (error == 0) {
/* opened ok, try mounting */
error = udf_mountfs(devvp, mp, l, &args);
error = udf_mountfs(devvp, mp, l, args);
if (error) {
free_udf_mountinfo(mp);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
@ -377,7 +381,7 @@ udf_mount(struct mount *mp, const char *path,
/* successfully mounted */
DPRINTF(VOLUMES, ("udf_mount() successfull\n"));
return set_statvfs_info(path, UIO_USERSPACE, args.fspec, UIO_USERSPACE,
return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
mp, l);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: union_vfsops.c,v 1.44 2007/04/08 11:20:42 hannken Exp $ */
/* $NetBSD: union_vfsops.c,v 1.45 2007/07/12 19:35:34 dsl Exp $ */
/*
* Copyright (c) 1994 The Regents of the University of California.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.44 2007/04/08 11:20:42 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.45 2007/07/12 19:35:34 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -95,8 +95,8 @@ __KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.44 2007/04/08 11:20:42 hannken Ex
#include <fs/union/union.h>
int union_mount(struct mount *, const char *, void *, struct nameidata *,
struct lwp *);
int union_mount(struct mount *, const char *, void *, size_t *data_len,
struct nameidata *, struct lwp *);
int union_start(struct mount *, int, struct lwp *);
int union_unmount(struct mount *, int, struct lwp *);
int union_root(struct mount *, struct vnode **);
@ -109,15 +109,16 @@ int union_vget(struct mount *, ino_t, struct vnode **);
* Mount union filesystem
*/
int
union_mount(mp, path, data, ndp, l)
union_mount(mp, path, data, data_len, ndp, l)
struct mount *mp;
const char *path;
void *data;
size_t *data_len;
struct nameidata *ndp;
struct lwp *l;
{
int error = 0;
struct union_args args;
struct union_args *args = data;
struct vnode *lowerrootvp = NULLVP;
struct vnode *upperrootvp = NULLVP;
struct union_mount *um = 0;
@ -126,6 +127,9 @@ union_mount(mp, path, data, ndp, l)
int len;
size_t size;
if (*data_len < sizeof *args)
return EINVAL;
#ifdef UNION_DIAGNOSTIC
printf("union_mount(mp = %p)\n", mp);
#endif
@ -134,9 +138,10 @@ union_mount(mp, path, data, ndp, l)
um = MOUNTTOUNIONMOUNT(mp);
if (um == NULL)
return EIO;
args.target = NULL;
args.mntflags = um->um_op;
return copyout(&args, data, sizeof(args));
args->target = NULL;
args->mntflags = um->um_op;
*data_len = sizeof *args;
return 0;
}
/*
* Update is a no-op
@ -151,21 +156,13 @@ union_mount(mp, path, data, ndp, l)
goto bad;
}
/*
* Get argument
*/
error = copyin(data, &args, sizeof(struct union_args));
if (error)
goto bad;
lowerrootvp = mp->mnt_vnodecovered;
VREF(lowerrootvp);
/*
* Find upper node.
*/
NDINIT(ndp, LOOKUP, FOLLOW,
UIO_USERSPACE, args.target, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->target, l);
if ((error = namei(ndp)) != 0)
goto bad;
@ -189,7 +186,7 @@ union_mount(mp, path, data, ndp, l)
* same as providing a mount under option to the mount syscall.
*/
um->um_op = args.mntflags & UNMNT_OPMASK;
um->um_op = args->mntflags & UNMNT_OPMASK;
switch (um->um_op) {
case UNMNT_ABOVE:
um->um_lowervp = lowerrootvp;
@ -283,7 +280,7 @@ union_mount(mp, path, data, ndp, l)
xp = mp->mnt_stat.f_mntfromname + len;
len = MNAMELEN - len;
(void) copyinstr(args.target, xp, len - 1, &size);
(void) copyinstr(args->target, xp, len - 1, &size);
memset(xp + size, 0, len - size);
#ifdef UNION_DIAGNOSTIC
@ -533,6 +530,7 @@ const struct vnodeopv_desc * const union_vnodeopv_descs[] = {
struct vfsops union_vfsops = {
MOUNT_UNION,
sizeof (struct union_args),
union_mount,
union_start,
union_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_syscalls.c,v 1.319 2007/06/16 20:48:04 dsl Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.320 2007/07/12 19:35:37 dsl Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.319 2007/06/16 20:48:04 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.320 2007/07/12 19:35:37 dsl Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_43.h"
@ -135,7 +135,7 @@ const int nmountcompatnames = sizeof(mountcompatnames) /
static int
mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
void *data, struct nameidata *ndp)
void *data, size_t *data_len, struct nameidata *ndp)
{
struct mount *mp;
int error = 0, saved_flags;
@ -144,29 +144,23 @@ mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
saved_flags = mp->mnt_flag;
/* We can operate only on VROOT nodes. */
if ((vp->v_flag & VROOT) == 0) {
error = EINVAL;
goto out;
}
if ((vp->v_flag & VROOT) == 0)
return EINVAL;
/*
* We only allow the filesystem to be reloaded if it
* is currently mounted read-only.
*/
if (flags & MNT_RELOAD && !(mp->mnt_flag & MNT_RDONLY)) {
error = EOPNOTSUPP; /* Needs translation */
goto out;
}
if (flags & MNT_RELOAD && !(mp->mnt_flag & MNT_RDONLY))
return EOPNOTSUPP; /* Needs translation */
error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
KAUTH_REQ_SYSTEM_MOUNT_UPDATE, mp, KAUTH_ARG(flags), data);
if (error)
goto out;
return error;
if (vfs_busy(mp, LK_NOWAIT, 0)) {
error = EPERM;
goto out;
}
if (vfs_busy(mp, LK_NOWAIT, 0))
return EPERM;
mp->mnt_flag &= ~MNT_OP_FLAGS;
mp->mnt_flag |= flags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE);
@ -188,10 +182,10 @@ mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
MNT_IGNORE);
error = VFS_MOUNT(mp, path, data, ndp, l);
error = VFS_MOUNT(mp, path, data, data_len, ndp, l);
#if defined(COMPAT_30) && defined(NFSSERVER)
if (error) {
if (error && data != NULL) {
int error2;
/* Update failed; let's try and see if it was an
@ -220,54 +214,16 @@ mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
}
vfs_unbusy(mp);
out:
return (error);
}
static int
mount_domount(struct lwp *l, struct vnode *vp, const char *fstype,
const char *path, int flags, void *data, struct nameidata *ndp)
mount_get_vfsops(const char *fstype, struct vfsops **vfsops)
{
struct mount *mp = NULL;
struct vattr va;
char fstypename[MFSNAMELEN];
int error;
error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
KAUTH_REQ_SYSTEM_MOUNT_NEW, vp, KAUTH_ARG(flags), data);
if (error) {
vput(vp);
goto out;
}
/* Can't make a non-dir a mount-point (from here anyway). */
if (vp->v_type != VDIR) {
error = ENOTDIR;
vput(vp);
goto out;
}
/*
* If the user is not root, ensure that they own the directory
* onto which we are attempting to mount.
*/
if ((error = VOP_GETATTR(vp, &va, l->l_cred, l)) != 0 ||
(va.va_uid != kauth_cred_geteuid(l->l_cred) &&
(error = kauth_authorize_generic(l->l_cred,
KAUTH_GENERIC_ISSUSER, NULL)) != 0)) {
vput(vp);
goto out;
}
if (flags & MNT_EXPORTED) {
error = EINVAL;
vput(vp);
goto out;
}
/*
* Copy file-system type from userspace.
*/
/* Copy file-system type from userspace. */
error = copyinstr(fstype, fstypename, MFSNAMELEN, NULL);
if (error) {
#if defined(COMPAT_09) || defined(COMPAT_43)
@ -279,46 +235,70 @@ mount_domount(struct lwp *l, struct vnode *vp, const char *fstype,
*/
u_long fsindex = (u_long)fstype;
if (fsindex >= nmountcompatnames ||
mountcompatnames[fsindex] == NULL) {
error = ENODEV;
vput(vp);
goto out;
}
mountcompatnames[fsindex] == NULL)
return ENODEV;
strlcpy(fstypename, mountcompatnames[fsindex], sizeof(fstypename));
#else
vput(vp);
goto out;
return error;
#endif
}
#ifdef COMPAT_10
/* Accept `ufs' as an alias for `ffs'. */
if (strncmp(fstypename, "ufs", MFSNAMELEN) == 0)
strlcpy(fstypename, "ffs", sizeof(fstypename));
if (strcmp(fstypename, "ufs") == 0)
fstypename[0] = 'f';
#endif
if ((error = vinvalbuf(vp, V_SAVE, l->l_cred, l, 0, 0)) != 0) {
vput(vp);
goto out;
if ((*vfsops = vfs_getopsbyname(fstypename)) == NULL)
return ENODEV;
return 0;
}
static int
mount_domount(struct lwp *l, struct vnode **vpp, struct vfsops *vfsops,
const char *path, int flags, void *data, size_t *data_len,
struct nameidata *ndp)
{
struct mount *mp = NULL;
struct vnode *vp = *vpp;
struct vattr va;
int error;
error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
KAUTH_REQ_SYSTEM_MOUNT_NEW, vp, KAUTH_ARG(flags), data);
if (error)
return error;
/* Can't make a non-dir a mount-point (from here anyway). */
if (vp->v_type != VDIR)
return ENOTDIR;
/*
* If the user is not root, ensure that they own the directory
* onto which we are attempting to mount.
*/
if ((error = VOP_GETATTR(vp, &va, l->l_cred, l)) != 0 ||
(va.va_uid != kauth_cred_geteuid(l->l_cred) &&
(error = kauth_authorize_generic(l->l_cred,
KAUTH_GENERIC_ISSUSER, NULL)) != 0)) {
return error;
}
if (flags & MNT_EXPORTED)
return EINVAL;
if ((error = vinvalbuf(vp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
return error;
/*
* Check if a file-system is not already mounted on this vnode.
*/
if (vp->v_mountedhere != NULL) {
error = EBUSY;
vput(vp);
goto out;
}
if (vp->v_mountedhere != NULL)
return EBUSY;
mp = malloc(sizeof(*mp), M_MOUNT, M_WAITOK|M_ZERO);
if ((mp->mnt_op = vfs_getopsbyname(fstypename)) == NULL) {
free(mp, M_MOUNT);
error = ENODEV;
vput(vp);
goto out;
}
mp->mnt_op = vfsops;
TAILQ_INIT(&mp->mnt_vnodelist);
lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, 0);
@ -343,52 +323,49 @@ mount_domount(struct lwp *l, struct vnode *vp, const char *fstype,
MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
MNT_IGNORE | MNT_RDONLY);
error = VFS_MOUNT(mp, path, data, ndp, l);
error = VFS_MOUNT(mp, path, data, data_len, ndp, l);
mp->mnt_flag &= ~MNT_OP_FLAGS;
/*
* Put the new filesystem on the mount list after root.
*/
cache_purge(vp);
if (!error) {
mp->mnt_iflag &= ~IMNT_WANTRDWR;
vp->v_mountedhere = mp;
simple_lock(&mountlist_slock);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
simple_unlock(&mountlist_slock);
VOP_UNLOCK(vp, 0);
checkdirs(vp);
if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0)
error = vfs_allocate_syncvnode(mp);
vfs_unbusy(mp);
(void) VFS_STATVFS(mp, &mp->mnt_stat, l);
error = VFS_START(mp, 0, l);
if (error)
vrele(vp);
} else {
if (error != 0) {
vp->v_mountedhere = NULL;
mp->mnt_op->vfs_refcount--;
vfs_unbusy(mp);
free(mp, M_MOUNT);
vput(vp);
return error;
}
out:
return (error);
mp->mnt_iflag &= ~IMNT_WANTRDWR;
vp->v_mountedhere = mp;
simple_lock(&mountlist_slock);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
simple_unlock(&mountlist_slock);
VOP_UNLOCK(vp, 0);
checkdirs(vp);
if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0)
error = vfs_allocate_syncvnode(mp);
vfs_unbusy(mp);
(void) VFS_STATVFS(mp, &mp->mnt_stat, l);
error = VFS_START(mp, 0, l);
if (error)
vrele(vp);
*vpp = NULL;
return error;
}
static int
mount_getargs(struct lwp *l, struct vnode *vp, const char *path, int flags,
void *data, struct nameidata *ndp)
void *data, size_t *data_len, struct nameidata *ndp)
{
struct mount *mp;
int error;
/* If MNT_GETARGS is specified, it should be the only flag. */
if (flags & ~MNT_GETARGS) {
error = EINVAL;
goto out;
}
if (flags & ~MNT_GETARGS)
return EINVAL;
mp = vp->v_mount;
@ -396,25 +373,20 @@ mount_getargs(struct lwp *l, struct vnode *vp, const char *path, int flags,
error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
KAUTH_REQ_SYSTEM_MOUNT_GET, mp, data, NULL);
if (error)
goto out;
return error;
if ((vp->v_flag & VROOT) == 0) {
error = EINVAL;
goto out;
}
if ((vp->v_flag & VROOT) == 0)
return EINVAL;
if (vfs_busy(mp, LK_NOWAIT, 0)) {
error = EPERM;
goto out;
}
if (vfs_busy(mp, LK_NOWAIT, 0))
return EPERM;
mp->mnt_flag &= ~MNT_OP_FLAGS;
mp->mnt_flag |= MNT_GETARGS;
error = VFS_MOUNT(mp, path, data, ndp, l);
error = VFS_MOUNT(mp, path, data, data_len, ndp, l);
mp->mnt_flag &= ~MNT_OP_FLAGS;
vfs_unbusy(mp);
out:
return (error);
}
@ -428,15 +400,26 @@ sys_mount(struct lwp *l, void *v, register_t *retval)
syscallarg(int) flags;
syscallarg(void *) data;
} */ *uap = v;
register_t dummy;
return do_sys_mount(l, NULL, SCARG(uap, type), SCARG(uap, path),
SCARG(uap, flags), SCARG(uap, data), UIO_USERSPACE, 0, &dummy);
}
int
do_sys_mount(struct lwp *l, struct vfsops *vfsops, const char *type,
const char *path, int flags, void *data, enum uio_seg data_seg,
size_t data_len, register_t *retval)
{
struct vnode *vp;
struct nameidata nd;
void *data_buf = data;
int error;
/*
* Get vnode to be covered
*/
NDINIT(&nd, LOOKUP, FOLLOW | TRYEMULROOT, UIO_USERSPACE,
SCARG(uap, path), l);
NDINIT(&nd, LOOKUP, FOLLOW | TRYEMULROOT, UIO_USERSPACE, path, l);
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
@ -446,21 +429,68 @@ sys_mount(struct lwp *l, void *v, register_t *retval)
* lock this vnode again, so make the lock recursive.
*/
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_SETRECURSE);
if (SCARG(uap, flags) & MNT_GETARGS) {
error = mount_getargs(l, vp, SCARG(uap, path),
SCARG(uap, flags), SCARG(uap, data), &nd);
vput(vp);
} else if (SCARG(uap, flags) & MNT_UPDATE) {
error = mount_update(l, vp, SCARG(uap, path),
SCARG(uap, flags), SCARG(uap, data), &nd);
vput(vp);
} else {
/* Locking is handled internally in mount_domount(). */
error = mount_domount(l, vp, SCARG(uap, type),
SCARG(uap, path), SCARG(uap, flags), SCARG(uap, data), &nd);
if (vfsops == NULL) {
if (flags & (MNT_GETARGS | MNT_UPDATE))
vfsops = vp->v_mount->mnt_op;
else {
/* 'type' is userspace */
error = mount_get_vfsops(type, &vfsops);
if (error != 0)
goto done;
}
}
if (data != NULL && data_seg == UIO_USERSPACE) {
if (data_len == 0) {
/* No length supplied, use default for filesystem */
data_len = vfsops->vfs_min_mount_data;
if (data_len > VFS_MAX_MOUNT_DATA) {
/* maybe a force loaded old LKM */
error = EINVAL;
goto done;
}
#ifdef COMPAT_30
/* Hopefully a longer buffer won't make copyin() fail */
if (flags & MNT_UPDATE
&& data_len < sizeof (struct mnt_export_args30))
data_len = sizeof (struct mnt_export_args30);
#endif
}
data_buf = malloc(data_len, M_TEMP, M_WAITOK);
/* NFS needs the buffer even for mnt_getargs .... */
error = copyin(data, data_buf, data_len);
if (error != 0)
goto done;
}
if (flags & MNT_GETARGS) {
if (data_len == 0) {
error = EINVAL;
goto done;
}
error = mount_getargs(l, vp, path, flags, data_buf,
&data_len, &nd);
if (error != 0)
goto done;
if (data_seg == UIO_USERSPACE)
error = copyout(data_buf, data, data_len);
*retval = data_len;
} else if (flags & MNT_UPDATE) {
error = mount_update(l, vp, path, flags, data_buf, &data_len,
&nd);
} else {
/* Locking is handled internally in mount_domount(). */
error = mount_domount(l, &vp, vfsops, path, flags, data_buf,
&data_len, &nd);
}
done:
if (vp)
vput(vp);
if (data_buf != data)
free(data_buf, M_TEMP);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdesc_vfsops.c,v 1.65 2007/07/08 23:58:53 pooka Exp $ */
/* $NetBSD: fdesc_vfsops.c,v 1.66 2007/07/12 19:35:34 dsl Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.65 2007/07/08 23:58:53 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.66 2007/07/12 19:35:34 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -63,7 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.65 2007/07/08 23:58:53 pooka Exp
#include <miscfs/fdesc/fdesc.h>
int fdesc_mount(struct mount *, const char *, void *,
int fdesc_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int fdesc_start(struct mount *, int, struct lwp *);
int fdesc_unmount(struct mount *, int, struct lwp *);
@ -77,15 +77,17 @@ int fdesc_vget(struct mount *, ino_t, struct vnode **);
* Mount the per-process file descriptors (/dev/fd)
*/
int
fdesc_mount(struct mount *mp, const char *path, void *data,
fdesc_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
int error = 0;
struct fdescmount *fmp;
struct vnode *rvp;
if (mp->mnt_flag & MNT_GETARGS)
if (mp->mnt_flag & MNT_GETARGS) {
*data_len = 0;
return 0;
}
/*
* Update is a no-op
*/
@ -278,6 +280,7 @@ const struct vnodeopv_desc * const fdesc_vnodeopv_descs[] = {
struct vfsops fdesc_vfsops = {
MOUNT_FDESC,
0,
fdesc_mount,
fdesc_start,
fdesc_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: kernfs_vfsops.c,v 1.77 2007/06/30 09:37:58 pooka Exp $ */
/* $NetBSD: kernfs_vfsops.c,v 1.78 2007/07/12 19:35:34 dsl Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.77 2007/06/30 09:37:58 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.78 2007/07/12 19:35:34 dsl Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -69,7 +69,7 @@ void kernfs_init(void);
void kernfs_reinit(void);
void kernfs_done(void);
void kernfs_get_rrootdev(void);
int kernfs_mount(struct mount *, const char *, void *,
int kernfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int kernfs_start(struct mount *, int, struct lwp *);
int kernfs_unmount(struct mount *, int, struct lwp *);
@ -125,7 +125,7 @@ kernfs_get_rrootdev()
* Mount the Kernel params filesystem
*/
int
kernfs_mount(struct mount *mp, const char *path, void *data,
kernfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
int error = 0;
@ -136,8 +136,10 @@ kernfs_mount(struct mount *mp, const char *path, void *data,
return (EINVAL);
}
if (mp->mnt_flag & MNT_GETARGS)
if (mp->mnt_flag & MNT_GETARGS) {
*data_len = 0;
return 0;
}
/*
* Update is a no-op
*/
@ -280,6 +282,7 @@ const struct vnodeopv_desc * const kernfs_vnodeopv_descs[] = {
struct vfsops kernfs_vfsops = {
MOUNT_KERNFS,
0,
kernfs_mount,
kernfs_start,
kernfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: null_vfsops.c,v 1.64 2007/07/08 23:58:53 pooka Exp $ */
/* $NetBSD: null_vfsops.c,v 1.65 2007/07/12 19:35:34 dsl Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.64 2007/07/08 23:58:53 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.65 2007/07/12 19:35:34 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -89,7 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.64 2007/07/08 23:58:53 pooka Exp $
#include <miscfs/nullfs/null.h>
#include <miscfs/genfs/layer_extern.h>
int nullfs_mount(struct mount *, const char *, void *,
int nullfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int nullfs_unmount(struct mount *, int, struct lwp *);
@ -97,14 +97,15 @@ int nullfs_unmount(struct mount *, int, struct lwp *);
* Mount null layer
*/
int
nullfs_mount(mp, path, data, ndp, l)
nullfs_mount(mp, path, data, data_len, ndp, l)
struct mount *mp;
const char *path;
void *data;
size_t *data_len;
struct nameidata *ndp;
struct lwp *l;
{
struct null_args args;
struct null_args *args = data;
struct vnode *lowerrootvp, *vp;
struct null_mount *nmp;
struct layer_mount *lmp;
@ -114,19 +115,17 @@ nullfs_mount(mp, path, data, ndp, l)
printf("nullfs_mount(mp = %p)\n", mp);
#endif
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
lmp = MOUNTTOLAYERMOUNT(mp);
if (lmp == NULL)
return EIO;
args.la.target = NULL;
return copyout(&args, data, sizeof(args));
args->la.target = NULL;
*data_len = sizeof *args;
return 0;
}
/*
* Get argument
*/
error = copyin(data, &args, sizeof(struct null_args));
if (error)
return (error);
/*
* Update is not supported
@ -138,7 +137,7 @@ nullfs_mount(mp, path, data, ndp, l)
* Find lower node
*/
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF,
UIO_USERSPACE, args.la.target, l);
UIO_USERSPACE, args->la.target, l);
if ((error = namei(ndp)) != 0)
return (error);
@ -199,7 +198,7 @@ nullfs_mount(mp, path, data, ndp, l)
vp->v_flag |= VROOT;
nmp->nullm_rootvp = vp;
error = set_statvfs_info(path, UIO_USERSPACE, args.la.target,
error = set_statvfs_info(path, UIO_USERSPACE, args->la.target,
UIO_USERSPACE, mp, l);
#ifdef NULLFS_DIAGNOSTIC
printf("nullfs_mount: lower %s, alias at %s\n",
@ -283,6 +282,7 @@ const struct vnodeopv_desc * const nullfs_vnodeopv_descs[] = {
struct vfsops nullfs_vfsops = {
MOUNT_NULL,
sizeof (struct null_args),
nullfs_mount,
layerfs_start,
nullfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: overlay_vfsops.c,v 1.39 2007/07/08 23:58:53 pooka Exp $ */
/* $NetBSD: overlay_vfsops.c,v 1.40 2007/07/12 19:35:35 dsl Exp $ */
/*
* Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.39 2007/07/08 23:58:53 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.40 2007/07/12 19:35:35 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -88,7 +88,7 @@ __KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.39 2007/07/08 23:58:53 pooka Ex
#include <miscfs/overlay/overlay.h>
#include <miscfs/genfs/layer_extern.h>
int ov_mount(struct mount *, const char *, void *,
int ov_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int ov_unmount(struct mount *, int, struct lwp *);
@ -98,11 +98,11 @@ int ov_unmount(struct mount *, int, struct lwp *);
* Mount overlay layer
*/
int
ov_mount(struct mount *mp, const char *path, void *data,
ov_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
int error = 0;
struct overlay_args args;
struct overlay_args *args = data;
struct vnode *lowerrootvp, *vp;
struct overlay_mount *nmp;
struct layer_mount *lmp;
@ -111,19 +111,17 @@ ov_mount(struct mount *mp, const char *path, void *data,
printf("ov_mount(mp = %p)\n", mp);
#endif
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
lmp = MOUNTTOLAYERMOUNT(mp);
if (lmp == NULL)
return EIO;
args.la.target = NULL;
return copyout(&args, data, sizeof(args));
args->la.target = NULL;
*data_len = sizeof *args;
return 0;
}
/*
* Get argument
*/
error = copyin(data, &args, sizeof(struct overlay_args));
if (error)
return (error);
/*
* Update is not supported
@ -189,7 +187,7 @@ ov_mount(struct mount *mp, const char *path, void *data,
vp->v_flag |= VROOT;
nmp->ovm_rootvp = vp;
error = set_statvfs_info(path, UIO_USERSPACE, args.la.target,
error = set_statvfs_info(path, UIO_USERSPACE, args->la.target,
UIO_USERSPACE, mp, l);
#ifdef OVERLAYFS_DIAGNOSTIC
printf("ov_mount: lower %s, alias at %s\n",
@ -262,6 +260,7 @@ const struct vnodeopv_desc * const ov_vnodeopv_descs[] = {
struct vfsops overlay_vfsops = {
MOUNT_OVERLAY,
sizeof (struct overlay_args),
ov_mount,
layerfs_start,
ov_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: portal_vfsops.c,v 1.61 2007/07/08 23:58:53 pooka Exp $ */
/* $NetBSD: portal_vfsops.c,v 1.62 2007/07/12 19:35:35 dsl Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.61 2007/07/08 23:58:53 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.62 2007/07/12 19:35:35 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -70,7 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.61 2007/07/08 23:58:53 pooka Exp
void portal_init(void);
void portal_done(void);
int portal_mount(struct mount *, const char *, void *,
int portal_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int portal_start(struct mount *, int, struct lwp *);
int portal_unmount(struct mount *, int, struct lwp *);
@ -99,26 +99,31 @@ portal_mount(
struct mount *mp,
const char *path,
void *data,
size_t *data_len,
struct nameidata *ndp,
struct lwp *l
)
{
struct file *fp;
struct portal_args args;
struct portal_args *args = data;
struct portalmount *fmp;
struct socket *so;
struct vnode *rvp;
struct proc *p;
int error;
if (*data_len < sizeof *args)
return EINVAL;
p = l->l_proc;
if (mp->mnt_flag & MNT_GETARGS) {
fmp = VFSTOPORTAL(mp);
if (fmp == NULL)
return EIO;
args.pa_config = NULL;
args.pa_socket = 0; /* XXX */
return copyout(&args, data, sizeof(args));
args->pa_config = NULL;
args->pa_socket = 0; /* XXX */
*data_len = sizeof *args;
return 0;
}
/*
* Update is a no-op
@ -126,12 +131,8 @@ portal_mount(
if (mp->mnt_flag & MNT_UPDATE)
return (EOPNOTSUPP);
error = copyin(data, &args, sizeof(struct portal_args));
if (error)
return (error);
/* getsock() will use the descriptor for us */
if ((error = getsock(p->p_fd, args.pa_socket, &fp)) != 0)
if ((error = getsock(p->p_fd, args->pa_socket, &fp)) != 0)
return (error);
so = (struct socket *) fp->f_data;
FILE_UNUSE(fp, NULL);
@ -162,7 +163,7 @@ portal_mount(
mp->mnt_data = fmp;
vfs_getnewfsid(mp);
return set_statvfs_info(path, UIO_USERSPACE, args.pa_config,
return set_statvfs_info(path, UIO_USERSPACE, args->pa_config,
UIO_USERSPACE, mp, l);
}
@ -308,6 +309,7 @@ const struct vnodeopv_desc * const portal_vnodeopv_descs[] = {
struct vfsops portal_vfsops = {
MOUNT_PORTAL,
sizeof (struct portal_args),
portal_mount,
portal_start,
portal_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_vfsops.c,v 1.70 2007/02/09 21:55:36 ad Exp $ */
/* $NetBSD: procfs_vfsops.c,v 1.71 2007/07/12 19:35:35 dsl Exp $ */
/*
* Copyright (c) 1993
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.70 2007/02/09 21:55:36 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.71 2007/07/12 19:35:35 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -104,7 +104,7 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.70 2007/02/09 21:55:36 ad Exp $"
void procfs_init(void);
void procfs_reinit(void);
void procfs_done(void);
int procfs_mount(struct mount *, const char *, void *,
int procfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int procfs_start(struct mount *, int, struct lwp *);
int procfs_unmount(struct mount *, int, struct lwp *);
@ -125,12 +125,13 @@ procfs_mount(
struct mount *mp,
const char *path,
void *data,
size_t *data_len,
struct nameidata *ndp,
struct lwp *l
)
{
struct procfsmount *pmnt;
struct procfs_args args;
struct procfs_args *args = data;
int error;
if (UIO_MX & (UIO_MX-1)) {
@ -139,26 +140,23 @@ procfs_mount(
}
if (mp->mnt_flag & MNT_GETARGS) {
if (*data_len < sizeof *args)
return EINVAL;
pmnt = VFSTOPROC(mp);
if (pmnt == NULL)
return EIO;
args.version = PROCFS_ARGSVERSION;
args.flags = pmnt->pmnt_flags;
return copyout(&args, data, sizeof(args));
args->version = PROCFS_ARGSVERSION;
args->flags = pmnt->pmnt_flags;
*data_len = sizeof *args;
return 0;
}
if (mp->mnt_flag & MNT_UPDATE)
return (EOPNOTSUPP);
if (data != NULL) {
error = copyin(data, &args, sizeof args);
if (error != 0)
return error;
if (args.version != PROCFS_ARGSVERSION)
return EINVAL;
} else
args.flags = 0;
if (*data_len >= sizeof *args && args->version != PROCFS_ARGSVERSION)
return EINVAL;
pmnt = (struct procfsmount *) malloc(sizeof(struct procfsmount),
M_UFSMNT, M_WAITOK); /* XXX need new malloc type */
@ -171,7 +169,10 @@ procfs_mount(
error = set_statvfs_info(path, UIO_USERSPACE, "procfs", UIO_SYSSPACE,
mp, l);
pmnt->pmnt_exechook = exechook_establish(procfs_revoke_vnodes, mp);
pmnt->pmnt_flags = args.flags;
if (*data_len >= sizeof *args)
pmnt->pmnt_flags = args->flags;
else
pmnt->pmnt_flags = 0;
return error;
}
@ -322,6 +323,7 @@ const struct vnodeopv_desc * const procfs_vnodeopv_descs[] = {
struct vfsops procfs_vfsops = {
MOUNT_PROCFS,
sizeof (struct procfs_args),
procfs_mount,
procfs_start,
procfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: umap_vfsops.c,v 1.65 2007/07/08 23:58:53 pooka Exp $ */
/* $NetBSD: umap_vfsops.c,v 1.66 2007/07/12 19:35:35 dsl Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.65 2007/07/08 23:58:53 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.66 2007/07/12 19:35:35 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.65 2007/07/08 23:58:53 pooka Exp $
#include <miscfs/umapfs/umap.h>
#include <miscfs/genfs/layer_extern.h>
int umapfs_mount(struct mount *, const char *, void *,
int umapfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int umapfs_unmount(struct mount *, int, struct lwp *);
@ -65,14 +65,15 @@ int umapfs_unmount(struct mount *, int, struct lwp *);
* Mount umap layer
*/
int
umapfs_mount(mp, path, data, ndp, l)
umapfs_mount(mp, path, data, data_len, ndp, l)
struct mount *mp;
const char *path;
void *data;
size_t *data_len;
struct nameidata *ndp;
struct lwp *l;
{
struct umap_args args;
struct umap_args *args = data;
struct vnode *lowerrootvp, *vp;
struct umap_mount *amp;
int error;
@ -80,14 +81,18 @@ umapfs_mount(mp, path, data, ndp, l)
int i;
#endif
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
amp = MOUNTTOUMAPMOUNT(mp);
if (amp == NULL)
return EIO;
args.la.target = NULL;
args.nentries = amp->info_nentries;
args.gnentries = amp->info_gnentries;
return copyout(&args, data, sizeof(args));
args->la.target = NULL;
args->nentries = amp->info_nentries;
args->gnentries = amp->info_gnentries;
*data_len = sizeof *args;
return 0;
}
/* only for root */
@ -99,13 +104,6 @@ umapfs_mount(mp, path, data, ndp, l)
printf("umapfs_mount(mp = %p)\n", mp);
#endif
/*
* Get argument
*/
error = copyin(data, &args, sizeof(struct umap_args));
if (error)
return (error);
/*
* Update is not supported
*/
@ -116,7 +114,7 @@ umapfs_mount(mp, path, data, ndp, l)
* Find lower node
*/
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF,
UIO_USERSPACE, args.umap_target, l);
UIO_USERSPACE, args->umap_target, l);
if ((error = namei(ndp)) != 0)
return (error);
@ -149,37 +147,37 @@ umapfs_mount(mp, path, data, ndp, l)
/*
* Now copy in the number of entries and maps for umap mapping.
*/
if (args.nentries > MAPFILEENTRIES || args.gnentries > GMAPFILEENTRIES) {
if (args->nentries > MAPFILEENTRIES || args->gnentries > GMAPFILEENTRIES) {
vput(lowerrootvp);
return (error);
}
amp->info_nentries = args.nentries;
amp->info_gnentries = args.gnentries;
error = copyin(args.mapdata, amp->info_mapdata,
2*sizeof(u_long)*args.nentries);
amp->info_nentries = args->nentries;
amp->info_gnentries = args->gnentries;
error = copyin(args->mapdata, amp->info_mapdata,
2*sizeof(u_long)*args->nentries);
if (error) {
vput(lowerrootvp);
return (error);
}
#ifdef UMAPFS_DIAGNOSTIC
printf("umap_mount:nentries %d\n",args.nentries);
for (i = 0; i < args.nentries; i++)
printf("umap_mount:nentries %d\n",args->nentries);
for (i = 0; i < args->nentries; i++)
printf(" %ld maps to %ld\n", amp->info_mapdata[i][0],
amp->info_mapdata[i][1]);
#endif
error = copyin(args.gmapdata, amp->info_gmapdata,
2*sizeof(u_long)*args.gnentries);
error = copyin(args->gmapdata, amp->info_gmapdata,
2*sizeof(u_long)*args->gnentries);
if (error) {
vput(lowerrootvp);
return (error);
}
#ifdef UMAPFS_DIAGNOSTIC
printf("umap_mount:gnentries %d\n",args.gnentries);
for (i = 0; i < args.gnentries; i++)
printf("umap_mount:gnentries %d\n",args->gnentries);
for (i = 0; i < args->gnentries; i++)
printf("\tgroup %ld maps to %ld\n",
amp->info_gmapdata[i][0],
amp->info_gmapdata[i][1]);
@ -224,7 +222,7 @@ umapfs_mount(mp, path, data, ndp, l)
vp->v_flag |= VROOT;
amp->umapm_rootvp = vp;
error = set_statvfs_info(path, UIO_USERSPACE, args.umap_target,
error = set_statvfs_info(path, UIO_USERSPACE, args->umap_target,
UIO_USERSPACE, mp, l);
#ifdef UMAPFS_DIAGNOSTIC
printf("umapfs_mount: lower %s, alias at %s\n",
@ -304,6 +302,7 @@ const struct vnodeopv_desc * const umapfs_vnodeopv_descs[] = {
struct vfsops umapfs_vfsops = {
MOUNT_UMAP,
sizeof (struct umap_args),
umapfs_mount,
layerfs_start,
umapfs_unmount,

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_export.c,v 1.29 2007/07/09 21:11:30 ad Exp $ */
/* $NetBSD: nfs_export.c,v 1.30 2007/07/12 19:35:35 dsl Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005 The NetBSD Foundation, Inc.
@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.29 2007/07/09 21:11:30 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.30 2007/07/12 19:35:35 dsl Exp $");
#include "opt_compat_netbsd.h"
#include "opt_inet.h"
@ -392,38 +392,27 @@ netexport_check(const fsid_t *fsid, struct mbuf *mb, struct mount **mpp,
* Otherwise, returns 0 on success or an appropriate error code otherwise.
*/
int
nfs_update_exports_30(struct mount *mp, const char *path, void *data,
struct lwp *l)
nfs_update_exports_30(struct mount *mp, const char *path,
struct mnt_export_args30 *args, struct lwp *l)
{
int error;
struct {
const char *fspec;
struct export_args30 eargs;
} args;
struct mountd_exports_list mel;
mel.mel_path = path;
error = copyin(data, &args, sizeof(args));
if (error != 0)
if (args->fspec != NULL)
return EJUSTRETURN;
if (args.fspec != NULL)
return EJUSTRETURN;
if (args.eargs.ex_flags & 0x00020000) {
if (args->eargs.ex_flags & 0x00020000) {
/* Request to delete exports. The mask above holds the
* value that used to be in MNT_DELEXPORT. */
mel.mel_nexports = 0;
} else {
struct export_args eargs;
/* The following assumes export_args has not changed since
* export_args30. */
memcpy(&eargs, &args.eargs, sizeof(struct export_args));
* export_args30 - typedef checks sizes. */
typedef char x[sizeof args->eargs == sizeof *mel.mel_exports ? 1 : -1];
mel.mel_nexports = 1;
mel.mel_exports = &eargs;
mel.mel_exports = (void *)&args->eargs;
}
return mountd_set_exports_list(&mel, l);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_var.h,v 1.68 2007/05/28 16:47:38 yamt Exp $ */
/* $NetBSD: nfs_var.h,v 1.69 2007/07/12 19:35:35 dsl Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -303,6 +303,7 @@ int netexport_check(const fsid_t *, struct mbuf *, struct mount **, int *,
void netexport_rdlock(void);
void netexport_rdunlock(void);
#ifdef COMPAT_30
int nfs_update_exports_30(struct mount *, const char *, void *, struct lwp *);
int nfs_update_exports_30(struct mount *, const char *,
struct mnt_export_args30 *, struct lwp *);
#endif
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vfsops.c,v 1.177 2007/04/29 15:31:08 yamt Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.178 2007/07/12 19:35:35 dsl Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.177 2007/04/29 15:31:08 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.178 2007/07/12 19:35:35 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -103,6 +103,7 @@ const struct vnodeopv_desc * const nfs_vnodeopv_descs[] = {
struct vfsops nfs_vfsops = {
MOUNT_NFS,
sizeof (struct nfs_args),
nfs_mount,
nfs_start,
nfs_unmount,
@ -345,7 +346,7 @@ nfs_mountroot()
* Side effect: Finds and configures a network interface.
*/
nd = malloc(sizeof(*nd), M_NFSMNT, M_WAITOK);
memset((void *)nd, 0, sizeof(*nd));
memset(nd, 0, sizeof(*nd));
error = nfs_boot_init(nd, l);
if (error) {
free(nd, M_NFSMNT);
@ -577,11 +578,11 @@ nfs_decode_args(nmp, argp, l)
*/
/* ARGSUSED */
int
nfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
struct lwp *l)
nfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
int error;
struct nfs_args args;
struct nfs_args *args = data;
struct mbuf *nam;
struct nfsmount *nmp = VFSTONFS(mp);
struct sockaddr *sa;
@ -591,49 +592,49 @@ nfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
size_t len;
u_char *nfh;
error = copyin(data, (void *)&args, sizeof (struct nfs_args));
if (error)
return (error);
if (*data_len < sizeof *args)
return EINVAL;
p = l->l_proc;
if (mp->mnt_flag & MNT_GETARGS) {
if (nmp == NULL)
return (EIO);
if (args.addr != NULL) {
if (args->addr != NULL) {
sa = mtod(nmp->nm_nam, struct sockaddr *);
error = copyout(sa, args.addr, sa->sa_len);
error = copyout(sa, args->addr, sa->sa_len);
if (error)
return (error);
args.addrlen = sa->sa_len;
args->addrlen = sa->sa_len;
} else
args.addrlen = 0;
args->addrlen = 0;
args.version = NFS_ARGSVERSION;
args.sotype = nmp->nm_sotype;
args.proto = nmp->nm_soproto;
args.fh = NULL;
args.fhsize = 0;
args.flags = nmp->nm_flag;
args.wsize = nmp->nm_wsize;
args.rsize = nmp->nm_rsize;
args.readdirsize = nmp->nm_readdirsize;
args.timeo = nmp->nm_timeo;
args.retrans = nmp->nm_retry;
args.maxgrouplist = nmp->nm_numgrps;
args.readahead = nmp->nm_readahead;
args.leaseterm = 0; /* dummy */
args.deadthresh = nmp->nm_deadthresh;
args.hostname = NULL;
return (copyout(&args, data, sizeof(args)));
args->version = NFS_ARGSVERSION;
args->sotype = nmp->nm_sotype;
args->proto = nmp->nm_soproto;
args->fh = NULL;
args->fhsize = 0;
args->flags = nmp->nm_flag;
args->wsize = nmp->nm_wsize;
args->rsize = nmp->nm_rsize;
args->readdirsize = nmp->nm_readdirsize;
args->timeo = nmp->nm_timeo;
args->retrans = nmp->nm_retry;
args->maxgrouplist = nmp->nm_numgrps;
args->readahead = nmp->nm_readahead;
args->leaseterm = 0; /* dummy */
args->deadthresh = nmp->nm_deadthresh;
args->hostname = NULL;
*data_len = sizeof *args;
return 0;
}
if (args.version != NFS_ARGSVERSION)
if (args->version != NFS_ARGSVERSION)
return (EPROGMISMATCH);
if (args.flags & (NFSMNT_NQNFS|NFSMNT_KERB))
if (args->flags & (NFSMNT_NQNFS|NFSMNT_KERB))
return (EPROGUNAVAIL);
#ifdef NFS_V2_ONLY
if (args.flags & NFSMNT_NFSV3)
if (args->flags & NFSMNT_NFSV3)
return (EPROGMISMATCH);
#endif
if (mp->mnt_flag & MNT_UPDATE) {
@ -643,15 +644,15 @@ nfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
* When doing an update, we can't change from or to
* v3, or change cookie translation
*/
args.flags = (args.flags & ~(NFSMNT_NFSV3|NFSMNT_XLATECOOKIE)) |
args->flags = (args->flags & ~(NFSMNT_NFSV3|NFSMNT_XLATECOOKIE)) |
(nmp->nm_flag & (NFSMNT_NFSV3|NFSMNT_XLATECOOKIE));
nfs_decode_args(nmp, &args, l);
nfs_decode_args(nmp, args, l);
return (0);
}
if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX)
if (args->fhsize < 0 || args->fhsize > NFSX_V3FHMAX)
return (EINVAL);
MALLOC(nfh, u_char *, NFSX_V3FHMAX, M_TEMP, M_WAITOK);
error = copyin((void *)args.fh, (void *)nfh, args.fhsize);
error = copyin(args->fh, nfh, args->fhsize);
if (error)
return (error);
MALLOC(pth, char *, MNAMELEN, M_TEMP, M_WAITOK);
@ -660,17 +661,17 @@ nfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
goto free_nfh;
memset(&pth[len], 0, MNAMELEN - len);
MALLOC(hst, char *, MNAMELEN, M_TEMP, M_WAITOK);
error = copyinstr(args.hostname, hst, MNAMELEN - 1, &len);
error = copyinstr(args->hostname, hst, MNAMELEN - 1, &len);
if (error)
goto free_pth;
memset(&hst[len], 0, MNAMELEN - len);
/* sockargs() call must be after above copyin() calls */
error = sockargs(&nam, (void *)args.addr, args.addrlen, MT_SONAME);
error = sockargs(&nam, args->addr, args->addrlen, MT_SONAME);
if (error)
goto free_hst;
MCLAIM(nam, &nfs_mowner);
args.fh = nfh;
error = mountnfs(&args, mp, nam, pth, hst, &vp, l);
args->fh = nfh;
error = mountnfs(args, mp, nam, pth, hst, &vp, l);
free_hst:
FREE(hst, M_TEMP);
@ -719,7 +720,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp, l)
} else {
MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount),
M_NFSMNT, M_WAITOK);
memset((void *)nmp, 0, sizeof (struct nfsmount));
memset(nmp, 0, sizeof (struct nfsmount));
mp->mnt_data = nmp;
TAILQ_INIT(&nmp->nm_uidlruhead);
TAILQ_INIT(&nmp->nm_bufq);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfsmount.h,v 1.44 2007/04/29 14:57:00 yamt Exp $ */
/* $NetBSD: nfsmount.h,v 1.45 2007/07/12 19:35:36 dsl Exp $ */
/*
* Copyright (c) 1989, 1993
@ -183,7 +183,7 @@ struct nfsmount {
/*
* Prototypes for NFS mount operations
*/
int nfs_mount __P((struct mount *mp, const char *path, void *data,
int nfs_mount __P((struct mount *mp, const char *path, void *data, size_t *,
struct nameidata *ndp, struct lwp *l));
int mountnfs __P((struct nfs_args *argp, struct mount *mp,
struct mbuf *nam, const char *pth, const char *hst,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mount.h,v 1.159 2007/06/29 23:30:32 rumble Exp $ */
/* $NetBSD: mount.h,v 1.160 2007/07/12 19:35:37 dsl Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@ -187,7 +187,7 @@ struct kauth_cred;
#define VFS_PROTOS(fsname) \
int fsname##_mount(struct mount *, const char *, void *, \
struct nameidata *, struct lwp *); \
size_t *, struct nameidata *, struct lwp *); \
int fsname##_start(struct mount *, int, struct lwp *); \
int fsname##_unmount(struct mount *, int, struct lwp *); \
int fsname##_root(struct mount *, struct vnode **); \
@ -210,10 +210,12 @@ int fsname##_extattrctl(struct mount *, int, struct vnode *, int, \
const char *, struct lwp *); \
int fsname##_suspendctl(struct mount *, int);
#define VFS_MAX_MOUNT_DATA 8192
struct vfsops {
const char *vfs_name;
size_t vfs_min_mount_data;
int (*vfs_mount) (struct mount *, const char *, void *,
struct nameidata *, struct lwp *);
size_t *, struct nameidata *, struct lwp *);
int (*vfs_start) (struct mount *, int, struct lwp *);
int (*vfs_unmount) (struct mount *, int, struct lwp *);
int (*vfs_root) (struct mount *, struct vnode **);
@ -244,8 +246,8 @@ struct vfsops {
#define VFS_ATTACH(vfs) __link_set_add_data(vfsops, vfs)
#define VFS_MOUNT(MP, PATH, DATA, NDP, L) \
(*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, L)
#define VFS_MOUNT(MP, PATH, DATA, DATA_LEN, NDP, L) \
(*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, DATA_LEN, NDP, L)
#define VFS_START(MP, FLAGS, L) (*(MP)->mnt_op->vfs_start)(MP, FLAGS, L)
#define VFS_UNMOUNT(MP, FORCE, L) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, L)
#define VFS_ROOT(MP, VPP) (*(MP)->mnt_op->vfs_root)(MP, VPP)
@ -293,6 +295,11 @@ struct export_args30 {
char *ex_indexfile; /* index file for WebNFS URLs */
};
struct mnt_export_args30 {
const char *fspec; /* Always NULL */
struct export_args30 eargs;
};
#ifdef _KERNEL
#include <sys/mallocvar.h>
MALLOC_DECLARE(M_MOUNT);
@ -328,6 +335,8 @@ extern struct simplelock mountlist_slock;
extern struct simplelock spechash_slock;
long makefstype(const char *);
int dounmount(struct mount *, int, struct lwp *);
int do_sys_mount(struct lwp *, struct vfsops *, const char *, const char *,
int, void *, enum uio_seg, size_t, register_t *);
void vfsinit(void);
void vfs_opv_init(const struct vnodeopv_desc * const *);
void vfs_opv_free(const struct vnodeopv_desc * const *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_extern.h,v 1.34 2006/07/13 12:00:26 martin Exp $ */
/* $NetBSD: ext2fs_extern.h,v 1.35 2007/07/12 19:35:36 dsl Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -141,8 +141,8 @@ void ext2fs_init(void);
void ext2fs_reinit(void);
void ext2fs_done(void);
int ext2fs_mountroot(void);
int ext2fs_mount(struct mount *, const char *, void *, struct nameidata *,
struct lwp *);
int ext2fs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int ext2fs_reload(struct mount *, kauth_cred_t, struct lwp *);
int ext2fs_mountfs(struct vnode *, struct mount *, struct lwp *);
int ext2fs_unmount(struct mount *, int, struct lwp *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vfsops.c,v 1.112 2007/06/30 09:37:53 pooka Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.113 2007/07/12 19:35:36 dsl Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.112 2007/06/30 09:37:53 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.113 2007/07/12 19:35:36 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -123,6 +123,7 @@ const struct vnodeopv_desc * const ext2fs_vnodeopv_descs[] = {
struct vfsops ext2fs_vfsops = {
MOUNT_EXT2FS,
sizeof (struct ufs_args),
ext2fs_mount,
ufs_start,
ext2fs_unmount,
@ -248,36 +249,38 @@ ext2fs_mountroot(void)
* mount system call
*/
int
ext2fs_mount(struct mount *mp, const char *path, void *data,
ext2fs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct vnode *devvp;
struct ufs_args args;
struct ufs_args *args = data;
struct ufsmount *ump = NULL;
struct m_ext2fs *fs;
size_t size;
int error, flags, update;
int error = 0, flags, update;
mode_t accessmode;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
ump = VFSTOUFS(mp);
if (ump == NULL)
return EIO;
args.fspec = NULL;
return copyout(&args, data, sizeof(args));
memset(args, 0, sizeof *args);
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
}
error = copyin(data, &args, sizeof (struct ufs_args));
if (error)
return (error);
update = mp->mnt_flag & MNT_UPDATE;
/* Check arguments */
if (args.fspec != NULL) {
if (args->fspec != NULL) {
/*
* Look up the name and verify that it's sane.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@ -414,11 +417,11 @@ ext2fs_mount(struct mount *mp, const char *path, void *data,
fs->e2fs.e2fs_state = E2FS_ERRORS;
fs->e2fs_fmod = 1;
}
if (args.fspec == NULL)
if (args->fspec == NULL)
return EINVAL;
}
error = set_statvfs_info(path, UIO_USERSPACE, args.fspec,
error = set_statvfs_info(path, UIO_USERSPACE, args->fspec,
UIO_USERSPACE, mp, l);
(void) copystr(mp->mnt_stat.f_mntonname, fs->e2fs_fsmnt,
sizeof(fs->e2fs_fsmnt) - 1, &size);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_extern.h,v 1.56 2007/06/07 05:34:48 yamt Exp $ */
/* $NetBSD: ffs_extern.h,v 1.57 2007/07/12 19:35:36 dsl Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -108,8 +108,8 @@ void ffs_init(void);
void ffs_reinit(void);
void ffs_done(void);
int ffs_mountroot(void);
int ffs_mount(struct mount *, const char *, void *, struct nameidata *,
struct lwp *);
int ffs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int ffs_reload(struct mount *, kauth_cred_t, struct lwp *);
int ffs_mountfs(struct vnode *, struct mount *, struct lwp *);
int ffs_unmount(struct mount *, int, struct lwp *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.203 2007/07/10 09:50:08 hannken Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.204 2007/07/12 19:35:36 dsl Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.203 2007/07/10 09:50:08 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.204 2007/07/12 19:35:36 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -93,6 +93,7 @@ const struct vnodeopv_desc * const ffs_vnodeopv_descs[] = {
struct vfsops ffs_vfsops = {
MOUNT_FFS,
sizeof (struct ufs_args),
ffs_mount,
ufs_start,
ffs_unmount,
@ -184,26 +185,27 @@ ffs_mountroot(void)
* mount system call
*/
int
ffs_mount(struct mount *mp, const char *path, void *data,
ffs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct vnode *devvp = NULL;
struct ufs_args args;
struct ufs_args *args = data;
struct ufsmount *ump = NULL;
struct fs *fs;
int error, flags, update;
int error = 0, flags, update;
mode_t accessmode;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
ump = VFSTOUFS(mp);
if (ump == NULL)
return EIO;
args.fspec = NULL;
return copyout(&args, data, sizeof(args));
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
}
error = copyin(data, &args, sizeof (struct ufs_args));
if (error)
return (error);
#if !defined(SOFTDEP)
mp->mnt_flag &= ~MNT_SOFTDEP;
@ -212,11 +214,11 @@ ffs_mount(struct mount *mp, const char *path, void *data,
update = mp->mnt_flag & MNT_UPDATE;
/* Check arguments */
if (args.fspec != NULL) {
if (args->fspec != NULL) {
/*
* Look up the name and verify that it's sane.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@ -424,7 +426,7 @@ ffs_mount(struct mount *mp, const char *path, void *data,
if (fs->fs_snapinum[0] != 0)
ffs_snapshot_mount(mp);
}
if (args.fspec == NULL)
if (args->fspec == NULL)
return EINVAL;
if ((mp->mnt_flag & (MNT_SOFTDEP | MNT_ASYNC)) ==
(MNT_SOFTDEP | MNT_ASYNC)) {
@ -434,7 +436,7 @@ ffs_mount(struct mount *mp, const char *path, void *data,
}
}
error = set_statvfs_info(path, UIO_USERSPACE, args.fspec,
error = set_statvfs_info(path, UIO_USERSPACE, args->fspec,
UIO_USERSPACE, mp, l);
if (error == 0)
(void)strncpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname,

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_extern.h,v 1.89 2007/04/17 01:16:46 perseant Exp $ */
/* $NetBSD: lfs_extern.h,v 1.90 2007/07/12 19:35:36 dsl Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -228,7 +228,8 @@ void lfs_init(void);
void lfs_reinit(void);
void lfs_done(void);
int lfs_mountroot(void);
int lfs_mount(struct mount *, const char *, void *, struct nameidata *, struct lwp *);
int lfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int lfs_unmount(struct mount *, int, struct lwp *);
int lfs_statvfs(struct mount *, struct statvfs *, struct lwp *);
int lfs_sync(struct mount *, int, kauth_cred_t, struct lwp *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.237 2007/07/09 21:11:34 ad Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.238 2007/07/12 19:35:36 dsl Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.237 2007/07/09 21:11:34 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.238 2007/07/12 19:35:36 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -140,6 +140,7 @@ const struct vnodeopv_desc * const lfs_vnodeopv_descs[] = {
struct vfsops lfs_vfsops = {
MOUNT_LFS,
sizeof (struct ufs_args),
lfs_mount,
ufs_start,
lfs_unmount,
@ -363,34 +364,36 @@ lfs_mountroot()
* mount system call
*/
int
lfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp, struct lwp *l)
lfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct vnode *devvp;
struct ufs_args args;
struct ufs_args *args = data;
struct ufsmount *ump = NULL;
struct lfs *fs = NULL; /* LFS */
int error, update;
int error = 0, update;
mode_t accessmode;
if (*data_len < sizeof *args)
return EINVAL;
if (mp->mnt_flag & MNT_GETARGS) {
ump = VFSTOUFS(mp);
if (ump == NULL)
return EIO;
args.fspec = NULL;
return copyout(&args, data, sizeof(args));
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
}
error = copyin(data, &args, sizeof (struct ufs_args));
if (error)
return (error);
update = mp->mnt_flag & MNT_UPDATE;
/* Check arguments */
if (args.fspec != NULL) {
if (args->fspec != NULL) {
/*
* Look up the name and verify that it's sane.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l);
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
if ((error = namei(ndp)) != 0)
return (error);
devvp = ndp->ni_vp;
@ -505,11 +508,11 @@ lfs_mount(struct mount *mp, const char *path, void *data, struct nameidata *ndp,
lfs_writesuper(fs, fs->lfs_sboffs[1]);
}
}
if (args.fspec == NULL)
if (args->fspec == NULL)
return EINVAL;
}
error = set_statvfs_info(path, UIO_USERSPACE, args.fspec,
error = set_statvfs_info(path, UIO_USERSPACE, args->fspec,
UIO_USERSPACE, mp, l);
if (error == 0)
(void)strncpy(fs->lfs_fsmnt, mp->mnt_stat.f_mntonname,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfs_extern.h,v 1.24 2007/03/04 06:03:46 christos Exp $ */
/* $NetBSD: mfs_extern.h,v 1.25 2007/07/12 19:35:37 dsl Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -50,7 +50,7 @@ __BEGIN_DECLS
/* mfs_vfsops.c */
int mfs_mountroot(void);
int mfs_initminiroot(void *);
int mfs_mount(struct mount *, const char *, void *,
int mfs_mount(struct mount *, const char *, void *, size_t *,
struct nameidata *, struct lwp *);
int mfs_start(struct mount *, int, struct lwp *);
int mfs_statvfs(struct mount *, struct statvfs *, struct lwp *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfs_vfsops.c,v 1.79 2007/06/30 09:37:54 pooka Exp $ */
/* $NetBSD: mfs_vfsops.c,v 1.80 2007/07/12 19:35:37 dsl Exp $ */
/*
* Copyright (c) 1989, 1990, 1993, 1994
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.79 2007/06/30 09:37:54 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.80 2007/07/12 19:35:37 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -86,6 +86,7 @@ const struct vnodeopv_desc * const mfs_vnodeopv_descs[] = {
struct vfsops mfs_vfsops = {
MOUNT_MFS,
sizeof (struct mfs_args),
mfs_mount,
mfs_start,
ffs_unmount,
@ -240,16 +241,19 @@ mfs_initminiroot(void *base)
*/
/* ARGSUSED */
int
mfs_mount(struct mount *mp, const char *path, void *data,
mfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
struct nameidata *ndp, struct lwp *l)
{
struct vnode *devvp;
struct mfs_args args;
struct mfs_args *args = data;
struct ufsmount *ump;
struct fs *fs;
struct mfsnode *mfsp;
struct proc *p;
int flags, error;
int flags, error = 0;
if (*data_len < sizeof *args)
return EINVAL;
p = l->l_proc;
if (mp->mnt_flag & MNT_GETARGS) {
@ -267,10 +271,11 @@ mfs_mount(struct mount *mp, const char *path, void *data,
if (mfsp == NULL)
return EIO;
args.fspec = NULL;
args.base = mfsp->mfs_baseoff;
args.size = mfsp->mfs_size;
return copyout(&args, data, sizeof(args));
args->fspec = NULL;
args->base = mfsp->mfs_baseoff;
args->size = mfsp->mfs_size;
*data_len = sizeof *args;
return 0;
}
/*
* XXX turn off async to avoid hangs when writing lots of data.
@ -283,10 +288,6 @@ mfs_mount(struct mount *mp, const char *path, void *data,
mp->mnt_flag &= ~MNT_ASYNC;
mp->mnt_flag |= MNT_SYNCHRONOUS;
error = copyin(data, (void *)&args, sizeof (struct mfs_args));
if (error)
return (error);
/*
* If updating, check whether changing from read-only to
* read/write; if there is no device name, that's all we do.
@ -304,7 +305,7 @@ mfs_mount(struct mount *mp, const char *path, void *data,
}
if (fs->fs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR))
fs->fs_ronly = 0;
if (args.fspec == NULL)
if (args->fspec == NULL)
return EINVAL;
return (0);
}
@ -317,8 +318,8 @@ mfs_mount(struct mount *mp, const char *path, void *data,
mfs_minor++;
mfsp = (struct mfsnode *)malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
devvp->v_data = mfsp;
mfsp->mfs_baseoff = args.base;
mfsp->mfs_size = args.size;
mfsp->mfs_baseoff = args->base;
mfsp->mfs_size = args->size;
mfsp->mfs_vnode = devvp;
mfsp->mfs_proc = p;
mfsp->mfs_shutdown = 0;
@ -330,7 +331,7 @@ mfs_mount(struct mount *mp, const char *path, void *data,
}
ump = VFSTOUFS(mp);
fs = ump->um_fs;
error = set_statvfs_info(path, UIO_USERSPACE, args.fspec,
error = set_statvfs_info(path, UIO_USERSPACE, args->fspec,
UIO_USERSPACE, mp, l);
if (error)
return error;