kern_rmlock.c (223758) | kern_rmlock.c (227588) |
---|---|
1/*- 2 * Copyright (c) 2007 Stephan Uphoff <ups@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) 2007 Stephan Uphoff <ups@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_rmlock.c 223758 2011-07-04 12:04:52Z attilio $"); | 35__FBSDID("$FreeBSD: head/sys/kern/kern_rmlock.c 227588 2011-11-16 21:51:17Z pjd $"); |
36 37#include "opt_ddb.h" 38#include "opt_kdtrace.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42 43#include <sys/kernel.h> --- 20 unchanged lines hidden (view full) --- 64 * priority tracker would be needed. Using this lock for cv and msleep also 65 * does not seem very useful 66 */ 67 68static __inline void compiler_memory_barrier(void) { 69 __asm __volatile("":::"memory"); 70} 71 | 36 37#include "opt_ddb.h" 38#include "opt_kdtrace.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42 43#include <sys/kernel.h> --- 20 unchanged lines hidden (view full) --- 64 * priority tracker would be needed. Using this lock for cv and msleep also 65 * does not seem very useful 66 */ 67 68static __inline void compiler_memory_barrier(void) { 69 __asm __volatile("":::"memory"); 70} 71 |
72static void assert_rm(struct lock_object *lock, int what); | 72static void assert_rm(const struct lock_object *lock, int what); |
73static void lock_rm(struct lock_object *lock, int how); 74#ifdef KDTRACE_HOOKS | 73static void lock_rm(struct lock_object *lock, int how); 74#ifdef KDTRACE_HOOKS |
75static int owner_rm(struct lock_object *lock, struct thread **owner); | 75static int owner_rm(const struct lock_object *lock, struct thread **owner); |
76#endif 77static int unlock_rm(struct lock_object *lock); 78 79struct lock_class lock_class_rm = { 80 .lc_name = "rm", 81 .lc_flags = LC_SLEEPLOCK | LC_RECURSABLE, 82 .lc_assert = assert_rm, 83#if 0 --- 4 unchanged lines hidden (view full) --- 88 .lc_lock = lock_rm, 89 .lc_unlock = unlock_rm, 90#ifdef KDTRACE_HOOKS 91 .lc_owner = owner_rm, 92#endif 93}; 94 95static void | 76#endif 77static int unlock_rm(struct lock_object *lock); 78 79struct lock_class lock_class_rm = { 80 .lc_name = "rm", 81 .lc_flags = LC_SLEEPLOCK | LC_RECURSABLE, 82 .lc_assert = assert_rm, 83#if 0 --- 4 unchanged lines hidden (view full) --- 88 .lc_lock = lock_rm, 89 .lc_unlock = unlock_rm, 90#ifdef KDTRACE_HOOKS 91 .lc_owner = owner_rm, 92#endif 93}; 94 95static void |
96assert_rm(struct lock_object *lock, int what) | 96assert_rm(const struct lock_object *lock, int what) |
97{ 98 99 panic("assert_rm called"); 100} 101 102static void 103lock_rm(struct lock_object *lock, int how) 104{ --- 5 unchanged lines hidden (view full) --- 110unlock_rm(struct lock_object *lock) 111{ 112 113 panic("unlock_rm called"); 114} 115 116#ifdef KDTRACE_HOOKS 117static int | 97{ 98 99 panic("assert_rm called"); 100} 101 102static void 103lock_rm(struct lock_object *lock, int how) 104{ --- 5 unchanged lines hidden (view full) --- 110unlock_rm(struct lock_object *lock) 111{ 112 113 panic("unlock_rm called"); 114} 115 116#ifdef KDTRACE_HOOKS 117static int |
118owner_rm(struct lock_object *lock, struct thread **owner) | 118owner_rm(const struct lock_object *lock, struct thread **owner) |
119{ 120 121 panic("owner_rm called"); 122} 123#endif 124 125static struct mtx rm_spinlock; 126 --- 95 unchanged lines hidden (view full) --- 222 if (rm->lock_object.lo_flags & RM_SLEEPABLE) 223 sx_destroy(&rm->rm_lock_sx); 224 else 225 mtx_destroy(&rm->rm_lock_mtx); 226 lock_destroy(&rm->lock_object); 227} 228 229int | 119{ 120 121 panic("owner_rm called"); 122} 123#endif 124 125static struct mtx rm_spinlock; 126 --- 95 unchanged lines hidden (view full) --- 222 if (rm->lock_object.lo_flags & RM_SLEEPABLE) 223 sx_destroy(&rm->rm_lock_sx); 224 else 225 mtx_destroy(&rm->rm_lock_mtx); 226 lock_destroy(&rm->lock_object); 227} 228 229int |
230rm_wowned(struct rmlock *rm) | 230rm_wowned(const struct rmlock *rm) |
231{ 232 233 if (rm->lock_object.lo_flags & RM_SLEEPABLE) 234 return (sx_xlocked(&rm->rm_lock_sx)); 235 else 236 return (mtx_owned(&rm->rm_lock_mtx)); 237} 238 --- 351 unchanged lines hidden --- | 231{ 232 233 if (rm->lock_object.lo_flags & RM_SLEEPABLE) 234 return (sx_xlocked(&rm->rm_lock_sx)); 235 else 236 return (mtx_owned(&rm->rm_lock_mtx)); 237} 238 --- 351 unchanged lines hidden --- |