From: Michael Tremer Date: Fri, 5 Jun 2026 15:09:35 +0000 (+0000) Subject: sources: Add helper function to check if a source is disabled X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a05a7e9aac7b73a3a41459890bbc845a63d0fec7;p=telemetry.git sources: Add helper function to check if a source is disabled Signed-off-by: Michael Tremer --- diff --git a/src/daemon/source.c b/src/daemon/source.c index 3565120..c089943 100644 --- a/src/daemon/source.c +++ b/src/daemon/source.c @@ -539,6 +539,18 @@ const char* td_source_name(td_source* self) { return self->impl->name; } +int td_source_is_disabled(td_source* self) { + switch (self->state) { + case STATE_DISABLED: + return 1; + + default: + break; + } + + return 0; +} + // Called to disable the source (e.g. if there is no support for it) int td_source_disable(td_source* self) { return td_source_change_state(self, STATE_DISABLED); diff --git a/src/daemon/source.h b/src/daemon/source.h index fefed4e..446545e 100644 --- a/src/daemon/source.h +++ b/src/daemon/source.h @@ -84,6 +84,8 @@ td_source* td_source_ref(td_source* self); td_source* td_source_unref(td_source* self); const char* td_source_name(td_source* self); + +int td_source_is_disabled(td_source* self); int td_source_disable(td_source* self); struct udev* td_source_get_udev(td_source* self);