diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-19 06:22:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-19 06:22:10 +0100 |
commit | 5be5d1f2a162ab80ef7d851dceea080f5e84acf4 (patch) | |
tree | 281183448ba5051012a2878acb0eb9bb00d090d3 /src/network | |
parent | Recommend drop-ins over modifications to the main config file (diff) | |
parent | oomd: increase accuracy of SwapUsedLimit= to permyriads too (diff) | |
download | systemd-5be5d1f2a162ab80ef7d851dceea080f5e84acf4.tar.xz systemd-5be5d1f2a162ab80ef7d851dceea080f5e84acf4.zip |
Merge pull request #18659 from poettering/permyriadification
use scaling relative to UINT32_MAX instead of percentages/permyriads wherever we can
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/tc/tc-util.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/network/tc/tc-util.c b/src/network/tc/tc-util.c index 3e10b50c96..3781182946 100644 --- a/src/network/tc/tc-util.c +++ b/src/network/tc/tc-util.c @@ -5,6 +5,7 @@ #include "extract-word.h" #include "fileio.h" #include "parse-util.h" +#include "percent-util.h" #include "tc-util.h" #include "time-util.h" @@ -57,17 +58,17 @@ int tc_time_to_tick(usec_t t, uint32_t *ret) { return 0; } -int parse_tc_percent(const char *s, uint32_t *percent) { +int parse_tc_percent(const char *s, uint32_t *ret_fraction) { int r; assert(s); - assert(percent); + assert(ret_fraction); - r = parse_permille(s); + r = parse_permyriad(s); if (r < 0) return r; - *percent = (double) r / 1000 * UINT32_MAX; + *ret_fraction = (double) r / 10000 * UINT32_MAX; return 0; } |