summaryrefslogtreecommitdiffstats
path: root/sys/fs/udf
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2002-06-15 22:40:13 +0000
committermux <mux@FreeBSD.org>2002-06-15 22:40:13 +0000
commita9b7ee8dc7c3c2068241f4fbe5ee281eec5529ac (patch)
tree9118c81ce3b9a4b30f053b88e1a4c2f81eca6db4 /sys/fs/udf
parent06a5147771dbf233786cce0382f17e67d2d7ad34 (diff)
downloadFreeBSD-src-a9b7ee8dc7c3c2068241f4fbe5ee281eec5529ac.zip
FreeBSD-src-a9b7ee8dc7c3c2068241f4fbe5ee281eec5529ac.tar.gz
Convert UDF to nmount.
Reviewed by: scottl
Diffstat (limited to 'sys/fs/udf')
-rw-r--r--sys/fs/udf/udf_mount.h34
-rw-r--r--sys/fs/udf/udf_vfsops.c44
2 files changed, 28 insertions, 50 deletions
diff --git a/sys/fs/udf/udf_mount.h b/sys/fs/udf/udf_mount.h
deleted file mode 100644
index 557f0e8..0000000
--- a/sys/fs/udf/udf_mount.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-struct udf_args {
- char *fspec;
- struct export_args export;
- int flags;
- int ssector;
-};
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index 17958b9..d4e672c 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -91,7 +91,6 @@
#include <fs/udf/ecma167-udf.h>
#include <fs/udf/udf.h>
-#include <fs/udf/udf_mount.h>
#include <fs/udf/osta.h>
MALLOC_DEFINE(M_UDFMOUNT, "UDF mount", "UDF mount structure");
@@ -104,8 +103,7 @@ uma_zone_t udf_zone_node = NULL;
static int udf_init(struct vfsconf *);
static int udf_uninit(struct vfsconf *);
-static int udf_mount(struct mount *, char *, caddr_t, struct nameidata *,
- struct thread *);
+static int udf_mount(struct mount *, struct nameidata *, struct thread *);
static int udf_unmount(struct mount *, int, struct thread *);
static int udf_root(struct mount *, struct vnode **);
static int udf_statfs(struct mount *, struct statfs *, struct thread *);
@@ -114,7 +112,7 @@ static int udf_vptofh(struct vnode *, struct fid *);
static int udf_find_partmaps(struct udf_mnt *, struct logvol_desc *);
static struct vfsops udf_vfsops = {
- udf_mount,
+ NULL,
vfs_stdstart,
udf_unmount,
udf_root,
@@ -128,10 +126,11 @@ static struct vfsops udf_vfsops = {
udf_init,
udf_uninit,
vfs_stdextattrctl,
+ udf_mount,
};
VFS_SET(udf_vfsops, udf, VFCF_READONLY);
-static int udf_mountfs(struct vnode *, struct mount *, struct thread *, struct udf_args *);
+static int udf_mountfs(struct vnode *, struct mount *, struct thread *);
static int
udf_init(struct vfsconf *foo)
@@ -174,13 +173,17 @@ udf_uninit(struct vfsconf *foo)
}
static int
-udf_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct thread *td)
+udf_mount(struct mount *mp, struct nameidata *ndp, struct thread *td)
{
struct vnode *devvp; /* vnode of the mount device */
- struct udf_args args;
struct udf_mnt *imp = 0;
+ struct export_args *export;
+ struct vfsoptlist *opts;
+ char *fspec;
size_t size;
- int error;
+ int error, len;
+
+ opts = mp->mnt_optnew;
if ((mp->mnt_flag & MNT_RDONLY) == 0)
return (EROFS);
@@ -192,17 +195,26 @@ udf_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, str
if (mp->mnt_flag & MNT_ROOTFS)
return (ENOTSUP);
- if ((error = copyin(data, (caddr_t)&args, sizeof(struct udf_args))))
- return (error);
+ fspec = NULL;
+ error = vfs_getopt(opts, "from", (void **)&fspec, &len);
+ if (!error && fspec[len - 1] != '\0')
+ return (EINVAL);
if (mp->mnt_flag & MNT_UPDATE) {
imp = VFSTOUDFFS(mp);
- if (args.fspec == 0)
- return (vfs_export(mp, &args.export));
+ if (fspec == NULL) {
+ error = vfs_getopt(opts, "export", (void **)&export,
+ &len);
+ if (error || len != sizeof(struct export_args))
+ return (EINVAL);
+ return (vfs_export(mp, export));
+ }
}
/* Check that the mount device exists */
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+ if (fspec == NULL)
+ return (EINVAL);
+ NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td);
if ((error = namei(ndp)))
return (error);
NDFREE(ndp, NDF_ONLY_PNBUF);
@@ -224,13 +236,13 @@ udf_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, str
}
VOP_UNLOCK(devvp, 0, td);
- if ((error = udf_mountfs(devvp, mp, td, &args))) {
+ if ((error = udf_mountfs(devvp, mp, td))) {
vrele(devvp);
return (error);
}
imp = VFSTOUDFFS(mp);
- copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
+ copystr(fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
udf_statfs(mp, &mp->mnt_stat, td);
return 0;
@@ -262,7 +274,7 @@ udf_checktag(struct desc_tag *tag, uint16_t id)
}
static int
-udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td, struct udf_args *argp) {
+udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) {
struct buf *bp = NULL;
struct anchor_vdp avdp;
struct udf_mnt *udfmp = NULL;
OpenPOWER on IntegriCloud