iPXE
Data Structures | Functions | Variables
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 More...
 
 COMMAND (sync, sync_exec)
 Sync commands. More...
 

Variables

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

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()

static 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:14
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:465
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition: parseopt.c:485
"sync" options
Definition: sync_cmd.c:41
static struct command_descriptor sync_cmd
"sync" command descriptor
Definition: sync_cmd.c:53
int sync(unsigned long timeout)
Wait for pending operations to complete.
Definition: sync.c:74
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
static union @447 opts
"cert<xxx>" option list

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

◆ COMMAND()

COMMAND ( sync  ,
sync_exec   
)

Sync commands.

Variable Documentation

◆ sync_opts

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

"sync" option list

Definition at line 47 of file sync_cmd.c.

◆ sync_cmd

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

"sync" command descriptor

Definition at line 53 of file sync_cmd.c.

Referenced by sync_exec().