[systemd-devel] [RFC][PATCH] conf-parser: distinguish between multiple sections with the same name

Lennart Poettering lennart at poettering.net
Wed Nov 20 13:37:17 PST 2013


On Wed, 20.11.13 14:38, Tom Gundersen (teg at jklm.no) wrote:

> Pass on the line on which a section was decleared to the parsers, so they
> can distinguish between multiple sections (if they chose to). Currently
> no parsers take advantage of this, but a follow-up patch will do that
> to distinguish
> 
> [Address]
> Address=192.168.0.1/24
> Label=one
> 
> [Address]
> Address=192.168.0.2/24
> Label=two
> 
> from
> 
> [Address]
> Address=192.168.0.1/24
> Label=one
> Address=192.168.0.2/24
> Label=two

I do like this solution better, but I can see Thomas' point. And the
issue Thomas points out manifests itself in handling of .d/
directories... If we want to support .d/ directories for these
configuration files (do we?) then how can we extend the settings of a
specific existing [Address] section? 

So I do prefer the "linear" version above, but I see a problem with
it...

Hmm, what other options do we have? 

We could number things:

[Address.0]
...

[Address.1]
...

[Address.2]
...

and so on. I kinda like that too, but numbers might suck as ids? 

Maybe then back to labelled sections:

[Address:foobar]
Label=waldo
Address=1.1.1.1

or so, so that the suffix "foobar" is purely an id that is by default
disconnected from any setting? And then maybe optionally inherit it into
Label= if Label= is not explicitly set? 

Other ideas?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list