mirror of
https://github.com/ipxe/ipxe
synced 2025-12-31 06:49:20 +03:00
[cmdline] Allow "if<xxx>" commands to take options
Allow commands implemented using ifcommon_exec() to accept command-specific options. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -33,10 +33,29 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
*
|
||||
*/
|
||||
|
||||
/** "autoboot" options */
|
||||
struct autoboot_options {};
|
||||
|
||||
/** "autoboot" option list */
|
||||
static struct option_descriptor autoboot_opts[] = {};
|
||||
|
||||
/**
|
||||
* "autoboot" payload
|
||||
*
|
||||
* @v netdev Network device
|
||||
* @v opts Command options
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int autoboot_payload ( struct net_device *netdev,
|
||||
struct autoboot_options *opts __unused ) {
|
||||
return netboot ( netdev );
|
||||
}
|
||||
|
||||
/** "autoboot" command descriptor */
|
||||
static struct command_descriptor autoboot_cmd =
|
||||
COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
|
||||
"[<interface>...]" );
|
||||
static struct ifcommon_command_descriptor autoboot_cmd =
|
||||
IFCOMMON_COMMAND_DESC ( struct autoboot_options, autoboot_opts,
|
||||
0, MAX_ARGUMENTS, "[<interface>...]",
|
||||
autoboot_payload, 0 );
|
||||
|
||||
/**
|
||||
* "autoboot" command
|
||||
@@ -46,7 +65,7 @@ static struct command_descriptor autoboot_cmd =
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int autoboot_exec ( int argc, char **argv ) {
|
||||
return ifcommon_exec ( argc, argv, &autoboot_cmd, netboot, 0 );
|
||||
return ifcommon_exec ( argc, argv, &autoboot_cmd );
|
||||
}
|
||||
|
||||
/** Booting commands */
|
||||
|
||||
Reference in New Issue
Block a user