kern_rwlock.c (173617) | kern_rwlock.c (173733) |
---|---|
1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 173617 2007-11-14 21:21:48Z attilio $"); | 35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 173733 2007-11-18 14:43:53Z attilio $"); |
36 37#include "opt_ddb.h" 38#include "opt_no_adaptive_rwlocks.h" 39 40#include <sys/param.h> 41#include <sys/ktr.h> 42#include <sys/lock.h> 43#include <sys/mutex.h> --- 10 unchanged lines hidden (view full) --- 54#define ADAPTIVE_RWLOCKS 55#endif 56 57#ifdef DDB 58#include <ddb/ddb.h> 59 60static void db_show_rwlock(struct lock_object *lock); 61#endif | 36 37#include "opt_ddb.h" 38#include "opt_no_adaptive_rwlocks.h" 39 40#include <sys/param.h> 41#include <sys/ktr.h> 42#include <sys/lock.h> 43#include <sys/mutex.h> --- 10 unchanged lines hidden (view full) --- 54#define ADAPTIVE_RWLOCKS 55#endif 56 57#ifdef DDB 58#include <ddb/ddb.h> 59 60static void db_show_rwlock(struct lock_object *lock); 61#endif |
62static void assert_rw(struct lock_object *lock, int what); |
|
62static void lock_rw(struct lock_object *lock, int how); 63static int unlock_rw(struct lock_object *lock); 64 65struct lock_class lock_class_rw = { 66 .lc_name = "rw", 67 .lc_flags = LC_SLEEPLOCK | LC_RECURSABLE | LC_UPGRADABLE, | 63static void lock_rw(struct lock_object *lock, int how); 64static int unlock_rw(struct lock_object *lock); 65 66struct lock_class lock_class_rw = { 67 .lc_name = "rw", 68 .lc_flags = LC_SLEEPLOCK | LC_RECURSABLE | LC_UPGRADABLE, |
69 .lc_assert = assert_rw, |
|
68#ifdef DDB 69 .lc_ddb_show = db_show_rwlock, 70#endif 71 .lc_lock = lock_rw, 72 .lc_unlock = unlock_rw, 73}; 74 75/* --- 22 unchanged lines hidden (view full) --- 98 */ 99#define rw_owner(rw) rw_wowner(rw) 100 101#ifndef INVARIANTS 102#define _rw_assert(rw, what, file, line) 103#endif 104 105void | 70#ifdef DDB 71 .lc_ddb_show = db_show_rwlock, 72#endif 73 .lc_lock = lock_rw, 74 .lc_unlock = unlock_rw, 75}; 76 77/* --- 22 unchanged lines hidden (view full) --- 100 */ 101#define rw_owner(rw) rw_wowner(rw) 102 103#ifndef INVARIANTS 104#define _rw_assert(rw, what, file, line) 105#endif 106 107void |
108assert_rw(struct lock_object *lock, int what) 109{ 110 111 rw_assert((struct rwlock *)lock, what); 112} 113 114void |
|
106lock_rw(struct lock_object *lock, int how) 107{ 108 struct rwlock *rw; 109 110 rw = (struct rwlock *)lock; 111 if (how) 112 rw_wlock(rw); 113 else --- 875 unchanged lines hidden --- | 115lock_rw(struct lock_object *lock, int how) 116{ 117 struct rwlock *rw; 118 119 rw = (struct rwlock *)lock; 120 if (how) 121 rw_wlock(rw); 122 else --- 875 unchanged lines hidden --- |