iPXE
reboot_cmd.c File Reference

Reboot command. More...

#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/reboot.h>

Go to the source code of this file.

Data Structures

struct  reboot_options
 "reboot" options More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static int reboot_exec (int argc, char **argv)
 The "reboot" command.
 COMMAND (reboot, reboot_exec)
 "reboot" command

Variables

static struct option_descriptor reboot_opts []
 "reboot" option list
static struct command_descriptor reboot_cmd
 "reboot" command descriptor

Detailed Description

Reboot command.

Definition in file reboot_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ reboot_exec()

int reboot_exec ( int argc,
char ** argv )
static

The "reboot" command.

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 65 of file reboot_cmd.c.

65 {
66 struct reboot_options opts;
67 int flags = 0;
68 int rc;
69
70 /* Parse options */
71 if ( ( rc = parse_options ( argc, argv, &reboot_cmd, &opts ) ) != 0 )
72 return rc;
73
74 /* Reboot system */
75 if ( opts.warm )
77 if ( opts.setup )
79 reboot ( flags );
80
81 return 0;
82}
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
uint8_t flags
Flags.
Definition ena.h:7
#define REBOOT_SETUP
Reboot to firmware setup.
Definition reboot.h:60
void reboot(int flags)
Reboot system.
#define REBOOT_WARM
Perform a warm reboot.
Definition reboot.h:59
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition parseopt.c:485
static struct command_descriptor reboot_cmd
"reboot" command descriptor
Definition reboot_cmd.c:55
"reboot" options
Definition reboot_cmd.c:39

References flags, opts, parse_options(), rc, reboot(), reboot_cmd, REBOOT_SETUP, and REBOOT_WARM.

Referenced by COMMAND().

◆ COMMAND()

COMMAND ( reboot ,
reboot_exec  )

"reboot" command

References reboot(), and reboot_exec().

Variable Documentation

◆ reboot_opts

struct option_descriptor reboot_opts[]
static
Initial value:
= {
OPTION_DESC ( "warm", 'w', no_argument,
struct reboot_options, warm, parse_flag ),
OPTION_DESC ( "setup", 's', no_argument,
struct reboot_options, setup, parse_flag ),
}
@ no_argument
Option does not take an argument.
Definition getopt.h:17
int parse_flag(char *text __unused, int *flag)
Parse flag.
Definition parseopt.c:227
#define OPTION_DESC(_longopt, _shortopt, _has_arg, _struct, _field, _parse)
Construct option descriptor.
Definition parseopt.h:68

"reboot" option list

Definition at line 47 of file reboot_cmd.c.

47 {
48 OPTION_DESC ( "warm", 'w', no_argument,
49 struct reboot_options, warm, parse_flag ),
50 OPTION_DESC ( "setup", 's', no_argument,
51 struct reboot_options, setup, parse_flag ),
52};

◆ reboot_cmd

struct command_descriptor reboot_cmd
static
Initial value:
=
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition parseopt.h:109
static struct option_descriptor reboot_opts[]
"reboot" option list
Definition reboot_cmd.c:47

"reboot" command descriptor

Definition at line 55 of file reboot_cmd.c.

Referenced by PROVIDE_REQUIRING_SYMBOL(), and reboot_exec().