From 2a3ba3e2308c8af6a6b571b670df40654627d1e2 Mon Sep 17 00:00:00 2001 From: utox39 Date: Sat, 10 May 2025 23:03:01 +0200 Subject: [PATCH] refactor: add comments --- src/linux/hardware.zig | 4 ++++ src/linux/network.zig | 1 + src/linux/system.zig | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/linux/hardware.zig b/src/linux/hardware.zig index 8230522..d65d6ef 100644 --- a/src/linux/hardware.zig +++ b/src/linux/hardware.zig @@ -2,6 +2,7 @@ const std = @import("std"); const c_unistd = @cImport(@cInclude("unistd.h")); const c_statvfs = @cImport(@cInclude("sys/statvfs.h")); +/// Struct representing CPU informations pub const CpuInfo = struct { cpu_name: []u8, cpu_cores: i32, @@ -12,6 +13,7 @@ pub const CpuInfo = struct { } }; +/// Struct representing RAM usage informations pub const RamInfo = struct { ram_size: f64, ram_usage: f64, @@ -22,6 +24,7 @@ pub const RamInfo = struct { } }; +/// Struct representing Swap usage informations pub const SwapInfo = struct { swap_size: f64, swap_usage: f64, @@ -32,6 +35,7 @@ pub const SwapInfo = struct { } }; +/// Struct representing Disk usage informations pub const DiskInfo = struct { disk_path: []const u8, disk_size: f64, diff --git a/src/linux/network.zig b/src/linux/network.zig index 610dede..fa1f119 100644 --- a/src/linux/network.zig +++ b/src/linux/network.zig @@ -5,6 +5,7 @@ const c_net_if = @cImport(@cInclude("net/if.h")); const c_netinet_in = @cImport(@cInclude("netinet/in.h")); const c_socket = @cImport(@cInclude("sys/socket.h")); +/// Struct representing Network informations (interface name - ipv4 address) pub const NetInfo = struct { interface_name: []u8, ipv4_addr: []u8, diff --git a/src/linux/system.zig b/src/linux/system.zig index c7fb2bf..70a33d7 100644 --- a/src/linux/system.zig +++ b/src/linux/system.zig @@ -2,7 +2,7 @@ const std = @import("std"); const c_sysinfo = @cImport(@cInclude("sys/sysinfo.h")); const c_utsname = @cImport(@cInclude("sys/utsname.h")); -/// Structure representing system uptime in days, hours, and minutes. +/// Struct representing system uptime in days, hours, and minutes. pub const SystemUptime = struct { days: i8, hours: i8, @@ -13,6 +13,7 @@ pub const SystemUptime = struct { } }; +/// Struct representing Kernel informations pub const KernelInfo = struct { kernel_name: []u8, kernel_release: []u8,