Module Name:    src
Committed By:   pooka
Date:           Fri Apr 25 13:10:42 UTC 2014

Modified Files:
        src/sys/rump/librump/rumpkern: Makefile.rumpkern rump.c rumpkern.ifspec
        src/sys/rump/librump/rumpvfs: rumpfs.c rumpvfs.ifspec
Added Files:
        src/sys/rump/librump/rumpkern: etfs_wrap.c

Log Message:
Move the etfs linkage from rumpvfs to rumpkern, and replace the
weak alias show with an honest pointer indirection.

No client-visible change. (apart from this version working e.g.
on musl w/ dlopen)


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r0 -r1.1 src/sys/rump/librump/rumpkern/etfs_wrap.c
cvs rdiff -u -r1.296 -r1.297 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/librump/rumpkern/rumpkern.ifspec
cvs rdiff -u -r1.126 -r1.127 src/sys/rump/librump/rumpvfs/rumpfs.c
cvs rdiff -u -r1.8 -r1.9 src/sys/rump/librump/rumpvfs/rumpvfs.ifspec

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.143 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.144
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.143	Fri Apr  4 18:20:28 2014
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Fri Apr 25 13:10:42 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.143 2014/04/04 18:20:28 njoly Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.144 2014/04/25 13:10:42 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -22,8 +22,8 @@ LIB=		rump
 #
 # Source modules, first the ones specifically implemented for librump.
 # 
-SRCS+=	rump.c rumpcopy.c cons.c emul.c intr.c lwproc.c klock.c	\
-	kobj_rename.c ltsleep.c scheduler.c			\
+SRCS+=	rump.c rumpcopy.c cons.c emul.c etfs_wrap.c intr.c	\
+	lwproc.c klock.c kobj_rename.c ltsleep.c scheduler.c	\
 	signals.c sleepq.c threads.c vm.c hyperentropy.c
 
 # autogenerated into the correct namespace

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.296 src/sys/rump/librump/rumpkern/rump.c:1.297
--- src/sys/rump/librump/rumpkern/rump.c:1.296	Wed Apr 23 23:25:45 2014
+++ src/sys/rump/librump/rumpkern/rump.c	Fri Apr 25 13:10:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.296 2014/04/23 23:25:45 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.297 2014/04/25 13:10:42 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.296 2014/04/23 23:25:45 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.297 2014/04/25 13:10:42 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -146,11 +146,6 @@ void rump__unavailable_vfs_panic(void);
 void rump__unavailable_vfs_panic() {panic("vfs component not available");}
 __weak_alias(usermount_common_policy,rump__unavailable_vfs_panic);
 
-/* easier to write vfs-less clients */
-__weak_alias(rump_pub_etfs_register,rump__unavailable);
-__weak_alias(rump_pub_etfs_register_withsize,rump__unavailable);
-__weak_alias(rump_pub_etfs_remove,rump__unavailable);
-
 rump_proc_vfs_init_fn rump_proc_vfs_init;
 rump_proc_vfs_release_fn rump_proc_vfs_release;
 

Index: src/sys/rump/librump/rumpkern/rumpkern.ifspec
diff -u src/sys/rump/librump/rumpkern/rumpkern.ifspec:1.12 src/sys/rump/librump/rumpkern/rumpkern.ifspec:1.13
--- src/sys/rump/librump/rumpkern/rumpkern.ifspec:1.12	Mon Mar 10 22:44:11 2014
+++ src/sys/rump/librump/rumpkern/rumpkern.ifspec	Fri Apr 25 13:10:42 2014
@@ -1,4 +1,4 @@
-;	$NetBSD: rumpkern.ifspec,v 1.12 2014/03/10 22:44:11 pooka Exp $
+;	$NetBSD: rumpkern.ifspec,v 1.13 2014/04/25 13:10:42 pooka Exp $
 
 NAME|kern
 PUBHDR|include/rump/rumpkern_if_pub.h
@@ -29,3 +29,13 @@ struct lwp *	|lwproc_curlwp		|void
 void		|lwproc_sysent_usenative|void
 
 void		|allbetsareoff_setid	|pid_t, int
