general cleanup, remove debug code, lint + KNF.
SCCS-vsn: sys/miscfs/fdesc/fdesc.h 8.4
SCCS-vsn: sys/miscfs/fdesc/fdesc_vfsops.c 8.3
SCCS-vsn: sys/miscfs/fdesc/fdesc_vnops.c 8.7
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)fdesc.h 8.3 (Berkeley) %G%
+ * @(#)fdesc.h 8.4 (Berkeley) %G%
*
* $Id: fdesc.h,v 1.8 1993/04/06 15:28:33 jsp Exp $
*/
*
* $Id: fdesc.h,v 1.8 1993/04/06 15:28:33 jsp Exp $
*/
} fdntype;
struct fdescnode {
} fdntype;
struct fdescnode {
+ struct fdescnode *fd_forw; /* Hash chain */
+ struct fdescnode *fd_back;
+ struct vnode *fd_vnode; /* Back ptr to vnode */
fdntype fd_type; /* Type of this node */
unsigned fd_fd; /* Fd to be dup'ed */
char *fd_link; /* Link to fd/n */
fdntype fd_type; /* Type of this node */
unsigned fd_fd; /* Fd to be dup'ed */
char *fd_link; /* Link to fd/n */
#define VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
extern dev_t devctty;
#define VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
extern dev_t devctty;
+extern int fdesc_init __P((void));
+extern int fdesc_root __P((struct mount *, struct vnode **));
extern int fdesc_allocvp __P((fdntype, int, struct mount *, struct vnode **));
extern int (**fdesc_vnodeop_p)();
extern struct vfsops fdesc_vfsops;
extern int fdesc_allocvp __P((fdntype, int, struct mount *, struct vnode **));
extern int (**fdesc_vnodeop_p)();
extern struct vfsops fdesc_vfsops;
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)fdesc_vfsops.c 8.2 (Berkeley) %G%
+ * @(#)fdesc_vfsops.c 8.3 (Berkeley) %G%
*
* $Id: fdesc_vfsops.c,v 1.9 1993/04/06 15:28:33 jsp Exp $
*/
*
* $Id: fdesc_vfsops.c,v 1.9 1993/04/06 15:28:33 jsp Exp $
*/
#include <sys/malloc.h>
#include <miscfs/fdesc/fdesc.h>
#include <sys/malloc.h>
#include <miscfs/fdesc/fdesc.h>
-dev_t devctty;
-
-fdesc_init()
-{
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_init\n"); /* printed during system boot */
-#endif
- devctty = makedev(nchrdev, 0);
-}
-
/*
* Mount the per-process file descriptors (/dev/fd)
*/
/*
* Mount the per-process file descriptors (/dev/fd)
*/
fdesc_mount(mp, path, data, ndp, p)
struct mount *mp;
char *path;
fdesc_mount(mp, path, data, ndp, p)
struct mount *mp;
char *path;
struct fdescmount *fmp;
struct vnode *rvp;
struct fdescmount *fmp;
struct vnode *rvp;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_mount(mp = %x)\n", mp);
-#endif
-
/*
* Update is a no-op
*/
/*
* Update is a no-op
*/
M_UFSMNT, M_WAITOK); /* XXX */
rvp->v_type = VDIR;
rvp->v_flag |= VROOT;
M_UFSMNT, M_WAITOK); /* XXX */
rvp->v_type = VDIR;
rvp->v_flag |= VROOT;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_mount: root vp = %x\n", rvp);
-#endif
fmp->f_root = rvp;
/* XXX -- don't mark as local to work around fts() problems */
/*mp->mnt_flag |= MNT_LOCAL;*/
fmp->f_root = rvp;
/* XXX -- don't mark as local to work around fts() problems */
/*mp->mnt_flag |= MNT_LOCAL;*/
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc"));
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc"));
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_mount: at %s\n", mp->mnt_stat.f_mntonname);
-#endif
fdesc_start(mp, flags, p)
struct mount *mp;
int flags;
fdesc_start(mp, flags, p)
struct mount *mp;
int flags;
fdesc_unmount(mp, mntflags, p)
struct mount *mp;
int mntflags;
fdesc_unmount(mp, mntflags, p)
struct mount *mp;
int mntflags;
extern int doforce;
struct vnode *rootvp = VFSTOFDESC(mp)->f_root;
extern int doforce;
struct vnode *rootvp = VFSTOFDESC(mp)->f_root;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_unmount(mp = %x)\n", mp);
-#endif
-
if (mntflags & MNT_FORCE) {
/* fdesc can never be rootfs so don't check for it */
if (!doforce)
if (mntflags & MNT_FORCE) {
/* fdesc can never be rootfs so don't check for it */
if (!doforce)
* ever get anything cached at this level at the
* moment, but who knows...
*/
* ever get anything cached at this level at the
* moment, but who knows...
*/
-#if 0
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_unmount: calling mntflushbuf\n");
-#endif
- mntflushbuf(mp, 0);
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_unmount: calling mntinvalbuf\n");
-#endif
- if (mntinvalbuf(mp, 1))
- return (EBUSY);
-#endif
if (rootvp->v_usecount > 1)
return (EBUSY);
if (rootvp->v_usecount > 1)
return (EBUSY);
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_unmount: calling vflush\n");
-#endif
if (error = vflush(mp, rootvp, flags))
return (error);
if (error = vflush(mp, rootvp, flags))
return (error);
-#ifdef FDESC_DIAGNOSTIC
- vprint("fdesc root", rootvp);
-#endif
/*
* Release reference on underlying root vnode
*/
/*
* Release reference on underlying root vnode
*/
*/
free(mp->mnt_data, M_UFSMNT); /* XXX */
mp->mnt_data = 0;
*/
free(mp->mnt_data, M_UFSMNT); /* XXX */
mp->mnt_data = 0;
fdesc_root(mp, vpp)
struct mount *mp;
struct vnode **vpp;
{
struct vnode *vp;
fdesc_root(mp, vpp)
struct mount *mp;
struct vnode **vpp;
{
struct vnode *vp;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_root(mp = %x)\n", mp);
-#endif
-
/*
* Return locked reference to root.
*/
/*
* Return locked reference to root.
*/
fdesc_quotactl(mp, cmd, uid, arg, p)
struct mount *mp;
int cmd;
fdesc_quotactl(mp, cmd, uid, arg, p)
struct mount *mp;
int cmd;
caddr_t arg;
struct proc *p;
{
caddr_t arg;
struct proc *p;
{
fdesc_statfs(mp, sbp, p)
struct mount *mp;
struct statfs *sbp;
fdesc_statfs(mp, sbp, p)
struct mount *mp;
struct statfs *sbp;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_statfs(mp = %x)\n", mp);
-#endif
-
/*
* Compute number of free file descriptors.
* [ Strange results will ensue if the open file
/*
* Compute number of free file descriptors.
* [ Strange results will ensue if the open file
fdesc_sync(mp, waitfor)
struct mount *mp;
int waitfor;
{
fdesc_sync(mp, waitfor)
struct mount *mp;
int waitfor;
{
* Fdesc flat namespace lookup.
* Currently unsupported.
*/
* Fdesc flat namespace lookup.
* Currently unsupported.
*/
fdesc_vget(mp, ino, vpp)
struct mount *mp;
ino_t ino;
fdesc_vget(mp, ino, vpp)
struct mount *mp;
ino_t ino;
fdesc_fhtovp(mp, fhp, setgen, vpp)
struct mount *mp;
struct fid *fhp;
fdesc_fhtovp(mp, fhp, setgen, vpp)
struct mount *mp;
struct fid *fhp;
fdesc_vptofh(vp, fhp)
struct vnode *vp;
struct fid *fhp;
{
fdesc_vptofh(vp, fhp)
struct vnode *vp;
struct fid *fhp;
{
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)fdesc_vnops.c 8.6 (Berkeley) %G%
+ * @(#)fdesc_vnops.c 8.7 (Berkeley) %G%
*
* $Id: fdesc_vnops.c,v 1.12 1993/04/06 16:17:17 jsp Exp $
*/
*
* $Id: fdesc_vnops.c,v 1.12 1993/04/06 16:17:17 jsp Exp $
*/
#define FDL_WANT 0x01
#define FDL_LOCKED 0x02
#define FDL_WANT 0x01
#define FDL_LOCKED 0x02
-static int fdescvplock;
-static struct vnode *fdescvp[FD_MAX];
+static int fdcache_lock;
+
+dev_t devctty;
#if (FD_STDIN != FD_STDOUT-1) || (FD_STDOUT != FD_STDERR-1)
FD_STDIN, FD_STDOUT, FD_STDERR must be a sequence n, n+1, n+2
#endif
#if (FD_STDIN != FD_STDOUT-1) || (FD_STDOUT != FD_STDERR-1)
FD_STDIN, FD_STDOUT, FD_STDERR must be a sequence n, n+1, n+2
#endif
+#define NFDCACHE 3
+#define FD_NHASH(ix) ((ix) & NFDCACHE)
+
+/*
+ * Cache head
+ */
+struct fdcache {
+ struct fdescnode *fc_forw;
+ struct fdescnode *fc_back;
+};
+
+static struct fdcache fdcache[NFDCACHE];
+
+/*
+ * Initialise cache headers
+ */
+fdesc_init()
+{
+ struct fdcache *fc;
+
+ devctty = makedev(nchrdev, 0);
+
+ for (fc = fdcache; fc < fdcache + NFDCACHE; fc++)
+ fc->fc_forw = fc->fc_back = (struct fdescnode *) fc;
+}
+
+/*
+ * Compute hash list for given target vnode
+ */
+static struct fdcache *
+fdesc_hash(ix)
+ int ix;
+{
+
+ return (&fdcache[FD_NHASH(ix)]);
+}
+
+int
fdesc_allocvp(ftype, ix, mp, vpp)
fdntype ftype;
int ix;
struct mount *mp;
struct vnode **vpp;
{
fdesc_allocvp(ftype, ix, mp, vpp)
fdntype ftype;
int ix;
struct mount *mp;
struct vnode **vpp;
{
- struct vnode **nvpp = 0;
+ struct fdcache *fc;
+ struct fdescnode *fd;
- /* get stashed copy of the vnode */
- if (ix >= 0 && ix < FD_MAX) {
- nvpp = &fdescvp[ix];
- if (*nvpp) {
- if (vget(*nvpp, 1))
+ fc = fdesc_hash(ix);
+ for (fd = fc->fc_forw; fd != (struct fdescnode *) fc; fd = fd->fd_forw) {
+ if (fd->fd_ix == ix && fd->fd_vnode->v_mount == mp) {
+ if (vget(fd->fd_vnode, 0))
- VOP_UNLOCK(*nvpp);
- *vpp = *nvpp;
* otherwise lock the array while we call getnewvnode
* since that can block.
*/
* otherwise lock the array while we call getnewvnode
* since that can block.
*/
- if (fdescvplock & FDL_LOCKED) {
- fdescvplock |= FDL_WANT;
- sleep((caddr_t) &fdescvplock, PINOD);
+ if (fdcache_lock & FDL_LOCKED) {
+ fdcache_lock |= FDL_WANT;
+ sleep((caddr_t) &fdcache_lock, PINOD);
- fdescvplock |= FDL_LOCKED;
+ fdcache_lock |= FDL_LOCKED;
error = getnewvnode(VT_FDESC, mp, fdesc_vnodeop_p, vpp);
if (error)
goto out;
error = getnewvnode(VT_FDESC, mp, fdesc_vnodeop_p, vpp);
if (error)
goto out;
- MALLOC((*vpp)->v_data, void *, sizeof(struct fdescnode), M_TEMP, M_WAITOK);
- if (nvpp)
- *nvpp = *vpp;
- VTOFDESC(*vpp)->fd_type = ftype;
- VTOFDESC(*vpp)->fd_fd = -1;
- VTOFDESC(*vpp)->fd_link = 0;
- VTOFDESC(*vpp)->fd_ix = ix;
+ MALLOC(fd, void *, sizeof(struct fdescnode), M_TEMP, M_WAITOK);
+ (*vpp)->v_data = fd;
+ fd->fd_vnode = *vpp;
+ fd->fd_type = ftype;
+ fd->fd_fd = -1;
+ fd->fd_link = 0;
+ fd->fd_ix = ix;
+ fc = fdesc_hash(ix);
+ insque(fd, fc);
- fdescvplock &= ~FDL_LOCKED;
+ fdcache_lock &= ~FDL_LOCKED;
- if (fdescvplock & FDL_WANT) {
- fdescvplock &= ~FDL_WANT;
- wakeup((caddr_t) &fdescvplock);
+ if (fdcache_lock & FDL_WANT) {
+ fdcache_lock &= ~FDL_WANT;
+ wakeup((caddr_t) &fdcache_lock);
* vp is the current namei directory
* ndp is the name to locate in that directory...
*/
* vp is the current namei directory
* ndp is the name to locate in that directory...
*/
fdesc_lookup(ap)
struct vop_lookup_args /* {
struct vnode * a_dvp;
fdesc_lookup(ap)
struct vop_lookup_args /* {
struct vnode * a_dvp;
struct vnode *fvp;
char *ln;
struct vnode *fvp;
char *ln;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup(%x)\n", ap);
- printf("fdesc_lookup(dp = %x, vpp = %x, cnp = %x)\n", dvp, vpp, ap->a_cnp);
-#endif
pname = ap->a_cnp->cn_nameptr;
pname = ap->a_cnp->cn_nameptr;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup(%s)\n", pname);
-#endif
if (ap->a_cnp->cn_namelen == 1 && *pname == '.') {
*vpp = dvp;
VREF(dvp);
if (ap->a_cnp->cn_namelen == 1 && *pname == '.') {
*vpp = dvp;
VREF(dvp);
*vpp = fvp;
fvp->v_type = VDIR;
VOP_LOCK(fvp);
*vpp = fvp;
fvp->v_type = VDIR;
VOP_LOCK(fvp);
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: newvp = %x\n", fvp);
-#endif
*vpp = fvp;
fvp->v_type = VFIFO;
VOP_LOCK(fvp);
*vpp = fvp;
fvp->v_type = VFIFO;
VOP_LOCK(fvp);
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: ttyvp = %x\n", fvp);
-#endif
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: link -> %s\n", ln);
-#endif
error = fdesc_allocvp(Flink, fd, dvp->v_mount, &fvp);
if (error)
goto bad;
error = fdesc_allocvp(Flink, fd, dvp->v_mount, &fvp);
if (error)
goto bad;
*vpp = fvp;
fvp->v_type = VLNK;
VOP_LOCK(fvp);
*vpp = fvp;
fvp->v_type = VLNK;
VOP_LOCK(fvp);
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: newvp = %x\n", fvp);
-#endif
return (0);
} else {
error = ENOENT;
goto bad;
}
return (0);
} else {
error = ENOENT;
goto bad;
}
case Fdevfd:
if (ap->a_cnp->cn_namelen == 2 && bcmp(pname, "..", 2) == 0) {
case Fdevfd:
if (ap->a_cnp->cn_namelen == 2 && bcmp(pname, "..", 2) == 0) {
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: fd = %d, *pname = %x\n", fd, *pname);
-#endif
if (*pname != '\0') {
error = ENOENT;
goto bad;
if (*pname != '\0') {
error = ENOENT;
goto bad;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: allocate new vnode\n");
-#endif
error = fdesc_allocvp(Fdesc, FD_DESC+fd, dvp->v_mount, &fvp);
if (error)
goto bad;
VTOFDESC(fvp)->fd_fd = fd;
*vpp = fvp;
error = fdesc_allocvp(Fdesc, FD_DESC+fd, dvp->v_mount, &fvp);
if (error)
goto bad;
VTOFDESC(fvp)->fd_fd = fd;
*vpp = fvp;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: newvp = %x\n", fvp);
-#endif
return (0);
}
bad:;
*vpp = NULL;
return (0);
}
bad:;
*vpp = NULL;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_lookup: error = %d\n", error);
-#endif
fdesc_open(ap)
struct vop_open_args /* {
struct vnode *a_vp;
fdesc_open(ap)
struct vop_open_args /* {
struct vnode *a_vp;
struct stat stb;
int error;
struct stat stb;
int error;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_attr: fd = %d, nfiles = %d\n", fd, fdp->fd_nfiles);
-#endif
- if (fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL) {
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_attr: fp = %x (EBADF)\n", fp);
-#endif
+ if (fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL)
switch (fp->f_type) {
case DTYPE_VNODE:
switch (fp->f_type) {
case DTYPE_VNODE:
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_attr: returns error %d\n", error);
-#endif
fdesc_getattr(ap)
struct vop_getattr_args /* {
struct vnode *a_vp;
fdesc_getattr(ap)
struct vop_getattr_args /* {
struct vnode *a_vp;
unsigned fd;
int error = 0;
unsigned fd;
int error = 0;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_getattr: stat type = %d\n", VTOFDESC(vp)->fd_type);
-#endif
-
switch (VTOFDESC(vp)->fd_type) {
case Froot:
case Fdevfd:
switch (VTOFDESC(vp)->fd_type) {
case Froot:
case Fdevfd:
vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
vap->va_type = VLNK;
vap->va_nlink = 1;
vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
vap->va_type = VLNK;
vap->va_nlink = 1;
- /* vap->va_qsize = strlen(VTOFDESC(vp)->fd_link); */
vap->va_size = strlen(VTOFDESC(vp)->fd_link);
break;
vap->va_size = strlen(VTOFDESC(vp)->fd_link);
break;
vap->va_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
vap->va_type = VFIFO;
vap->va_nlink = 1;
vap->va_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
vap->va_type = VFIFO;
vap->va_nlink = 1;
- /* vap->va_qsize = 0; */
vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
vap->va_type = VDIR;
vap->va_nlink = 2;
vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
vap->va_type = VDIR;
vap->va_nlink = 2;
- /* vap->va_qsize = 0; */
vap->va_size = DEV_BSIZE;
break;
}
vap->va_size = DEV_BSIZE;
break;
}
vap->va_gen = 0;
vap->va_flags = 0;
vap->va_rdev = 0;
vap->va_gen = 0;
vap->va_flags = 0;
vap->va_rdev = 0;
- /* vap->va_qbytes = 0; */
vap->va_bytes = 0;
break;
case Fdesc:
vap->va_bytes = 0;
break;
case Fdesc:
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_getattr: stat desc #%d\n", VTOFDESC(vp)->fd_fd);
-#endif
fd = VTOFDESC(vp)->fd_fd;
error = fdesc_attr(fd, vap, ap->a_cred, ap->a_p);
break;
fd = VTOFDESC(vp)->fd_fd;
error = fdesc_attr(fd, vap, ap->a_cred, ap->a_p);
break;
if (error == 0)
vp->v_type = vap->va_type;
if (error == 0)
vp->v_type = vap->va_type;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_getattr: stat returns 0\n");
-#endif
fdesc_setattr(ap)
struct vop_setattr_args /* {
struct vnode *a_vp;
fdesc_setattr(ap)
struct vop_setattr_args /* {
struct vnode *a_vp;
}
fd = VTOFDESC(ap->a_vp)->fd_fd;
}
fd = VTOFDESC(ap->a_vp)->fd_fd;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_setattr: fd = %d, nfiles = %d\n", fd, fdp->fd_nfiles);
-#endif
if (fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL) {
if (fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL) {
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_setattr: fp = %x (EBADF)\n", fp);
-#endif
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_setattr: returns error %d\n", error);
-#endif
fdesc_readdir(ap)
struct vop_readdir_args /* {
struct vnode *a_vp;
fdesc_readdir(ap)
struct vop_readdir_args /* {
struct vnode *a_vp;
i = uio->uio_offset / UIO_MX;
error = 0;
while (uio->uio_resid > 0) {
i = uio->uio_offset / UIO_MX;
error = 0;
while (uio->uio_resid > 0) {
- if (i >= fdp->fd_nfiles) {
- /* *ap->a_eofflagp = 1; */
+ if (i >= fdp->fd_nfiles)
if (fdp->fd_ofiles[i] != NULL) {
struct dirent d;
struct dirent *dp = &d;
if (fdp->fd_ofiles[i] != NULL) {
struct dirent d;
struct dirent *dp = &d;
bzero((caddr_t) dp, UIO_MX);
dp->d_namlen = sprintf(dp->d_name, "%d", i);
bzero((caddr_t) dp, UIO_MX);
dp->d_namlen = sprintf(dp->d_name, "%d", i);
- /*
- * Fill in the remaining fields
- */
dp->d_reclen = UIO_MX;
dp->d_type = DT_UNKNOWN;
dp->d_fileno = i + FD_STDIN;
dp->d_reclen = UIO_MX;
dp->d_type = DT_UNKNOWN;
dp->d_fileno = i + FD_STDIN;
struct ucred *a_cred;
} */ *ap;
{
struct ucred *a_cred;
} */ *ap;
{
- register struct vnode *vp = ap->a_vp;
+ struct vnode *vp = ap->a_vp;
int error;
if (vp->v_type != VLNK)
int error;
if (vp->v_type != VLNK)
fdesc_read(ap)
struct vop_read_args /* {
struct vnode *a_vp;
fdesc_read(ap)
struct vop_read_args /* {
struct vnode *a_vp;
fdesc_write(ap)
struct vop_write_args /* {
struct vnode *a_vp;
fdesc_write(ap)
struct vop_write_args /* {
struct vnode *a_vp;
fdesc_ioctl(ap)
struct vop_ioctl_args /* {
struct vnode *a_vp;
fdesc_ioctl(ap)
struct vop_ioctl_args /* {
struct vnode *a_vp;
{
int error = EOPNOTSUPP;
{
int error = EOPNOTSUPP;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_ioctl: type = %d, command = %x\n",
- VTOFDESC(ap->a_vp)->fd_type, ap->a_command);
-#endif
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
error = cttyioctl(devctty, ap->a_command, ap->a_data,
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
error = cttyioctl(devctty, ap->a_command, ap->a_data,
fdesc_select(ap)
struct vop_select_args /* {
struct vnode *a_vp;
fdesc_select(ap)
struct vop_select_args /* {
struct vnode *a_vp;
fdesc_inactive(ap)
struct vop_inactive_args /* {
struct vnode *a_vp;
fdesc_inactive(ap)
struct vop_inactive_args /* {
struct vnode *a_vp;
* nasty things happening in vgone().
*/
vp->v_type = VNON;
* nasty things happening in vgone().
*/
vp->v_type = VNON;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_inactive(%x)\n", vp);
-#endif
fdesc_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
fdesc_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
-#ifdef FDESC_DIAGNOSTIC
- printf("fdesc_reclaim(%x)\n", vp);
-#endif
- ix = VTOFDESC(vp)->fd_ix;
- if (ix >= 0 && ix < FD_MAX) {
- if (fdescvp[ix] != vp)
- panic("fdesc_reclaim");
- fdescvp[ix] = 0;
- }
- if (vp->v_data) {
- FREE(vp->v_data, M_TEMP);
- vp->v_data = 0;
- }
+ remque(VTOFDESC(vp));
+ FREE(vp->v_data, M_TEMP);
+ vp->v_data = 0;
+
* Print out the contents of a /dev/fd vnode.
*/
/* ARGSUSED */
* Print out the contents of a /dev/fd vnode.
*/
/* ARGSUSED */
fdesc_print(ap)
struct vop_print_args /* {
struct vnode *a_vp;
fdesc_print(ap)
struct vop_print_args /* {
struct vnode *a_vp;
fdesc_vfree(ap)
struct vop_vfree_args /* {
struct vnode *a_pvp;
fdesc_vfree(ap)
struct vop_vfree_args /* {
struct vnode *a_pvp;
/*
* /dev/fd vnode unsupported operation
*/
/*
* /dev/fd vnode unsupported operation
*/
/*
* /dev/fd "should never get here" operation
*/
/*
* /dev/fd "should never get here" operation
*/
/*
* /dev/fd vnode null operation
*/
/*
* /dev/fd vnode null operation
*/