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.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user