summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2021-05-24 13:41:23 +0200
committerMaria Matejka <mq@ucw.cz>2021-11-22 19:05:43 +0100
commitdf3264f51ff38c9366398564a9d342a26bc83f37 (patch)
tree449ae9b631b57f867cc01dd4b6e8de63bbc30045 /lib
parent1289c1c5eede5b3d015d06b725d30024ccac51bd (diff)
Lock position checking allows for safe lock unions
Diffstat (limited to 'lib')
-rw-r--r--lib/locking.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/locking.h b/lib/locking.h
index eb1bc8fa..eef60154 100644
--- a/lib/locking.h
+++ b/lib/locking.h
@@ -16,16 +16,14 @@ struct lock_order {
struct domain_generic *the_bird;
};
-#define LOCK_ORDER_DEPTH (sizeof(struct lock_order) / sizeof(struct domain_generic *))
-
extern _Thread_local struct lock_order locking_stack;
extern _Thread_local struct domain_generic **last_locked;
#define DOMAIN(type) struct domain__##type
#define DEFINE_DOMAIN(type) DOMAIN(type) { struct domain_generic *type; }
-#define DOMAIN_NEW(type, name) (DOMAIN(type)) { .type = domain_new(name) }
-struct domain_generic *domain_new(const char *name);
+#define DOMAIN_NEW(type, name) (DOMAIN(type)) { .type = domain_new(name, OFFSETOF(struct lock_order, type)) }
+struct domain_generic *domain_new(const char *name, uint order);
#define DOMAIN_NULL(type) (DOMAIN(type)) {}