mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-19 14:48:33 +02:00
initrd: refactor parsing of "rd.ethtool=" to accept zero positional arguments
The point of positional arguments is that you can omit them, and that should be treated as the parameter being set to the default. So, don't treat "rd.ethtool=eth0" (or "rd.ethtool=eth0:") special. Just continue the parsing and take all following positional arguments as unset.
This commit is contained in:
parent
0e384b0170
commit
44e484a6aa
2 changed files with 3 additions and 12 deletions
|
|
@ -1187,11 +1187,6 @@ reader_parse_ethtool(Reader *reader, char *argument)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!*argument) {
|
||||
_LOGW(LOGD_CORE, "Could not find rd.ethtool options to set");
|
||||
return;
|
||||
}
|
||||
|
||||
autoneg_str = get_word(&argument, ':');
|
||||
speed_str = get_word(&argument, ':');
|
||||
|
||||
|
|
|
|||
|
|
@ -2318,11 +2318,9 @@ test_rd_ethtool(void)
|
|||
NMTST_EXPECT_NM_WARN("cmdline-reader: Impossible to set rd.ethtool options: invalid format");
|
||||
_ethtool_check_inval("rd.ethtool=");
|
||||
|
||||
NMTST_EXPECT_NM_WARN("cmdline-reader: Could not find rd.ethtool options to set");
|
||||
_ethtool_check_inval("rd.ethtool=eth0");
|
||||
_ethtool_check("rd.ethtool=eth0", FALSE, 0);
|
||||
|
||||
NMTST_EXPECT_NM_WARN("cmdline-reader: Could not find rd.ethtool options to set");
|
||||
_ethtool_check_inval("rd.ethtool=eth0:");
|
||||
_ethtool_check("rd.ethtool=eth0:", FALSE, 0);
|
||||
|
||||
NMTST_EXPECT_NM_WARN("cmdline-reader: Impossible to set rd.ethtool options: invalid format");
|
||||
_ethtool_check_inval("rd.ethtool=::");
|
||||
|
|
@ -2407,9 +2405,7 @@ test_rd_ethtool(void)
|
|||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:off:100", "rd.ethtool=eth0:off"), FALSE, 0);
|
||||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:on:100", "rd.ethtool=eth0:on"), TRUE, 0);
|
||||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:on:100", "rd.ethtool=eth0:off"), FALSE, 0);
|
||||
|
||||
NMTST_EXPECT_NM_WARN("cmdline-reader: Could not find rd.ethtool options to set");
|
||||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:off:100", "rd.ethtool=eth0:"), FALSE, 100);
|
||||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:off:100", "rd.ethtool=eth0:"), FALSE, 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue