implement _kernel_lock{,_unlock}()

This commit is contained in:
pooka 2007-11-07 16:24:22 +00:00
parent a4fdbff490
commit 6fd64d7496
3 changed files with 31 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locks.c,v 1.1 2007/10/31 15:57:21 pooka Exp $ */
/* $NetBSD: locks.c,v 1.2 2007/11/07 16:24:22 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -32,6 +32,8 @@
#include <sys/mutex.h>
#include <sys/rwlock.h>
#include "rump_private.h"
#include "rumpuser.h"
void
@ -159,3 +161,23 @@ cv_signal(kcondvar_t *cv)
rumpuser_cv_signal(RUMPCV(cv));
}
/* kernel biglock, only for vnode_if */
void
_kernel_lock(int nlocks, struct lwp *l)
{
KASSERT(nlocks == 1);
mutex_enter(&rump_giantlock);
}
void
_kernel_unlock(int nlocks, struct lwp *l, int *countp)
{
KASSERT(nlocks == 1);
mutex_exit(&rump_giantlock);
if (countp)
*countp = 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump.c,v 1.18 2007/11/07 15:41:18 pooka Exp $ */
/* $NetBSD: rump.c,v 1.19 2007/11/07 16:24:22 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -50,6 +50,8 @@ struct plimit rump_limits;
kauth_cred_t rump_cred;
struct cpu_info rump_cpu;
kmutex_t rump_giantlock;
struct fakeblk {
char path[MAXPATHLEN];
LIST_ENTRY(fakeblk) entries;
@ -98,6 +100,8 @@ rump_init()
rump_sleepers_init();
rumpuser_thrinit();
mutex_init(&rump_giantlock, MUTEX_DEFAULT, IPL_NONE);
/* aieeeedondest */
if (workqueue_create(&uvm.aiodone_queue, "aiodoned",
rump_aiodone_worker, NULL, 0, 0, 0))

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_private.h,v 1.5 2007/11/06 11:35:04 pooka Exp $ */
/* $NetBSD: rump_private.h,v 1.6 2007/11/07 16:24:22 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -53,6 +53,8 @@ struct lwp;
extern kauth_cred_t rump_cred;
extern struct vmspace rump_vmspace;
extern kmutex_t rump_giantlock;
#define UIO_VMSPACE_SYS (&rump_vmspace)
struct rump_specpriv {