diff options
author | phk <phk@FreeBSD.org> | 2004-12-06 20:11:56 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-06 20:11:56 +0000 |
commit | 68b4df69d02240e33503489bab016fc9f09fb0ac (patch) | |
tree | de617479c3423a9642400937e3529b0b014d02fa /sys/fs/nwfs | |
parent | 17bd3d91490f974be0bec7e3be902eddefa4c7bc (diff) | |
download | FreeBSD-src-68b4df69d02240e33503489bab016fc9f09fb0ac.zip FreeBSD-src-68b4df69d02240e33503489bab016fc9f09fb0ac.tar.gz |
Convert nwfs to nmount, but take the low road: There is no way this is
ever going to work without a dedicated mount_nwfs(8) program so simply
stick struct nwfs_args into a nmount argument and leave it at that.
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r-- | sys/fs/nwfs/nwfs_vfsops.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index bec5d1b..9f21579 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -70,7 +70,8 @@ SYSCTL_INT(_vfs_nwfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nwfs_debuglevel, 0, "") MODULE_DEPEND(nwfs, ncp, 1, 1, 1); MODULE_DEPEND(nwfs, libmchain, 1, 1, 1); -static vfs_omount_t nwfs_omount; +static vfs_cmount_t nwfs_cmount; +static vfs_mount_t nwfs_mount; static vfs_quotactl_t nwfs_quotactl; static vfs_root_t nwfs_root; static vfs_statfs_t nwfs_statfs; @@ -80,7 +81,8 @@ static vfs_uninit_t nwfs_uninit; static struct vfsops nwfs_vfsops = { .vfs_init = nwfs_init, - .vfs_omount = nwfs_omount, + .vfs_mount = nwfs_mount, + .vfs_cmount = nwfs_cmount, .vfs_quotactl = nwfs_quotactl, .vfs_root = nwfs_root, .vfs_statfs = nwfs_statfs, @@ -130,12 +132,34 @@ nwfs_initnls(struct nwmount *nmp) { } return 0; } + +static int nwfs_cmount(struct mntarg *ma, void *data, int flags, + struct thread *td) +{ + struct nwfs_args args; /* will hold data from mount request */ + int error; + + error = copyin(data, (caddr_t)&args, sizeof(struct nwfs_args)); + if (error) + return (error); + + /* + * XXX: cheap cop-out here, args contains a structure I don't + * XXX: know how we should handle, and I don't see any immediate + * XXX: prospect of avoiding a mount_nwfs(8) binary anyway. + */ + ma = mount_arg(ma, "nwfs_args", &args, sizeof args); + + error = kernel_mount(ma, flags); + + return (error); +} + /* * mp - path - addr in user space of mount point (ie /usr or whatever) * data - addr in user space of mount params */ -static int nwfs_omount(struct mount *mp, char *path, caddr_t data, - struct thread *td) +static int nwfs_mount(struct mount *mp, struct thread *td) { struct nwfs_args args; /* will hold data from mount request */ int error; @@ -147,15 +171,11 @@ static int nwfs_omount(struct mount *mp, char *path, caddr_t data, if (mp->mnt_flag & MNT_ROOTFS) return (EOPNOTSUPP); - if (data == NULL) { - nwfs_printf("missing data argument\n"); - return 1; - } if (mp->mnt_flag & MNT_UPDATE) { nwfs_printf("MNT_UPDATE not implemented"); return (EOPNOTSUPP); } - error = copyin(data, (caddr_t)&args, sizeof(struct nwfs_args)); + error = vfs_copyopt(mp->mnt_optnew, "nwfw_args", &args, sizeof args); if (error) return (error); if (args.version != NWFS_VERSION) { |