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...


static int sync_exec (int argc, char **argv)
 "sync" command More...


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

Detailed Description

"sync" command

Definition in file sync_cmd.c.

Function Documentation



◆ sync_exec()

static int sync_exec ( int  argc,
char **  argv 

"sync" command

argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 62 of file sync_cmd.c.

62  {
63  struct sync_options opts;
64  int rc;
66  /* Parse options */
67  if ( ( rc = parse_options ( argc, argv, &sync_cmd, &opts ) ) != 0 )
68  return rc;
70  /* Wait for pending operations to complete */
71  if ( ( rc = sync ( opts.timeout ) ) != 0 ) {
72  printf ( "Operations did not complete: %s\n", strerror ( rc ) );
73  return rc;
74  }
76  return 0;
77 }
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:464
static union @424 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:447
"sync" options
Definition: sync_cmd.c:40
static struct command_descriptor sync_cmd
"sync" command descriptor
Definition: sync_cmd.c:52
int sync(unsigned long timeout)
Wait for pending operations to complete.
Definition: sync.c:73
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78

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

Variable Documentation

◆ sync_opts

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

"sync" option list

Definition at line 46 of file sync_cmd.c.

◆ sync_cmd

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

"sync" command descriptor

Definition at line 52 of file sync_cmd.c.

Referenced by sync_exec().

◆ __command

struct command sync_command __command
Initial value:
= {
.name = "sync",
.exec = sync_exec,
static int sync_exec(int argc, char **argv)
"sync" command
Definition: sync_cmd.c:62

Sync commands.

Definition at line 80 of file sync_cmd.c.