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.
@ -41,7 +41,7 @@
*/
#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/dirent.h>
@ -516,10 +516,10 @@ tmpfs_read(void *v)
struct vnode *vp = ((struct vop_read_args *)v)->a_vp;
struct uio *uio = ((struct vop_read_args *)v)->a_uio;
int error;
int flags;
struct tmpfs_node *node;
struct uvm_object *uobj;
int flags;
int error;
KASSERT(VOP_ISLOCKED(vp));
@ -540,20 +540,17 @@ tmpfs_read(void *v)
uobj = node->tn_aobj;
flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0;
error = 0;
while (uio->uio_resid > 0) {
while (error == 0 && uio->uio_resid > 0) {
vsize_t len;
void *win;
len = MIN(node->tn_size - uio->uio_offset, uio->uio_resid);
if (len == 0) {
if (len == 0)
break;
}
win = ubc_alloc(uobj, uio->uio_offset, &len, UBC_READ);
error = uiomove(win, len, uio);
ubc_release(win, flags);
if (error) {
break;
}
}
out:
@ -573,10 +570,10 @@ tmpfs_write(void *v)
boolean_t extended;
int error;
int flags;
off_t oldsize;
struct tmpfs_node *node;
struct uvm_object *uobj;
int flags;
KASSERT(VOP_ISLOCKED(vp));
@ -606,28 +603,24 @@ tmpfs_write(void *v)
uobj = node->tn_aobj;
flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0;
error = 0;
while (uio->uio_resid > 0) {
while (error == 0 && uio->uio_resid > 0) {
vsize_t len;
void *win;
len = MIN(node->tn_size - uio->uio_offset, uio->uio_resid);
if (len == 0) {
if (len == 0)
break;
}
win = ubc_alloc(uobj, uio->uio_offset, &len, UBC_WRITE);
error = uiomove(win, len, uio);
ubc_release(win, flags);
if (error) {
break;
}
}
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
(extended ? TMPFS_NODE_CHANGED : 0);
if (error) {
if (error != 0)
(void)tmpfs_reg_resize(vp, oldsize);
}
out:
KASSERT(VOP_ISLOCKED(vp));
@ -1425,38 +1418,41 @@ tmpfs_update(void *v)
int
tmpfs_getpages(void *v)
{
const struct vop_getpages_args *ap = v;
struct vnode *vp = ap->a_vp;
voff_t offset = ap->a_offset;
vm_prot_t access_type = ap->a_access_type;
int flags = ap->a_flags;
struct tmpfs_node *node = VP_TO_TMPFS_NODE(vp);
struct uvm_object *uobj;
struct vnode *vp = ((struct vop_getpages_args *)v)->a_vp;
voff_t offset = ((struct vop_getpages_args *)v)->a_offset;
struct vm_page **m = ((struct vop_getpages_args *)v)->a_m;
int *count = ((struct vop_getpages_args *)v)->a_count;
int centeridx = ((struct vop_getpages_args *)v)->a_centeridx;
vm_prot_t access_type = ((struct vop_getpages_args *)v)->a_access_type;
int advice = ((struct vop_getpages_args *)v)->a_advice;
int flags = ((struct vop_getpages_args *)v)->a_flags;
int error;
struct tmpfs_node *node;
struct uvm_object *uobj;
KASSERT(vp->v_type == VREG);
uobj = node->tn_aobj;
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;
}
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;
}
if ((access_type & VM_PROT_WRITE) != 0) {
if ((access_type & VM_PROT_WRITE) != 0)
node->tn_status |= TMPFS_NODE_MODIFIED;
}
}
simple_unlock(&vp->v_interlock);
simple_lock(&uobj->vmobjlock);
error = (*uobj->pgops->pgo_get)(uobj, offset, ap->a_m, ap->a_count,
ap->a_centeridx, access_type, ap->a_advice, flags);
error = (*uobj->pgops->pgo_get)(uobj, offset, m, count, centeridx,
access_type, advice, flags);
return error;
}
@ -1466,15 +1462,19 @@ tmpfs_getpages(void *v)
int
tmpfs_putpages(void *v)
{
const struct vop_putpages_args *ap = v;
struct vnode *vp = ap->a_vp;
int flags = ap->a_flags;
struct tmpfs_node *node = VP_TO_TMPFS_NODE(vp);
struct uvm_object *uobj;
struct vnode *vp = ((struct vop_putpages_args *)v)->a_vp;
voff_t offlo = ((struct vop_putpages_args *)v)->a_offlo;
voff_t offhi = ((struct vop_putpages_args *)v)->a_offhi;
int flags = ((struct vop_putpages_args *)v)->a_flags;
int error;
struct tmpfs_node *node;
struct uvm_object *uobj;
LOCK_ASSERT(simple_lock_held(&vp->v_interlock));
node = VP_TO_TMPFS_NODE(vp);
if (vp->v_type != VREG) {
simple_unlock(&vp->v_interlock);
return 0;
@ -1484,7 +1484,7 @@ tmpfs_putpages(void *v)
simple_unlock(&vp->v_interlock);
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 */