diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1997-10-06 15:27:41 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1997-10-06 15:27:41 +0000 |
commit | 62c64950f8e658fa60106b4d32e70ae3b6156d0d (patch) | |
tree | 744cdeb111ee67810449481a1420174c49e0ef8d /sys/ufs/mfs | |
parent | cc87020169150a242c9019d00234c378942f5e88 (diff) |
VFS Lite2 Changes
Diffstat (limited to 'sys/ufs/mfs')
-rw-r--r-- | sys/ufs/mfs/mfs_extern.h | 6 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vfsops.c | 65 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vnops.c | 15 | ||||
-rw-r--r-- | sys/ufs/mfs/mfsnode.h | 8 |
4 files changed, 41 insertions, 53 deletions
diff --git a/sys/ufs/mfs/mfs_extern.h b/sys/ufs/mfs/mfs_extern.h index bd14c23226d..3616acedf76 100644 --- a/sys/ufs/mfs/mfs_extern.h +++ b/sys/ufs/mfs/mfs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_extern.h,v 1.2 1996/02/27 07:15:46 niklas Exp $ */ +/* $OpenBSD: mfs_extern.h,v 1.3 1997/10/06 15:27:12 csapuntz Exp $ */ /* $NetBSD: mfs_extern.h,v 1.4 1996/02/09 22:31:27 christos Exp $ */ /*- @@ -43,6 +43,7 @@ struct proc; struct statfs; struct ucred; struct vnode; +struct vfsconf; __BEGIN_DECLS /* mfs_vfsops.c */ @@ -53,7 +54,7 @@ int mfs_mount __P((struct mount *, char *, caddr_t, int mfs_start __P((struct mount *, int, struct proc *)); int mfs_statfs __P((struct mount *, struct statfs *, struct proc *)); -void mfs_init __P((void)); +int mfs_init __P((struct vfsconf *)); /* mfs_vnops.c */ int mfs_open __P((void *)); @@ -65,6 +66,7 @@ int mfs_close __P((void *)); int mfs_inactive __P((void *)); int mfs_reclaim __P((void *)); int mfs_print __P((void *)); +#define mfs_revoke vop_revoke int mfs_badop __P((void *)); __END_DECLS diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 577325fe95b..dbd32e6ea2f 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vfsops.c,v 1.2 1996/02/27 07:15:47 niklas Exp $ */ +/* $OpenBSD: mfs_vfsops.c,v 1.3 1997/10/06 15:27:12 csapuntz Exp $ */ /* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */ /* @@ -69,7 +69,6 @@ extern int (**mfs_vnodeop_p) __P((void *)); * mfs vfs operations. */ struct vfsops mfs_vfsops = { - MOUNT_MFS, mfs_mount, mfs_start, ffs_unmount, @@ -81,37 +80,31 @@ struct vfsops mfs_vfsops = { ffs_fhtovp, ffs_vptofh, mfs_init, + ffs_sysctl }; /* * Called by main() when mfs is going to be mounted as root. - * - * Name is updated by mount(8) after booting. */ -#define ROOTNAME "mfs_root" int mfs_mountroot() { extern struct vnode *rootvp; register struct fs *fs; - register struct mount *mp; + struct mount *mp; struct proc *p = curproc; /* XXX */ struct ufsmount *ump; struct mfsnode *mfsp; - size_t size; int error; - /* - * Get vnodes for swapdev and rootdev. - */ - if (bdevvp(swapdev, &swapdev_vp) || bdevvp(rootdev, &rootvp)) - panic("mfs_mountroot: can't setup bdevvp's"); - - mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); - bzero((char *)mp, (u_long)sizeof(struct mount)); - mp->mnt_op = &mfs_vfsops; - mp->mnt_flag = MNT_RDONLY; + if ((error = bdevvp(swapdev, &swapdev_vp)) || + (error = bdevvp(rootdev, &rootvp))) { + printf("mfs_mountroot: can't setup bdevvp's"); + return (error); + } + if ((error = vfs_rootmountalloc("mfs", "mfs_root", &mp)) != 0) + return (error); mfsp = malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK); rootvp->v_data = mfsp; rootvp->v_op = mfs_vnodeop_p; @@ -122,28 +115,20 @@ mfs_mountroot() mfsp->mfs_pid = p->p_pid; mfsp->mfs_buflist = (struct buf *)0; if ((error = ffs_mountfs(rootvp, mp, p)) != 0) { + mp->mnt_vfc->vfc_refcount--; + vfs_unbusy(mp, p); free(mp, M_MOUNT); free(mfsp, M_MFSNODE); return (error); } - if ((error = vfs_lock(mp)) != 0) { - (void)ffs_unmount(mp, 0, p); - free(mp, M_MOUNT); - free(mfsp, M_MFSNODE); - return (error); - } + simple_lock(&mountlist_slock); CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - mp->mnt_vnodecovered = NULLVP; + simple_unlock(&mountlist_slock); ump = VFSTOUFS(mp); fs = ump->um_fs; - bzero(fs->fs_fsmnt, sizeof(fs->fs_fsmnt)); - fs->fs_fsmnt[0] = '/'; - bcopy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname, MNAMELEN); - (void) copystr(ROOTNAME, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, - &size); - bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + (void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0); (void)ffs_statfs(mp, &mp->mnt_stat, p); - vfs_unlock(mp); + vfs_unbusy(mp, p); inittodr((time_t)0); return (0); } @@ -207,10 +192,7 @@ mfs_mount(mp, path, data, ndp, p) flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; - if (vfs_busy(mp)) - return (EBUSY); error = ffs_flushfiles(mp, flags, p); - vfs_unbusy(mp); if (error) return (error); } @@ -272,7 +254,6 @@ mfs_start(mp, flags, p) register struct mfsnode *mfsp = VTOMFS(vp); register struct buf *bp; register caddr_t base; - int error = 0; base = mfsp->mfs_baseoff; while (mfsp->mfs_buflist != (struct buf *)-1) { @@ -289,13 +270,11 @@ mfs_start(mp, flags, p) * otherwise we will loop here, as tsleep will always return * EINTR/ERESTART. */ - if ((error = tsleep((caddr_t)vp, mfs_pri, "mfsidl", 0)) != 0) { - DOIO(); - if (dounmount(mp, 0, p) != 0) - CLRSIG(p, CURSIG(p)); - } + if (tsleep((caddr_t)vp, mfs_pri, "mfsidl", 0) && + dounmount(mp, 0, p) != 0) + CLRSIG(p, CURSIG(p)); } - return (error); + return (0); } /* @@ -311,10 +290,10 @@ mfs_statfs(mp, sbp, p) error = ffs_statfs(mp, sbp, p); #ifdef COMPAT_09 - sbp->f_type = 3; + sbp->f_type = mp->mnt_vfc->vfc_typenum; #else sbp->f_type = 0; #endif - strncpy(&sbp->f_fstypename[0], mp->mnt_op->vfs_name, MFSNAMELEN); + strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); return (error); } diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c index 63b20a029bf..84a5ed3d368 100644 --- a/sys/ufs/mfs/mfs_vnops.c +++ b/sys/ufs/mfs/mfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vnops.c,v 1.4 1996/04/21 22:32:49 deraadt Exp $ */ +/* $OpenBSD: mfs_vnops.c,v 1.5 1997/10/06 15:27:13 csapuntz Exp $ */ /* $NetBSD: mfs_vnops.c,v 1.8 1996/03/17 02:16:32 christos Exp $ */ /* @@ -72,6 +72,7 @@ struct vnodeopv_entry_desc mfs_vnodeop_entries[] = { { &vop_write_desc, mfs_write }, /* write */ { &vop_ioctl_desc, mfs_ioctl }, /* ioctl */ { &vop_select_desc, mfs_select }, /* select */ + { &vop_revoke_desc, mfs_revoke }, /* revoke */ { &vop_mmap_desc, mfs_mmap }, /* mmap */ { &vop_fsync_desc, spec_fsync }, /* fsync */ { &vop_seek_desc, mfs_seek }, /* seek */ @@ -231,6 +232,9 @@ mfs_bmap(v) *ap->a_vpp = ap->a_vp; if (ap->a_bnp != NULL) *ap->a_bnp = ap->a_bn; + if (ap->a_runp != NULL) + *ap->a_runp = 0; + return (0); } @@ -294,12 +298,14 @@ mfs_inactive(v) { struct vop_inactive_args /* { struct vnode *a_vp; + struct proc *a_p; } */ *ap = v; register struct mfsnode *mfsp = VTOMFS(ap->a_vp); if (mfsp->mfs_buflist && mfsp->mfs_buflist != (struct buf *)(-1)) panic("mfs_inactive: not inactive (mfs_buflist %p)", mfsp->mfs_buflist); + VOP_UNLOCK(ap->a_vp, 0, ap->a_p); return (0); } @@ -352,8 +358,9 @@ mfs_badop(v) /* * Memory based filesystem initialization. */ -void -mfs_init() +int +mfs_init(vfsp) + struct vfsconf *vfsp; { - + return (0); } diff --git a/sys/ufs/mfs/mfsnode.h b/sys/ufs/mfs/mfsnode.h index d37f7ba4e68..29c290c4e09 100644 --- a/sys/ufs/mfs/mfsnode.h +++ b/sys/ufs/mfs/mfsnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfsnode.h,v 1.3 1996/06/11 03:25:15 tholo Exp $ */ +/* $OpenBSD: mfsnode.h,v 1.4 1997/10/06 15:27:13 csapuntz Exp $ */ /* $NetBSD: mfsnode.h,v 1.3 1996/02/09 22:31:31 christos Exp $ */ /* @@ -76,9 +76,9 @@ struct mfsnode { #define mfs_readdir mfs_badop #define mfs_readlink mfs_badop #define mfs_abortop mfs_badop -#define mfs_lock nullop -#define mfs_unlock nullop -#define mfs_islocked nullop +#define mfs_lock vop_nolock +#define mfs_unlock vop_nounlock +#define mfs_islocked vop_noislocked #define mfs_pathconf mfs_badop #define mfs_advlock mfs_badop #define mfs_blkatoff mfs_badop |