diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-02-23 03:13:54 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-02-23 03:19:04 +0100 |
commit | 5556b5fe41173107a67dbe875fbd916a46e52a02 (patch) | |
tree | a9ca468b7c030c5c95a87bb35b4f986dedb1bba8 /src/core | |
parent | e342365c27ecae32a7f20ada0b2c623ce22e5ea8 (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')
-rw-r--r-- | src/core/load-fragment-gperf.gperf.m4 | 6 | ||||
-rw-r--r-- | src/core/load-fragment.c | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index e1bab7a264..26146b1927 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -219,12 +219,12 @@ Socket.Accept, config_parse_bool, 0, Socket.MaxConnections, config_parse_unsigned, 0, offsetof(Socket, max_connections) Socket.KeepAlive, config_parse_bool, 0, offsetof(Socket, keep_alive) Socket.Priority, config_parse_int, 0, offsetof(Socket, priority) -Socket.ReceiveBuffer, config_parse_bytes_size, 0, offsetof(Socket, receive_buffer) -Socket.SendBuffer, config_parse_bytes_size, 0, offsetof(Socket, send_buffer) +Socket.ReceiveBuffer, config_parse_iec_size, 0, offsetof(Socket, receive_buffer) +Socket.SendBuffer, config_parse_iec_size, 0, offsetof(Socket, send_buffer) Socket.IPTOS, config_parse_ip_tos, 0, offsetof(Socket, ip_tos) Socket.IPTTL, config_parse_int, 0, offsetof(Socket, ip_ttl) Socket.Mark, config_parse_int, 0, offsetof(Socket, mark) -Socket.PipeSize, config_parse_bytes_size, 0, offsetof(Socket, pipe_size) +Socket.PipeSize, config_parse_iec_size, 0, offsetof(Socket, pipe_size) Socket.FreeBind, config_parse_bool, 0, offsetof(Socket, free_bind) Socket.Transparent, config_parse_bool, 0, offsetof(Socket, transparent) Socket.Broadcast, config_parse_bool, 0, offsetof(Socket, broadcast) 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" }, |