From: Michael Tremer Date: Fri, 5 Jun 2026 14:47:21 +0000 (+0000) Subject: graphs: Rename function to load a source X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d919f65b8c344a8bf1c05bba1bcd87ab24cdc44d;p=telemetry.git graphs: Rename function to load a source Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graph.c b/src/daemon/graph.c index fb9470d..9d7001b 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -195,7 +195,7 @@ char* td_graph_get_bus_path(td_graph* self) { return path; } -int td_graph_require_source(td_graph* self, +int td_graph_load_source(td_graph* self, td_args* args, const char* name, const char* object) { td_sources* sources = NULL; td_source* source = NULL; @@ -230,13 +230,13 @@ ERROR: return r; } -int td_graph_require_sources(td_graph* self, +int td_graph_load_sources(td_graph* self, td_args* args, const char* name, const char** objects) { int r; // Add objects for (const char** o = objects; *o; o++) { - r = td_graph_require_source(self, args, name, *o); + r = td_graph_load_source(self, args, name, *o); if (r < 0) return r; } diff --git a/src/daemon/graph.h b/src/daemon/graph.h index 5421f71..5890dc6 100644 --- a/src/daemon/graph.h +++ b/src/daemon/graph.h @@ -94,9 +94,9 @@ td_graph* td_graph_unref(td_graph* self); const char* td_graph_get_name(td_graph* self); char* td_graph_get_bus_path(td_graph* self); -int td_graph_require_source(td_graph* self, +int td_graph_load_source(td_graph* self, td_args* args, const char* name, const char* object); -int td_graph_require_sources(td_graph* self, +int td_graph_load_sources(td_graph* self, td_args* args, const char* name, const char** objects); int td_graph_render(td_graph* self, const char* object, diff --git a/src/daemon/graphs/conntrack.c b/src/daemon/graphs/conntrack.c index 3ac2521..f945c3c 100644 --- a/src/daemon/graphs/conntrack.c +++ b/src/daemon/graphs/conntrack.c @@ -39,7 +39,7 @@ static int conntrack_render(td_ctx* ctx, td_graph* graph, int r; // This requires the conntrack source - r = td_graph_require_source(graph, args, "conntrack", NULL); + r = td_graph_load_source(graph, args, "conntrack", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/contextswitches.c b/src/daemon/graphs/contextswitches.c index 7873a5d..ded1d71 100644 --- a/src/daemon/graphs/contextswitches.c +++ b/src/daemon/graphs/contextswitches.c @@ -39,7 +39,7 @@ static int contextswitches_render(td_ctx* ctx, td_graph* graph, int r; // This requires the contextswitches source - r = td_graph_require_source(graph, args, "contextswitches", NULL); + r = td_graph_load_source(graph, args, "contextswitches", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/cpufreq.c b/src/daemon/graphs/cpufreq.c index dd1a4a2..8d22bd4 100644 --- a/src/daemon/graphs/cpufreq.c +++ b/src/daemon/graphs/cpufreq.c @@ -53,7 +53,7 @@ static int cpufreq_render(td_ctx* ctx, td_graph* graph, return r; // Require the source - r = td_graph_require_source(graph, args, "cpufreq", object); + r = td_graph_load_source(graph, args, "cpufreq", object); if (r < 0) return r; diff --git a/src/daemon/graphs/disk.c b/src/daemon/graphs/disk.c index 601561a..6deae2c 100644 --- a/src/daemon/graphs/disk.c +++ b/src/daemon/graphs/disk.c @@ -33,7 +33,7 @@ static int disk_io_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "disk", object); + r = td_graph_load_source(graph, args, "disk", object); if (r < 0) return r; @@ -73,7 +73,7 @@ static int disk_temp_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "disk", object); + r = td_graph_load_source(graph, args, "disk", object); if (r < 0) return r; diff --git a/src/daemon/graphs/hostapd-station-bandwidth.c b/src/daemon/graphs/hostapd-station-bandwidth.c index dab3362..388e91c 100644 --- a/src/daemon/graphs/hostapd-station-bandwidth.c +++ b/src/daemon/graphs/hostapd-station-bandwidth.c @@ -34,7 +34,7 @@ static int hostapd_station_bandwidth_render(td_ctx* ctx,td_graph* graph, int r; // Require the source - r = td_graph_require_source(graph, args, "hostapd", object); + r = td_graph_load_source(graph, args, "hostapd", object); if (r < 0) return r; diff --git a/src/daemon/graphs/hostapd-station-rate-info.c b/src/daemon/graphs/hostapd-station-rate-info.c index 918afad..5bfaa93 100644 --- a/src/daemon/graphs/hostapd-station-rate-info.c +++ b/src/daemon/graphs/hostapd-station-rate-info.c @@ -34,7 +34,7 @@ static int hostapd_station_rate_info_render(td_ctx* ctx, td_graph* graph, int r; // Require the source - r = td_graph_require_source(graph, args, "hostapd", object); + r = td_graph_load_source(graph, args, "hostapd", object); if (r < 0) return r; diff --git a/src/daemon/graphs/hostapd-station-signal.c b/src/daemon/graphs/hostapd-station-signal.c index b5c255e..d455610 100644 --- a/src/daemon/graphs/hostapd-station-signal.c +++ b/src/daemon/graphs/hostapd-station-signal.c @@ -46,7 +46,7 @@ static int hostapd_station_signal_render(td_ctx* ctx, td_graph* graph, int r; // This require the source - r = td_graph_require_source(graph, args, "hostapd", object); + r = td_graph_load_source(graph, args, "hostapd", object); if (r < 0) return r; diff --git a/src/daemon/graphs/interface-packets.c b/src/daemon/graphs/interface-packets.c index 1140401..4127f5e 100644 --- a/src/daemon/graphs/interface-packets.c +++ b/src/daemon/graphs/interface-packets.c @@ -33,7 +33,7 @@ static int interface_packets_render(td_ctx* ctx,td_graph* graph, int r; // Require the source - r = td_graph_require_source(graph, args, "interface", object); + r = td_graph_load_source(graph, args, "interface", object); if (r < 0) return r; diff --git a/src/daemon/graphs/interface-throughput.c b/src/daemon/graphs/interface-throughput.c index dffbad9..f6b457d 100644 --- a/src/daemon/graphs/interface-throughput.c +++ b/src/daemon/graphs/interface-throughput.c @@ -34,7 +34,7 @@ static int interface_throughput_render(td_ctx* ctx,td_graph* graph, int r; // Require the source - r = td_graph_require_source(graph, args, "interface", object); + r = td_graph_load_source(graph, args, "interface", object); if (r < 0) return r; diff --git a/src/daemon/graphs/knot-resolver-queries.c b/src/daemon/graphs/knot-resolver-queries.c index cb0971d..544899d 100644 --- a/src/daemon/graphs/knot-resolver-queries.c +++ b/src/daemon/graphs/knot-resolver-queries.c @@ -33,7 +33,7 @@ static int knot_resolver_queries_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "knot-resolver", NULL); + r = td_graph_load_source(graph, args, "knot-resolver", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/legacy-gateway-latency4.c b/src/daemon/graphs/legacy-gateway-latency4.c index c058ce6..9a85b3c 100644 --- a/src/daemon/graphs/legacy-gateway-latency4.c +++ b/src/daemon/graphs/legacy-gateway-latency4.c @@ -33,7 +33,7 @@ static int legacy_gateway_latency4_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "legacy-gateway-latency4", NULL); + r = td_graph_load_source(graph, args, "legacy-gateway-latency4", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/legacy-hostile-drops.c b/src/daemon/graphs/legacy-hostile-drops.c index 5a064b5..76eb183 100644 --- a/src/daemon/graphs/legacy-hostile-drops.c +++ b/src/daemon/graphs/legacy-hostile-drops.c @@ -33,7 +33,7 @@ static int legacy_hostile_drops_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "iptables", "DROP_HOSTILE"); + r = td_graph_load_source(graph, args, "iptables", "DROP_HOSTILE"); if (r < 0) return r; diff --git a/src/daemon/graphs/legacy-port-scans.c b/src/daemon/graphs/legacy-port-scans.c index 9e04535..83d784d 100644 --- a/src/daemon/graphs/legacy-port-scans.c +++ b/src/daemon/graphs/legacy-port-scans.c @@ -42,7 +42,7 @@ static int legacy_port_scans_render(td_ctx* ctx, td_graph* graph, }; // Load all sources - r = td_graph_require_sources(graph, args, "iptables", sources); + r = td_graph_load_sources(graph, args, "iptables", sources); if (r < 0) return r; diff --git a/src/daemon/graphs/legacy-suricata.c b/src/daemon/graphs/legacy-suricata.c index 4fef694..a8a4609 100644 --- a/src/daemon/graphs/legacy-suricata.c +++ b/src/daemon/graphs/legacy-suricata.c @@ -45,7 +45,7 @@ static int legacy_suricata_render(td_ctx* ctx, td_graph* graph, }; // Load all sources - r = td_graph_require_sources(graph, args, "iptables", chains); + r = td_graph_load_sources(graph, args, "iptables", chains); if (r < 0) return r; diff --git a/src/daemon/graphs/loadavg.c b/src/daemon/graphs/loadavg.c index 1d52679..c6c47bc 100644 --- a/src/daemon/graphs/loadavg.c +++ b/src/daemon/graphs/loadavg.c @@ -39,7 +39,7 @@ static int loadavg_render(td_ctx* ctx, td_graph* graph, int r; // This requires the loadavg source - r = td_graph_require_source(graph, args, "loadavg", NULL); + r = td_graph_load_source(graph, args, "loadavg", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/memory.c b/src/daemon/graphs/memory.c index dbe2112..9a46280 100644 --- a/src/daemon/graphs/memory.c +++ b/src/daemon/graphs/memory.c @@ -39,7 +39,7 @@ static int memory_render(td_ctx* ctx, td_graph* graph, int r; // This requires the loadavg source - r = td_graph_require_source(graph, args, "memory", NULL); + r = td_graph_load_source(graph, args, "memory", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/pressure.c b/src/daemon/graphs/pressure.c index 91b1de7..6122c1d 100644 --- a/src/daemon/graphs/pressure.c +++ b/src/daemon/graphs/pressure.c @@ -29,7 +29,7 @@ static int pressure_render(td_ctx* ctx, td_graph* graph, int r; // This requires the source - r = td_graph_require_source(graph, args, source, NULL); + r = td_graph_load_source(graph, args, source, NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/processor-power-consumption.c b/src/daemon/graphs/processor-power-consumption.c index 77c1951..d2de62b 100644 --- a/src/daemon/graphs/processor-power-consumption.c +++ b/src/daemon/graphs/processor-power-consumption.c @@ -55,7 +55,7 @@ static int processor_power_consumption_render_sensor(td_ctx* ctx, td_source* sou return 0; // Add the source - r = td_graph_require_source(state->graph, state->args, "sensors-power", name); + r = td_graph_load_source(state->graph, state->args, "sensors-power", name); if (r < 0) return r; diff --git a/src/daemon/graphs/processor-temperature.c b/src/daemon/graphs/processor-temperature.c index 9ddc244..726bb97 100644 --- a/src/daemon/graphs/processor-temperature.c +++ b/src/daemon/graphs/processor-temperature.c @@ -58,7 +58,7 @@ static int processor_temperature_render_sensor(td_ctx* ctx, td_source* source, return 0; // Add the source - r = td_graph_require_source(state->graph, state->args, "sensors-temp", name); + r = td_graph_load_source(state->graph, state->args, "sensors-temp", name); if (r < 0) return r; diff --git a/src/daemon/graphs/processor.c b/src/daemon/graphs/processor.c index 8eb0d91..8748b53 100644 --- a/src/daemon/graphs/processor.c +++ b/src/daemon/graphs/processor.c @@ -34,7 +34,7 @@ static int processor_render(td_ctx* ctx, td_graph* graph, int r; // This requires the loadavg source - r = td_graph_require_source(graph, args, "processor", NULL); + r = td_graph_load_source(graph, args, "processor", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/system-temperature.c b/src/daemon/graphs/system-temperature.c index 613e86d..1128878 100644 --- a/src/daemon/graphs/system-temperature.c +++ b/src/daemon/graphs/system-temperature.c @@ -55,7 +55,7 @@ static int system_temperature_render_sensor(td_ctx* ctx, td_source* source, return 0; // Add the source - r = td_graph_require_source(state->graph, state->args, "sensors-temp", name); + r = td_graph_load_source(state->graph, state->args, "sensors-temp", name); if (r < 0) return r; diff --git a/src/daemon/graphs/unbound-cache-performance.c b/src/daemon/graphs/unbound-cache-performance.c index 7a0fe76..a54b3ce 100644 --- a/src/daemon/graphs/unbound-cache-performance.c +++ b/src/daemon/graphs/unbound-cache-performance.c @@ -33,7 +33,7 @@ static int unbound_cache_performance_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); + r = td_graph_load_source(graph, args, "unbound", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/unbound-cache-usage.c b/src/daemon/graphs/unbound-cache-usage.c index 1fcebbf..976cb35 100644 --- a/src/daemon/graphs/unbound-cache-usage.c +++ b/src/daemon/graphs/unbound-cache-usage.c @@ -33,7 +33,7 @@ static int unbound_cache_usage_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); + r = td_graph_load_source(graph, args, "unbound", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/unbound-memory-usage.c b/src/daemon/graphs/unbound-memory-usage.c index b1ef29a..f250fe5 100644 --- a/src/daemon/graphs/unbound-memory-usage.c +++ b/src/daemon/graphs/unbound-memory-usage.c @@ -33,7 +33,7 @@ static int unbound_memory_usage_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); + r = td_graph_load_source(graph, args, "unbound", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/unbound-queries.c b/src/daemon/graphs/unbound-queries.c index 05a09ae..c5b7fcd 100644 --- a/src/daemon/graphs/unbound-queries.c +++ b/src/daemon/graphs/unbound-queries.c @@ -33,7 +33,7 @@ static int unbound_queries_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); + r = td_graph_load_source(graph, args, "unbound", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/unbound-recursion-time.c b/src/daemon/graphs/unbound-recursion-time.c index cf9671a..4d6b024 100644 --- a/src/daemon/graphs/unbound-recursion-time.c +++ b/src/daemon/graphs/unbound-recursion-time.c @@ -33,7 +33,7 @@ static int unbound_recursion_time_render(td_ctx* ctx, td_graph* graph, int r; // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); + r = td_graph_load_source(graph, args, "unbound", NULL); if (r < 0) return r; diff --git a/src/daemon/graphs/uptime.c b/src/daemon/graphs/uptime.c index 181dc83..7198dd6 100644 --- a/src/daemon/graphs/uptime.c +++ b/src/daemon/graphs/uptime.c @@ -34,7 +34,7 @@ static int uptime_render(td_ctx* ctx, td_graph* graph, int r; // This requires the uptime source - r = td_graph_require_source(graph, args, "uptime", NULL); + r = td_graph_load_source(graph, args, "uptime", NULL); if (r < 0) return r;