Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump Move the etfs linkage from rumpvfs to rumpk...
details: https://anonhg.NetBSD.org/src/rev/eab0ac6b2f3d
branches: trunk
changeset: 795700:eab0ac6b2f3d
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Apr 25 13:10:42 2014 +0000
description:
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)
diffstat:
sys/rump/librump/rumpkern/Makefile.rumpkern | 6 +-
sys/rump/librump/rumpkern/etfs_wrap.c | 60 +++++++++++++++++++++++++++++
sys/rump/librump/rumpkern/rump.c | 9 +---
sys/rump/librump/rumpkern/rumpkern.ifspec | 12 +++++-
sys/rump/librump/rumpvfs/rumpfs.c | 31 ++++----------
sys/rump/librump/rumpvfs/rumpvfs.ifspec | 8 +---
6 files changed, 87 insertions(+), 39 deletions(-)
diffs (231 lines):
diff -r 6e4be0cfdeff -r eab0ac6b2f3d sys/rump/librump/rumpkern/Makefile.rumpkern
--- a/sys/rump/librump/rumpkern/Makefile.rumpkern Fri Apr 25 13:07:31 2014 +0000
+++ b/sys/rump/librump/rumpkern/Makefile.rumpkern Fri Apr 25 13:10:42 2014 +0000
@@ -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 @@
#
# 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
diff -r 6e4be0cfdeff -r eab0ac6b2f3d sys/rump/librump/rumpkern/etfs_wrap.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/librump/rumpkern/etfs_wrap.c Fri Apr 25 13:10:42 2014 +0000
@@ -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);
+}
diff -r 6e4be0cfdeff -r eab0ac6b2f3d sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c Fri Apr 25 13:07:31 2014 +0000
+++ b/sys/rump/librump/rumpkern/rump.c Fri Apr 25 13:10:42 2014 +0000
@@ -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() {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;
diff -r 6e4be0cfdeff -r eab0ac6b2f3d sys/rump/librump/rumpkern/rumpkern.ifspec
--- a/sys/rump/librump/rumpkern/rumpkern.ifspec Fri Apr 25 13:07:31 2014 +0000
+++ b/sys/rump/librump/rumpkern/rumpkern.ifspec Fri Apr 25 13:10:42 2014 +0000
@@ -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 @@
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 *
diff -r 6e4be0cfdeff -r eab0ac6b2f3d sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Fri Apr 25 13:07:31 2014 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Fri Apr 25 13:10:42 2014 +0000
@@ -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 @@
#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 @@
}
#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 @@
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
diff -r 6e4be0cfdeff -r eab0ac6b2f3d sys/rump/librump/rumpvfs/rumpvfs.ifspec
--- a/sys/rump/librump/rumpvfs/rumpvfs.ifspec Fri Apr 25 13:07:31 2014 +0000
+++ b/sys/rump/librump/rumpvfs/rumpvfs.ifspec Fri Apr 25 13:10:42 2014 +0000
@@ -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_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 **, \
Home |
Main Index |
Thread Index |
Old Index