diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-07-11 21:32:08 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-07-11 21:32:08 +0000 |
commit | 4f942d92aa035ca844a5c3963c110132a8b82226 (patch) | |
tree | ce2366253733b52e5002cf7e4e685bb4b5a3dcbb /sys/coda/coda_psdev.c | |
parent | c2081368d230e2160f4ab899eadf89a0201e6bbb (diff) | |
download | FreeBSD-src-4f942d92aa035ca844a5c3963c110132a8b82226.zip FreeBSD-src-4f942d92aa035ca844a5c3963c110132a8b82226.tar.gz |
Replace CODA_OPEN with CODA_OPEN_BY_FD: coda_open was disabled because
we can't open container files by device/inode number pair anymore.
Replace the CODA_OPEN upcall with CODA_OPEN_BY_FD, where venus returns
an open file descriptor for the container file. We can then grab a
reference on the vnode coda_psdev.c:vc_nb_write and use this vnode for
further accesses to the container file.
Submitted by: Jan Harkes <jaharkes@cs.cmu.edu>
Approved by: re (kensmith)
Diffstat (limited to 'sys/coda/coda_psdev.c')
-rw-r--r-- | sys/coda/coda_psdev.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index b9a45a9..f62a246 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -65,6 +65,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ #include <sys/mutex.h> #include <sys/poll.h> #include <sys/proc.h> +#include <sys/filedesc.h> #include <coda/coda.h> #include <coda/cnode.h> @@ -370,9 +371,29 @@ vc_nb_write(dev, uiop, flag) out->unique = seq; vmp->vm_outSize = buf[0]; /* Amount of data transferred? */ vmp->vm_flags |= VM_WRITE; + + error = 0; + if (opcode == CODA_OPEN_BY_FD) { + struct coda_open_by_fd_out *tmp = (struct coda_open_by_fd_out *)out; + struct file *fp; + struct vnode *vp = NULL; + + if (tmp->oh.result == 0) { + error = getvnode(uiop->uio_td->td_proc->p_fd, tmp->fd, &fp); + if (!error) { + mtx_lock(&Giant); + vp = fp->f_vnode; + VREF(vp); + fdrop(fp, uiop->uio_td); + mtx_unlock(&Giant); + } + } + tmp->vp = vp; + } + wakeup(&vmp->vm_sleep); - return(0); + return(error); } int |