1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 |
39 * $Id: vfs_vnops.c,v 1.21 1995/12/11 04:56:13 dyson Exp $ |
40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/file.h> 46#include <sys/stat.h> 47#include <sys/buf.h> 48#include <sys/proc.h> 49#include <sys/mount.h> 50#include <sys/namei.h> 51#include <sys/vnode.h> 52#include <sys/ioctl.h> 53 54#include <vm/vm.h> 55#include <vm/vm_param.h> 56#include <vm/vm_object.h> 57#include <vm/vnode_pager.h> 58 |
59static int vn_closefile __P((struct file *fp, struct proc *p)); 60static int vn_ioctl __P((struct file *fp, int com, caddr_t data, 61 struct proc *p)); 62static int vn_read __P((struct file *fp, struct uio *uio, 63 struct ucred *cred)); 64static int vn_select __P((struct file *fp, int which, struct proc *p)); 65static int vn_vmio_open __P((struct vnode *vp, struct proc *p, 66 struct ucred *cred)); 67static int vn_write __P((struct file *fp, struct uio *uio, 68 struct ucred *cred)); 69 |
70struct fileops vnops = 71 { vn_read, vn_write, vn_ioctl, vn_select, vn_closefile }; 72 73/* 74 * Common code for vnode open operations. 75 * Check permissions, and call the VOP_OPEN or VOP_CREATE routine. 76 */ 77int --- 183 unchanged lines hidden (view full) --- 261 if ((ioflg & IO_NODELOCKED) == 0) 262 VOP_UNLOCK(vp); 263 return (error); 264} 265 266/* 267 * File table vnode read routine. 268 */ |
269static int |
270vn_read(fp, uio, cred) 271 struct file *fp; 272 struct uio *uio; 273 struct ucred *cred; 274{ 275 register struct vnode *vp = (struct vnode *)fp->f_data; 276 int count, error; 277 --- 6 unchanged lines hidden (view full) --- 284 fp->f_offset += count - uio->uio_resid; 285 VOP_UNLOCK(vp); 286 return (error); 287} 288 289/* 290 * File table vnode write routine. 291 */ |
292static int |
293vn_write(fp, uio, cred) 294 struct file *fp; 295 struct uio *uio; 296 struct ucred *cred; 297{ 298 register struct vnode *vp = (struct vnode *)fp->f_data; 299 int count, error, ioflag = 0; 300 --- 82 unchanged lines hidden (view full) --- 383 sb->st_blocks = vap->va_bytes / S_BLKSIZE; 384#endif 385 return (0); 386} 387 388/* 389 * File table vnode ioctl routine. 390 */ |
391static int |
392vn_ioctl(fp, com, data, p) 393 struct file *fp; 394 int com; 395 caddr_t data; 396 struct proc *p; 397{ 398 register struct vnode *vp = ((struct vnode *)fp->f_data); 399 struct vattr vattr; --- 36 unchanged lines hidden (view full) --- 436 } 437 return (error); 438 } 439} 440 441/* 442 * File table vnode select routine. 443 */ |
444static int |
445vn_select(fp, which, p) 446 struct file *fp; 447 int which; 448 struct proc *p; 449{ 450 451 return (VOP_SELECT(((struct vnode *)fp->f_data), which, fp->f_flag, 452 fp->f_cred, p)); 453} 454 455/* 456 * File table vnode close routine. 457 */ |
458static int |
459vn_closefile(fp, p) 460 struct file *fp; 461 struct proc *p; 462{ 463 464 return (vn_close(((struct vnode *)fp->f_data), fp->f_flag, 465 fp->f_cred, p)); 466} 467 |
468static int |
469vn_vmio_open(vp, p, cred) 470 struct vnode *vp; 471 struct proc *p; 472 struct ucred *cred; 473{ 474 struct vattr vat; 475 int error; 476 /* --- 42 unchanged lines hidden --- |