Module Name: src
Committed By: pooka
Date: Wed Nov 4 13:32:39 UTC 2009
Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern locks.c rump.c
Log Message:
Use kern_mutex_obj.c directly instead of copypasting code.
To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.32 -r1.33 src/sys/rump/librump/rumpkern/locks.c
cvs rdiff -u -r1.132 -r1.133 src/sys/rump/librump/rumpkern/rump.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.56 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.57
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.56 Tue Nov 3 18:44:15 2009
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern Wed Nov 4 13:32:39 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.rumpkern,v 1.56 2009/11/03 18:44:15 pooka Exp $
+# $NetBSD: Makefile.rumpkern,v 1.57 2009/11/04 13:32:39 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@@ -31,8 +31,9 @@
#
# sys/kern
SRCS+= init_sysctl_base.c kern_auth.c kern_descrip.c kern_event.c \
- kern_ksyms.c kern_malloc_stdtype.c kern_module.c kern_rate.c \
- kern_stub.c kern_sysctl.c kern_timeout.c kern_uidinfo.c param.c \
+ kern_ksyms.c kern_malloc_stdtype.c kern_module.c \
+ kern_mutex_obj.c kern_rate.c kern_stub.c kern_sysctl.c \
+ kern_timeout.c kern_uidinfo.c param.c \
sys_descrip.c sys_generic.c sys_select.c syscalls.c
# sys/kern subr (misc)
Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.32 src/sys/rump/librump/rumpkern/locks.c:1.33
--- src/sys/rump/librump/rumpkern/locks.c:1.32 Fri Oct 16 00:14:53 2009
+++ src/sys/rump/librump/rumpkern/locks.c Wed Nov 4 13:32:39 2009
@@ -1,30 +1,4 @@
-/* $NetBSD: locks.c,v 1.32 2009/10/16 00:14:53 pooka Exp $ */
-
-/*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
- * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION 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.
- */
+/* $NetBSD: locks.c,v 1.33 2009/11/04 13:32:39 pooka Exp $ */
/*
* Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved.
@@ -55,10 +29,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.32 2009/10/16 00:14:53 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.33 2009/11/04 13:32:39 pooka Exp $");
#include <sys/param.h>
-#include <sys/atomic.h>
#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/rwlock.h>
@@ -396,41 +369,3 @@
if (nlocks)
_kernel_lock(nlocks);
}
-
-struct kmutexobj {
- kmutex_t mo_lock;
- u_int mo_refcnt;
-};
-
-kmutex_t *
-mutex_obj_alloc(kmutex_type_t type, int ipl)
-{
- struct kmutexobj *mo;
-
- mo = kmem_alloc(sizeof(*mo), KM_SLEEP);
- mutex_init(&mo->mo_lock, type, ipl);
- mo->mo_refcnt = 1;
-
- return (kmutex_t *)mo;
-}
-
-void
-mutex_obj_hold(kmutex_t *lock)
-{
- struct kmutexobj *mo = (struct kmutexobj *)lock;
-
- atomic_inc_uint(&mo->mo_refcnt);
-}
-
-bool
-mutex_obj_free(kmutex_t *lock)
-{
- struct kmutexobj *mo = (struct kmutexobj *)lock;
-
- if (atomic_dec_uint_nv(&mo->mo_refcnt) > 0) {
- return false;
- }
- mutex_destroy(&mo->mo_lock);
- kmem_free(mo, sizeof(*mo));
- return true;
-}
Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.132 src/sys/rump/librump/rumpkern/rump.c:1.133
--- src/sys/rump/librump/rumpkern/rump.c:1.132 Tue Nov 3 20:25:31 2009
+++ src/sys/rump/librump/rumpkern/rump.c Wed Nov 4 13:32:39 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.c,v 1.132 2009/11/03 20:25:31 pooka Exp $ */
+/* $NetBSD: rump.c,v 1.133 2009/11/04 13:32:39 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.132 2009/11/03 20:25:31 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.133 2009/11/04 13:32:39 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -230,6 +230,8 @@
pool_subsystem_init();
kmem_init();
+ mutex_obj_init();
+
kprintf_init();
loginit();