From 681cb84a63c14410449469c580ea3cc54f590ca4 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Tue, 28 Sep 2021 10:12:36 +0200 Subject: meson: allow extra net naming schemes to be defined during configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In upstream, we have a linearly-growing list of net-naming-scheme defines; we add a new one for every release where we make user-visible changes to the naming scheme. But the general idea was that downstream distributions could define their own combinations (or even just their own names for existing combinations), so provide stability for their users. So far this required patching of the netif-naming-scheme.c and .h files to add the new lines. With this patch, patching is not required: $ meson configure build \ -Dextra-net-naming-schemes=gargoyle=v238+npar_ari+allow_rerenames,gargoyle2=gargoyle+nspawn_long_hash \ -Ddefault-net-naming-scheme=gargoyle2 or even $ meson configure build \ -Dextra-net-naming-schemes=gargoyle=v238+npar_ari+allow_rerenames,gargoyle2=gargoyle+nspawn_long_hash,latest=v249 \ -Ddefault-net-naming-scheme=gargoyle2 The syntax is a comma-separated list of NAME=name+name+… This syntax is a bit scary, but any typos result in compilation errors, so I think it should be OK in practice. With this approach, we don't allow users to define arbitrary combinations: what is allowed is still defined at compilation time, so it's up to the distribution maintainers to provide reasonable combinations. In this regard, the only difference from status quo is that it's much easier to do (and harder to do incorrectly, for example by forgetting to add a name to one of the maps). --- src/shared/netif-naming-scheme.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/shared/netif-naming-scheme.h') diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h index f5d040cc09..0141a4fb90 100644 --- a/src/shared/netif-naming-scheme.h +++ b/src/shared/netif-naming-scheme.h @@ -46,6 +46,8 @@ typedef enum NamingSchemeFlags { NAMING_V247 = NAMING_V245 | NAMING_BRIDGE_NO_SLOT, NAMING_V249 = NAMING_V247 | NAMING_SLOT_FUNCTION_ID | NAMING_16BIT_INDEX | NAMING_REPLACE_STRICTLY, + EXTRA_NET_NAMING_SCHEMES + _NAMING_SCHEME_FLAGS_INVALID = -EINVAL, } NamingSchemeFlags; -- cgit v1.2.3