Adapt recent changes to the style of the rest of the file.

This commit is contained in:
jmmv 2005-09-13 20:02:05 +00:00
parent 873763ea0f
commit 5f4b660e4e

View File

@ -1,4 +1,4 @@
/* $NetBSD: tmpfs_vnops.c,v 1.6 2005/09/13 14:29:18 yamt Exp $ */ /* $NetBSD: tmpfs_vnops.c,v 1.7 2005/09/13 20:02:05 jmmv Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation, Inc. * Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.6 2005/09/13 14:29:18 yamt Exp $"); __KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.7 2005/09/13 20:02:05 jmmv Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/dirent.h> #include <sys/dirent.h>
@ -516,10 +516,10 @@ tmpfs_read(void *v)
struct vnode *vp = ((struct vop_read_args *)v)->a_vp; struct vnode *vp = ((struct vop_read_args *)v)->a_vp;
struct uio *uio = ((struct vop_read_args *)v)->a_uio; struct uio *uio = ((struct vop_read_args *)v)->a_uio;
int error;
int flags;
struct tmpfs_node *node; struct tmpfs_node *node;
struct uvm_object *uobj; struct uvm_object *uobj;
int flags;
int error;
KASSERT(VOP_ISLOCKED(vp)); KASSERT(VOP_ISLOCKED(vp));
@ -540,20 +540,17 @@ tmpfs_read(void *v)
uobj = node->tn_aobj; uobj = node->tn_aobj;
flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0; flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0;
error = 0; error = 0;
while (uio->uio_resid > 0) { while (error == 0 && uio->uio_resid > 0) {
vsize_t len; vsize_t len;
void *win; void *win;
len = MIN(node->tn_size - uio->uio_offset, uio->uio_resid); len = MIN(node->tn_size - uio->uio_offset, uio->uio_resid);
if (len == 0) { if (len == 0)
break; break;
}
win = ubc_alloc(uobj, uio->uio_offset, &len, UBC_READ); win = ubc_alloc(uobj, uio->uio_offset, &len, UBC_READ);
error = uiomove(win, len, uio); error = uiomove(win, len, uio);
ubc_release(win, flags); ubc_release(win, flags);
if (error) {
break;
}
} }
out: out:
@ -573,10 +570,10 @@ tmpfs_write(void *v)
boolean_t extended; boolean_t extended;
int error; int error;
int flags;
off_t oldsize; off_t oldsize;
struct tmpfs_node *node; struct tmpfs_node *node;
struct uvm_object *uobj; struct uvm_object *uobj;
int flags;
KASSERT(VOP_ISLOCKED(vp)); KASSERT(VOP_ISLOCKED(vp));
@ -606,28 +603,24 @@ tmpfs_write(void *v)
uobj = node->tn_aobj; uobj = node->tn_aobj;
flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0; flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0;
error = 0; error = 0;
while (uio->uio_resid > 0) { while (error == 0 && uio->uio_resid > 0) {
vsize_t len; vsize_t len;
void *win; void *win;
len = MIN(node->tn_size - uio->uio_offset, uio->uio_resid); len = MIN(node->tn_size - uio->uio_offset, uio->uio_resid);
if (len == 0) { if (len == 0)
break; break;
}
win = ubc_alloc(uobj, uio->uio_offset, &len, UBC_WRITE); win = ubc_alloc(uobj, uio->uio_offset, &len, UBC_WRITE);
error = uiomove(win, len, uio); error = uiomove(win, len, uio);
ubc_release(win, flags); ubc_release(win, flags);
if (error) {
break;
}
} }
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
(extended ? TMPFS_NODE_CHANGED : 0); (extended ? TMPFS_NODE_CHANGED : 0);
if (error) { if (error != 0)
(void)tmpfs_reg_resize(vp, oldsize); (void)tmpfs_reg_resize(vp, oldsize);
}
out: out:
KASSERT(VOP_ISLOCKED(vp)); KASSERT(VOP_ISLOCKED(vp));
@ -1425,38 +1418,41 @@ tmpfs_update(void *v)
int int
tmpfs_getpages(void *v) tmpfs_getpages(void *v)
{ {
const struct vop_getpages_args *ap = v; struct vnode *vp = ((struct vop_getpages_args *)v)->a_vp;
struct vnode *vp = ap->a_vp; voff_t offset = ((struct vop_getpages_args *)v)->a_offset;
voff_t offset = ap->a_offset; struct vm_page **m = ((struct vop_getpages_args *)v)->a_m;
vm_prot_t access_type = ap->a_access_type; int *count = ((struct vop_getpages_args *)v)->a_count;
int flags = ap->a_flags; int centeridx = ((struct vop_getpages_args *)v)->a_centeridx;
struct tmpfs_node *node = VP_TO_TMPFS_NODE(vp); vm_prot_t access_type = ((struct vop_getpages_args *)v)->a_access_type;
struct uvm_object *uobj; int advice = ((struct vop_getpages_args *)v)->a_advice;
int flags = ((struct vop_getpages_args *)v)->a_flags;
int error; int error;
struct tmpfs_node *node;
struct uvm_object *uobj;
KASSERT(vp->v_type == VREG); KASSERT(vp->v_type == VREG);
uobj = node->tn_aobj;
LOCK_ASSERT(simple_lock_held(&vp->v_interlock)); LOCK_ASSERT(simple_lock_held(&vp->v_interlock));
if ((flags & PGO_LOCKED) != 0) { node = VP_TO_TMPFS_NODE(vp);
uobj = node->tn_aobj;
if ((flags & PGO_LOCKED) != 0)
return EBUSY; return EBUSY;
}
if ((flags & PGO_NOTIMESTAMP) == 0) { if ((flags & PGO_NOTIMESTAMP) == 0) {
if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0) { if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
node->tn_status |= TMPFS_NODE_ACCESSED; node->tn_status |= TMPFS_NODE_ACCESSED;
}
if ((access_type & VM_PROT_WRITE) != 0) { if ((access_type & VM_PROT_WRITE) != 0)
node->tn_status |= TMPFS_NODE_MODIFIED; node->tn_status |= TMPFS_NODE_MODIFIED;
}
} }
simple_unlock(&vp->v_interlock); simple_unlock(&vp->v_interlock);
simple_lock(&uobj->vmobjlock); simple_lock(&uobj->vmobjlock);
error = (*uobj->pgops->pgo_get)(uobj, offset, ap->a_m, ap->a_count, error = (*uobj->pgops->pgo_get)(uobj, offset, m, count, centeridx,
ap->a_centeridx, access_type, ap->a_advice, flags); access_type, advice, flags);
return error; return error;
} }
@ -1466,15 +1462,19 @@ tmpfs_getpages(void *v)
int int
tmpfs_putpages(void *v) tmpfs_putpages(void *v)
{ {
const struct vop_putpages_args *ap = v; struct vnode *vp = ((struct vop_putpages_args *)v)->a_vp;
struct vnode *vp = ap->a_vp; voff_t offlo = ((struct vop_putpages_args *)v)->a_offlo;
int flags = ap->a_flags; voff_t offhi = ((struct vop_putpages_args *)v)->a_offhi;
struct tmpfs_node *node = VP_TO_TMPFS_NODE(vp); int flags = ((struct vop_putpages_args *)v)->a_flags;
struct uvm_object *uobj;
int error; int error;
struct tmpfs_node *node;
struct uvm_object *uobj;
LOCK_ASSERT(simple_lock_held(&vp->v_interlock)); LOCK_ASSERT(simple_lock_held(&vp->v_interlock));
node = VP_TO_TMPFS_NODE(vp);
if (vp->v_type != VREG) { if (vp->v_type != VREG) {
simple_unlock(&vp->v_interlock); simple_unlock(&vp->v_interlock);
return 0; return 0;
@ -1484,7 +1484,7 @@ tmpfs_putpages(void *v)
simple_unlock(&vp->v_interlock); simple_unlock(&vp->v_interlock);
simple_lock(&uobj->vmobjlock); simple_lock(&uobj->vmobjlock);
error = (*uobj->pgops->pgo_put)(uobj, ap->a_offlo, ap->a_offhi, flags); error = (*uobj->pgops->pgo_put)(uobj, offlo, offhi, flags);
/* XXX mtime */ /* XXX mtime */