remove match-foo priorities from config files
In *.endpoint
and *.endpoint-link
files, the [match-node]
and [match-endpoint]
sections, respectively, have a priority field that specifies the order in which those files are searched for a match.
After actually using these config files in AGL, I found that this priority number is actually a bit weird to use. Traditionally on unix systems, the order in which configuration files or scripts are being parsed is defined by their filenames. Because many configuration files are involved here, an experienced developer/administrator will want to use this naming scheme to maintain them in order (because it's hard to find a configuration ordering issue if the files cannot be sorted by that order). This is what I already did in src/config
:
00-audio-sink.endpoint
00-audio-source.endpoint
00-stream-input-audio.endpoint
00-stream-output-audio.endpoint
01-hw:0,0-audio-sink.endpoint
01-hw:0,0-audio-source.endpoint
70-usb-audio-sink.endpoint
70-usb-audio-source.endpoint
... and I just set the match-node.priority
to be the same number as the one on the filename.
My proposal now is to remove this priority number completely. Instead, the parser should store the filename (as a string, without the path) and when sorting, instead of returning b->mn.priority - a->mn.priority
in the compare func, it should return g_strcmp0(b->filename, a->filename)
The additional advantage here is that it will no longer be very confusing that there are two priorities in a .endpoint
file, the one from [match-node]
and the one from [endpoint]
. We will now have only the second one, while the first one will be determined from the filename.