diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-24 11:01:34 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-24 11:34:36 +0100 |
commit | f7c2a886c9fb73b2749d5e270f15b79c44e72a62 (patch) | |
tree | 602486438a95ce8bd1d71d0461227e0138b54b95 /proto/radv | |
parent | 3ac628e0f0b7ffaa49c95688cc95954ece8f61fc (diff) |
Object locks use events
Instead of calling custom hooks from object locks, we use standard event
sending mechanism to inform protocols about object lock changes. As
event sending is lockless, the unlocking protocol simply enqueues the
appropriate event to the given loop when the locking is done.
Diffstat (limited to 'proto/radv')
-rw-r--r-- | proto/radv/radv.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/proto/radv/radv.c b/proto/radv/radv.c index 8929e8ef..b7c8d7be 100644 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@ -266,9 +266,9 @@ radv_iface_find(struct radv_proto *p, struct iface *what) } static void -radv_iface_add(struct object_lock *lock) +radv_iface_add(void *_ifa) { - struct radv_iface *ifa = lock->data; + struct radv_iface *ifa = _ifa; struct radv_proto *p = ifa->ra; if (! radv_sk_open(ifa)) @@ -305,8 +305,11 @@ radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_conf lock->type = OBJLOCK_IP; lock->port = ICMPV6_PROTO; lock->iface = iface; - lock->data = ifa; - lock->hook = radv_iface_add; + lock->event = (event) { + .hook = radv_iface_add, + .data = ifa, + }; + lock->target = &global_event_list; ifa->lock = lock; olock_acquire(lock); |