Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / hci / commands / autoboot_cmd.c
1 /*
2  * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  */
19
20 #include <stdio.h>
21 #include <getopt.h>
22 #include <ipxe/command.h>
23 #include <ipxe/parseopt.h>
24 #include <ipxe/netdevice.h>
25 #include <hci/ifmgmt_cmd.h>
26 #include <usr/autoboot.h>
27
28 FILE_LICENCE ( GPL2_OR_LATER );
29
30 /** @file
31  *
32  * Booting commands
33  *
34  */
35
36 /** "autoboot" options */
37 struct autoboot_options {};
38
39 /** "autoboot" option list */
40 static struct option_descriptor autoboot_opts[] = {};
41
42 /**
43  * "autoboot" payload
44  *
45  * @v netdev            Network device
46  * @v opts              Command options
47  * @ret rc              Return status code
48  */
49 static int autoboot_payload ( struct net_device *netdev,
50                               struct autoboot_options *opts __unused ) {
51         return netboot ( netdev );
52 }
53
54 /** "autoboot" command descriptor */
55 static struct ifcommon_command_descriptor autoboot_cmd =
56         IFCOMMON_COMMAND_DESC ( struct autoboot_options, autoboot_opts,
57                                 0, MAX_ARGUMENTS, "[<interface>...]",
58                                 autoboot_payload, 0 );
59
60 /**
61  * "autoboot" command
62  *
63  * @v argc              Argument count
64  * @v argv              Argument list
65  * @ret rc              Return status code
66  */
67 static int autoboot_exec ( int argc, char **argv ) {
68         return ifcommon_exec ( argc, argv, &autoboot_cmd );
69 }
70
71 /** Booting commands */
72 struct command autoboot_commands[] __command = {
73         {
74                 .name = "autoboot",
75                 .exec = autoboot_exec,
76         },
77 };