iPXE
autoboot_cmd.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  *
00019  * You can also choose to distribute this program under the terms of
00020  * the Unmodified Binary Distribution Licence (as given in the file
00021  * COPYING.UBDL), provided that you have satisfied its requirements.
00022  */
00023 
00024 #include <stdio.h>
00025 #include <getopt.h>
00026 #include <ipxe/command.h>
00027 #include <ipxe/parseopt.h>
00028 #include <ipxe/netdevice.h>
00029 #include <hci/ifmgmt_cmd.h>
00030 #include <usr/autoboot.h>
00031 
00032 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00033 
00034 /** @file
00035  *
00036  * Booting commands
00037  *
00038  */
00039 
00040 /** "autoboot" options */
00041 struct autoboot_options {};
00042 
00043 /** "autoboot" option list */
00044 static struct option_descriptor autoboot_opts[] = {};
00045 
00046 /**
00047  * "autoboot" payload
00048  *
00049  * @v netdev            Network device
00050  * @v opts              Command options
00051  * @ret rc              Return status code
00052  */
00053 static int autoboot_payload ( struct net_device *netdev,
00054                               struct autoboot_options *opts __unused ) {
00055         return netboot ( netdev );
00056 }
00057 
00058 /** "autoboot" command descriptor */
00059 static struct ifcommon_command_descriptor autoboot_cmd =
00060         IFCOMMON_COMMAND_DESC ( struct autoboot_options, autoboot_opts,
00061                                 0, MAX_ARGUMENTS, "[<interface>...]",
00062                                 autoboot_payload, 0 );
00063 
00064 /**
00065  * "autoboot" command
00066  *
00067  * @v argc              Argument count
00068  * @v argv              Argument list
00069  * @ret rc              Return status code
00070  */
00071 static int autoboot_exec ( int argc, char **argv ) {
00072         return ifcommon_exec ( argc, argv, &autoboot_cmd );
00073 }
00074 
00075 /** Booting commands */
00076 struct command autoboot_commands[] __command = {
00077         {
00078                 .name = "autoboot",
00079                 .exec = autoboot_exec,
00080         },
00081 };