summaryrefslogtreecommitdiffstats
path: root/plugins/check_disk.d/utils_disk.h
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-03-30 23:30:51 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-03-30 23:30:51 +0200
commita4cf2e79f75dce3828be21726f10c755f652f710 (patch)
treee6b72e1453a026917e67030334de16c407ccbb1d /plugins/check_disk.d/utils_disk.h
parentc4fd34ed7966a197e596f3e766f58423fe9c5ddc (diff)
downloadmonitoring-plugins-a4cf2e79f75dce3828be21726f10c755f652f710.tar.gz
Remove cool, comfy c23 functionality for some dirty old hacks
Diffstat (limited to 'plugins/check_disk.d/utils_disk.h')
-rw-r--r--plugins/check_disk.d/utils_disk.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/plugins/check_disk.d/utils_disk.h b/plugins/check_disk.d/utils_disk.h
index a66453ea..1f574695 100644
--- a/plugins/check_disk.d/utils_disk.h
+++ b/plugins/check_disk.d/utils_disk.h
@@ -8,22 +8,24 @@
8#include "regex.h" 8#include "regex.h"
9#include <stdint.h> 9#include <stdint.h>
10 10
11typedef enum : unsigned long { 11typedef unsigned long long byte_unit;
12 Humanized = 0, 12
13 Bytes = 1, 13typedef enum {
14 KibiBytes = 1024, 14 Humanized,
15 MebiBytes = 1024 * KibiBytes, 15 Bytes,
16 GibiBytes = 1024 * MebiBytes, 16 KibiBytes,
17 TebiBytes = 1024 * GibiBytes, 17 MebiBytes,
18 PebiBytes = 1024 * TebiBytes, 18 GibiBytes,
19 ExbiBytes = 1024 * PebiBytes, 19 TebiBytes,
20 KiloBytes = 1000, 20 PebiBytes,
21 MegaBytes = 1000 * KiloBytes, 21 ExbiBytes,
22 GigaBytes = 1000 * MegaBytes, 22 KiloBytes,
23 TeraBytes = 1000 * GigaBytes, 23 MegaBytes,
24 PetaBytes = 1000 * TeraBytes, 24 GigaBytes,
25 ExaBytes = 1000 * PetaBytes 25 TeraBytes,
26} byte_unit; 26 PetaBytes,
27 ExaBytes,
28} byte_unit_enum;
27 29
28typedef struct name_list string_list; 30typedef struct name_list string_list;
29struct name_list { 31struct name_list {
@@ -120,7 +122,7 @@ typedef struct {
120 struct mount_entry *mount_list; 122 struct mount_entry *mount_list;
121 struct name_list *seen; 123 struct name_list *seen;
122 124
123 byte_unit display_unit; 125 byte_unit_enum display_unit;
124 // byte_unit unit; 126 // byte_unit unit;
125 127
126 bool output_format_is_set; 128 bool output_format_is_set;
@@ -149,7 +151,7 @@ measurement_unit create_measurement_unit_from_filesystem(parameter_list_elem fil
149int search_parameter_list(parameter_list_elem *list, const char *name); 151int search_parameter_list(parameter_list_elem *list, const char *name);
150bool np_regex_match_mount_entry(struct mount_entry *, regex_t *); 152bool np_regex_match_mount_entry(struct mount_entry *, regex_t *);
151 153
152char *get_unit_string(byte_unit); 154char *get_unit_string(byte_unit_enum);
153check_disk_config check_disk_config_init(); 155check_disk_config check_disk_config_init();
154 156
155char *humanize_byte_value(uintmax_t value, bool use_si_units); 157char *humanize_byte_value(uintmax_t value, bool use_si_units);