summaryrefslogtreecommitdiffstats
path: root/sys/dev/vn
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>1998-09-14 19:56:42 +0000
committersos <sos@FreeBSD.org>1998-09-14 19:56:42 +0000
commit8397655514874e9ac9c02380c3cc1013673ef3e8 (patch)
tree084072c8f496cd1095844d011436b8d56454e3d1 /sys/dev/vn
parent5468fdfd0c4063b52da159a8842649834a85de03 (diff)
downloadFreeBSD-src-8397655514874e9ac9c02380c3cc1013673ef3e8.zip
FreeBSD-src-8397655514874e9ac9c02380c3cc1013673ef3e8.tar.gz
Remove the SLICE code.
This clearly needs alot more thought, and we dont need this to hunt us down in 3.0-RELEASE.
Diffstat (limited to 'sys/dev/vn')
-rw-r--r--sys/dev/vn/vn.c326
1 files changed, 1 insertions, 325 deletions
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 6a55bc5..fe832a0 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -38,7 +38,7 @@
* from: Utah Hdr: vn.c 1.13 94/04/02
*
* from: @(#)vn.c 8.6 (Berkeley) 4/1/94
- * $Id: vn.c,v 1.69 1998/08/23 20:16:28 phk Exp $
+ * $Id: vn.c,v 1.70 1998/09/12 18:46:06 sos Exp $
*/
/*
@@ -84,10 +84,6 @@
#include <sys/diskslice.h>
#include <sys/stat.h>
#include <sys/conf.h>
-#ifdef SLICE
-#include <sys/device.h>
-#include <dev/slice/slice.h>
-#endif /* SLICE */
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
@@ -95,7 +91,6 @@
#include <sys/vnioctl.h>
static d_ioctl_t vnioctl;
-#ifndef SLICE
static d_open_t vnopen;
static d_read_t vnread;
static d_write_t vnwrite;
@@ -115,31 +110,6 @@ static struct cdevsw vn_cdevsw = {
NULL, -1, vndump, vnsize,
D_DISK|D_NOCLUSTERRW, 0, -1 };
-#else /* SLICE */
-
-static sl_h_IO_req_t nvsIOreq; /* IO req downward (to device) */
-static sl_h_ioctl_t nvsioctl; /* ioctl req downward (to device) */
-static sl_h_open_t nvsopen; /* downwards travelling open */
-/*static sl_h_close_t nvsclose; */ /* downwards travelling close */
-static sl_h_dump_t nvsdump; /* core dump req downward */
-
-static struct slice_handler slicetype = {
- "vn",
- 0,
- NULL,
- 0,
- NULL, /* constructor */
- &nvsIOreq,
- &nvsioctl,
- &nvsopen,
- /*&nvsclose*/NULL,
- NULL, /* revoke */
- NULL, /* claim */
- NULL, /* verify */
- NULL, /* upconfig */
- &nvsdump
-};
-#endif
#define vnunit(dev) dkunit(dev)
@@ -152,14 +122,7 @@ static struct slice_handler slicetype = {
struct vn_softc {
int sc_flags; /* flags */
size_t sc_size; /* size of vn */
-#ifdef SLICE
- struct slice *slice;
- struct slicelimits limit;
- int mynor;
- int unit;
-#else
struct diskslices *sc_slices;
-#endif /* SLICE */
struct vnode *sc_vp; /* vnode */
struct ucred *sc_cred; /* credentials */
int sc_maxactive; /* max # of active requests */
@@ -184,7 +147,6 @@ static int vnsetcred (struct vn_softc *vn, struct ucred *cred);
static void vnshutdown (int, void *);
static void vnclear (struct vn_softc *vn);
-#ifndef SLICE
static int
vnclose(dev_t dev, int flags, int mode, struct proc *p)
{
@@ -453,181 +415,6 @@ vnstrategy(struct buf *bp)
}
}
-#else /* SLICE */
-static void
-nvsIOreq(void *private ,struct buf *bp)
-{
- struct vn_softc *vn = private;
- u_int32_t unit = vn->unit;
- register daddr_t bn;
- int error;
- int isvplocked = 0;
- long sz;
- struct uio auio;
- struct iovec aiov;
-
- IFOPT(vn, VN_DEBUG)
- printf("vnstrategy(%p): unit %d\n", bp, unit);
-
- if ((vn->sc_flags & VNF_INITED) == 0) {
- bp->b_error = ENXIO;
- bp->b_flags |= B_ERROR;
- biodone(bp);
- return;
- }
- bn = bp->b_pblkno;
- bp->b_resid = bp->b_bcount;/* XXX best place to set this? */
- sz = howmany(bp->b_bcount, DEV_BSIZE);
- if (bn < 0 || bn + sz > vn->sc_size) {
- if (bn != vn->sc_size) {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- }
- biodone(bp);
- return;
- }
-
- if( (bp->b_flags & B_PAGING) == 0) {
- aiov.iov_base = bp->b_data;
- aiov.iov_len = bp->b_bcount;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = dbtob(bn);
- auio.uio_segflg = UIO_SYSSPACE;
- if( bp->b_flags & B_READ)
- auio.uio_rw = UIO_READ;
- else
- auio.uio_rw = UIO_WRITE;
- auio.uio_resid = bp->b_bcount;
- auio.uio_procp = curproc;
- if (!VOP_ISLOCKED(vn->sc_vp)) {
- isvplocked = 1;
- vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc);
- }
- if( bp->b_flags & B_READ)
- error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred);
- else
- error = VOP_WRITE(vn->sc_vp, &auio, 0, vn->sc_cred);
- if (isvplocked) {
- VOP_UNLOCK(vn->sc_vp, 0, curproc);
- isvplocked = 0;
- }
- bp->b_resid = auio.uio_resid;
-
- if( error )
- bp->b_flags |= B_ERROR;
- biodone(bp);
- } else {
- long bsize, resid;
- off_t byten;
- int flags;
- caddr_t addr;
- struct buf *nbp;
-
- nbp = getvnbuf();
- bzero(nbp, sizeof(struct buf));
- LIST_INIT(&nbp->b_dep);
- byten = dbtob(bn);
- /* This is probably the only time this is RIGHT */
- bsize = vn->sc_vp->v_mount->mnt_stat.f_iosize;
- addr = bp->b_data;
- flags = bp->b_flags | B_CALL;
- for (resid = bp->b_resid; resid; ) {
- struct vnode *vp;
- daddr_t nbn;
- int off, s, nra;
-
- nra = 0;
- if (!VOP_ISLOCKED(vn->sc_vp)) {
- isvplocked = 1;
- vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc);
- }
- error = VOP_BMAP(vn->sc_vp, (daddr_t)(byten / bsize),
- &vp, &nbn, &nra, NULL);
- if (isvplocked) {
- VOP_UNLOCK(vn->sc_vp, 0, curproc);
- isvplocked = 0;
- }
- if (error == 0 && nbn == -1)
- error = EIO;
-
- IFOPT(vn, VN_DONTCLUSTER)
- nra = 0;
-
- off = byten % bsize;
- if (off)
- sz = bsize - off;
- else
- sz = (1 + nra) * bsize;
- if (resid < sz)
- sz = resid;
-
- if (error) {
- bp->b_resid -= (resid - sz);
- bp->b_flags |= B_ERROR;
- biodone(bp);
- putvnbuf(nbp);
- return;
- }
-
- IFOPT(vn,VN_IO)
- printf(
- /* XXX no %qx in kernel. Synthesize it. */
- "vnstrategy: vp %p/%p bn 0x%lx%08lx/0x%lx sz 0x%lx\n",
- (void *)vn->sc_vp, (void *)vp,
- (u_long)(byten >> 32), (u_long)byten,
- (u_long)nbn, sz);
-
- nbp->b_flags = flags;
- nbp->b_bcount = sz;
- nbp->b_bufsize = sz;
- nbp->b_error = 0;
- if (vp->v_type == VBLK || vp->v_type == VCHR)
- nbp->b_dev = vp->v_rdev;
- else
- nbp->b_dev = NODEV;
- nbp->b_data = addr;
- nbp->b_blkno = nbn + btodb(off);
- nbp->b_offset = dbtob(nbn) + off;
- nbp->b_proc = bp->b_proc;
- nbp->b_iodone = vniodone;
- nbp->b_vp = vp;
- nbp->b_rcred = vn->sc_cred; /* XXX crdup? */
- nbp->b_wcred = vn->sc_cred; /* XXX crdup? */
- nbp->b_dirtyoff = bp->b_dirtyoff;
- nbp->b_dirtyend = bp->b_dirtyend;
- nbp->b_validoff = bp->b_validoff;
- nbp->b_validend = bp->b_validend;
-
- if ((nbp->b_flags & B_READ) == 0)
- nbp->b_vp->v_numoutput++;
-
- VOP_STRATEGY(vp, nbp);
-
- s = splbio();
- while ((nbp->b_flags & B_DONE) == 0) {
- nbp->b_flags |= B_WANTED;
- tsleep(nbp, PRIBIO, "vnwait", 0);
- }
- splx(s);
-
- if( nbp->b_flags & B_ERROR) {
- bp->b_flags |= B_ERROR;
- bp->b_resid -= (resid - sz);
- biodone(bp);
- putvnbuf(nbp);
- return;
- }
-
- byten += sz;
- addr += sz;
- resid -= sz;
- }
- biodone(bp);
- putvnbuf(nbp);
- }
-}
-#endif /* SLICE */
void
vniodone( struct buf *bp) {
@@ -645,9 +432,6 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
struct nameidata nd;
int error;
u_long *f;
-#ifdef SLICE
- sh_p tp;
-#endif
IFOPT(vn,VN_FOLLOW)
printf("vnioctl(0x%lx, 0x%lx, %p, 0x%x, %p): unit %d\n",
@@ -663,7 +447,6 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
case VNIOCUCLEAR:
goto vn_specific;
}
-#ifndef SLICE
IFOPT(vn,VN_LABELS) {
if (vn->sc_slices != NULL) {
@@ -678,7 +461,6 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
return (ENOTTY);
}
-#endif
vn_specific:
error = suser(p->p_ucred, &p->p_acflag);
@@ -718,26 +500,6 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
}
vio->vn_size = dbtob(vn->sc_size);
vn->sc_flags |= VNF_INITED;
-#ifdef SLICE
-/*
- * XXX The filesystem blocksize will say 1024
- * for a 8K filesystem. don't know yet how to deal with this,
- * so lie for now.. say 512.
- */
-#if 0
- vn->limit.blksize = vn->sc_vp->v_mount->mnt_stat.f_bsize;
-#else
- vn->limit.blksize = DEV_BSIZE;
-#endif
- vn->slice->limits.blksize = vn->limit.blksize;
- vn->limit.slicesize = vattr.va_size;
- vn->slice->limits.slicesize = vattr.va_size;
- /*
- * We have a media to read/write.
- * Try identify it.
- */
- slice_start_probe(vn->slice); /* this happens asynchronously */
-#else
IFOPT(vn, VN_LABELS) {
/*
* Reopen so that `ds' knows which devices are open.
@@ -750,7 +512,6 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if (error)
vnclear(vn);
}
-#endif
IFOPT(vn, VN_FOLLOW)
printf("vnioctl: SET vp %p size %x\n",
vn->sc_vp, vn->sc_size);
@@ -850,14 +611,8 @@ vnclear(struct vn_softc *vn)
IFOPT(vn, VN_FOLLOW)
printf("vnclear(%p): vp=%p\n", vn, vp);
-#ifdef SLICE
- if (vn->slice->handler_up) {
- (*(vn->slice->handler_up->revoke)) (vn->slice->private_up);
- }
-#else /* SLICE */
if (vn->sc_slices != NULL)
dsgone(&vn->sc_slices);
-#endif
vn->sc_flags &= ~VNF_INITED;
if (vp == (struct vnode *)0)
panic("vnclear: null vp");
@@ -868,7 +623,6 @@ vnclear(struct vn_softc *vn)
vn->sc_size = 0;
}
-#ifndef SLICE
static int
vnsize(dev_t dev)
{
@@ -887,7 +641,6 @@ vndump(dev_t dev)
}
static vn_devsw_installed = 0;
-#endif /* !SLICE */
static void
vn_drvinit(void *unused)
@@ -895,7 +648,6 @@ vn_drvinit(void *unused)
#ifdef DEVFS
int unit;
#endif
-#ifndef SLICE
if(!vn_devsw_installed ) {
if (at_shutdown(&vnshutdown, NULL, SHUTDOWN_POST_SYNC)) {
printf("vn: could not install shutdown hook\n");
@@ -925,84 +677,8 @@ vn_drvinit(void *unused)
"vn%d", unit);
}
#endif
-#else /* SLICE */
- int mynor;
- int unit;
- struct vn_softc *vn;
- char namebuf[64];
- if (at_shutdown(&vnshutdown, NULL, SHUTDOWN_POST_SYNC)) {
- printf("vn: could not install shutdown hook\n");
- return;
- }
- for (unit = 0; unit < NVN; unit++) {
- vn = malloc(sizeof *vn, M_DEVBUF, M_NOWAIT);
- if (!vn)
- return;
- bzero(vn, sizeof *vn);
- vn_softc[unit] = vn;
- vn->unit = unit;
- sprintf(namebuf,"vn%d",vn->unit);
- vn->mynor = dkmakeminor(unit, WHOLE_DISK_SLICE,
- RAW_PART);
- vn->limit.blksize = DEV_BSIZE;
- vn->limit.slicesize = ((u_int64_t)vn->sc_size * DEV_BSIZE);
- sl_make_slice(&slicetype,
- vn,
- &vn->limit,
- &vn->slice,
- namebuf);
- /* Allow full probing */
- vn->slice->probeinfo.typespecific = NULL;
- vn->slice->probeinfo.type = NULL;
- }
-#endif /* SLICE */
}
SYSINIT(vndev, SI_SUB_DRIVERS, SI_ORDER_ANY, vn_drvinit, NULL)
-#ifdef SLICE
-
-static int
-nvsopen(void *private, int flags, int mode, struct proc *p)
-{
- struct vn_softc *vn;
-
- vn = private;
-
- IFOPT(vn, VN_FOLLOW)
- printf("vnopen(0x%lx, 0x%x, 0x%x, %p)\n",
- makedev(0,vn->mynor) , flags, mode, p);
- return (0);
-}
-
-#if 0
-static void
-nvsclose(void *private, int flags, int mode, struct proc *p)
-{
- struct vn_softc *vn;
-
- vn = private;
- IFOPT(vn, VN_FOLLOW)
- printf("vnclose(0x%lx, 0x%x, 0x%x, %p)\n",
- makedev(0,vn->mynor) , flags, mode, p);
- return;
-}
-#endif
-
-static int
-nvsioctl( void *private, u_long cmd, caddr_t addr, int flag, struct proc *p)
-{
- struct vn_softc *vn;
-
- vn = private;
-
- return(vnioctl(makedev(0,vn->mynor), cmd, addr, flag, p));
-}
-
-static int
-nvsdump(void *private, int32_t blkoff, int32_t blkcnt)
-{
- return (ENODEV);
-}
-#endif
#endif
OpenPOWER on IntegriCloud