107 char *name_uri =
NULL;
114 goto err_parse_options;
123 goto err_parse_cmdline;
130 if ( (
rc =
desc->acquire ( name_uri,
opts.timeout,
136 printf (
"No image selected\n" );
142 if (
desc->preaction )
148 printf (
"Could not name image: %s\n",
157 printf (
"Could not set arguments: %s\n",
159 goto err_set_cmdline;
168 if (
desc->action ) {
170 printf (
"Could not %s: %s\n",
263 if (
opts->replace ) {
344 void ( * payload ) (
struct image *
image ) ) {
363 for ( i =
optind ; i < argc ; i++ ) {
366 printf (
"\"%s\": no such image\n", argv[i] );
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
#define COMMAND(name, exec)
uint32_t kernel
Kernel version (numeric)
struct ena_llq_option desc
Descriptor counts.
char * concat_args(char **args)
Concatenate arguments.
void shell_stop(int stop)
Set shell stop state.
int optind
Current option index.
Parse command-line options.
@ required_argument
Option requires an argument.
@ no_argument
Option does not take an argument.
#define __unused
Declare a variable or data structure as unused.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOENT
No such file or directory.
#define ENOMEM
Not enough space.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
struct image * find_image(const char *name)
Find image by name.
void unregister_image(struct image *image)
Unregister executable image.
int image_exec(struct image *image)
Execute image.
struct image * find_image_tag(struct image_tag *tag)
Find image by tag.
int image_set_cmdline(struct image *image, const char *cmdline)
Set image command line.
int image_replace(struct image *replacement)
Set replacement image.
int image_set_name(struct image *image, const char *name)
Set image name.
int image_select(struct image *image)
Select image for execution.
#define for_each_image_safe(image, tmp)
Iterate over all registered images, safe against deletion.
struct image_tag selected_image
static void image_clear_cmdline(struct image *image)
Clear image command line.
#define IMAGE_AUTO_UNREGISTER
Image will be automatically unregistered after execution.
static int imgfetch_exec(int argc, char **argv)
The "imgfetch" command.
struct option_descriptor imgsingle[3]
static struct command_descriptor imgmulti_cmd
"img{multi}" command descriptor
static int imgstat_exec(int argc, char **argv)
The "imgstat" command.
struct option_descriptor imgexec[4]
struct imgsingle_descriptor imgargs_desc
"imgargs" family command descriptor
static int imgexec_exec(int argc, char **argv)
The "imgexec" command.
struct imgsingle_descriptor imgfetch_desc
"imgfetch" family command descriptor
static struct command_descriptor imgselect_cmd
"imgselect" command descriptor
static int imgfree_exec(int argc, char **argv)
The "imgfree" command.
static struct command_descriptor imgexec_cmd
"imgexec" command descriptor
static int imgselect(struct image *image, struct imgsingle_options *opts __unused)
"imgselect" command action
struct imgsingle_descriptor imgselect_desc
"imgselect" family command descriptor
static union @306150031363321274373032327065175057277367014027 opts
"img{single}" option list
static struct command_descriptor imgargs_cmd
"imgargs" command descriptor
static struct command_descriptor imgfetch_cmd
"imgfetch" command descriptor
static int imgargs_exec(int argc, char **argv)
The "imgargs" command body.
static int imgsingle_exec(int argc, char **argv, struct imgsingle_descriptor *desc)
The "img{single}" family of commands.
struct imgsingle_descriptor imgexec_desc
"imgexec" family command descriptor
static int imgmulti_exec(int argc, char **argv, void(*payload)(struct image *image))
The "img{multi}" family of commands.
static int imgselect_exec(int argc, char **argv)
The "imgselect" command.
static struct option_descriptor imgmulti_opts[]
"img{multi}" option list
int imgdownload_string(const char *uri_string, unsigned long timeout, struct image **image)
Download a new image.
int imgacquire(const char *name_uri, unsigned long timeout, struct image **image)
Acquire an image.
void imgstat(struct image *image)
Display status of an image.
int parse_flag(char *text __unused, int *flag)
Parse flag.
int parse_string(char *text, char **value)
Parse string value.
int parse_timeout(char *text, unsigned long *value)
Parse timeout value (in ms)
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Command line option parsing.
#define MAX_ARGUMENTS
No maximum number of arguments.
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
#define OPTION_DESC(_longopt, _shortopt, _has_arg, _struct, _field, _parse)
Construct option descriptor.
static void(* free)(struct refcnt *refcnt))
@ SHELL_STOP_COMMAND_SEQUENCE
Stop processing commands.
char * strerror(int errno)
Retrieve string representation of error number.
An "img{single}" family command descriptor.
struct command_descriptor * cmd
Command descriptor.
int(* action)(struct image *image, struct imgsingle_options *opts)
Action to take upon image, or NULL.
const char * verb
Verb to describe action.
int(* acquire)(const char *name, unsigned long timeout, struct image **image)
Function to use to acquire the image.
void(* preaction)(struct image *image)
Pre-action to take upon image, or NULL.
unsigned long timeout
Download timeout.
int replace
Replace image.
int autofree
Free image after execution.
A command-line option descriptor.
int printf(const char *fmt,...)
Write a formatted string to the console.