mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
watchlist: Add WATCHLIST_NOTIFY_MATCHES
This can be used to selectively notify watchlist items. The match function is called for each watchlist_item and match_data is passed along. If the match function returns true, then the watch_item is notified. The match function signature and semantics are identical to l_queue_match_func_t.
This commit is contained in:
parent
70079912ad
commit
fa7fab196e
@ -73,3 +73,22 @@ void __watchlist_prune_stale(struct watchlist *watchlist);
|
|||||||
__watchlist_prune_stale(watchlist); \
|
__watchlist_prune_stale(watchlist); \
|
||||||
} while (false) \
|
} while (false) \
|
||||||
|
|
||||||
|
#define WATCHLIST_NOTIFY_MATCHES(watchlist, match, match_data, type, args...) \
|
||||||
|
do { \
|
||||||
|
const struct l_queue_entry *entry = \
|
||||||
|
l_queue_get_entries((watchlist)->items);\
|
||||||
|
\
|
||||||
|
(watchlist)->in_notify = true; \
|
||||||
|
for (; entry; entry = entry->next) { \
|
||||||
|
struct watchlist_item *item = entry->data; \
|
||||||
|
type t = item->notify; \
|
||||||
|
\
|
||||||
|
if (!match(item->notify_data, match_data)) \
|
||||||
|
continue; \
|
||||||
|
\
|
||||||
|
t(args, item->notify_data); \
|
||||||
|
} \
|
||||||
|
(watchlist)->in_notify = false; \
|
||||||
|
if ((watchlist)->stale_items) \
|
||||||
|
__watchlist_prune_stale(watchlist); \
|
||||||
|
} while (false)
|
||||||
|
Loading…
Reference in New Issue
Block a user