diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-30 23:30:51 +0200 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-30 23:30:51 +0200 |
| commit | a4cf2e79f75dce3828be21726f10c755f652f710 (patch) | |
| tree | e6b72e1453a026917e67030334de16c407ccbb1d /plugins/check_disk.d | |
| parent | c4fd34ed7966a197e596f3e766f58423fe9c5ddc (diff) | |
| download | monitoring-plugins-a4cf2e79f75dce3828be21726f10c755f652f710.tar.gz | |
Remove cool, comfy c23 functionality for some dirty old hacks
Diffstat (limited to 'plugins/check_disk.d')
| -rw-r--r-- | plugins/check_disk.d/utils_disk.c | 2 | ||||
| -rw-r--r-- | plugins/check_disk.d/utils_disk.h | 38 |
2 files changed, 21 insertions, 19 deletions
diff --git a/plugins/check_disk.d/utils_disk.c b/plugins/check_disk.d/utils_disk.c index 3986a8a8..a78b4eae 100644 --- a/plugins/check_disk.d/utils_disk.c +++ b/plugins/check_disk.d/utils_disk.c | |||
| @@ -180,7 +180,7 @@ check_disk_config check_disk_config_init() { | |||
| 180 | return tmp; | 180 | return tmp; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | char *get_unit_string(byte_unit unit) { | 183 | char *get_unit_string(byte_unit_enum unit) { |
| 184 | switch (unit) { | 184 | switch (unit) { |
| 185 | case Bytes: | 185 | case Bytes: |
| 186 | return "Bytes"; | 186 | return "Bytes"; |
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 | ||
| 11 | typedef enum : unsigned long { | 11 | typedef unsigned long long byte_unit; |
| 12 | Humanized = 0, | 12 | |
| 13 | Bytes = 1, | 13 | typedef 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 | ||
| 28 | typedef struct name_list string_list; | 30 | typedef struct name_list string_list; |
| 29 | struct name_list { | 31 | struct 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 | |||
| 149 | int search_parameter_list(parameter_list_elem *list, const char *name); | 151 | int search_parameter_list(parameter_list_elem *list, const char *name); |
| 150 | bool np_regex_match_mount_entry(struct mount_entry *, regex_t *); | 152 | bool np_regex_match_mount_entry(struct mount_entry *, regex_t *); |
| 151 | 153 | ||
| 152 | char *get_unit_string(byte_unit); | 154 | char *get_unit_string(byte_unit_enum); |
| 153 | check_disk_config check_disk_config_init(); | 155 | check_disk_config check_disk_config_init(); |
| 154 | 156 | ||
| 155 | char *humanize_byte_value(uintmax_t value, bool use_si_units); | 157 | char *humanize_byte_value(uintmax_t value, bool use_si_units); |
