aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/module.h
diff options
context:
space:
mode:
authorAndrew R. Reiter <arr@FreeBSD.org>2002-03-18 07:45:30 +0000
committerAndrew R. Reiter <arr@FreeBSD.org>2002-03-18 07:45:30 +0000
commit9b3851e9e3b18d7460573cd75115f055aef65c34 (patch)
treec2eff913b2ef7378688b056e3fde7b549d509901 /sys/sys/module.h
parent0af93efb4d2ab41d4adf894a5365cfada8e12adf (diff)
downloadsrc-9b3851e9e3b18d7460573cd75115f055aef65c34.tar.gz
src-9b3851e9e3b18d7460573cd75115f055aef65c34.zip
- Lock down the ``module'' structure by adding an SX lock that is used by
all the global bits of ``module'' data. This commit adds a few generic macros, MOD_SLOCK, MOD_XLOCK, etc., that are meant to be used as ways of accessing the SX lock. It is also the first step in helping to lock down the kernel linker and module systems. Reviewed by: jhb, jake, smp@
Notes
Notes: svn path=/head/; revision=92547
Diffstat (limited to 'sys/sys/module.h')
-rw-r--r--sys/sys/module.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/sys/module.h b/sys/sys/module.h
index 5dc615183502..39f138d206b0 100644
--- a/sys/sys/module.h
+++ b/sys/sys/module.h
@@ -125,6 +125,15 @@ struct mod_metadata {
MODULE_METADATA(_##module##_version, MDT_VERSION, \
&_##module##_version, #module)
+extern struct sx modules_sx;
+
+#define MOD_XLOCK sx_xlock(&modules_sx)
+#define MOD_SLOCK sx_slock(&modules_sx)
+#define MOD_XUNLOCK sx_xunlock(&modules_sx)
+#define MOD_SUNLOCK sx_sunlock(&modules_sx)
+#define MOD_LOCK_ASSERT sx_assert(&modules_sx, SX_LOCKED)
+#define MOD_XLOCK_ASSERT sx_assert(&modules_sx, SX_XLOCKED)
+
struct linker_file;
void module_register_init(const void *);