]> git.ipfire.org Git - telemetry.git/commitdiff
sources: Rename interfaces to interface
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Dec 2025 15:19:58 +0000 (15:19 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Dec 2025 15:20:31 +0000 (15:20 +0000)
All sources should have singular names.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
configure.ac
src/daemon/graphs/interface-throughput.c
src/daemon/sources.c
src/daemon/sources/interface.c [moved from src/daemon/sources/interfaces.c with 91% similarity]
src/daemon/sources/interface.h [moved from src/daemon/sources/interfaces.h with 86% similarity]

index 393be43141d2add3e2be38a5d393f35d65eb1417..21933db51eaeaac647dc29793a5f21d4305ceaf1 100644 (file)
@@ -174,8 +174,8 @@ dist_telemetryd_SOURCES = \
        src/daemon/sources/disk.h \
        src/daemon/sources/hostapd.c \
        src/daemon/sources/hostapd.h \
-       src/daemon/sources/interfaces.c \
-       src/daemon/sources/interfaces.h \
+       src/daemon/sources/interface.c \
+       src/daemon/sources/interface.h \
        src/daemon/sources/ipfrag4.c \
        src/daemon/sources/ipfrag4.h \
        src/daemon/sources/iptables.c \
index 74f22cda35bf50d82f873f347a658786770a3e79..dc0e19a3ae4b886e3fa584133fc9d2cd1e860530 100644 (file)
@@ -215,7 +215,7 @@ ENABLE_SOURCE([cpufreq])
 ENABLE_SOURCE([df])
 ENABLE_SOURCE([disk])
 ENABLE_SOURCE([hostapd])
-ENABLE_SOURCE([interfaces], [$have_libnl3 $have_libnl3_route])
+ENABLE_SOURCE([interface], [$have_libnl3 $have_libnl3_route])
 ENABLE_SOURCE([ipfrag4])
 ENABLE_SOURCE([iptables], [$have_libiptc])
 ENABLE_SOURCE([legacy-gateway-latency4], [$have_libnl3 $have_libnl3_route])
@@ -313,7 +313,7 @@ AC_MSG_RESULT([
                df:                             ${build_source_df}
                disk:                           ${build_source_disk}
                hostapd:                        ${build_source_hostapd}
-               interfaces:                     ${build_source_interfaces}
+               interface:                      ${build_source_interface}
                ipfrag4:                        ${build_source_ipfrag4}
                iptables:                       ${build_source_iptables}
                legacy-gateway-latency4:        ${build_source_legacy_gateway_latency4}
index 526c64146241b1be5144e6b5307ea542cb01b3ca..dffbad9fb72407e8292bef3599ee58526115b218 100644 (file)
@@ -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, "interfaces", object);
+       r = td_graph_require_source(graph, args, "interface", object);
        if (r < 0)
                return r;
 
index 6e7ed621e1cd66cbd173fe56b094790dec9ad15e..a9ce8b6f52e679ba8c30a798b569f831b6859f6d 100644 (file)
@@ -35,7 +35,7 @@
 #include "sources/df.h"
 #include "sources/disk.h"
 #include "sources/hostapd.h"
-#include "sources/interfaces.h"
+#include "sources/interface.h"
 #include "sources/ipfrag4.h"
 #include "sources/iptables.h"
 #include "sources/legacy-gateway-latency4.h"
@@ -85,9 +85,9 @@ static const td_source_impl* source_impls[] = {
        &hostapd_source,
 #endif /* BUILD_SOURCE_HOSTAPD */
 
-#ifdef BUILD_SOURCE_INTERFACES
-       &interfaces_source,
-#endif /* BUILD_SOURCE_INTERFACES */
+#ifdef BUILD_SOURCE_INTERFACE
+       &interface_source,
+#endif /* BUILD_SOURCE_INTERFACE */
 
 #ifdef BUILD_SOURCE_IPFRAG4
        &ipfrag4_source,
similarity index 91%
rename from src/daemon/sources/interfaces.c
rename to src/daemon/sources/interface.c
index 2222c286fefc7b0dc24eea3634fecf33ff17d6f3..0dadc519cf9461aeecf562b1ce7f72ae0d7a7082 100644 (file)
@@ -18,7 +18,7 @@
 #                                                                             #
 #############################################################################*/
 
-#ifdef BUILD_SOURCE_INTERFACES
+#ifdef BUILD_SOURCE_INTERFACE
 
 #include <errno.h>
 #include <limits.h>
 #include "../time.h"
 #include "interfaces.h"
 
-typedef struct interfaces_stats {
+typedef struct interface_stats {
        const char* field;
        rtnl_link_stat_id_t id;
 }  interfaces_stats;
 
-static const interfaces_stats stats[] = {
+static const interface_stats stats[] = {
        // Packets Received/Sent
        { "rx_packets", RTNL_LINK_RX_PACKETS },
        { "tx_packets", RTNL_LINK_TX_PACKETS },
@@ -101,7 +101,7 @@ static const interfaces_stats stats[] = {
        { NULL },
 };
 
-static void interfaces_link_callback(struct nl_object* object, void* data) {
+static void interface_link_callback(struct nl_object* object, void* data) {
        struct rtnl_link* link = (struct rtnl_link*)object;
        td_metrics* metrics = NULL;
        td_source* source = data;
@@ -119,7 +119,7 @@ static void interfaces_link_callback(struct nl_object* object, void* data) {
                goto ERROR;
 
        // Collect all stats
-       for (const interfaces_stats* stat = stats; stat->field; stat++) {
+       for (const interface_stats* stat = stats; stat->field; stat++) {
                // Fetch the value
                value = rtnl_link_get_stat(link, stat->id);
 
@@ -139,7 +139,7 @@ ERROR:
                td_metrics_unref(metrics);
 }
 
-static int interfaces_heartbeat(td_ctx* ctx, td_source* source) {
+static int interface_heartbeat(td_ctx* ctx, td_source* source) {
        struct nl_cache* links = NULL;
        int r;
 
@@ -157,7 +157,7 @@ static int interfaces_heartbeat(td_ctx* ctx, td_source* source) {
        }
 
        // Walk through all interfaces
-       nl_cache_foreach(links, interfaces_link_callback, source);
+       nl_cache_foreach(links, interface_link_callback, source);
 
 ERROR:
        if (links)
@@ -166,8 +166,8 @@ ERROR:
        return r;
 }
 
-const td_source_impl interfaces_source = {
-       .name = "interfaces",
+const td_source_impl interface_source = {
+       .name = "interface",
 
        // RRD Data Sources
        .rrd_dss = {
@@ -232,7 +232,7 @@ const td_source_impl interfaces_source = {
        },
 
        // Methods
-       .heartbeat = interfaces_heartbeat,
+       .heartbeat = interface_heartbeat,
 };
 
-#endif /* BUILD_SOURCE_INTERFACES */
+#endif /* BUILD_SOURCE_INTERFACE */
similarity index 86%
rename from src/daemon/sources/interfaces.h
rename to src/daemon/sources/interface.h
index 1c1856b20eee3f121af044221c10cc32c274a724..2152f5d15bf35702ff0f1ebc5f0482f5edeb07af 100644 (file)
 #                                                                             #
 #############################################################################*/
 
-#ifndef TELEMETRY_SOURCE_INTERFACES_H
-#define TELEMETRY_SOURCE_INTERFACES_H
-#ifdef BUILD_SOURCE_INTERFACES
+#ifndef TELEMETRY_SOURCE_INTERFACE_H
+#define TELEMETRY_SOURCE_INTERFACE_H
+#ifdef BUILD_SOURCE_INTERFACE
 
 #include "../source.h"
 
-extern const td_source_impl interfaces_source;
+extern const td_source_impl interface_source;
 
-#endif /* BUILD_SOURCE_INTERFACES */
-#endif /* TELEMETRY_SOURCE_INTERFACES_H */
+#endif /* BUILD_SOURCE_INTERFACE */
+#endif /* TELEMETRY_SOURCE_INTERFACE_H */