summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-07-30 22:08:52 +0000
committerphk <phk@FreeBSD.org>2004-07-30 22:08:52 +0000
commit2d868d02cfcc9af8da398c52add2f28fe1c493bc (patch)
treeaf2a6b4c3e63a13443b647b947b57d5b31690b5a /sys
parent941a15ae99cc0252acd241ea5e407eb00a540858 (diff)
downloadFreeBSD-src-2d868d02cfcc9af8da398c52add2f28fe1c493bc.zip
FreeBSD-src-2d868d02cfcc9af8da398c52add2f28fe1c493bc.tar.gz
Put a version element in the VFS filesystem configuration structure
and refuse initializing filesystems with a wrong version. This will aid maintenance activites on the 5-stable branch. s/vfs_mount/vfs_omount/ s/vfs_nmount/vfs_mount/ Name our filesystems mount function consistently. Eliminate the namiedata argument to both vfs_mount and vfs_omount. It was originally there to save stack space. A few places abused it to get hold of some credentials to pass around. Effectively it is unused. Reorganize the root filesystem selection code.
Diffstat (limited to 'sys')
-rw-r--r--sys/coda/coda_vfsops.c27
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c16
-rw-r--r--sys/fs/coda/coda_vfsops.c27
-rw-r--r--sys/fs/devfs/devfs_vfsops.c9
-rw-r--r--sys/fs/fdescfs/fdesc_vfsops.c9
-rw-r--r--sys/fs/hpfs/hpfs_vfsops.c23
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c18
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c17
-rw-r--r--sys/fs/nullfs/null_vfsops.c10
-rw-r--r--sys/fs/nwfs/nwfs_vfsops.c8
-rw-r--r--sys/fs/portalfs/portal_vfsops.c7
-rw-r--r--sys/fs/pseudofs/pseudofs.c3
-rw-r--r--sys/fs/pseudofs/pseudofs.h9
-rw-r--r--sys/fs/smbfs/smbfs_vfsops.c7
-rw-r--r--sys/fs/udf/udf_vfsops.c7
-rw-r--r--sys/fs/umapfs/umap_vfsops.c6
-rw-r--r--sys/fs/unionfs/union_vfsops.c8
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c10
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c10
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c16
-rw-r--r--sys/kern/vfs_init.c9
-rw-r--r--sys/kern/vfs_mount.c105
-rw-r--r--sys/nfs4client/nfs4_vfsops.c7
-rw-r--r--sys/nfsclient/nfs_vfsops.c7
-rw-r--r--sys/sys/mount.h29
-rw-r--r--sys/ufs/ffs/ffs_extern.h1
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c38
27 files changed, 221 insertions, 222 deletions
diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c
index de84eb0..189ee92 100644
--- a/sys/coda/coda_vfsops.c
+++ b/sys/coda/coda_vfsops.c
@@ -83,6 +83,8 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE];
extern int coda_nc_initialized; /* Set if cache has been initialized */
extern int vc_nb_open(struct cdev *, int, int, struct thread *);
+static vfs_omount_t coda_omount;
+
int
coda_vfsopstats_init(void)
{
@@ -105,11 +107,10 @@ coda_vfsopstats_init(void)
*/
/*ARGSUSED*/
int
-coda_mount(vfsp, path, data, ndp, td)
+coda_omount(vfsp, path, data, td)
struct mount *vfsp; /* Allocated and initialized by mount(2) */
char *path; /* path covered: ignored by the fs-layer */
caddr_t data; /* Need to define a data type for this in netbsd? */
- struct nameidata *ndp; /* Clobber this to lookup the device name */
struct thread *td;
{
struct vnode *dvp;
@@ -120,7 +121,7 @@ coda_mount(vfsp, path, data, ndp, td)
CodaFid rootfid = INVAL_FID;
CodaFid ctlfid = CTL_FID;
int error;
-
+ struct nameidata ndp;
ENTRY;
coda_vfsopstats_init();
@@ -133,9 +134,9 @@ coda_mount(vfsp, path, data, ndp, td)
}
/* Validate mount device. Similar to getmdev(). */
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, td);
- error = namei(ndp);
- dvp = ndp->ni_vp;
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, td);
+ error = namei(&ndp);
+ dvp = ndp.ni_vp;
if (error) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
@@ -144,12 +145,12 @@ coda_mount(vfsp, path, data, ndp, td)
if (dvp->v_type != VCHR) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
vrele(dvp);
- NDFREE(ndp, NDF_ONLY_PNBUF);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
return(ENXIO);
}
dev = dvp->v_rdev;
vrele(dvp);
- NDFREE(ndp, NDF_ONLY_PNBUF);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
/*
* See if the device table matches our expectations.
@@ -216,7 +217,7 @@ coda_mount(vfsp, path, data, ndp, td)
/* error is currently guaranteed to be zero, but in case some
code changes... */
CODADEBUG(1,
- myprintf(("coda_mount returned %d\n",error)););
+ myprintf(("coda_omount returned %d\n",error)););
if (error)
MARK_INT_FAIL(CODA_MOUNT_STATS);
else
@@ -300,10 +301,10 @@ coda_root(vfsp, vpp, td)
/*
* Cache the root across calls. We only need to pass the request
* on to Venus if the root vnode is the dummy we installed in
- * coda_mount() with all c_fid members zeroed.
+ * coda_omount() with all c_fid members zeroed.
*
- * XXX In addition, if we are called between coda_mount() and
- * coda_start(), we assume that the request is from vfs_mount()
+ * XXX In addition, if we are called between coda_omount() and
+ * coda_start(), we assume that the request is from vfs_omount()
* (before the call to checkdirs()) and return the dummy root
* node to avoid a deadlock. This bug is fixed in the Coda CVS
* repository but not in any released versions as of 6 Mar 2003.
@@ -543,7 +544,7 @@ struct mount *devtomp(dev)
}
struct vfsops coda_vfsops = {
- .vfs_mount = coda_mount,
+ .vfs_omount = coda_omount,
.vfs_root = coda_root,
.vfs_start = coda_start,
.vfs_statfs = coda_nb_statfs,
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 7c83449..639dc75 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -65,7 +65,7 @@ MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
struct iconv_functions *cd9660_iconv = NULL;
-static vfs_mount_t cd9660_mount;
+static vfs_omount_t cd9660_omount;
static vfs_unmount_t cd9660_unmount;
static vfs_root_t cd9660_root;
static vfs_statfs_t cd9660_statfs;
@@ -76,7 +76,7 @@ static vfs_vptofh_t cd9660_vptofh;
static struct vfsops cd9660_vfsops = {
.vfs_fhtovp = cd9660_fhtovp,
.vfs_init = cd9660_init,
- .vfs_mount = cd9660_mount,
+ .vfs_omount = cd9660_omount,
.vfs_root = cd9660_root,
.vfs_statfs = cd9660_statfs,
.vfs_uninit = cd9660_uninit,
@@ -179,11 +179,10 @@ iso_mountroot(mp, td)
* mount system call
*/
static int
-cd9660_mount(mp, path, data, ndp, td)
+cd9660_omount(mp, path, data, td)
struct mount *mp;
char *path;
caddr_t data;
- struct nameidata *ndp;
struct thread *td;
{
struct vnode *devvp;
@@ -192,6 +191,7 @@ cd9660_mount(mp, path, data, ndp, td)
int error;
mode_t accessmode;
struct iso_mnt *imp = 0;
+ struct nameidata ndp;
if (path == NULL) /* We are doing the initial root mount */
return (iso_mountroot(mp, td));
@@ -214,11 +214,11 @@ cd9660_mount(mp, path, data, ndp, td)
* 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, td);
- if ((error = namei(ndp)))
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+ if ((error = namei(&ndp)))
return (error);
- NDFREE(ndp, NDF_ONLY_PNBUF);
- devvp = ndp->ni_vp;
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
+ devvp = ndp.ni_vp;
if (!vn_isdisk(devvp, &error)) {
vrele(devvp);
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
index de84eb0..189ee92 100644
--- a/sys/fs/coda/coda_vfsops.c
+++ b/sys/fs/coda/coda_vfsops.c
@@ -83,6 +83,8 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE];
extern int coda_nc_initialized; /* Set if cache has been initialized */
extern int vc_nb_open(struct cdev *, int, int, struct thread *);
+static vfs_omount_t coda_omount;
+
int
coda_vfsopstats_init(void)
{
@@ -105,11 +107,10 @@ coda_vfsopstats_init(void)
*/
/*ARGSUSED*/
int
-coda_mount(vfsp, path, data, ndp, td)
+coda_omount(vfsp, path, data, td)
struct mount *vfsp; /* Allocated and initialized by mount(2) */
char *path; /* path covered: ignored by the fs-layer */
caddr_t data; /* Need to define a data type for this in netbsd? */
- struct nameidata *ndp; /* Clobber this to lookup the device name */
struct thread *td;
{
struct vnode *dvp;
@@ -120,7 +121,7 @@ coda_mount(vfsp, path, data, ndp, td)
CodaFid rootfid = INVAL_FID;
CodaFid ctlfid = CTL_FID;
int error;
-
+ struct nameidata ndp;
ENTRY;
coda_vfsopstats_init();
@@ -133,9 +134,9 @@ coda_mount(vfsp, path, data, ndp, td)
}
/* Validate mount device. Similar to getmdev(). */
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, td);
- error = namei(ndp);
- dvp = ndp->ni_vp;
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, td);
+ error = namei(&ndp);
+ dvp = ndp.ni_vp;
if (error) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
@@ -144,12 +145,12 @@ coda_mount(vfsp, path, data, ndp, td)
if (dvp->v_type != VCHR) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
vrele(dvp);
- NDFREE(ndp, NDF_ONLY_PNBUF);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
return(ENXIO);
}
dev = dvp->v_rdev;
vrele(dvp);
- NDFREE(ndp, NDF_ONLY_PNBUF);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
/*
* See if the device table matches our expectations.
@@ -216,7 +217,7 @@ coda_mount(vfsp, path, data, ndp, td)
/* error is currently guaranteed to be zero, but in case some
code changes... */
CODADEBUG(1,
- myprintf(("coda_mount returned %d\n",error)););
+ myprintf(("coda_omount returned %d\n",error)););
if (error)
MARK_INT_FAIL(CODA_MOUNT_STATS);
else
@@ -300,10 +301,10 @@ coda_root(vfsp, vpp, td)
/*
* Cache the root across calls. We only need to pass the request
* on to Venus if the root vnode is the dummy we installed in
- * coda_mount() with all c_fid members zeroed.
+ * coda_omount() with all c_fid members zeroed.
*
- * XXX In addition, if we are called between coda_mount() and
- * coda_start(), we assume that the request is from vfs_mount()
+ * XXX In addition, if we are called between coda_omount() and
+ * coda_start(), we assume that the request is from vfs_omount()
* (before the call to checkdirs()) and return the dummy root
* node to avoid a deadlock. This bug is fixed in the Coda CVS
* repository but not in any released versions as of 6 Mar 2003.
@@ -543,7 +544,7 @@ struct mount *devtomp(dev)
}
struct vfsops coda_vfsops = {
- .vfs_mount = coda_mount,
+ .vfs_omount = coda_omount,
.vfs_root = coda_root,
.vfs_start = coda_start,
.vfs_statfs = coda_nb_statfs,
diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c
index f23d660..27a759f 100644
--- a/sys/fs/devfs/devfs_vfsops.c
+++ b/sys/fs/devfs/devfs_vfsops.c
@@ -51,7 +51,7 @@
MALLOC_DEFINE(M_DEVFS, "DEVFS", "DEVFS data");
-static vfs_nmount_t devfs_nmount;
+static vfs_mount_t devfs_mount;
static vfs_unmount_t devfs_unmount;
static vfs_root_t devfs_root;
static vfs_statfs_t devfs_statfs;
@@ -60,10 +60,7 @@ static vfs_statfs_t devfs_statfs;
* Mount the filesystem
*/
static int
-devfs_nmount(mp, ndp, td)
- struct mount *mp;
- struct nameidata *ndp;
- struct thread *td;
+devfs_mount(struct mount *mp, struct thread *td)
{
int error;
struct devfs_mount *fmp;
@@ -187,7 +184,7 @@ devfs_statfs(mp, sbp, td)
}
static struct vfsops devfs_vfsops = {
- .vfs_nmount = devfs_nmount,
+ .vfs_mount = devfs_mount,
.vfs_root = devfs_root,
.vfs_statfs = devfs_statfs,
.vfs_unmount = devfs_unmount,
diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c
index 2cd56f5..01e8956 100644
--- a/sys/fs/fdescfs/fdesc_vfsops.c
+++ b/sys/fs/fdescfs/fdesc_vfsops.c
@@ -54,7 +54,7 @@
static MALLOC_DEFINE(M_FDESCMNT, "FDESC mount", "FDESC mount structure");
-static vfs_nmount_t fdesc_mount;
+static vfs_mount_t fdesc_mount;
static vfs_unmount_t fdesc_unmount;
static vfs_statfs_t fdesc_statfs;
@@ -62,10 +62,7 @@ static vfs_statfs_t fdesc_statfs;
* Mount the per-process file descriptors (/dev/fd)
*/
static int
-fdesc_mount(mp, ndp, td)
- struct mount *mp;
- struct nameidata *ndp;
- struct thread *td;
+fdesc_mount(struct mount *mp, struct thread *td)
{
int error = 0;
struct fdescmount *fmp;
@@ -203,7 +200,7 @@ fdesc_statfs(mp, sbp, td)
static struct vfsops fdesc_vfsops = {
.vfs_init = fdesc_init,
- .vfs_nmount = fdesc_mount,
+ .vfs_mount = fdesc_mount,
.vfs_root = fdesc_root,
.vfs_statfs = fdesc_statfs,
.vfs_unmount = fdesc_unmount,
diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c
index 9ea6cfb..e002feb 100644
--- a/sys/fs/hpfs/hpfs_vfsops.c
+++ b/sys/fs/hpfs/hpfs_vfsops.c
@@ -62,7 +62,7 @@ static vfs_init_t hpfs_init;
static vfs_uninit_t hpfs_uninit;
static vfs_fhtovp_t hpfs_fhtovp;
static vfs_vget_t hpfs_vget;
-static vfs_mount_t hpfs_mount;
+static vfs_omount_t hpfs_omount;
static vfs_root_t hpfs_root;
static vfs_statfs_t hpfs_statfs;
static vfs_unmount_t hpfs_unmount;
@@ -87,11 +87,10 @@ hpfs_uninit (vfsp)
}
static int
-hpfs_mount (
+hpfs_omount (
struct mount *mp,
char *path,
caddr_t data,
- struct nameidata *ndp,
struct thread *td )
{
size_t size;
@@ -99,8 +98,9 @@ hpfs_mount (
struct vnode *devvp;
struct hpfs_args args;
struct hpfsmount *hpmp = 0;
+ struct nameidata ndp;
- dprintf(("hpfs_mount():\n"));
+ dprintf(("hpfs_omount():\n"));
/*
***
* Mounting non-root filesystem or updating a filesystem
@@ -117,7 +117,7 @@ hpfs_mount (
* read/write; if there is no device name, that's all we do.
*/
if (mp->mnt_flag & MNT_UPDATE) {
- dprintf(("hpfs_mount: MNT_UPDATE: "));
+ dprintf(("hpfs_omount: MNT_UPDATE: "));
hpmp = VFSTOHPFS(mp);
@@ -125,7 +125,7 @@ hpfs_mount (
dprintf(("export 0x%x\n",args.export.ex_flags));
err = vfs_export(mp, &args.export);
if (err) {
- printf("hpfs_mount: vfs_export failed %d\n",
+ printf("hpfs_omount: vfs_export failed %d\n",
err);
}
goto success;
@@ -141,14 +141,14 @@ hpfs_mount (
* 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, td);
- err = namei(ndp);
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+ err = namei(&ndp);
if (err) {
/* can't get devvp!*/
goto error_1;
}
- devvp = ndp->ni_vp;
+ devvp = ndp.ni_vp;
if (!vn_isdisk(devvp, &err))
goto error_2;
@@ -163,7 +163,7 @@ hpfs_mount (
* Since this is a new mount, we want the names for
* the device and the mount point copied in. If an
* error occurs, the mountpoint is discarded by the
- * upper level code. Note that vfs_mount() handles
+ * upper level code. Note that vfs_omount() handles
* copying the mountpoint f_mntonname for us, so we
* don't have to do it here unless we want to set it
* to something other than "path" for some rason.
@@ -196,6 +196,7 @@ error_2: /* error with devvp held*/
vrele(devvp);
error_1: /* no state to back out*/
+ /* XXX: Missing NDFREE(&ndp, ...) */
success:
return( err);
@@ -573,7 +574,7 @@ hpfs_vget(
static struct vfsops hpfs_vfsops = {
.vfs_fhtovp = hpfs_fhtovp,
.vfs_init = hpfs_init,
- .vfs_mount = hpfs_mount,
+ .vfs_omount = hpfs_omount,
.vfs_root = hpfs_root,
.vfs_statfs = hpfs_statfs,
.vfs_uninit = hpfs_uninit,
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index b54f6ec..ccf4b7b 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -96,7 +96,7 @@ static int update_mp(struct mount *mp, struct msdosfs_args *argp,
static int mountmsdosfs(struct vnode *devvp, struct mount *mp,
struct thread *td, struct msdosfs_args *argp);
static vfs_fhtovp_t msdosfs_fhtovp;
-static vfs_mount_t msdosfs_mount;
+static vfs_omount_t msdosfs_omount;
static vfs_root_t msdosfs_root;
static vfs_statfs_t msdosfs_statfs;
static vfs_sync_t msdosfs_sync;
@@ -158,17 +158,17 @@ update_mp(mp, argp, td)
* special file to treat as a filesystem.
*/
static int
-msdosfs_mount(mp, path, data, ndp, td)
+msdosfs_omount(mp, path, data, td)
struct mount *mp;
char *path;
caddr_t data;
- struct nameidata *ndp;
struct thread *td;
{
struct vnode *devvp; /* vnode for blk device to mount */
struct msdosfs_args args; /* will hold data from mount request */
/* msdosfs specific mount control block */
struct msdosfsmount *pmp = NULL;
+ struct nameidata ndp;
size_t size;
int error, flags;
mode_t accessmode;
@@ -241,12 +241,12 @@ msdosfs_mount(mp, path, data, ndp, td)
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible disk device.
*/
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
- error = namei(ndp);
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+ error = namei(&ndp);
if (error)
return (error);
- devvp = ndp->ni_vp;
- NDFREE(ndp, NDF_ONLY_PNBUF);
+ devvp = ndp.ni_vp;
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
if (!vn_isdisk(devvp, &error)) {
vrele(devvp);
@@ -294,7 +294,7 @@ msdosfs_mount(mp, path, data, ndp, td)
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
(void) msdosfs_statfs(mp, &mp->mnt_stat, td);
#ifdef MSDOSFS_DEBUG
- printf("msdosfs_mount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap);
+ printf("msdosfs_omount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap);
#endif
return (0);
}
@@ -900,7 +900,7 @@ msdosfs_vptofh(vp, fhp)
static struct vfsops msdosfs_vfsops = {
.vfs_fhtovp = msdosfs_fhtovp,
.vfs_init = msdosfs_init,
- .vfs_mount = msdosfs_mount,
+ .vfs_omount = msdosfs_omount,
.vfs_root = msdosfs_root,
.vfs_statfs = msdosfs_statfs,
.vfs_sync = msdosfs_sync,
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index a9a9c7a..3bd803c 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -71,7 +71,7 @@ static vfs_init_t ntfs_init;
static vfs_uninit_t ntfs_uninit;
static vfs_vget_t ntfs_vget;
static vfs_fhtovp_t ntfs_fhtovp;
-static vfs_mount_t ntfs_mount;
+static vfs_omount_t ntfs_omount;
static vfs_root_t ntfs_root;
static vfs_statfs_t ntfs_statfs;
static vfs_unmount_t ntfs_unmount;
@@ -96,17 +96,17 @@ ntfs_uninit (
}
static int
-ntfs_mount (
+ntfs_omount (
struct mount *mp,
char *path,
caddr_t data,
- struct nameidata *ndp,
struct thread *td )
{
size_t size;
int err = 0;
struct vnode *devvp, *rootvp;
struct ntfs_args args;
+ struct nameidata ndp;
/*
* Use NULL path to flag a root mount
@@ -174,14 +174,14 @@ ntfs_mount (
* 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, td);
- err = namei(ndp);
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+ err = namei(&ndp);
if (err) {
/* can't get devvp!*/
goto error_1;
}
- NDFREE(ndp, NDF_ONLY_PNBUF);
- devvp = ndp->ni_vp;
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
+ devvp = ndp.ni_vp;
if (!vn_isdisk(devvp, &err))
goto error_2;
@@ -256,6 +256,7 @@ error_2: /* error with devvp held*/
vrele(devvp);
error_1: /* no state to back out*/
+ /* XXX: missing NDFREE(&ndp, ...) */
success:
return(err);
@@ -786,7 +787,7 @@ ntfs_vget(
static struct vfsops ntfs_vfsops = {
.vfs_fhtovp = ntfs_fhtovp,
.vfs_init = ntfs_init,
- .vfs_mount = ntfs_mount,
+ .vfs_omount = ntfs_omount,
.vfs_root = ntfs_root,
.vfs_statfs = ntfs_statfs,
.vfs_uninit = ntfs_uninit,
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 25c1651..ea49163 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -57,7 +57,7 @@ static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure");
static vfs_fhtovp_t nullfs_fhtovp;
static vfs_checkexp_t nullfs_checkexp;
-static vfs_nmount_t nullfs_mount;
+static vfs_mount_t nullfs_mount;
static vfs_quotactl_t nullfs_quotactl;
static vfs_root_t nullfs_root;
static vfs_start_t nullfs_start;
@@ -72,10 +72,7 @@ static vfs_extattrctl_t nullfs_extattrctl;
* Mount null layer
*/
static int
-nullfs_mount(mp, ndp, td)
- struct mount *mp;
- struct nameidata *ndp;
- struct thread *td;
+nullfs_mount(struct mount *mp, struct thread *td)
{
int error = 0;
struct vnode *lowerrootvp, *vp;
@@ -84,6 +81,7 @@ nullfs_mount(mp, ndp, td)
char *target;
size_t size;
int isvnunlocked = 0, len;
+ struct nameidata nd, *ndp = &nd;
NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
@@ -403,7 +401,7 @@ static struct vfsops null_vfsops = {
.vfs_extattrctl = nullfs_extattrctl,
.vfs_fhtovp = nullfs_fhtovp,
.vfs_init = nullfs_init,
- .vfs_nmount = nullfs_mount,
+ .vfs_mount = nullfs_mount,
.vfs_quotactl = nullfs_quotactl,
.vfs_root = nullfs_root,
.vfs_start = nullfs_start,
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c
index 824ef4e..2900048 100644
--- a/sys/fs/nwfs/nwfs_vfsops.c
+++ b/sys/fs/nwfs/nwfs_vfsops.c
@@ -70,7 +70,7 @@ 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_mount_t nwfs_mount;
+static vfs_omount_t nwfs_omount;
static vfs_quotactl_t nwfs_quotactl;
static vfs_root_t nwfs_root;
static vfs_start_t nwfs_start;
@@ -81,7 +81,7 @@ static vfs_uninit_t nwfs_uninit;
static struct vfsops nwfs_vfsops = {
.vfs_init = nwfs_init,
- .vfs_mount = nwfs_mount,
+ .vfs_omount = nwfs_omount,
.vfs_quotactl = nwfs_quotactl,
.vfs_root = nwfs_root,
.vfs_start = nwfs_start,
@@ -136,8 +136,8 @@ nwfs_initnls(struct nwmount *nmp) {
* mp - path - addr in user space of mount point (ie /usr or whatever)
* data - addr in user space of mount params
*/
-static int nwfs_mount(struct mount *mp, char *path, caddr_t data,
- struct nameidata *ndp, struct thread *td)
+static int nwfs_omount(struct mount *mp, char *path, caddr_t data,
+ struct thread *td)
{
struct nwfs_args args; /* will hold data from mount request */
int error;
diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c
index 3b2d8be..dea2d39 100644
--- a/sys/fs/portalfs/portal_vfsops.c
+++ b/sys/fs/portalfs/portal_vfsops.c
@@ -58,7 +58,7 @@
static MALLOC_DEFINE(M_PORTALFSMNT, "PORTAL mount", "PORTAL mount structure");
-static vfs_mount_t portal_mount;
+static vfs_omount_t portal_omount;
static vfs_unmount_t portal_unmount;
static vfs_root_t portal_root;
static vfs_statfs_t portal_statfs;
@@ -67,11 +67,10 @@ static vfs_statfs_t portal_statfs;
* Mount the per-process file descriptors (/dev/fd)
*/
static int
-portal_mount(mp, path, data, ndp, td)
+portal_omount(mp, path, data, td)
struct mount *mp;
char *path;
caddr_t data;
- struct nameidata *ndp;
struct thread *td;
{
struct file *fp;
@@ -236,7 +235,7 @@ portal_statfs(mp, sbp, td)
}
static struct vfsops portal_vfsops = {
- .vfs_mount = portal_mount,
+ .vfs_omount = portal_omount,
.vfs_root = portal_root,
.vfs_statfs = portal_statfs,
.vfs_unmount = portal_unmount,
diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c
index 22d6286..140a993 100644
--- a/sys/fs/pseudofs/pseudofs.c
+++ b/sys/fs/pseudofs/pseudofs.c
@@ -257,8 +257,7 @@ pfs_destroy(struct pfs_node *node)
* Mount a pseudofs instance
*/
int
-pfs_mount(struct pfs_info *pi, struct mount *mp, struct nameidata *ndp,
- struct thread *td)
+pfs_mount(struct pfs_info *pi, struct mount *mp, struct thread *td)
{
struct statfs *sbp;
diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h
index 1bac49c..c2bb9b3 100644
--- a/sys/fs/pseudofs/pseudofs.h
+++ b/sys/fs/pseudofs/pseudofs.h
@@ -198,7 +198,7 @@ struct pfs_node {
* VFS interface
*/
int pfs_mount (struct pfs_info *pi, struct mount *mp,
- struct nameidata *ndp, struct thread *td);
+ struct thread *td);
int pfs_unmount (struct mount *mp, int mntflags,
struct thread *td);
int pfs_root (struct mount *mp, struct vnode **vpp,
@@ -236,9 +236,8 @@ static struct pfs_info name##_info = { \
}; \
\
static int \
-_##name##_mount(struct mount *mp, struct nameidata *ndp, \
- struct thread *td) { \
- return pfs_mount(&name##_info, mp, ndp, td); \
+_##name##_mount(struct mount *mp, struct thread *td) { \
+ return pfs_mount(&name##_info, mp, td); \
} \
\
static int \
@@ -253,7 +252,7 @@ _##name##_uninit(struct vfsconf *vfc) { \
\
static struct vfsops name##_vfsops = { \
.vfs_init = _##name##_init, \
- .vfs_nmount = _##name##_mount, \
+ .vfs_mount = _##name##_mount, \
.vfs_root = pfs_root, \
.vfs_statfs = pfs_statfs, \
.vfs_uninit = _##name##_uninit, \
diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c
index ec67445..d8d90e4 100644
--- a/sys/fs/smbfs/smbfs_vfsops.c
+++ b/sys/fs/smbfs/smbfs_vfsops.c
@@ -78,7 +78,7 @@ static MALLOC_DEFINE(M_SMBFSHASH, "SMBFS hash", "SMBFS hash table");
static vfs_init_t smbfs_init;
static vfs_uninit_t smbfs_uninit;
-static vfs_mount_t smbfs_mount;
+static vfs_omount_t smbfs_omount;
static vfs_start_t smbfs_start;
static vfs_root_t smbfs_root;
static vfs_quotactl_t smbfs_quotactl;
@@ -87,7 +87,7 @@ static vfs_unmount_t smbfs_unmount;
static struct vfsops smbfs_vfsops = {
.vfs_init = smbfs_init,
- .vfs_mount = smbfs_mount,
+ .vfs_omount = smbfs_omount,
.vfs_quotactl = smbfs_quotactl,
.vfs_root = smbfs_root,
.vfs_start = smbfs_start,
@@ -107,8 +107,7 @@ MODULE_DEPEND(smbfs, libmchain, 1, 1, 1);
int smbfs_pbuf_freecnt = -1; /* start out unlimited */
static int
-smbfs_mount(struct mount *mp, char *path, caddr_t data,
- struct nameidata *ndp, struct thread *td)
+smbfs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td)
{
struct smbfs_args args; /* will hold data from mount request */
struct smbmount *smp = NULL;
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index 2b2501a..89f38ba 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -108,7 +108,7 @@ uma_zone_t udf_zone_ds = NULL;
static vfs_init_t udf_init;
static vfs_uninit_t udf_uninit;
-static vfs_nmount_t udf_mount;
+static vfs_mount_t udf_mount;
static vfs_root_t udf_root;
static vfs_statfs_t udf_statfs;
static vfs_unmount_t udf_unmount;
@@ -120,7 +120,7 @@ static int udf_find_partmaps(struct udf_mnt *, struct logvol_desc *);
static struct vfsops udf_vfsops = {
.vfs_fhtovp = udf_fhtovp,
.vfs_init = udf_init,
- .vfs_nmount = udf_mount,
+ .vfs_mount = udf_mount,
.vfs_root = udf_root,
.vfs_statfs = udf_statfs,
.vfs_uninit = udf_uninit,
@@ -184,7 +184,7 @@ udf_uninit(struct vfsconf *foo)
}
static int
-udf_mount(struct mount *mp, struct nameidata *ndp, struct thread *td)
+udf_mount(struct mount *mp, struct thread *td)
{
struct vnode *devvp; /* vnode of the mount device */
struct udf_mnt *imp = 0;
@@ -193,6 +193,7 @@ udf_mount(struct mount *mp, struct nameidata *ndp, struct thread *td)
char *fspec, *cs_disk, *cs_local;
size_t size;
int error, len, *udf_flags;
+ struct nameidata nd, *ndp = &nd;
opts = mp->mnt_optnew;
diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c
index c6f0e57..c9da7f7 100644
--- a/sys/fs/umapfs/umap_vfsops.c
+++ b/sys/fs/umapfs/umap_vfsops.c
@@ -53,7 +53,7 @@
static MALLOC_DEFINE(M_UMAPFSMNT, "UMAP mount", "UMAP mount structure");
-static vfs_mount_t umapfs_mount;
+static vfs_omount_t umapfs_omount;
static vfs_start_t umapfs_start;
static vfs_root_t umapfs_root;
static vfs_quotactl_t umapfs_quotactl;
@@ -69,7 +69,7 @@ static vfs_extattrctl_t umapfs_extattrctl;
* Mount umap layer
*/
static int
-umapfs_mount(mp, path, data, ndp, td)
+umapfs_omount(mp, path, data, ndp, td)
struct mount *mp;
char *path;
caddr_t data;
@@ -430,7 +430,7 @@ static struct vfsops umap_vfsops = {
.vfs_extattrctl = umapfs_extattrctl,
.vfs_fhtovp = umapfs_fhtovp,
.vfs_init = umapfs_init,
- .vfs_mount = umapfs_mount,
+ .vfs_omount = umapfs_omount,
.vfs_quotactl = umapfs_quotactl,
.vfs_root = umapfs_root,
.vfs_start = umapfs_start,
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index e756e18..1b5293e 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -55,7 +55,7 @@ static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure");
extern vfs_init_t union_init;
static vfs_root_t union_root;
-static vfs_nmount_t union_mount;
+static vfs_mount_t union_mount;
static vfs_statfs_t union_statfs;
static vfs_unmount_t union_unmount;
@@ -63,9 +63,8 @@ static vfs_unmount_t union_unmount;
* Mount union filesystem.
*/
static int
-union_mount(mp, ndp, td)
+union_mount(mp, td)
struct mount *mp;
- struct nameidata *ndp;
struct thread *td;
{
int error = 0;
@@ -79,6 +78,7 @@ union_mount(mp, ndp, td)
int len;
size_t size;
struct componentname fakecn;
+ struct nameidata nd, *ndp = &nd;
UDEBUG(("union_mount(mp = %p)\n", (void *)mp));
@@ -486,7 +486,7 @@ union_statfs(mp, sbp, td)
static struct vfsops union_vfsops = {
.vfs_init = union_init,
- .vfs_nmount = union_mount,
+ .vfs_mount = union_mount,
.vfs_root = union_root,
.vfs_statfs = union_statfs,
.vfs_unmount = union_unmount,
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 73207d5..a1e5365 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -73,7 +73,7 @@ static vfs_fhtovp_t ext2_fhtovp;
static vfs_vptofh_t ext2_vptofh;
static vfs_init_t ext2_init;
static vfs_uninit_t ext2_uninit;
-static vfs_nmount_t ext2_mount;
+static vfs_mount_t ext2_mount;
MALLOC_DEFINE(M_EXT2NODE, "EXT2 node", "EXT2 vnode private part");
static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure");
@@ -81,7 +81,7 @@ static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure");
static struct vfsops ext2fs_vfsops = {
.vfs_fhtovp = ext2_fhtovp,
.vfs_init = ext2_init,
- .vfs_nmount = ext2_mount,
+ .vfs_mount = ext2_mount,
.vfs_root = ext2_root, /* root inode via vget */
.vfs_statfs = ext2_statfs,
.vfs_sync = ext2_sync,
@@ -166,9 +166,8 @@ ext2_mountroot()
* mount system call
*/
static int
-ext2_mount(mp, ndp, td)
+ext2_mount(mp, td)
struct mount *mp;
- struct nameidata *ndp;
struct thread *td;
{
struct export_args *export;
@@ -180,6 +179,7 @@ ext2_mount(mp, ndp, td)
size_t size;
int error, flags, len;
mode_t accessmode;
+ struct nameidata nd, *ndp = &nd;
opts = mp->mnt_optnew;
@@ -216,7 +216,7 @@ ext2_mount(mp, ndp, td)
fs->s_rd_only = 1;
}
if (!error && (mp->mnt_flag & MNT_RELOAD))
- error = ext2_reload(mp, ndp->ni_cnd.cn_cred, td);
+ error = ext2_reload(mp, td->td_ucred, td);
if (error)
return (error);
devvp = ump->um_devvp;
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 73207d5..a1e5365 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -73,7 +73,7 @@ static vfs_fhtovp_t ext2_fhtovp;
static vfs_vptofh_t ext2_vptofh;
static vfs_init_t ext2_init;
static vfs_uninit_t ext2_uninit;
-static vfs_nmount_t ext2_mount;
+static vfs_mount_t ext2_mount;
MALLOC_DEFINE(M_EXT2NODE, "EXT2 node", "EXT2 vnode private part");
static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure");
@@ -81,7 +81,7 @@ static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure");
static struct vfsops ext2fs_vfsops = {
.vfs_fhtovp = ext2_fhtovp,
.vfs_init = ext2_init,
- .vfs_nmount = ext2_mount,
+ .vfs_mount = ext2_mount,
.vfs_root = ext2_root, /* root inode via vget */
.vfs_statfs = ext2_statfs,
.vfs_sync = ext2_sync,
@@ -166,9 +166,8 @@ ext2_mountroot()
* mount system call
*/
static int
-ext2_mount(mp, ndp, td)
+ext2_mount(mp, td)
struct mount *mp;
- struct nameidata *ndp;
struct thread *td;
{
struct export_args *export;
@@ -180,6 +179,7 @@ ext2_mount(mp, ndp, td)
size_t size;
int error, flags, len;
mode_t accessmode;
+ struct nameidata nd, *ndp = &nd;
opts = mp->mnt_optnew;
@@ -216,7 +216,7 @@ ext2_mount(mp, ndp, td)
fs->s_rd_only = 1;
}
if (!error && (mp->mnt_flag & MNT_RELOAD))
- error = ext2_reload(mp, ndp->ni_cnd.cn_cred, td);
+ error = ext2_reload(mp, td->td_ucred, td);
if (error)
return (error);
devvp = ump->um_devvp;
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 7c83449..639dc75 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -65,7 +65,7 @@ MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
struct iconv_functions *cd9660_iconv = NULL;
-static vfs_mount_t cd9660_mount;
+static vfs_omount_t cd9660_omount;
static vfs_unmount_t cd9660_unmount;
static vfs_root_t cd9660_root;
static vfs_statfs_t cd9660_statfs;
@@ -76,7 +76,7 @@ static vfs_vptofh_t cd9660_vptofh;
static struct vfsops cd9660_vfsops = {
.vfs_fhtovp = cd9660_fhtovp,
.vfs_init = cd9660_init,
- .vfs_mount = cd9660_mount,
+ .vfs_omount = cd9660_omount,
.vfs_root = cd9660_root,
.vfs_statfs = cd9660_statfs,
.vfs_uninit = cd9660_uninit,
@@ -179,11 +179,10 @@ iso_mountroot(mp, td)
* mount system call
*/
static int
-cd9660_mount(mp, path, data, ndp, td)
+cd9660_omount(mp, path, data, td)
struct mount *mp;
char *path;
caddr_t data;
- struct nameidata *ndp;
struct thread *td;
{
struct vnode *devvp;
@@ -192,6 +191,7 @@ cd9660_mount(mp, path, data, ndp, td)
int error;
mode_t accessmode;
struct iso_mnt *imp = 0;
+ struct nameidata ndp;
if (path == NULL) /* We are doing the initial root mount */
return (iso_mountroot(mp, td));
@@ -214,11 +214,11 @@ cd9660_mount(mp, path, data, ndp, td)
* 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, td);
- if ((error = namei(ndp)))
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+ if ((error = namei(&ndp)))
return (error);
- NDFREE(ndp, NDF_ONLY_PNBUF);
- devvp = ndp->ni_vp;
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
+ devvp = ndp.ni_vp;
if (!vn_isdisk(devvp, &error)) {
vrele(devvp);
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index 999764a..be8f2af 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -379,6 +379,11 @@ vfs_register(struct vfsconf *vfc)
struct sysctl_oid *oidp;
struct vfsops *vfsops;
+ if (vfc->vfc_version != VFS_VERSION) {
+ printf("ERROR: filesystem %s, unsupported ABI version %x\n",
+ vfc->vfc_name, vfc->vfc_version);
+ return (EINVAL);
+ }
if (vfs_byname(vfc->vfc_name) != NULL)
return EEXIST;
@@ -414,8 +419,8 @@ vfs_register(struct vfsconf *vfc)
* Check the mount and unmount operations.
*/
vfsops = vfc->vfc_vfsops;
- KASSERT(vfsops->vfs_mount != NULL || vfsops->vfs_nmount != NULL,
- ("Filesystem %s has no (n)mount op", vfc->vfc_name));
+ KASSERT(vfsops->vfs_mount != NULL || vfsops->vfs_omount != NULL,
+ ("Filesystem %s has no (o)mount op", vfc->vfc_name));
KASSERT(vfsops->vfs_unmount != NULL,
("Filesystem %s has no unmount op", vfc->vfc_name));
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 5694fa5..9f995f4 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -104,7 +104,7 @@ static int vfs_domount(struct thread *td, const char *fstype,
static int vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp,
const char *fspath, struct thread *td, struct mount **mpp);
static int vfs_mountroot_ask(void);
-static int vfs_mountroot_try(char *mountfrom);
+static int vfs_mountroot_try(const char *mountfrom);
static int vfs_donmount(struct thread *td, int fsflags,
struct uio *fsoptions);
@@ -148,8 +148,12 @@ static char *cdrom_rootdevnames[] = {
/* legacy find-root code */
char *rootdevnames[2] = {NULL, NULL};
-static int setrootbyname(char *name);
struct cdev *rootdev = NULL;
+#ifdef ROOTDEVNAME
+const char *ctrootdevname = ROOTDEVNAME;
+#else
+const char *ctrootdevname = NULL;
+#endif
/*
* Has to be dynamic as the value of rootdev can change; however, it can't
@@ -823,10 +827,10 @@ vfs_domount(
mp->mnt_optnew = fsdata;
}
/*
- * Check if the fs implements the type VFS_[N]MOUNT()
+ * Check if the fs implements the type VFS_[O]MOUNT()
* function we are looking for.
*/
- if ((compat == 0) == (mp->mnt_op->vfs_mount != NULL)) {
+ if ((compat == 0) == (mp->mnt_op->vfs_omount != NULL)) {
printf("%s doesn't support the %s mount syscall\n",
mp->mnt_vfc->vfc_name, compat ? "old" : "new");
VI_LOCK(vp);
@@ -854,8 +858,10 @@ vfs_domount(
* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
* get. No freeing of cn_pnbuf.
*/
- error = compat ? VFS_MOUNT(mp, fspath, fsdata, &nd, td) :
- VFS_NMOUNT(mp, &nd, td);
+ if (compat)
+ error = VFS_OMOUNT(mp, fspath, fsdata, td);
+ else
+ error = VFS_MOUNT(mp, td);
if (!error) {
if (mp->mnt_opt != NULL)
vfs_freeopts(mp->mnt_opt);
@@ -1195,25 +1201,31 @@ void
vfs_mountroot(void)
{
char *cp;
- int error, i;
+ int error, i, asked = 0;
- g_waitidle();
/*
- * The root filesystem information is compiled in, and we are
- * booted with instructions to use it.
+ * Wait for GEOM to settle down
*/
-#ifdef ROOTDEVNAME
- if ((boothowto & RB_DFLTROOT) && !vfs_mountroot_try(ROOTDEVNAME))
- return;
-#endif
+ g_waitidle();
+
/*
- * We are booted with instructions to prompt for the root filesystem,
- * or to use the compiled-in default when it doesn't exist.
+ * We are booted with instructions to prompt for the root filesystem.
*/
- if (boothowto & (RB_DFLTROOT | RB_ASKNAME)) {
+ if (boothowto & RB_ASKNAME) {
if (!vfs_mountroot_ask())
return;
+ asked = 1;
+ }
+
+ /*
+ * The root filesystem information is compiled in, and we are
+ * booted with instructions to use it.
+ */
+ if (ctrootdevname != NULL && (boothowto & RB_DFLTROOT)) {
+ if (!vfs_mountroot_try(ctrootdevname))
+ return;
+ ctrootdevname = NULL;
}
/*
@@ -1233,7 +1245,8 @@ vfs_mountroot(void)
* supplied via some other means. This is the preferred
* mechanism.
*/
- if ((cp = getenv("vfs.root.mountfrom")) != NULL) {
+ cp = getenv("vfs.root.mountfrom");
+ if (cp != NULL) {
error = vfs_mountroot_try(cp);
freeenv(cp);
if (!error)
@@ -1241,8 +1254,7 @@ vfs_mountroot(void)
}
/*
- * Try values that may have been computed by the machine-dependant
- * legacy code.
+ * Try values that may have been computed by code during boot
*/
if (!vfs_mountroot_try(rootdevnames[0]))
return;
@@ -1250,21 +1262,19 @@ vfs_mountroot(void)
return;
/*
- * If we have a compiled-in default, and haven't already tried it, try
- * it now.
+ * If we (still) have a compiled-in default, try it.
*/
-#ifdef ROOTDEVNAME
- if (!(boothowto & RB_DFLTROOT))
- if (!vfs_mountroot_try(ROOTDEVNAME))
+ if (ctrootdevname != NULL)
+ if (!vfs_mountroot_try(ctrootdevname))
return;
-#endif
/*
* Everything so far has failed, prompt on the console if we haven't
* already tried that.
*/
- if (!(boothowto & (RB_DFLTROOT | RB_ASKNAME)) && !vfs_mountroot_ask())
- return;
+ if (!asked)
+ if (!vfs_mountroot_ask())
+ return;
panic("Root mount failed, startup aborted.");
}
@@ -1272,7 +1282,7 @@ vfs_mountroot(void)
* Mount (mountfrom) as the root filesystem.
*/
static int
-vfs_mountroot_try(char *mountfrom)
+vfs_mountroot_try(const char *mountfrom)
{
struct mount *mp;
char *vfsname, *path;
@@ -1310,9 +1320,18 @@ vfs_mountroot_try(char *mountfrom)
goto done;
}
- /* do our best to set rootdev */
- if (path[0] != '\0' && setrootbyname(path))
- printf("setrootbyname failed\n");
+ /*
+ * do our best to set rootdev
+ * XXX: This does not belong here!
+ */
+ if (path[0] != '\0') {
+ struct cdev *diskdev;
+ diskdev = getdiskbyname(path);
+ if (diskdev != NULL)
+ rootdev = diskdev;
+ else
+ printf("setrootbyname failed\n");
+ }
/* If the root device is a type "memory disk", mount RW */
if (rootdev != NULL && devsw(rootdev) != NULL) {
@@ -1321,7 +1340,7 @@ vfs_mountroot_try(char *mountfrom)
mp->mnt_flag &= ~MNT_RDONLY;
}
- error = VFS_MOUNT(mp, NULL, NULL, NULL, curthread);
+ error = VFS_OMOUNT(mp, NULL, NULL, curthread);
done:
if (vfsname != NULL)
@@ -1451,7 +1470,7 @@ getdiskbyname(char *name)
break;
mp->mnt_flag |= MNT_RDONLY;
- error = VFS_NMOUNT(mp, NULL, curthread);
+ error = VFS_MOUNT(mp, curthread);
if (error)
break;
VFS_START(mp, 0, td);
@@ -1479,24 +1498,6 @@ getdiskbyname(char *name)
return (dev);
}
-/*
- * Set rootdev to match (name), given that we expect it to
- * refer to a disk-like device.
- */
-static int
-setrootbyname(char *name)
-{
- struct cdev *diskdev;
-
- diskdev = getdiskbyname(name);
- if (diskdev != NULL) {
- rootdev = diskdev;
- return (0);
- }
-
- return (1);
-}
-
/* Show the struct cdev *for a disk specified by name */
#ifdef DDB
DB_SHOW_COMMAND(disk, db_getdiskbyname)
diff --git a/sys/nfs4client/nfs4_vfsops.c b/sys/nfs4client/nfs4_vfsops.c
index cf730ad..b8e8a32 100644
--- a/sys/nfs4client/nfs4_vfsops.c
+++ b/sys/nfs4client/nfs4_vfsops.c
@@ -120,7 +120,7 @@ static int mountnfs(struct nfs_args *, struct mount *,
struct sockaddr *, char *, char *, struct vnode **,
struct ucred *cred);
static int nfs4_do_setclientid(struct nfsmount *nmp, struct ucred *cred);
-static vfs_mount_t nfs_mount;
+static vfs_omount_t nfs_omount;
static vfs_unmount_t nfs_unmount;
static vfs_root_t nfs_root;
static vfs_statfs_t nfs_statfs;
@@ -131,7 +131,7 @@ static vfs_sync_t nfs_sync;
*/
static struct vfsops nfs_vfsops = {
.vfs_init = nfs4_init,
- .vfs_mount = nfs_mount,
+ .vfs_omount = nfs_omount,
.vfs_root = nfs_root,
.vfs_statfs = nfs_statfs,
.vfs_sync = nfs_sync,
@@ -384,8 +384,7 @@ nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp)
*/
/* ARGSUSED */
static int
-nfs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
- struct thread *td)
+nfs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td)
{
int error;
struct nfs_args args;
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index f6281ac..25b5248 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -104,7 +104,7 @@ static void nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp);
static int mountnfs(struct nfs_args *, struct mount *,
struct sockaddr *, char *, char *, struct vnode **,
struct ucred *cred);
-static vfs_mount_t nfs_mount;
+static vfs_omount_t nfs_omount;
static vfs_unmount_t nfs_unmount;
static vfs_root_t nfs_root;
static vfs_statfs_t nfs_statfs;
@@ -116,7 +116,7 @@ static vfs_sysctl_t nfs_sysctl;
*/
static struct vfsops nfs_vfsops = {
.vfs_init = nfs_init,
- .vfs_mount = nfs_mount,
+ .vfs_omount = nfs_omount,
.vfs_root = nfs_root,
.vfs_statfs = nfs_statfs,
.vfs_sync = nfs_sync,
@@ -667,8 +667,7 @@ nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp)
*/
/* ARGSUSED */
static int
-nfs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
- struct thread *td)
+nfs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td)
{
int error;
struct nfs_args args;
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index fc66ae3..c0298f5 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -338,10 +338,13 @@ struct nfs_public {
* Filesystem configuration information. One of these exists for each
* type of filesystem supported by the kernel. These are searched at
* mount time to identify the requested filesystem.
+ *
+ * XXX: Never change the first two arguments!
*/
struct vfsconf {
- struct vfsops *vfc_vfsops; /* filesystem operations vector */
+ u_int vfc_version; /* ABI version number */
char vfc_name[MFSNAMELEN]; /* filesystem type name */
+ struct vfsops *vfc_vfsops; /* filesystem operations vector */
int vfc_typenum; /* historic filesystem type number */
int vfc_refcount; /* number mounted of this type */
int vfc_flags; /* permanent flags */
@@ -462,8 +465,8 @@ struct mount_args;
struct nameidata;
struct sysctl_req;
-typedef int vfs_mount_t(struct mount *mp, char *path, caddr_t data,
- struct nameidata *ndp, struct thread *td);
+typedef int vfs_omount_t(struct mount *mp, char *path, caddr_t data,
+ struct thread *td);
typedef int vfs_start_t(struct mount *mp, int flags, struct thread *td);
typedef int vfs_unmount_t(struct mount *mp, int mntflags, struct thread *td);
typedef int vfs_root_t(struct mount *mp, struct vnode **vpp, struct thread *td);
@@ -484,13 +487,13 @@ typedef int vfs_uninit_t(struct vfsconf *);
typedef int vfs_extattrctl_t(struct mount *mp, int cmd,
struct vnode *filename_vp, int attrnamespace,
const char *attrname, struct thread *td);
-typedef int vfs_nmount_t(struct mount *mp, struct nameidata *ndp,
- struct thread *td);
+typedef int vfs_mount_t(struct mount *mp, struct thread *td);
typedef int vfs_sysctl_t(struct mount *mp, fsctlop_t op,
struct sysctl_req *req);
struct vfsops {
vfs_mount_t *vfs_mount;
+ vfs_omount_t *vfs_omount;
vfs_start_t *vfs_start;
vfs_unmount_t *vfs_unmount;
vfs_root_t *vfs_root;
@@ -505,13 +508,12 @@ struct vfsops {
vfs_uninit_t *vfs_uninit;
vfs_extattrctl_t *vfs_extattrctl;
/* Additions below are not binary compatible with 5.0 and below. */
- vfs_nmount_t *vfs_nmount;
vfs_sysctl_t *vfs_sysctl;
};
-#define VFS_NMOUNT(MP, NDP, P) (*(MP)->mnt_op->vfs_nmount)(MP, NDP, P)
-#define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
- (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P)
+#define VFS_MOUNT(MP, P) (*(MP)->mnt_op->vfs_mount)(MP, P)
+#define VFS_OMOUNT(MP, PATH, DATA, P) \
+ (*(MP)->mnt_op->vfs_omount)(MP, PATH, DATA, P)
#define VFS_START(MP, FLAGS, P) (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P)
#define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P)
#define VFS_ROOT(MP, VPP, P) (*(MP)->mnt_op->vfs_root)(MP, VPP, P)
@@ -532,10 +534,17 @@ struct vfsops {
#include <sys/module.h>
+/*
+ * Version numbers.
+ */
+#define VFS_VERSION_00 0x19660120
+#define VFS_VERSION VFS_VERSION_00
+
#define VFS_SET(vfsops, fsname, flags) \
static struct vfsconf fsname ## _vfsconf = { \
- .vfc_vfsops = &vfsops, \
+ .vfc_version = VFS_VERSION, \
.vfc_name = #fsname, \
+ .vfc_vfsops = &vfsops, \
.vfc_typenum = -1, \
.vfc_flags = flags, \
}; \
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index 23d76f3..556ad5d 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -69,7 +69,6 @@ int ffs_freefile(struct fs *, struct vnode *, ino_t, int);
int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
void ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t);
int ffs_mountroot(void);
-vfs_mount_t ffs_mount;
int ffs_reallocblks(struct vop_reallocblks_args *);
int ffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t,
ufs2_daddr_t, int, int, struct ucred *, struct buf **);
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 7cdf9f5..8fc3741 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
uma_zone_t uma_inode, uma_ufs1, uma_ufs2;
static int ffs_sbupdate(struct ufsmount *, int);
- int ffs_reload(struct mount *,struct ucred *,struct thread *);
+static int ffs_reload(struct mount *, struct thread *);
static int ffs_mountfs(struct vnode *, struct mount *, struct thread *);
static void ffs_oldfscompat_read(struct fs *, struct ufsmount *,
ufs2_daddr_t);
@@ -77,12 +77,13 @@ static void ffs_ifree(struct ufsmount *ump, struct inode *ip);
static vfs_init_t ffs_init;
static vfs_uninit_t ffs_uninit;
static vfs_extattrctl_t ffs_extattrctl;
+static vfs_omount_t ffs_omount;
static struct vfsops ufs_vfsops = {
.vfs_extattrctl = ffs_extattrctl,
.vfs_fhtovp = ffs_fhtovp,
.vfs_init = ffs_init,
- .vfs_mount = ffs_mount,
+ .vfs_omount = ffs_omount,
.vfs_quotactl = ufs_quotactl,
.vfs_root = ufs_root,
.vfs_start = ufs_start,
@@ -97,7 +98,7 @@ static struct vfsops ufs_vfsops = {
VFS_SET(ufs_vfsops, ufs, 0);
/*
- * ffs_mount
+ * ffs_omount
*
* Called when mounting local physical media
*
@@ -133,13 +134,8 @@ VFS_SET(ufs_vfsops, ufs, 0);
* system call will fail with EFAULT in copyinstr in
* namei() if it is a genuine NULL from the user.
*/
-int
-ffs_mount(mp, path, data, ndp, td)
- struct mount *mp; /* mount struct pointer*/
- char *path; /* path to mount point*/
- caddr_t data; /* arguments to FS specific mount*/
- struct nameidata *ndp; /* mount point credentials*/
- struct thread *td; /* process requesting mount*/
+static int
+ffs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td)
{
size_t size;
struct vnode *devvp, *rootvp;
@@ -148,6 +144,7 @@ ffs_mount(mp, path, data, ndp, td)
struct fs *fs;
int error, flags;
mode_t accessmode;
+ struct nameidata ndp;
if (uma_inode == NULL) {
uma_inode = uma_zcreate("FFS inode",
@@ -236,7 +233,7 @@ ffs_mount(mp, path, data, ndp, td)
vn_finished_write(mp);
}
if ((mp->mnt_flag & MNT_RELOAD) &&
- (error = ffs_reload(mp, ndp->ni_cnd.cn_cred, td)) != 0)
+ (error = ffs_reload(mp, td)) != 0)
return (error);
if (fs->fs_ronly && (mp->mnt_kern_flag & MNTK_WANTRDWR)) {
/*
@@ -310,11 +307,11 @@ ffs_mount(mp, path, data, ndp, td)
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible disk device.
*/
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
- if ((error = namei(ndp)) != 0)
+ NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+ if ((error = namei(&ndp)) != 0)
return (error);
- NDFREE(ndp, NDF_ONLY_PNBUF);
- devvp = ndp->ni_vp;
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
+ devvp = ndp.ni_vp;
if (!vn_isdisk(devvp, &error)) {
vrele(devvp);
return (error);
@@ -385,11 +382,8 @@ ffs_mount(mp, path, data, ndp, td)
* 5) invalidate all cached file data.
* 6) re-read inode data for all active vnodes.
*/
-int
-ffs_reload(mp, cred, td)
- struct mount *mp;
- struct ucred *cred;
- struct thread *td;
+static int
+ffs_reload(struct mount *mp, struct thread *td)
{
struct vnode *vp, *nvp, *devvp;
struct inode *ip;
@@ -407,7 +401,7 @@ ffs_reload(mp, cred, td)
*/
devvp = VFSTOUFS(mp)->um_devvp;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- if (vinvalbuf(devvp, 0, cred, td, 0, 0) != 0)
+ if (vinvalbuf(devvp, 0, td->td_ucred, td, 0, 0) != 0)
panic("ffs_reload: dirty1");
/*
* Only VMIO the backing device if the backing device is a real
@@ -504,7 +498,7 @@ loop:
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
goto loop;
}
- if (vinvalbuf(vp, 0, cred, td, 0, 0))
+ if (vinvalbuf(vp, 0, td->td_ucred, td, 0, 0))
panic("ffs_reload: dirty2");
/*
* Step 6: re-read inode data for all active vnodes.
OpenPOWER on IntegriCloud