iPXE
Data Structures | Functions | Variables
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)
 
static int reboot_exec (int argc, char **argv)
 The "reboot" command. More...
 
 COMMAND (reboot, reboot_exec)
 "reboot" command More...
 

Variables

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

Detailed Description

Reboot command.

Definition in file reboot_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ reboot_exec()

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

The "reboot" command.

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 64 of file reboot_cmd.c.

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

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

◆ COMMAND()

COMMAND ( reboot  ,
reboot_exec   
)

"reboot" command

Variable Documentation

◆ reboot_opts

struct option_descriptor reboot_opts[]
static
Initial value:
= {
OPTION_DESC ( "warm", 'w', no_argument,
OPTION_DESC ( "setup", 's', no_argument,
}
int parse_flag(char *text __unused, int *flag)
Parse flag.
Definition: parseopt.c:226
int warm
Perform a warm reboot.
Definition: reboot_cmd.c:40
Option does not take an argument.
Definition: getopt.h:16
"reboot" options
Definition: reboot_cmd.c:38
int setup
Reboot to firmware setup.
Definition: reboot_cmd.c:42
#define OPTION_DESC(_longopt, _shortopt, _has_arg, _struct, _field, _parse)
Construct option descriptor.
Definition: parseopt.h:67

"reboot" option list

Definition at line 46 of file reboot_cmd.c.

◆ reboot_cmd

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

"reboot" command descriptor

Definition at line 54 of file reboot_cmd.c.

Referenced by reboot_exec().