diff options
author | 1997-10-06 20:19:26 +0000 | |
---|---|---|
committer | 1997-10-06 20:19:26 +0000 | |
commit | f6d35f956ac60c4dbcc91b018b2bcefd71ad933f (patch) | |
tree | 918af077b7c363fb7d19243c4ecb7f0165b3bc65 /sys/miscfs/specfs | |
parent | Build generic and genericsbc kernels into snapshot and distribute them (diff) | |
download | wireguard-openbsd-f6d35f956ac60c4dbcc91b018b2bcefd71ad933f.tar.xz wireguard-openbsd-f6d35f956ac60c4dbcc91b018b2bcefd71ad933f.zip |
back out vfs lite2 till after 2.2
Diffstat (limited to 'sys/miscfs/specfs')
-rw-r--r-- | sys/miscfs/specfs/spec_vnops.c | 159 | ||||
-rw-r--r-- | sys/miscfs/specfs/specdev.h | 20 |
2 files changed, 43 insertions, 136 deletions
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index c9d59179f98..995870d11d0 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.10 1997/10/06 15:19:12 csapuntz Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.11 1997/10/06 20:20:37 deraadt Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -79,7 +79,6 @@ struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_lease_desc, spec_lease_check }, /* lease */ { &vop_ioctl_desc, spec_ioctl }, /* ioctl */ { &vop_select_desc, spec_select }, /* select */ - { &vop_revoke_desc, spec_revoke }, /* revoke */ { &vop_mmap_desc, spec_mmap }, /* mmap */ { &vop_fsync_desc, spec_fsync }, /* fsync */ { &vop_seek_desc, spec_seek }, /* seek */ @@ -144,13 +143,8 @@ spec_open(v) struct ucred *a_cred; struct proc *a_p; } */ *ap = v; - struct proc *p = ap->a_p; - struct vnode *vp = ap->a_vp; -#if 0 - struct vnode *bvp; - dev_t bdev; -#endif - dev_t dev = (dev_t)vp->v_rdev; + struct vnode *bvp, *vp = ap->a_vp; + dev_t bdev, dev = (dev_t)vp->v_rdev; register int maj = major(dev); int error; @@ -178,7 +172,6 @@ spec_open(v) * devices whose corresponding block devices are * currently mounted. */ -#if 0 if (securelevel >= 1) { if ((bdev = chrtoblk(dev)) != NODEV && vfinddev(bdev, VBLK, &bvp) && @@ -188,13 +181,12 @@ spec_open(v) if (iskmemdev(dev)) return (EPERM); } -#endif } if (cdevsw[maj].d_type == D_TTY) vp->v_flag |= VISTTY; - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp); error = (*cdevsw[maj].d_open)(dev, ap->a_mode, S_IFCHR, ap->a_p); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_LOCK(vp); return (error); case VBLK: @@ -263,10 +255,10 @@ spec_read(v) switch (vp->v_type) { case VCHR: - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp); error = (*cdevsw[major(vp->v_rdev)].d_read) (vp->v_rdev, uio, ap->a_ioflag); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_LOCK(vp); return (error); case VBLK: @@ -314,19 +306,6 @@ spec_read(v) /* NOTREACHED */ } -int -spec_inactive(v) - void *v; -{ - struct vop_inactive_args /* { - struct vnode *a_vp; - struct proc *a_p; - } */ *ap = v; - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} - /* * Vnode op for write */ @@ -362,10 +341,10 @@ spec_write(v) switch (vp->v_type) { case VCHR: - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp); error = (*cdevsw[major(vp->v_rdev)].d_write) (vp->v_rdev, uio, ap->a_ioflag); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_LOCK(vp); return (error); case VBLK: @@ -535,74 +514,6 @@ loop: /* * Just call the device strategy routine */ -int fs_read[16], fs_write[16]; - -int cur_found[10]; - -int fs_bwrite[64][10]; -int fs_bwrite_cnt[64]; -int num_found; - -int num_levels = 4; -#include <machine/cpu.h> -#include <machine/pcb.h> - -int find_stack(int); - -int find_stack(int levels) - -{ - struct pcb stack; - int *eip, *ebp; - - savectx(&stack); - ebp = (int *)stack.pcb_ebp; - eip = (int *) *(ebp + 1); - - while ((int)ebp > 0xf0000000 && levels--) { - eip = (int *) *(ebp + 1); - - ebp = (int *) *ebp; - } - - return ((int)eip); -} - -void track_write __P((void)); - -void track_write(void) - -{ - int idx, cnt; - - for (idx = 0; idx < 10; idx++) { - cur_found[idx] = find_stack(idx + num_levels); - } - - for (cnt = 0; cnt < num_found; cnt++) { - for (idx = 0; idx < 10; idx++) { - if (fs_bwrite[cnt][idx] != cur_found[idx]) - goto next_iter; - } - - fs_bwrite_cnt[cnt]++; - break; - next_iter: - } - - if ((cnt == num_found) && - (num_found != 64)) { - for (idx = 0; idx < 10; idx++) { - fs_bwrite[num_found][idx] = cur_found[idx]; - } - - fs_bwrite_cnt[num_found] = 1; - num_found++; - } - - return; -} - int spec_strategy(v) void *v; @@ -610,31 +521,8 @@ spec_strategy(v) struct vop_strategy_args /* { struct buf *a_bp; } */ *ap = v; - struct buf *bp; - - int maj = major(ap->a_bp->b_dev); - - if ((maj >= 0) && (maj < 16)) { - if (ap->a_bp->b_flags & B_READ) - fs_read[maj]++; - else { - fs_write[maj]++; - if (maj == 4) - track_write(); - - } - } - -#if 0 - assert (!(flags & (B_DELWRI | B_DONE))); -#endif - bp = ap->a_bp; - - if (LIST_FIRST(&bp->b_dep) != NULL && bioops.io_start) - (*bioops.io_start)(bp); - - (*bdevsw[maj].d_strategy)(ap->a_bp); + (*bdevsw[major(ap->a_bp->b_dev)].d_strategy)(ap->a_bp); return (0); } @@ -650,16 +538,33 @@ spec_bmap(v) daddr_t a_bn; struct vnode **a_vpp; daddr_t *a_bnp; - int *a_runp; } */ *ap = v; if (ap->a_vpp != NULL) *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); +} + +/* + * At the moment we do not do any locking. + */ +/* ARGSUSED */ +int +spec_lock(v) + void *v; +{ + + return (0); +} + +/* ARGSUSED */ +int +spec_unlock(v) + void *v; +{ + return (0); } @@ -716,9 +621,7 @@ spec_close(v) * we must invalidate any in core blocks, so that * we can, for instance, change floppy disks. */ - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, ap->a_p); error = vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 0, 0); - VOP_UNLOCK(vp, 0, ap->a_p); if (error) return (error); /* diff --git a/sys/miscfs/specfs/specdev.h b/sys/miscfs/specfs/specdev.h index 94f98ac3c70..23d90b7c891 100644 --- a/sys/miscfs/specfs/specdev.h +++ b/sys/miscfs/specfs/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.4 1997/10/06 15:19:13 csapuntz Exp $ */ +/* $OpenBSD: specdev.h,v 1.5 1997/10/06 20:20:39 deraadt Exp $ */ /* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */ /* @@ -44,7 +44,7 @@ struct specinfo { struct vnode **si_hashchain; struct vnode *si_specnext; - struct mount *si_mountpoint; + long si_flags; dev_t si_rdev; struct lockf *si_lockf; }; @@ -54,10 +54,15 @@ struct specinfo { #define v_rdev v_specinfo->si_rdev #define v_hashchain v_specinfo->si_hashchain #define v_specnext v_specinfo->si_specnext -#define v_specmountpoint v_specinfo->si_mountpoint +#define v_specflags v_specinfo->si_flags #define v_speclockf v_specinfo->si_lockf /* + * Flags for specinfo + */ +#define SI_MOUNTEDON 0x0001 /* block special device is mounted on */ + +/* * Special device management */ #define SPECHSZ 64 @@ -108,14 +113,14 @@ int spec_fsync __P((void *)); #define spec_readdir spec_badop #define spec_readlink spec_badop #define spec_abortop spec_badop -int spec_inactive __P((void *)); +#define spec_inactive nullop #define spec_reclaim nullop -#define spec_lock vop_nolock -#define spec_unlock vop_nounlock -#define spec_islocked vop_noislocked +int spec_lock __P((void *)); +int spec_unlock __P((void *)); int spec_bmap __P((void *)); int spec_strategy __P((void *)); int spec_print __P((void *)); +#define spec_islocked nullop int spec_pathconf __P((void *)); int spec_advlock __P((void *)); #define spec_blkatoff spec_badop @@ -125,4 +130,3 @@ int spec_advlock __P((void *)); #define spec_truncate nullop #define spec_update nullop #define spec_bwrite vn_bwrite -#define spec_revoke vop_revoke |