summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2010-04-09 22:42:10 +0000
committeroga <oga@openbsd.org>2010-04-09 22:42:10 +0000
commit8fc8e70096561724760dfdd082479fba1d378273 (patch)
treec2e44abab82fb944b8ff9740862b4fc717da2590
parentIn the nfs bio functions, instead of looking at an invalid vnode type, (diff)
downloadwireguard-openbsd-8fc8e70096561724760dfdd082479fba1d378273.tar.xz
wireguard-openbsd-8fc8e70096561724760dfdd082479fba1d378273.zip
make more bettah. instead of doing:
switch(type) { case VREG: /*something */ break; case VLNK: /* something */ break; default: panic("wtf?"); } do_something_that_doesn't_change_type(); switch(type) { case VREG: /* nowt */ break; case VLNK: n = 0; break; default: panic("wtf?"); } be a bit less silly and replace the second switch with: if (type == VLNK) n = 0; ok beck@, blambert@
-rw-r--r--sys/nfs/nfs_bio.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index af2103d0b48..c16791483d6 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.69 2010/04/09 22:08:04 oga Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.70 2010/04/09 22:42:10 oga Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */
/*
@@ -228,15 +228,10 @@ again:
baddr = bp->b_data;
error = uiomove(baddr + on, (int)n, uio);
}
- switch (vp->v_type) {
- case VREG:
- break;
- case VLNK:
+
+ if (vp->v_type == VLNK)
n = 0;
- break;
- default:
- panic("nfsbioread: type %x unexpected\n", vp->v_type);
- }
+
if (got_buf)
brelse(bp);
} while (error == 0 && uio->uio_resid > 0 && n > 0);