summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpooka <pooka@NetBSD.org>2010-09-01 19:40:34 +0000
committerpooka <pooka@NetBSD.org>2010-09-01 19:40:34 +0000
commitcd52561abe2846ec9db3f3edee5e2b7a2e5bca3c (patch)
tree00807135b5a71f88dcc47b411ede46196472abcf /lib
parent11f8c2f90245d70b2b4426ebfda36b25a69d9dd9 (diff)
update to new rump proc/lwp interfaces
Diffstat (limited to 'lib')
-rw-r--r--lib/libp2k/p2k.c27
-rw-r--r--lib/libukfs/ukfs.c30
2 files changed, 20 insertions, 37 deletions
diff --git a/lib/libp2k/p2k.c b/lib/libp2k/p2k.c
index 2d70fffdd46..9b7892b570a 100644
--- a/lib/libp2k/p2k.c
+++ b/lib/libp2k/p2k.c
@@ -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 @@ makecn(const struct puffs_cn *pcn, int myflags)
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 @@ makelwp(struct puffs_usermount *pu)
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 @@ p2k_init(uint32_t puffs_flags)
if (p2m)
rump_init();
+ rump_pub_lwproc_newproc();
+
return p2m;
}
@@ -463,7 +457,7 @@ setupfs(struct p2k_mount *p2m, const char *vfsname, const char *devpath,
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 @@ p2k_fs_unmount(struct puffs_usermount *pu, int flags)
{
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);
+
+ 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 @@ p2k_fs_unmount(struct puffs_usermount *pu, int flags)
}
}
p2m->p2m_ukfs = NULL;
+ rump_pub_lwproc_switch(l);
if (p2m->p2m_hasdebug) {
printf("-- rump kernel event counters --\n");
@@ -587,7 +585,6 @@ p2k_fs_unmount(struct puffs_usermount *pu, int flags)
printf("-- end of event counters --\n");
}
- rump_pub_lwp_alloc_and_switch(0, 0);
return error;
}
diff --git a/lib/libukfs/ukfs.c b/lib/libukfs/ukfs.c
index b85023a1b82..0dbb8664f88 100644
--- a/lib/libukfs/ukfs.c
+++ b/lib/libukfs/ukfs.c
@@ -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 @@ struct ukfs {
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 @@ ukfs_getspecific(struct ukfs *ukfs)
#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 @@ postcall(struct ukfs *ukfs)
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 @@ ukfs_release(struct ukfs *fs, int flags)
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 @@ getmydents(struct vnode *vp, off_t *off, uint8_t *buf, size_t bufsize)
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);