From 028923e54d3901c2efaa6f7a4d98afcc249bd7e2 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 30 Mar 2007 18:10:08 +0000 Subject: [PATCH] - Use PARTIAL_PICKUP_GIANT() to implement PICKUP_GIANT(). - Move UGAR() macro up to the comment that describes it. - Fix a couple of typos. --- sys/sys/mutex.h | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index 6d16ff01172..dea4b760b8c 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -375,11 +375,7 @@ do { \ mtx_unlock(&Giant) #define PICKUP_GIANT() \ - mtx_assert(&Giant, MA_NOTOWNED); \ - while (_giantcnt--) \ - mtx_lock(&Giant); \ - if (mtx_owned(&Giant)) \ - WITNESS_RESTORE(&Giant.lock_object, Giant); \ + PARTIAL_PICKUP_GIANT(); \ } while (0) #define PARTIAL_PICKUP_GIANT() \ @@ -390,14 +386,20 @@ do { \ WITNESS_RESTORE(&Giant.lock_object, Giant) #endif +#define UGAR(rval) do { \ + int _val = (rval); \ + mtx_unlock(&Giant); \ + return (_val); \ +} while (0) + /* * Network MPSAFE temporary workarounds. When debug_mpsafenet * is 1 the network is assumed to operate without Giant on the * input path and protocols that require Giant must collect it * on entry. When 0 Giant is grabbed in the network interface * ISR's and in the netisr path and there is no need to grab - * the Giant lock. Note that, unlike GIANT_PICKUP() and - * GIANT_DROP(), these macros directly wrap mutex operations + * the Giant lock. Note that, unlike PICKUP_GIANT() and + * DROP_GIANT(), these macros directly wrap mutex operations * without special recursion handling. * * This mechanism is intended as temporary until everything of @@ -421,12 +423,6 @@ extern int debug_mpsafenet; /* defined in net/netisr.c */ } while (0) #define NET_CALLOUT_MPSAFE (debug_mpsafenet ? CALLOUT_MPSAFE : 0) -#define UGAR(rval) do { \ - int _val = (rval); \ - mtx_unlock(&Giant); \ - return (_val); \ -} while (0) - struct mtx_args { struct mtx *ma_mtx; const char *ma_desc;