[systemd-devel] [PATCH] WIP: conf-parser: allow config_parse_iec_off to parse percentages

jsynacek at redhat.com jsynacek at redhat.com
Wed May 20 01:37:41 PDT 2015


From: Jan Synacek <jsynacek at redhat.com>

Allow certain configuration options to be specified as percentages. For
example, in journald.conf, SystemMaxUse= can now also be specified as 33%.

There is a slight "problem" with the patch. It parses option names to determine
what filesystem it should use to get the available space from. This approach
is probably not the rigth thing to do, but I couldn't think of a better one.
Another approach that came to my mind was to use the highest bit of the off_t
value returned by the parser to indicate if the value was a percentage, or
a normal value. This would require to rewrite a significant amount of code
which now counts on the values being definite (not percentages), and would,
IMHO, be hardly any improvement at all.

What do you think? Is there a better way to implement this functionality? Is it
a real problem to parse the option lvalues like that?

Jan Synacek (1):
  WIP: conf-parser: allow config_parse_iec_off to parse percentages

 src/shared/conf-parser.c | 42 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 4 deletions(-)

-- 
2.1.0



More information about the systemd-devel mailing list