+
+; wrappers for etfs interfaces.  They are not handled by librump,
+; but having the function interfaces here makes it possible to always
+; link clients which can then get a runtime failure if components
+; handling etfs are not present.
+int		|etfs_register  |const char *, const char *, enum rump_etfs_type
+int		|etfs_register_withsize |const char *, const char *,	\
+					 enum rump_etfs_type, uint64_t,	\
+					 uint64_t
+int		|etfs_remove	|const char *

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.126 src/sys/rump/librump/rumpvfs/rumpfs.c:1.127
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.126	Sun Mar 16 10:16:15 2014
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Fri Apr 25 13:10:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.126 2014/03/16 10:16:15 njoly Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.127 2014/04/25 13:10:42 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.126 2014/03/16 10:16:15 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.127 2014/04/25 13:10:42 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -324,7 +324,7 @@ etfs_find(const char *key, struct etfs *
 #define REGDIR(ftype) \
     ((ftype) == RUMP_ETFS_DIR || (ftype) == RUMP_ETFS_DIR_SUBDIRS)
 static int
-doregister(const char *key, const char *hostpath, 
+etfsregister(const char *key, const char *hostpath, 
 	enum rump_etfs_type ftype, uint64_t begin, uint64_t size)
 {
 	char buf[9];
@@ -422,25 +422,9 @@ doregister(const char *key, const char *
 }
 #undef REGDIR
 
-int
-rump_etfs_register(const char *key, const char *hostpath,
-	enum rump_etfs_type ftype)
-{
-
-	return doregister(key, hostpath, ftype, 0, RUMP_ETFS_SIZE_ENDOFF);
-}
-
-int
-rump_etfs_register_withsize(const char *key, const char *hostpath,
-	enum rump_etfs_type ftype, uint64_t begin, uint64_t size)
-{
-
-	return doregister(key, hostpath, ftype, begin, size);
-}
-
 /* remove etfs mapping.  caller's responsibility to make sure it's not in use */
-int
-rump_etfs_remove(const char *key)
+static int
+etfsremove(const char *key)
 {
 	struct etfs *et;
 	size_t keylen;
@@ -1831,11 +1815,16 @@ rumpfs_vget(struct mount *mp, ino_t ino,
 void
 rumpfs_init()
 {
+	extern rump_etfs_register_withsize_fn rump__etfs_register;
+	extern rump_etfs_remove_fn rump__etfs_remove;
 
 	CTASSERT(RUMP_ETFS_SIZE_ENDOFF == RUMPBLK_SIZENOTSET);
 
 	mutex_init(&reclock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(&etfs_lock, MUTEX_DEFAULT, IPL_NONE);
+
+	rump__etfs_register = etfsregister;
+	rump__etfs_remove = etfsremove;
 }
 
 void

Index: src/sys/rump/librump/rumpvfs/rumpvfs.ifspec
diff -u src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.8 src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.9
--- src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.8	Sun Nov 18 18:39:23 2012
+++ src/sys/rump/librump/rumpvfs/rumpvfs.ifspec	Fri Apr 25 13:10:42 2014
@@ -1,4 +1,4 @@
-;       $NetBSD: rumpvfs.ifspec,v 1.8 2012/11/18 18:39:23 pooka Exp $
+;       $NetBSD: rumpvfs.ifspec,v 1.9 2014/04/25 13:10:42 pooka Exp $
 
 NAME|vfs
 PUBHDR|include/rump/rumpvfs_if_pub.h
@@ -26,12 +26,6 @@ void		|vp_rele	|struct vnode *
 
 void		|vp_interlock	|struct vnode *
 
-int		|etfs_register	|const char *, const char *, enum rump_etfs_type
-int		|etfs_register_withsize	|const char *, const char *,	\
-					 enum rump_etfs_type, uint64_t,	\
-					 uint64_t
-int		|etfs_remove	|const char *
-
 void		|freecn		|struct componentname *, int
 int		|namei		|uint32_t, uint32_t, const char *,	\
 				 struct vnode **, struct vnode **,	\

Added files:

Index: src/sys/rump/librump/rumpkern/etfs_wrap.c
diff -u /dev/null src/sys/rump/librump/rumpkern/etfs_wrap.c:1.1
--- /dev/null	Fri Apr 25 13:10:42 2014
+++ src/sys/rump/librump/rumpkern/etfs_wrap.c	Fri Apr 25 13:10:42 2014
@@ -0,0 +1,60 @@
+/*	$NetBSD: etfs_wrap.c,v 1.1 2014/04/25 13:10:42 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: etfs_wrap.c,v 1.1 2014/04/25 13:10:42 pooka Exp $");
+
+#include <sys/param.h>
+
+#include "rump_private.h"
+
+rump_etfs_register_withsize_fn rump__etfs_register	= (void *)enosys;
+rump_etfs_remove_fn rump__etfs_remove			= (void *)enosys;
+
+int
+rump_etfs_register(const char *key, const char *hostpath,
+        enum rump_etfs_type ftype)
+{
+
+	return rump__etfs_register(key, hostpath, ftype,
+	    0, RUMP_ETFS_SIZE_ENDOFF);
+}
+
+int
+rump_etfs_register_withsize(const char *key, const char *hostpath,
+        enum rump_etfs_type ftype, uint64_t begin, uint64_t size)
+{
+
+	return rump__etfs_register(key, hostpath, ftype, begin, size);
+}
+
+int
+rump_etfs_remove(const char *key)
+{
+
+	return rump__etfs_remove(key);
+}

Reply via email to