diff options
author | phk <phk@FreeBSD.org> | 2002-05-20 10:03:15 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-05-20 10:03:15 +0000 |
commit | 0d0d0abc101acc6be03792b1dfcd57f92eb5a7e2 (patch) | |
tree | 7083aa144f3e824c70e7dae41183442d6ce709cf /sys/geom/geom.h | |
parent | 110842c75ed00588986c685c3c68abd01c9d5f6a (diff) | |
download | FreeBSD-src-0d0d0abc101acc6be03792b1dfcd57f92eb5a7e2.zip FreeBSD-src-0d0d0abc101acc6be03792b1dfcd57f92eb5a7e2.tar.gz |
Don't grab Giant around malloc(9) and free(9).
Don't grab Giant around wakeup(9).
Don't print verbose messages about each device found in geom_dev.
Various cleanups.
Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/geom/geom.h')
-rw-r--r-- | sys/geom/geom.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h index df85fe3..dafe65e 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -251,9 +251,7 @@ g_malloc(int size, int flags) { void *p; - mtx_lock(&Giant); p = malloc(size, M_GEOM, flags); - mtx_unlock(&Giant); g_sanity(p); /* printf("malloc(%d, %x) -> %p\n", size, flags, p); */ return (p); @@ -264,15 +262,28 @@ g_free(void *ptr) { g_sanity(ptr); /* printf("free(%p)\n", ptr); */ - mtx_lock(&Giant); free(ptr, M_GEOM); - mtx_unlock(&Giant); } extern struct sx topology_lock; -#define g_topology_lock() do { mtx_assert(&Giant, MA_NOTOWNED); sx_xlock(&topology_lock); } while (0) -#define g_topology_unlock() do { g_sanity(NULL); sx_xunlock(&topology_lock); } while (0) -#define g_topology_assert() do { g_sanity(NULL); sx_assert(&topology_lock, SX_XLOCKED); } while (0) + +#define g_topology_lock() \ + do { \ + mtx_assert(&Giant, MA_NOTOWNED); \ + sx_xlock(&topology_lock); \ + } while (0) + +#define g_topology_unlock() \ + do { \ + g_sanity(NULL); \ + sx_xunlock(&topology_lock); \ + } while (0) + +#define g_topology_assert() \ + do { \ + g_sanity(NULL); \ + sx_assert(&topology_lock, SX_XLOCKED); \ + } while (0) #define DECLARE_GEOM_CLASS(class, name) \ static void \ |