Module Name:    src
Committed By:   pooka
Date:           Sun May 25 16:31:51 UTC 2014

Modified Files:
        src/sys/kern: subr_devsw.c vfs_bio.c
        src/sys/rump/librump/rumpkern: rump.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/subr_devsw.c
cvs rdiff -u -r1.249 -r1.250 src/sys/kern/vfs_bio.c
cvs rdiff -u -r1.304 -r1.305 src/sys/rump/librump/rumpkern/rump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_devsw.c
diff -u src/sys/kern/subr_devsw.c:1.30 src/sys/kern/subr_devsw.c:1.31
--- src/sys/kern/subr_devsw.c:1.30	Sat Feb 18 06:29:10 2012
+++ src/sys/kern/subr_devsw.c	Sun May 25 16:31:51 2014
@@ -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 @@ static void devsw_detach_locked(const st
 
 kmutex_t device_lock;
 
+void (*biodone_vfs)(buf_t *) = (void *)nullop;
+
 void
 devsw_init(void)
 {
@@ -737,7 +739,7 @@ bdev_strategy(struct buf *bp)
 	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;
 	}
 

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.249 src/sys/kern/vfs_bio.c:1.250
--- src/sys/kern/vfs_bio.c:1.249	Tue Feb 25 18:30:11 2014
+++ src/sys/kern/vfs_bio.c	Sun May 25 16:31:51 2014
@@ -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 @@ bufinit(void)
 	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);

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.304 src/sys/rump/librump/rumpkern/rump.c:1.305
--- src/sys/rump/librump/rumpkern/rump.c:1.304	Sun Apr 27 15:08:52 2014
+++ src/sys/rump/librump/rumpkern/rump.c	Sun May 25 16:31:51 2014
@@ -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_makeonedevnode)(dev_t, c
 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;
 

Reply via email to