Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Call biodone() in the bdev_strategy() error via a pointe...



details:   https://anonhg.NetBSD.org/src/rev/3676c3e0b0b3
branches:  trunk
changeset: 329472:3676c3e0b0b3
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun May 25 16:31:51 2014 +0000

description:
Call biodone() in the bdev_strategy() error via a pointer.  Decouples
subr_devsw from VFS -- not that I/O buffers are _VFS_ entities -- and
eliminates the last weak alias from librump, which means things now
fully work on glibc (w/o LD_DYNAMIC_WEAK) and musl.

The whole code path is suspect anyway, since nothing prevents the device
from escaping after the lookup, suggesting that the whole error path
should be handled by the caller, but oh well.

diffstat:

 sys/kern/subr_devsw.c            |  8 +++++---
 sys/kern/vfs_bio.c               |  7 +++++--
 sys/rump/librump/rumpkern/rump.c |  9 ++-------
 3 files changed, 12 insertions(+), 12 deletions(-)

diffs (94 lines):

diff -r 482f64a0a3d9 -r 3676c3e0b0b3 sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c     Sun May 25 16:19:08 2014 +0000
+++ b/sys/kern/subr_devsw.c     Sun May 25 16:31:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_devsw.c,v 1.30 2012/02/18 06:29:10 mrg Exp $      */
+/*     $NetBSD: subr_devsw.c,v 1.31 2014/05/25 16:31:51 pooka Exp $    */
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.30 2012/02/18 06:29:10 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.31 2014/05/25 16:31:51 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -104,6 +104,8 @@
 
 kmutex_t device_lock;
 
+void (*biodone_vfs)(buf_t *) = (void *)nullop;
+
 void
 devsw_init(void)
 {
@@ -737,7 +739,7 @@
        if ((d = bdevsw_lookup(bp->b_dev)) == NULL) {
                bp->b_error = ENXIO;
                bp->b_resid = bp->b_bcount;
-               biodone(bp);
+               biodone_vfs(bp); /* biodone() iff vfs present */
                return;
        }
 
diff -r 482f64a0a3d9 -r 3676c3e0b0b3 sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c        Sun May 25 16:19:08 2014 +0000
+++ b/sys/kern/vfs_bio.c        Sun May 25 16:31:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_bio.c,v 1.249 2014/02/25 18:30:11 pooka Exp $      */
+/*     $NetBSD: vfs_bio.c,v 1.250 2014/05/25 16:31:51 pooka Exp $      */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.249 2014/02/25 18:30:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.250 2014/05/25 16:31:51 pooka Exp $");
 
 #include "opt_bufcache.h"
 
@@ -441,6 +441,9 @@
        struct bqueue *dp;
        int use_std;
        u_int i;
+       extern void (*biodone_vfs)(buf_t *);
+
+       biodone_vfs = biodone;
 
        mutex_init(&bufcache_lock, MUTEX_DEFAULT, IPL_NONE);
        mutex_init(&buffer_lock, MUTEX_DEFAULT, IPL_NONE);
diff -r 482f64a0a3d9 -r 3676c3e0b0b3 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Sun May 25 16:19:08 2014 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Sun May 25 16:31:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.304 2014/04/27 15:08:52 pooka Exp $ */
+/*     $NetBSD: rump.c,v 1.305 2014/05/25 16:31:51 pooka Exp $ */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.304 2014/04/27 15:08:52 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.305 2014/05/25 16:31:51 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -130,11 +130,6 @@
 int  (*rump_vfs_makedevnodes)(dev_t, const char *, char,
                              devmajor_t, devminor_t, int) = (void *)nullop;
 
-int rump__unavailable(void);
-int rump__unavailable() {return EOPNOTSUPP;}
-
-__weak_alias(biodone,rump__unavailable);
-
 rump_proc_vfs_init_fn rump_proc_vfs_init = (void *)nullop;
 rump_proc_vfs_release_fn rump_proc_vfs_release = (void *)nullop;
 



Home | Main Index | Thread Index | Old Index