Deleted Added
full compact
vfs_vnops.c (12767) vfs_vnops.c (12913)
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
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.20 1995/12/07 12:47:07 davidg Exp $
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
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
59struct fileops vnops =
60 { vn_read, vn_write, vn_ioctl, vn_select, vn_closefile };
61
62/*
63 * Common code for vnode open operations.
64 * Check permissions, and call the VOP_OPEN or VOP_CREATE routine.
65 */
66int

--- 183 unchanged lines hidden (view full) ---

250 if ((ioflg & IO_NODELOCKED) == 0)
251 VOP_UNLOCK(vp);
252 return (error);
253}
254
255/*
256 * File table vnode read routine.
257 */
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 */
258int
269static int
259vn_read(fp, uio, cred)
260 struct file *fp;
261 struct uio *uio;
262 struct ucred *cred;
263{
264 register struct vnode *vp = (struct vnode *)fp->f_data;
265 int count, error;
266

--- 6 unchanged lines hidden (view full) ---

273 fp->f_offset += count - uio->uio_resid;
274 VOP_UNLOCK(vp);
275 return (error);
276}
277
278/*
279 * File table vnode write routine.
280 */
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 */
281int
292static int
282vn_write(fp, uio, cred)
283 struct file *fp;
284 struct uio *uio;
285 struct ucred *cred;
286{
287 register struct vnode *vp = (struct vnode *)fp->f_data;
288 int count, error, ioflag = 0;
289

--- 82 unchanged lines hidden (view full) ---

372 sb->st_blocks = vap->va_bytes / S_BLKSIZE;
373#endif
374 return (0);
375}
376
377/*
378 * File table vnode ioctl routine.
379 */
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 */
380int
391static int
381vn_ioctl(fp, com, data, p)
382 struct file *fp;
383 int com;
384 caddr_t data;
385 struct proc *p;
386{
387 register struct vnode *vp = ((struct vnode *)fp->f_data);
388 struct vattr vattr;

--- 36 unchanged lines hidden (view full) ---

425 }
426 return (error);
427 }
428}
429
430/*
431 * File table vnode select routine.
432 */
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 */
433int
444static int
434vn_select(fp, which, p)
435 struct file *fp;
436 int which;
437 struct proc *p;
438{
439
440 return (VOP_SELECT(((struct vnode *)fp->f_data), which, fp->f_flag,
441 fp->f_cred, p));
442}
443
444/*
445 * File table vnode close routine.
446 */
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 */
447int
458static int
448vn_closefile(fp, p)
449 struct file *fp;
450 struct proc *p;
451{
452
453 return (vn_close(((struct vnode *)fp->f_data), fp->f_flag,
454 fp->f_cred, p));
455}
456
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
457int
468static int
458vn_vmio_open(vp, p, cred)
459 struct vnode *vp;
460 struct proc *p;
461 struct ucred *cred;
462{
463 struct vattr vat;
464 int error;
465 /*

--- 42 unchanged lines hidden ---
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 ---