projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make kernel includes standard
[unix-history]
/
usr
/
src
/
sys
/
dev
/
vn.c
diff --git
a/usr/src/sys/dev/vn.c
b/usr/src/sys/dev/vn.c
index
d388b1e
..
b1f1655
100644
(file)
--- a/
usr/src/sys/dev/vn.c
+++ b/
usr/src/sys/dev/vn.c
@@
-9,87
+9,92
@@
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * from: Utah $Hdr: fd.c 1.
1 90/07/09
$
+ * from: Utah $Hdr: fd.c 1.
3 89/12/03
$
*
*
- * @(#)vn.c 7.4 (Berkeley) %G%
+ * @(#)vn.c 7.
1
4 (Berkeley) %G%
*/
/*
*/
/*
- * CURRENTLY BROKEN; the name "fd" collides with /dev/fd/xxx.
- * This would need to be converted to the new proc/user layout as well.
- */
-/*
- * File (vnode) disk driver.
+ * Vnode disk driver.
*
*
- * Block/character interface to a vnode. Note that this uses the
- * VOP_BMAP/VOP_STRATEGY interface to the vnode instead of a simple
- * VOP_RDWR. We do this to avoid distorting the local buffer cache.
+ * Block/character interface to a vnode. Allows one to treat a file
+ * as a disk (e.g. build a filesystem in it, mount it, etc.).
*
*
- * NOTE: There is a security issue involved with this driver.
+ * NOTE 1: This uses the VOP_BMAP/VOP_STRATEGY interface to the vnode
+ * instead of a simple VOP_RDWR. We do this to avoid distorting the
+ * local buffer cache.
+ *
+ * NOTE 2: There is a security issue involved with this driver.
* Once mounted all access to the contents of the "mapped" file via
* the special file is controlled by the permissions on the special
* file, the protection of the mapped file is ignored (effectively,
* by using root credentials in all transactions).
*/
* Once mounted all access to the contents of the "mapped" file via
* the special file is controlled by the permissions on the special
* file, the protection of the mapped file is ignored (effectively,
* by using root credentials in all transactions).
*/
-#include "fd.h"
-#if NFD > 0
-
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/buf.h"
-#include "sys/errno.h"
-#include "sys/dkstat.h"
-#include "sys/ioctl.h"
-#include "sys/user.h"
-#include "sys/vfs.h"
-#include "sys/vnode.h"
-#include "sys/file.h"
-#include "sys/uio.h"
-#include "sys/malloc.h"
-
-#include "fdioctl.h"
+#include "vn.h"
+#if NVN > 0
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/namei.h>
+#include <sys/proc.h>
+#include <sys/errno.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/malloc.h>
+#include <sys/ioctl.h>
+#include <sys/mount.h>
+#include <sys/vnode.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+
+#include <miscfs/specfs/specdev.h>
+
+#include <dev/vnioctl.h>
#ifdef DEBUG
#ifdef DEBUG
-int
fd
debug = 0x00;
-#define
F
DB_FOLLOW 0x01
-#define
F
DB_INIT 0x02
-#define
F
DB_IO 0x04
+int
vn
debug = 0x00;
+#define
V
DB_FOLLOW 0x01
+#define
V
DB_INIT 0x02
+#define
V
DB_IO 0x04
#endif
#endif
-struct buf
fdbuf[NFD
];
-struct buf
fdtab[NFD
];
+struct buf
vnbuf[NVN
];
+struct buf
vntab[NVN
];
#define b_cylin b_resid
#define b_cylin b_resid
-#define
fd
unit(x) ((minor(x) >> 3) & 0x7) /* for consistency */
+#define
vn
unit(x) ((minor(x) >> 3) & 0x7) /* for consistency */
-#define get
fd
buf() \
+#define get
vn
buf() \
((struct buf *)malloc(sizeof(struct buf), M_DEVBUF, M_WAITOK))
((struct buf *)malloc(sizeof(struct buf), M_DEVBUF, M_WAITOK))
-#define put
fd
buf(bp) \
+#define put
vn
buf(bp) \
free((caddr_t)(bp), M_DEVBUF)
free((caddr_t)(bp), M_DEVBUF)
-struct
fd
_softc {
+struct
vn
_softc {
int sc_flags; /* flags */
int sc_flags; /* flags */
- size_t sc_size; /* size of
fd
*/
+ size_t sc_size; /* size of
vn
*/
struct vnode *sc_vp; /* vnode */
struct ucred *sc_cred; /* credentials */
int sc_maxactive; /* max # of active requests */
struct vnode *sc_vp; /* vnode */
struct ucred *sc_cred; /* credentials */
int sc_maxactive; /* max # of active requests */
-}
fd_softc[NFD
];
+}
vn_softc[NVN
];
/* sc_flags */
/* sc_flags */
-#define
FD
F_ALIVE 0x01
-#define
FD
F_INITED 0x02
+#define
VN
F_ALIVE 0x01
+#define
VN
F_INITED 0x02
-fdopen(dev, flags)
+int
+vnopen(dev, flags, mode, p)
dev_t dev;
dev_t dev;
+ int flags, mode;
+ struct proc *p;
{
{
- int unit =
fd
unit(dev);
+ int unit =
vn
unit(dev);
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_FOLLOW)
- printf("
fdopen(%x, %x)\n", dev, flags
);
+ if (
vndebug & V
DB_FOLLOW)
+ printf("
vnopen(%x, %x, %x, %x)\n", dev, flags, mode, p
);
#endif
#endif
- if (unit >= N
FD
)
+ if (unit >= N
VN
)
return(ENXIO);
return(0);
}
return(ENXIO);
return(0);
}
@@
-99,40
+104,40
@@
fdopen(dev, flags)
* Note that this driver can only be used for swapping over NFS on the hp
* since nfs_strategy on the vax cannot handle u-areas and page tables.
*/
* Note that this driver can only be used for swapping over NFS on the hp
* since nfs_strategy on the vax cannot handle u-areas and page tables.
*/
-
fd
strategy(bp)
+
vn
strategy(bp)
register struct buf *bp;
{
register struct buf *bp;
{
- int unit =
fd
unit(bp->b_dev);
- register struct
fd_softc *fs = &fd
_softc[unit];
+ int unit =
vn
unit(bp->b_dev);
+ register struct
vn_softc *vn = &vn
_softc[unit];
register struct buf *nbp;
register int bn, bsize, resid;
register caddr_t addr;
int sz, flags;
register struct buf *nbp;
register int bn, bsize, resid;
register caddr_t addr;
int sz, flags;
- extern
int fd
iodone();
+ extern
void vn
iodone();
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_FOLLOW)
- printf("
fd
strategy(%x): unit %d\n", bp, unit);
+ if (
vndebug & V
DB_FOLLOW)
+ printf("
vn
strategy(%x): unit %d\n", bp, unit);
#endif
#endif
- if ((
fs->sc_flags & FD
F_INITED) == 0) {
+ if ((
vn->sc_flags & VN
F_INITED) == 0) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
- iodone(bp);
+
b
iodone(bp);
return;
}
bn = bp->b_blkno;
sz = howmany(bp->b_bcount, DEV_BSIZE);
bp->b_resid = bp->b_bcount;
return;
}
bn = bp->b_blkno;
sz = howmany(bp->b_bcount, DEV_BSIZE);
bp->b_resid = bp->b_bcount;
- if (bn < 0 || bn + sz >
fs
->sc_size) {
- if (bn !=
fs
->sc_size) {
+ if (bn < 0 || bn + sz >
vn
->sc_size) {
+ if (bn !=
vn
->sc_size) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
}
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
}
- iodone(bp);
+
b
iodone(bp);
return;
}
bn = dbtob(bn);
return;
}
bn = dbtob(bn);
- bsize =
fs->sc_vp->v_vfsp->vfs_b
size;
+ bsize =
vn->sc_vp->v_mount->mnt_stat.f_io
size;
addr = bp->b_un.b_addr;
flags = bp->b_flags | B_CALL;
for (resid = bp->b_resid; resid; resid -= sz) {
addr = bp->b_un.b_addr;
flags = bp->b_flags | B_CALL;
for (resid = bp->b_resid; resid; resid -= sz) {
@@
-140,24
+145,27
@@
fdstrategy(bp)
daddr_t nbn;
int off, s;
daddr_t nbn;
int off, s;
- nbp = get
fd
buf();
+ nbp = get
vn
buf();
off = bn % bsize;
off = bn % bsize;
- sz =
MIN
(bsize - off, resid);
- (void) VOP_BMAP(
fs->sc_vp, bn / bsize, &vp, &nbn
);
+ sz =
min
(bsize - off, resid);
+ (void) VOP_BMAP(
vn->sc_vp, bn / bsize, &vp, &nbn, NULL
);
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_IO)
- printf("
fdstrategy: vp %x/%x bn %x/%x dev
%x\n",
-
fs->sc_vp, vp, bn, nbn, vp->v_rdev
);
+ if (
vndebug & V
DB_IO)
+ printf("
vnstrategy: vp %x/%x bn %x/
%x\n",
+
vn->sc_vp, vp, bn, nbn
);
#endif
nbp->b_flags = flags;
nbp->b_bcount = sz;
nbp->b_bufsize = bp->b_bufsize;
nbp->b_error = 0;
#endif
nbp->b_flags = flags;
nbp->b_bcount = sz;
nbp->b_bufsize = bp->b_bufsize;
nbp->b_error = 0;
- nbp->b_dev = vp->v_rdev;
+ if (vp->v_type == VBLK || vp->v_type == VCHR)
+ nbp->b_dev = vp->v_rdev;
+ else
+ nbp->b_dev = NODEV;
nbp->b_un.b_addr = addr;
nbp->b_blkno = nbn + btodb(off);
nbp->b_proc = bp->b_proc;
nbp->b_un.b_addr = addr;
nbp->b_blkno = nbn + btodb(off);
nbp->b_proc = bp->b_proc;
- nbp->b_iodone =
fd
iodone;
+ nbp->b_iodone =
vn
iodone;
nbp->b_vp = vp;
nbp->b_pfcent = (int) bp; /* XXX */
/*
nbp->b_vp = vp;
nbp->b_pfcent = (int) bp; /* XXX */
/*
@@
-165,10
+173,10
@@
fdstrategy(bp)
*/
nbp->b_cylin = nbp->b_blkno;
s = splbio();
*/
nbp->b_cylin = nbp->b_blkno;
s = splbio();
- disksort(&
fd
tab[unit], nbp);
- if (
fdtab[unit].b_active < fs
->sc_maxactive) {
-
fd
tab[unit].b_active++;
-
fd
start(unit);
+ disksort(&
vn
tab[unit], nbp);
+ if (
vntab[unit].b_active < vn
->sc_maxactive) {
+
vn
tab[unit].b_active++;
+
vn
start(unit);
}
splx(s);
bn += sz;
}
splx(s);
bn += sz;
@@
-182,121
+190,127
@@
fdstrategy(bp)
* to an NFS file. This places the burden on the client rather than the
* server.
*/
* to an NFS file. This places the burden on the client rather than the
* server.
*/
-
fd
start(unit)
+
vn
start(unit)
{
{
- register struct
fd_softc *fs = &fd
_softc[unit];
+ register struct
vn_softc *vn = &vn
_softc[unit];
register struct buf *bp;
/*
* Dequeue now since lower level strategy routine might
* queue using same links
*/
register struct buf *bp;
/*
* Dequeue now since lower level strategy routine might
* queue using same links
*/
- bp =
fd
tab[unit].b_actf;
-
fd
tab[unit].b_actf = bp->b_actf;
+ bp =
vn
tab[unit].b_actf;
+
vn
tab[unit].b_actf = bp->b_actf;
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_IO)
- printf("
fd
start(%d): bp %x vp %x blkno %x addr %x cnt %x\n",
+ if (
vndebug & V
DB_IO)
+ printf("
vn
start(%d): bp %x vp %x blkno %x addr %x cnt %x\n",
unit, bp, bp->b_vp, bp->b_blkno, bp->b_un.b_addr,
bp->b_bcount);
#endif
VOP_STRATEGY(bp);
}
unit, bp, bp->b_vp, bp->b_blkno, bp->b_un.b_addr,
bp->b_bcount);
#endif
VOP_STRATEGY(bp);
}
-fdiodone(bp)
+void
+vniodone(bp)
register struct buf *bp;
{
register struct buf *pbp = (struct buf *)bp->b_pfcent; /* XXX */
register struct buf *bp;
{
register struct buf *pbp = (struct buf *)bp->b_pfcent; /* XXX */
- register int unit =
fd
unit(pbp->b_dev);
+ register int unit =
vn
unit(pbp->b_dev);
int s;
s = splbio();
#ifdef DEBUG
int s;
s = splbio();
#ifdef DEBUG
- if (
fddebug & F
DB_IO)
- printf("
fd
iodone(%d): bp %x vp %x blkno %x addr %x cnt %x\n",
+ if (
vndebug & V
DB_IO)
+ printf("
vn
iodone(%d): bp %x vp %x blkno %x addr %x cnt %x\n",
unit, bp, bp->b_vp, bp->b_blkno, bp->b_un.b_addr,
bp->b_bcount);
#endif
if (bp->b_error) {
#ifdef DEBUG
unit, bp, bp->b_vp, bp->b_blkno, bp->b_un.b_addr,
bp->b_bcount);
#endif
if (bp->b_error) {
#ifdef DEBUG
- if (
fddebug & F
DB_IO)
- printf("
fd
iodone: bp %x error %d\n", bp, bp->b_error);
+ if (
vndebug & V
DB_IO)
+ printf("
vn
iodone: bp %x error %d\n", bp, bp->b_error);
#endif
pbp->b_flags |= B_ERROR;
#endif
pbp->b_flags |= B_ERROR;
- pbp->b_error =
geterror
(bp);
+ pbp->b_error =
biowait
(bp);
}
pbp->b_resid -= bp->b_bcount;
}
pbp->b_resid -= bp->b_bcount;
- put
fd
buf(bp);
+ put
vn
buf(bp);
if (pbp->b_resid == 0) {
#ifdef DEBUG
if (pbp->b_resid == 0) {
#ifdef DEBUG
- if (
fddebug & F
DB_IO)
- printf("
fd
iodone: pbp %x iodone\n", pbp);
+ if (
vndebug & V
DB_IO)
+ printf("
vn
iodone: pbp %x iodone\n", pbp);
#endif
#endif
- iodone(pbp);
+
b
iodone(pbp);
}
}
- if (
fd
tab[unit].b_actf)
-
fd
start(unit);
+ if (
vn
tab[unit].b_actf)
+
vn
start(unit);
else
else
-
fd
tab[unit].b_active--;
+
vn
tab[unit].b_active--;
splx(s);
}
splx(s);
}
-
fdread(dev, uio
)
+
vnread(dev, uio, flags, p
)
dev_t dev;
struct uio *uio;
dev_t dev;
struct uio *uio;
+ int flags;
+ struct proc *p;
{
{
- register int unit =
fd
unit(dev);
+ register int unit =
vn
unit(dev);
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_FOLLOW)
- printf("
fdread(%x, %x)\n", dev, uio
);
+ if (
vndebug & V
DB_FOLLOW)
+ printf("
vnread(%x, %x, %x, %x)\n", dev, uio, flags, p
);
#endif
#endif
- return(physio(
fdstrategy, &fd
buf[unit], dev, B_READ, minphys, uio));
+ return(physio(
vnstrategy, &vn
buf[unit], dev, B_READ, minphys, uio));
}
}
-
fdwrite(dev, uio
)
+
vnwrite(dev, uio, flags, p
)
dev_t dev;
struct uio *uio;
dev_t dev;
struct uio *uio;
+ int flags;
+ struct proc *p;
{
{
- register int unit =
fd
unit(dev);
+ register int unit =
vn
unit(dev);
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_FOLLOW)
- printf("
fdwrite(%x, %x)\n", dev, uio
);
+ if (
vndebug & V
DB_FOLLOW)
+ printf("
vnwrite(%x, %x, %x, %x)\n", dev, uio, flags, p
);
#endif
#endif
- return(physio(
fdstrategy, &fd
buf[unit], dev, B_WRITE, minphys, uio));
+ return(physio(
vnstrategy, &vn
buf[unit], dev, B_WRITE, minphys, uio));
}
/* ARGSUSED */
}
/* ARGSUSED */
-
fdioctl(dev, cmd, data, flag
)
+
vnioctl(dev, cmd, data, flag, p
)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
+ struct proc *p;
{
{
- int unit =
fd
unit(dev);
- register struct
fd_softc *fs
;
- struct
fd_ioctl *f
io;
+ int unit =
vn
unit(dev);
+ register struct
vn_softc *vn
;
+ struct
vn_ioctl *v
io;
struct vattr vattr;
struct vattr vattr;
- struct
vnode *vp
;
+ struct
nameidata nd
;
int error;
#ifdef DEBUG
int error;
#ifdef DEBUG
- if (
fddebug & F
DB_FOLLOW)
- printf("
fdioctl(
%x, %x, %x, %x): unit %d\n",
- dev, cmd, data, flag, unit);
+ if (
vndebug & V
DB_FOLLOW)
+ printf("
vnioctl(%x,
%x, %x, %x, %x): unit %d\n",
+ dev, cmd, data, flag,
p,
unit);
#endif
#endif
- error = suser(
u.u_cred, &u.u
_acflag);
+ error = suser(
p->p_ucred, &p->p
_acflag);
if (error)
return (error);
if (error)
return (error);
- if (unit >= N
FD
)
+ if (unit >= N
VN
)
return (ENXIO);
return (ENXIO);
-
fs = &fd
_softc[unit];
-
fio = (struct fd
_ioctl *)data;
+
vn = &vn
_softc[unit];
+
vio = (struct vn
_ioctl *)data;
switch (cmd) {
switch (cmd) {
- case
FD
IOCSET:
- if (
fs->sc_flags & FD
F_INITED)
+ case
VN
IOCSET:
+ if (
vn->sc_flags & VN
F_INITED)
return(EBUSY);
/*
* Always open for read and write.
return(EBUSY);
/*
* Always open for read and write.
@@
-304,41
+318,38
@@
fdioctl(dev, cmd, data, flag)
* weed out directories, sockets, etc. so we don't
* have to worry about them.
*/
* weed out directories, sockets, etc. so we don't
* have to worry about them.
*/
- error = vn_open(fio->fd_file, UIO_USERSPACE,
- FREAD|FWRITE, 0, &vp);
- if (error)
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, vio->vn_file, p);
+ if (error = vn_open(&nd, FREAD|FWRITE, 0))
return(error);
return(error);
- error = VOP_GETATTR(vp, &vattr, u.u_cred);
- if (error) {
- vn_close(vp, FREAD|FWRITE);
- VN_RELE(vp);
+ if (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p)) {
+ VOP_UNLOCK(nd.ni_vp);
+ (void) vn_close(nd.ni_vp, FREAD|FWRITE, p->p_ucred, p);
return(error);
}
return(error);
}
- fs->sc_vp = vp;
- fs->sc_size = btodb(vattr.va_size); /* note truncation */
- error = fdsetcred(fs);
- if (error) {
- vn_close(vp, FREAD|FWRITE);
- VN_RELE(vp);
+ VOP_UNLOCK(nd.ni_vp);
+ vn->sc_vp = nd.ni_vp;
+ vn->sc_size = btodb(vattr.va_size); /* note truncation */
+ if (error = vnsetcred(vn, p->p_ucred)) {
+ (void) vn_close(vn->sc_vp, FREAD|FWRITE, p->p_ucred, p);
return(error);
}
return(error);
}
-
fdthrottle(fs,
vp);
-
fio->fd_size = dbtob(fs
->sc_size);
-
fs->sc_flags |= FD
F_INITED;
+
vnthrottle(vn, vn->sc_
vp);
+
vio->vn_size = dbtob(vn
->sc_size);
+
vn->sc_flags |= VN
F_INITED;
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_INIT)
- printf("
fd
ioctl: SET vp %x size %x\n",
-
fs->sc_vp, fs
->sc_size);
+ if (
vndebug & V
DB_INIT)
+ printf("
vn
ioctl: SET vp %x size %x\n",
+
vn->sc_vp, vn
->sc_size);
#endif
break;
#endif
break;
- case
FD
IOCCLR:
- if ((
fs->sc_flags & FD
F_INITED) == 0)
+ case
VN
IOCCLR:
+ if ((
vn->sc_flags & VN
F_INITED) == 0)
return(ENXIO);
return(ENXIO);
-
fdclear(fs
);
+
vnclear(vn
);
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_INIT)
- printf("
fd
ioctl: CLRed\n");
+ if (
vndebug & V
DB_INIT)
+ printf("
vn
ioctl: CLRed\n");
#endif
break;
#endif
break;
@@
-354,89
+365,91
@@
fdioctl(dev, cmd, data, flag)
* to this "disk" is essentially as root. Note that credentials may change
* if some other uid can write directly to the mapped file (NFS).
*/
* to this "disk" is essentially as root. Note that credentials may change
* if some other uid can write directly to the mapped file (NFS).
*/
-fdsetcred(fs)
- register struct fd_softc *fs;
+vnsetcred(vn, cred)
+ register struct vn_softc *vn;
+ struct ucred cred;
{
struct uio auio;
struct iovec aiov;
char tmpbuf[DEV_BSIZE];
{
struct uio auio;
struct iovec aiov;
char tmpbuf[DEV_BSIZE];
-
fs->sc_cred = crdup(u.u_
cred);
+
vn->sc_cred = crdup(
cred);
/* XXX: Horrible kludge to establish credentials for NFS */
aiov.iov_base = tmpbuf;
/* XXX: Horrible kludge to establish credentials for NFS */
aiov.iov_base = tmpbuf;
- aiov.iov_len =
MIN(DEV_BSIZE, dbtob(fs
->sc_size));
+ aiov.iov_len =
min(DEV_BSIZE, dbtob(vn
->sc_size));
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_offset = 0;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_resid = aiov.iov_len;
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_offset = 0;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_resid = aiov.iov_len;
- return(VOP_READ(
fs->sc_vp, &auio, 0, fs
->sc_cred));
+ return(VOP_READ(
vn->sc_vp, &auio, 0, vn
->sc_cred));
}
/*
* Set maxactive based on FS type
*/
}
/*
* Set maxactive based on FS type
*/
-
fdthrottle(fs
, vp)
- register struct
fd_softc *fs
;
+
vnthrottle(vn
, vp)
+ register struct
vn_softc *vn
;
struct vnode *vp;
{
struct vnode *vp;
{
- extern struct vnodeops ufs_vnodeops, nfs_vnodeops;
+ extern int (**ufs_vnodeop_p)();
+ extern int (**nfsv2_vnodeop_p)();
- if (vp->v_op ==
&nfs_vnodeops
)
-
fs
->sc_maxactive = 2;
+ if (vp->v_op ==
nfsv2_vnodeop_p
)
+
vn
->sc_maxactive = 2;
else
else
-
fs
->sc_maxactive = 8;
+
vn
->sc_maxactive = 8;
- if (
fs
->sc_maxactive < 1)
-
fs
->sc_maxactive = 1;
+ if (
vn
->sc_maxactive < 1)
+
vn
->sc_maxactive = 1;
}
}
-
fd
shutdown()
+
vn
shutdown()
{
{
- register struct
fd_softc *fs
;
+ register struct
vn_softc *vn
;
- for (
fs = &fd_softc[0]; fs < &fd_softc[NFD]; fs
++)
- if (
fs->sc_flags & FD
F_INITED)
-
fdclear(fs
);
+ for (
vn = &vn_softc[0]; vn < &vn_softc[NVN]; vn
++)
+ if (
vn->sc_flags & VN
F_INITED)
+
vnclear(vn
);
}
}
-
fdclear(fs
)
- register struct
fd_softc *fs
;
+
vnclear(vn
)
+ register struct
vn_softc *vn
;
{
{
- register struct vnode *vp = fs->sc_vp;
+ register struct vnode *vp = vn->sc_vp;
+ struct proc *p = curproc; /* XXX */
#ifdef DEBUG
#ifdef DEBUG
- if (
fddebug & F
DB_FOLLOW)
- printf("
fd
clear(%x): vp %x\n", vp);
+ if (
vndebug & V
DB_FOLLOW)
+ printf("
vn
clear(%x): vp %x\n", vp);
#endif
#endif
-
fs->sc_flags &= ~FD
F_INITED;
+
vn->sc_flags &= ~VN
F_INITED;
if (vp == (struct vnode *)0)
if (vp == (struct vnode *)0)
- panic("
fd
ioctl: null vp");
+ panic("
vn
ioctl: null vp");
#if 0
/* XXX - this doesn't work right now */
#if 0
/* XXX - this doesn't work right now */
- (void) VOP_FSYNC(vp,
fs->sc_cred
);
+ (void) VOP_FSYNC(vp,
0, vn->sc_cred, MNT_WAIT, p
);
#endif
#endif
- vn_close(vp, FREAD|FWRITE);
- VN_RELE(vp);
- crfree(fs->sc_cred);
- fs->sc_vp = (struct vnode *)0;
- fs->sc_cred = (struct ucred *)0;
- fs->sc_size = 0;
+ (void) vn_close(vp, FREAD|FWRITE, vn->sc_cred, p);
+ crfree(vn->sc_cred);
+ vn->sc_vp = (struct vnode *)0;
+ vn->sc_cred = (struct ucred *)0;
+ vn->sc_size = 0;
}
}
-
fd
size(dev)
+
vn
size(dev)
dev_t dev;
{
dev_t dev;
{
- int unit =
fd
unit(dev);
- register struct
fd_softc *fs = &fd
_softc[unit];
+ int unit =
vn
unit(dev);
+ register struct
vn_softc *vn = &vn
_softc[unit];
- if (unit >= N
FD || (fs->sc_flags & FD
F_INITED) == 0)
+ if (unit >= N
VN || (vn->sc_flags & VN
F_INITED) == 0)
return(-1);
return(-1);
- return(
fs
->sc_size);
+ return(
vn
->sc_size);
}
}
-
fd
dump(dev)
+
vn
dump(dev)
{
return(ENXIO);
}
{
return(ENXIO);
}