iPXE
sync_cmd.c File Reference

"sync" command More...

#include <string.h>
#include <stdio.h>
#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <usr/sync.h>

Go to the source code of this file.

Data Structures

struct  sync_options
 "sync" options More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static int sync_exec (int argc, char **argv)
 "sync" command
 COMMAND (sync, sync_exec)
 Sync commands.

Variables

static struct option_descriptor sync_opts []
 "sync" option list
static struct command_descriptor sync_cmd
 "sync" command descriptor

Detailed Description

"sync" command

Definition in file sync_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ sync_exec()

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

"sync" command

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 63 of file sync_cmd.c.

63 {
64 struct sync_options opts;
65 int rc;
66
67 /* Parse options */
68 if ( ( rc = parse_options ( argc, argv, &sync_cmd, &opts ) ) != 0 )
69 return rc;
70
71 /* Wait for pending operations to complete */
72 if ( ( rc = sync ( opts.timeout ) ) != 0 ) {
73 printf ( "Operations did not complete: %s\n", strerror ( rc ) );
74 return rc;
75 }
76
77 return 0;
78}
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition parseopt.c:485
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
"sync" options
Definition sync_cmd.c:41
int sync(unsigned long timeout)
Wait for pending operations to complete.
Definition sync.c:74
static struct command_descriptor sync_cmd
"sync" command descriptor
Definition sync_cmd.c:53
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465

References opts, parse_options(), printf(), rc, strerror(), sync(), and sync_cmd.

Referenced by COMMAND().

◆ COMMAND()

COMMAND ( sync ,
sync_exec  )

Sync commands.

References sync(), and sync_exec().

Variable Documentation

◆ sync_opts

struct option_descriptor sync_opts[]
static
Initial value:
= {
OPTION_DESC ( "timeout", 't', required_argument,
}
void timeout(int)
@ required_argument
Option requires an argument.
Definition getopt.h:19
int parse_timeout(char *text, unsigned long *value)
Parse timeout value (in ms)
Definition parseopt.c:115
#define OPTION_DESC(_longopt, _shortopt, _has_arg, _struct, _field, _parse)
Construct option descriptor.
Definition parseopt.h:68

"sync" option list

Definition at line 47 of file sync_cmd.c.

47 {
48 OPTION_DESC ( "timeout", 't', required_argument,
50};

◆ sync_cmd

struct command_descriptor sync_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 sync_opts[]
"sync" option list
Definition sync_cmd.c:47

"sync" command descriptor

Definition at line 53 of file sync_cmd.c.

Referenced by PROVIDE_REQUIRING_SYMBOL(), and sync_exec().