summaryrefslogtreecommitdiff
path: root/src/core/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-23 03:13:54 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-23 03:19:04 +0100
commit5556b5fe41173107a67dbe875fbd916a46e52a02 (patch)
treea9ca468b7c030c5c95a87bb35b4f986dedb1bba8 /src/core/load-fragment.c
parente342365c27ecae32a7f20ada0b2c623ce22e5ea8 (diff)
core: clean up some confusing regarding SI decimal and IEC binary suffixes for sizes
According to Wikipedia it is customary to specify hardware metrics and transfer speeds to the basis 1000 (SI decimal), while software metrics and physical volatile memory (RAM) sizes to the basis 1024 (IEC binary). So far we specified everything in IEC, let's fix that and be more true to what's otherwise customary. Since we don't want to parse "Mi" instead of "M" we document each time what the context used is.
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r--src/core/load-fragment.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 5b1e990921..82aed1eb92 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2327,10 +2327,9 @@ int config_parse_memory_limit(
assert_cc(sizeof(uint64_t) == sizeof(off_t));
- r = parse_bytes(rvalue, &bytes);
+ r = parse_size(rvalue, 1024, &bytes);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Memory limit '%s' invalid. Ignoring.", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Memory limit '%s' invalid. Ignoring.", rvalue);
return 0;
}
@@ -2563,10 +2562,9 @@ int config_parse_blockio_bandwidth(
return 0;
}
- r = parse_bytes(bandwidth, &bytes);
+ r = parse_size(bandwidth, 1000, &bytes);
if (r < 0 || bytes <= 0) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Block IO Bandwidth '%s' invalid. Ignoring.", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Block IO Bandwidth '%s' invalid. Ignoring.", rvalue);
return 0;
}
@@ -2964,7 +2962,9 @@ void unit_dump_config_items(FILE *f) {
#endif
{ config_parse_int, "INTEGER" },
{ config_parse_unsigned, "UNSIGNED" },
- { config_parse_bytes_size, "SIZE" },
+ { config_parse_iec_size, "SIZE" },
+ { config_parse_iec_off, "SIZE" },
+ { config_parse_si_size, "SIZE" },
{ config_parse_bool, "BOOLEAN" },
{ config_parse_string, "STRING" },
{ config_parse_path, "PATH" },