1 From 82b05408e5ed8a8651a99b2dcc61a24c108d48f1 Mon Sep 17 00:00:00 2001
2 From: Marius Vlad <marius.vlad@collabora.com>
3 Date: Fri, 5 May 2023 11:33:40 +0300
4 Subject: [PATCH] libweston/weston-log: Add an iterator for going over scope
7 libweston users, with the weston-debug protocol doesn't have a way
8 to list the debug scopes. This adds an iterator function to browse
9 over the opaque weston_log_scope.
11 This also adds two helper functions to get the scope name and its
14 Upstream-Status: Pending
16 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
18 include/libweston/weston-log.h | 9 +++++++++
19 libweston/weston-log.c | 36 ++++++++++++++++++++++++++++++++++
20 2 files changed, 45 insertions(+)
22 diff --git a/include/libweston/weston-log.h b/include/libweston/weston-log.h
23 index aeb7768bf..846cdb089 100644
24 --- a/include/libweston/weston-log.h
25 +++ b/include/libweston/weston-log.h
26 @@ -131,9 +131,18 @@ struct weston_log_subscription *
27 weston_log_subscription_iterate(struct weston_log_scope *scope,
28 struct weston_log_subscription *sub_iter);
30 +struct weston_log_scope *
31 +weston_log_scopes_iterate(struct weston_compositor *compositor,
32 + struct weston_log_scope *nscope);
34 weston_log_flight_recorder_display_buffer(FILE *file);
37 +weston_log_scope_get_description(struct weston_log_scope *scope);
40 +weston_log_scope_get_name(struct weston_log_scope *scope);
45 diff --git a/libweston/weston-log.c b/libweston/weston-log.c
46 index 276fde267..957c30c56 100644
47 --- a/libweston/weston-log.c
48 +++ b/libweston/weston-log.c
49 @@ -1009,3 +1009,39 @@ weston_log_subscription_iterate(struct weston_log_scope *scope,
51 return container_of(node, struct weston_log_subscription, source_link);
54 +WL_EXPORT struct weston_log_scope *
55 +weston_log_scopes_iterate(struct weston_compositor *compositor,
56 + struct weston_log_scope *nscope)
58 + struct weston_log_context *log_ctx = compositor->weston_log_ctx;
59 + struct wl_list *list;
60 + struct wl_list *node;
64 + list = &log_ctx->scope_list;
67 + node = nscope->compositor_link.next;
75 + return container_of(node, struct weston_log_scope, compositor_link);
78 +WL_EXPORT const char *
79 +weston_log_scope_get_name(struct weston_log_scope *scope)
84 +WL_EXPORT const char *
85 +weston_log_scope_get_description(struct weston_log_scope *scope)