/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
*
* @(#)vfs_vnops.c 8.14 (Berkeley) 6/15/95
*
- * History
- * 10-20-1997 Umesh Vaishampayan
- * Fixed the count to be off_t rather than int.
*/
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/ubc.h>
-#include <mach/kern_return.h>
-#include <mach/memory_object_control.h>
-#include <mach/vm_prot.h>
struct fileops vnops =
{ vn_read, vn_write, vn_ioctl, vn_select, vn_closefile };
if (fmode & O_TRUNC) {
VOP_UNLOCK(vp, 0, p); /* XXX */
VOP_LEASE(vp, p, cred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); /* XXX */
+ (void)vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); /* XXX */
VATTR_NULL(vap);
vap->va_size = 0;
if (error = VOP_SETATTR(vp, vap, cred, p))
goto bad;
}
- if (error = VOP_OPEN(vp, fmode, cred, p))
- goto bad;
+
+#if DIAGNOSTIC
if (UBCINFOMISSING(vp))
- panic("vn_open: ubc_info_init");
- if (UBCINFOEXISTS(vp) && !ubc_hold(vp))
- panic("vn_open: hold");
+ panic("vn_open: ubc_info_init");
+#endif /* DIAGNOSTIC */
+
+ if (UBCINFOEXISTS(vp) && !ubc_hold(vp)) {
+ error = ENOENT;
+ goto bad;
+ }
+
+ if (error = VOP_OPEN(vp, fmode, cred, p)) {
+ ubc_rele(vp);
+ goto bad;
+ }
+
if (fmode & FWRITE)
if (++vp->v_writecount <= 0)
panic("vn_open: v_writecount");
struct proc *p;
{
int error;
- vm_map_t user_map;
- vm_offset_t addr, addr1;
- vm_size_t size, pageoff;
if (flags & FWRITE)
vp->v_writecount--;
/* FIXME XXX */
if ((ioflg & IO_NODELOCKED) == 0)
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ (void)vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
aiov.iov_base = base;
off_t count;
VOP_LEASE(vp, p, cred, LEASE_READ);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ (void)vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
uio->uio_offset = fp->f_offset;
count = uio->uio_resid;
(vp->v_mount && (vp->v_mount->mnt_flag & MNT_SYNCHRONOUS)))
ioflag |= IO_SYNC;
VOP_LEASE(vp, p, cred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ (void)vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
uio->uio_offset = fp->f_offset;
count = uio->uio_resid;
register struct vnode *vp = ((struct vnode *)fp->f_data);
struct vattr vattr;
int error;
+ struct vnode *ttyvp;
switch (vp->v_type) {
case VBLK:
error = VOP_IOCTL(vp, com, data, fp->f_flag, p->p_ucred, p);
if (error == 0 && com == TIOCSCTTY) {
- if (p->p_session->s_ttyvp)
- vrele(p->p_session->s_ttyvp);
- p->p_session->s_ttyvp = vp;
VREF(vp);
+ ttyvp = p->p_session->s_ttyvp;
+ p->p_session->s_ttyvp = vp;
+ if (ttyvp)
+ vrele(ttyvp);
}
return (error);
}
/*
* File table vnode select routine.
*/
-vn_select(fp, which, p)
+vn_select(fp, which, wql, p)
struct file *fp;
int which;
+ void * wql;
struct proc *p;
{
- return (VOP_SELECT(((struct vnode *)fp->f_data), which, fp->f_flag,
- fp->f_cred, p));
+ return(VOP_SELECT(((struct vnode *)fp->f_data), which, fp->f_flag,
+ fp->f_cred, wql, p));
}
/*
while (vp->v_flag & VXLOCK) {
vp->v_flag |= VXWANT;
simple_unlock(&vp->v_interlock);
- tsleep((caddr_t)vp, PINOD, "vn_lock", 0);
+ (void)tsleep((caddr_t)vp, PINOD, "vn_lock", 0);
}
error = ENOENT;
} else {