Sat May 2 15:20:08 2009 UTC ()
Since rump_module_load() doesn't actually load the module, change
the name to rump_module_init().  Also, adjust the signature to take
a direct pointer to modinfo and allow passing of props.  Finally,
provide rump_module_fini().


(pooka)
diff -r1.25 -r1.26 src/lib/libukfs/ukfs.c
diff -r1.13 -r1.14 src/sys/rump/include/rump/rump.h
diff -r1.105 -r1.106 src/sys/rump/librump/rumpkern/rump.c

cvs diff -r1.25 -r1.26 src/lib/libukfs/ukfs.c (expand / switch to unified diff)

--- src/lib/libukfs/ukfs.c 2009/05/02 01:15:52 1.25
+++ src/lib/libukfs/ukfs.c 2009/05/02 15:20:08 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ukfs.c,v 1.25 2009/05/02 01:15:52 pooka Exp $ */ 1/* $NetBSD: ukfs.c,v 1.26 2009/05/02 15:20:08 pooka Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Development of this software was supported by the 6 * Development of this software was supported by the
7 * Finnish Cultural Foundation. 7 * Finnish Cultural Foundation.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -665,46 +665,47 @@ ukfs_lutimes(struct ukfs *ukfs, const ch @@ -665,46 +665,47 @@ ukfs_lutimes(struct ukfs *ukfs, const ch
665 * Dynamic module support 665 * Dynamic module support
666 */ 666 */
667 667
668/* load one library */ 668/* load one library */
669 669
670/* 670/*
671 * XXX: the dlerror stuff isn't really threadsafe, but then again I 671 * XXX: the dlerror stuff isn't really threadsafe, but then again I
672 * can't protect against other threads calling dl*() outside of ukfs, 672 * can't protect against other threads calling dl*() outside of ukfs,
673 * so just live with it being flimsy 673 * so just live with it being flimsy
674 */ 674 */
675int 675int
676ukfs_modload(const char *fname) 676ukfs_modload(const char *fname)
677{ 677{
678 void *handle, *thesym; 678 void *handle;
 679 struct modinfo **mi;
679 struct stat sb; 680 struct stat sb;
680 int error; 681 int error;
681 682
682 if (stat(fname, &sb) == -1) 683 if (stat(fname, &sb) == -1)
683 return -1; 684 return -1;
684 685
685 handle = dlopen(fname, RTLD_GLOBAL); 686 handle = dlopen(fname, RTLD_GLOBAL);
686 if (handle == NULL) { 687 if (handle == NULL) {
687 const char *dlmsg = dlerror(); 688 const char *dlmsg = dlerror();
688 if (strstr(dlmsg, "Undefined symbol")) 689 if (strstr(dlmsg, "Undefined symbol"))
689 return 0; 690 return 0;
690 warnx("dlopen %s failed: %s\n", fname, dlmsg); 691 warnx("dlopen %s failed: %s\n", fname, dlmsg);
691 /* XXXerrno */ 692 /* XXXerrno */
692 return -1; 693 return -1;
693 } 694 }
694 695
695 thesym = dlsym(handle, "__start_link_set_modules"); 696 mi = dlsym(handle, "__start_link_set_modules");
696 if (thesym) { 697 if (mi) {
697 error = rump_module_load(thesym); 698 error = rump_module_init(*mi, NULL);
698 if (error) 699 if (error)
699 goto errclose; 700 goto errclose;
700 return 1; 701 return 1;
701 } 702 }
702 error = EINVAL; 703 error = EINVAL;
703 704
704 errclose: 705 errclose:
705 dlclose(handle); 706 dlclose(handle);
706 errno = error; 707 errno = error;
707 return -1; 708 return -1;
708} 709}
709 710
710struct loadfail { 711struct loadfail {

cvs diff -r1.13 -r1.14 src/sys/rump/include/rump/rump.h (expand / switch to unified diff)

--- src/sys/rump/include/rump/rump.h 2009/04/29 18:00:49 1.13
+++ src/sys/rump/include/rump/rump.h 2009/05/02 15:20:08 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rump.h,v 1.13 2009/04/29 18:00:49 pooka Exp $ */ 1/* $NetBSD: rump.h,v 1.14 2009/05/02 15:20:08 pooka Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2007 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Development of this software was supported by Google Summer of Code. 6 * Development of this software was supported by Google Summer of Code.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -33,48 +33,56 @@ @@ -33,48 +33,56 @@
33/* 33/*
34 * NOTE: do not #include anything from <sys> here. Otherwise this 34 * NOTE: do not #include anything from <sys> here. Otherwise this
35 * has no chance of working on non-NetBSD platforms. 35 * has no chance of working on non-NetBSD platforms.
36 */ 36 */
37 37
38struct mount; 38struct mount;
39struct vnode; 39struct vnode;
40struct vattr; 40struct vattr;
41struct componentname; 41struct componentname;
42struct vfsops; 42struct vfsops;
43struct fid; 43struct fid;
44struct statvfs; 44struct statvfs;
45 45
 46/* yetch */
46#if !defined(_RUMPKERNEL) && !defined(__NetBSD__) 47#if !defined(_RUMPKERNEL) && !defined(__NetBSD__)
47struct kauth_cred; 48struct kauth_cred;
48typedef struct kauth_cred *kauth_cred_t; 49typedef struct kauth_cred *kauth_cred_t;
49#endif 50#endif
 51#if defined(__NetBSD__)
 52#include <prop/proplib.h>
 53#else
 54struct prop_dictionary;
 55typedef struct prop_dictionary *prop_dictionary_t;
 56#endif /* __NetBSD__ */
50 57
51struct lwp; 58struct lwp;
52struct modinfo; 59struct modinfo;
53 60
54#include <rump/rumpvnode_if.h> 61#include <rump/rumpvnode_if.h>
55#include <rump/rumpdefs.h> 62#include <rump/rumpdefs.h>
56 63
57#ifndef curlwp 64#ifndef curlwp
58#define curlwp rump_get_curlwp() 65#define curlwp rump_get_curlwp()
59#endif 66#endif
60 67
61/* 68/*
62 * Something like rump capabilities would be nicer, but let's 69 * Something like rump capabilities would be nicer, but let's
63 * do this for a start. 70 * do this for a start.
64 */ 71 */
65#define RUMP_VERSION 01 72#define RUMP_VERSION 01
66#define rump_init() rump__init(RUMP_VERSION) 73#define rump_init() rump__init(RUMP_VERSION)
67int rump_module_load(struct modinfo **); 74int rump_module_init(struct modinfo *, prop_dictionary_t props);
 75int rump_module_fini(struct modinfo *);
68 76
69int rump__init(int); 77int rump__init(int);
70struct mount *rump_mnt_init(struct vfsops *, int); 78struct mount *rump_mnt_init(struct vfsops *, int);
71int rump_mnt_mount(struct mount *, const char *, void *, size_t *); 79int rump_mnt_mount(struct mount *, const char *, void *, size_t *);
72void rump_mnt_destroy(struct mount *); 80void rump_mnt_destroy(struct mount *);
73 81
74struct componentname *rump_makecn(u_long, u_long, const char *, size_t, 82struct componentname *rump_makecn(u_long, u_long, const char *, size_t,
75 kauth_cred_t, struct lwp *); 83 kauth_cred_t, struct lwp *);
76void rump_freecn(struct componentname *, int); 84void rump_freecn(struct componentname *, int);
77#define RUMPCN_ISLOOKUP 0x01 85#define RUMPCN_ISLOOKUP 0x01
78#define RUMPCN_FREECRED 0x02 86#define RUMPCN_FREECRED 0x02
79#define RUMPCN_HASNTBUF 0x04 87#define RUMPCN_HASNTBUF 0x04
80int rump_namei(uint32_t, uint32_t, const char *, 88int rump_namei(uint32_t, uint32_t, const char *,

cvs diff -r1.105 -r1.106 src/sys/rump/librump/rumpkern/rump.c (expand / switch to unified diff)

--- src/sys/rump/librump/rumpkern/rump.c 2009/04/30 16:59:32 1.105
+++ src/sys/rump/librump/rumpkern/rump.c 2009/05/02 15:20:08 1.106
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rump.c,v 1.105 2009/04/30 16:59:32 pooka Exp $ */ 1/* $NetBSD: rump.c,v 1.106 2009/05/02 15:20:08 pooka Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2007 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Development of this software was supported by Google Summer of Code. 6 * Development of this software was supported by Google Summer of Code.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.105 2009/04/30 16:59:32 pooka Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.106 2009/05/02 15:20:08 pooka Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/atomic.h> 34#include <sys/atomic.h>
35#include <sys/buf.h> 35#include <sys/buf.h>
36#include <sys/callout.h> 36#include <sys/callout.h>
37#include <sys/conf.h> 37#include <sys/conf.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39#include <sys/evcnt.h> 39#include <sys/evcnt.h>
40#include <sys/event.h> 40#include <sys/event.h>
41#include <sys/filedesc.h> 41#include <sys/filedesc.h>
42#include <sys/iostat.h> 42#include <sys/iostat.h>
43#include <sys/kauth.h> 43#include <sys/kauth.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
@@ -472,33 +472,40 @@ rump_nextlid(void) @@ -472,33 +472,40 @@ rump_nextlid(void)
472 * Take next one, don't return 0 472 * Take next one, don't return 0
473 * XXX: most likely we'll have collisions in case this 473 * XXX: most likely we'll have collisions in case this
474 * wraps around. 474 * wraps around.
475 */ 475 */
476 if (++proc0.p_nlwpid == 0) 476 if (++proc0.p_nlwpid == 0)
477 ++proc0.p_nlwpid; 477 ++proc0.p_nlwpid;
478 retid = proc0.p_nlwpid; 478 retid = proc0.p_nlwpid;
479 mutex_exit(proc0.p_lock); 479 mutex_exit(proc0.p_lock);
480 480
481 return retid; 481 return retid;
482} 482}
483 483
484int 484int
485rump_module_load(struct modinfo **mi) 485rump_module_init(struct modinfo *mi, prop_dictionary_t props)
486{ 486{
487 487
488 if (!module_compatible((*mi)->mi_version, __NetBSD_Version__)) 488 if (!module_compatible(mi->mi_version, __NetBSD_Version__))
489 return EPROGMISMATCH; 489 return EPROGMISMATCH;
490 490
491 return (*mi)->mi_modcmd(MODULE_CMD_INIT, NULL); 491 return mi->mi_modcmd(MODULE_CMD_INIT, props);
 492}
 493
 494int
 495rump_module_fini(struct modinfo *mi)
 496{
 497
 498 return mi->mi_modcmd(MODULE_CMD_FINI, NULL);
492} 499}
493 500
494int _syspuffs_stub(int, int *); 501int _syspuffs_stub(int, int *);
495int 502int
496_syspuffs_stub(int fd, int *newfd) 503_syspuffs_stub(int fd, int *newfd)
497{ 504{
498 505
499 return ENODEV; 506 return ENODEV;
500} 507}
501__weak_alias(rump_syspuffs_glueinit,_syspuffs_stub); 508__weak_alias(rump_syspuffs_glueinit,_syspuffs_stub);
502 509
503static int 510static int
504rump_sysproxy_local(int num, void *arg, uint8_t *data, size_t dlen, 511rump_sysproxy_local(int num, void *arg, uint8_t *data, size_t dlen,