Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib update to new rump proc/lwp interfaces
details: https://anonhg.NetBSD.org/src/rev/133eda5641d7
branches: trunk
changeset: 757514:133eda5641d7
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Sep 01 19:40:34 2010 +0000
description:
update to new rump proc/lwp interfaces
diffstat:
lib/libp2k/p2k.c | 27 ++++++++++++---------------
lib/libukfs/ukfs.c | 30 ++++++++----------------------
2 files changed, 20 insertions(+), 37 deletions(-)
diffs (173 lines):
diff -r 7c77d3cd89d6 -r 133eda5641d7 lib/libp2k/p2k.c
--- a/lib/libp2k/p2k.c Wed Sep 01 19:37:58 2010 +0000
+++ b/lib/libp2k/p2k.c Wed Sep 01 19:40:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: p2k.c,v 1.41 2010/06/24 13:03:05 hannken Exp $ */
+/* $NetBSD: p2k.c,v 1.42 2010/09/01 19:40:35 pooka Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved.
@@ -141,7 +141,7 @@
cred = cred_create(pcn->pcn_cred);
/* LINTED: prehistoric types in first two args */
return rump_pub_makecn(pcn->pcn_nameiop, pcn->pcn_flags | myflags,
- pcn->pcn_name, pcn->pcn_namelen, cred, rump_pub_lwp_curlwp());
+ pcn->pcn_name, pcn->pcn_namelen, cred, rump_pub_lwproc_curlwp());
}
static __inline void
@@ -158,15 +158,7 @@
lwpid_t lid;
puffs_cc_getcaller(puffs_cc_getcc(pu), &pid, &lid);
- rump_pub_lwp_alloc_and_switch(pid, lid);
-}
-
-/*ARGSUSED*/
-static void
-clearlwp(struct puffs_usermount *pu)
-{
-
- rump_pub_lwp_release(rump_pub_lwp_curlwp());
+ rump_pub_allbetsareoff_setid(pid, lid);
}
static __inline struct p2k_vp_hash *
@@ -372,6 +364,8 @@
if (p2m)
rump_init();
+ rump_pub_lwproc_newproc();
+
return p2m;
}
@@ -463,7 +457,7 @@
puffs_setfhsize(pu, 0, PUFFS_FHFLAG_PASSTHROUGH);
puffs_setstacksize(pu, PUFFS_STACKSIZE_MIN);
puffs_fakecc = 1;
- puffs_set_prepost(pu, makelwp, clearlwp);
+ puffs_set_prepost(pu, makelwp, NULL);
puffs_set_errnotify(pu, p2k_errcatcher);
puffs_setspecific(pu, p2m);
@@ -568,11 +562,14 @@
{
struct p2k_mount *p2m = puffs_getspecific(pu);
struct ukfs *fs = p2m->p2m_ukfs;
+ struct lwp *l;
int error = 0;
- rump_pub_lwp_release(rump_pub_lwp_curlwp()); /* ukfs & curlwp tricks */
+ rump_pub_vp_rele(p2m->p2m_rvp);
- rump_pub_vp_rele(p2m->p2m_rvp);
+ l = rump_pub_lwproc_curlwp();
+ rump_pub_lwproc_switch(NULL); /* ukfs & curlwp tricks */
+
if (fs) {
if (ukfs_release(fs, 0) != 0) {
ukfs_release(fs, UKFS_RELFLAG_FORCE);
@@ -580,6 +577,7 @@
}
}
p2m->p2m_ukfs = NULL;
+ rump_pub_lwproc_switch(l);
if (p2m->p2m_hasdebug) {
printf("-- rump kernel event counters --\n");
@@ -587,7 +585,6 @@
printf("-- end of event counters --\n");
}
- rump_pub_lwp_alloc_and_switch(0, 0);
return error;
}
diff -r 7c77d3cd89d6 -r 133eda5641d7 lib/libukfs/ukfs.c
--- a/lib/libukfs/ukfs.c Wed Sep 01 19:37:58 2010 +0000
+++ b/lib/libukfs/ukfs.c Wed Sep 01 19:40:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukfs.c,v 1.52 2010/07/19 15:35:38 pooka Exp $ */
+/* $NetBSD: ukfs.c,v 1.53 2010/09/01 19:40:34 pooka Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved.
@@ -74,7 +74,6 @@
void *ukfs_specific;
pthread_spinlock_t ukfs_spin;
- pid_t ukfs_nextpid;
struct vnode *ukfs_cdir;
int ukfs_devfd;
char *ukfs_devpath;
@@ -124,26 +123,12 @@
#define pthread_spin_destroy(a)
#endif
-static pid_t
-nextpid(struct ukfs *ukfs)
-{
- pid_t npid;
-
- pthread_spin_lock(&ukfs->ukfs_spin);
- if (ukfs->ukfs_nextpid == 0)
- ukfs->ukfs_nextpid++;
- npid = ukfs->ukfs_nextpid++;
- pthread_spin_unlock(&ukfs->ukfs_spin);
-
- return npid;
-}
-
static void
precall(struct ukfs *ukfs)
{
struct vnode *rvp, *cvp;
- rump_pub_lwp_alloc_and_switch(nextpid(ukfs), 1);
+ rump_pub_lwproc_newproc();
rvp = ukfs_getrvp(ukfs);
pthread_spin_lock(&ukfs->ukfs_spin);
cvp = ukfs->ukfs_cdir;
@@ -160,7 +145,8 @@
rvp = ukfs_getrvp(ukfs);
rump_pub_rcvp_set(NULL, rvp);
rump_pub_vp_rele(rvp);
- rump_pub_lwp_release(rump_pub_lwp_curlwp());
+
+ rump_pub_lwproc_releaselwp();
}
struct ukfs_part {
@@ -685,19 +671,19 @@
mntflag = 0;
if (flags & UKFS_RELFLAG_FORCE)
mntflag = MNT_FORCE;
- rump_pub_lwp_alloc_and_switch(nextpid(fs), 1);
+ rump_pub_lwproc_newproc();
rump_pub_vp_rele(fs->ukfs_rvp);
fs->ukfs_rvp = NULL;
rv = rump_sys_unmount(fs->ukfs_mountpath, mntflag);
if (rv == -1) {
error = errno;
rump_pub_vfs_root(fs->ukfs_mp, &fs->ukfs_rvp, 0);
- rump_pub_lwp_release(rump_pub_lwp_curlwp());
+ rump_pub_lwproc_releaselwp();
ukfs_chdir(fs, fs->ukfs_mountpath);
errno = error;
return -1;
}
- rump_pub_lwp_release(rump_pub_lwp_curlwp());
+ rump_pub_lwproc_releaselwp();
}
if (fs->ukfs_devpath) {
@@ -773,7 +759,7 @@
struct kauth_cred *cred;
uio = rump_pub_uio_setup(buf, bufsize, *off, RUMPUIO_READ);
- cred = rump_pub_cred_suserget();
+ cred = rump_pub_cred_create(0, 0, 0, NULL);
rv = RUMP_VOP_READDIR(vp, uio, cred, &eofflag, NULL, NULL);
rump_pub_cred_put(cred);
RUMP_VOP_UNLOCK(vp);
Home |
Main Index |
Thread Index |
Old Index