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)
static int sync_exec (int argc, char **argv)
 "sync" command

Variables

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

Detailed Description

"sync" command

Definition in file sync_cmd.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int sync_exec ( int  argc,
char **  argv 
) [static]

"sync" command

Parameters:
argcArgument count
argvArgument list
Return values:
rcReturn status code

Definition at line 62 of file sync_cmd.c.

References parse_options(), printf(), rc, strerror(), sync(), and sync_options::timeout.

                                               {
        struct sync_options opts;
        int rc;

        /* Parse options */
        if ( ( rc = parse_options ( argc, argv, &sync_cmd, &opts ) ) != 0 )
                return rc;

        /* Wait for pending operations to complete */
        if ( ( rc = sync ( opts.timeout ) ) != 0 ) {
                printf ( "Operations did not complete: %s\n", strerror ( rc ) );
                return rc;
        }

        return 0;
}

Variable Documentation

struct option_descriptor sync_opts[] [static]
Initial value:
 {
        OPTION_DESC ( "timeout", 't', required_argument,
                      struct sync_options, timeout, parse_timeout ),
}

"sync" option list

Definition at line 46 of file sync_cmd.c.

struct command_descriptor sync_cmd [static]
Initial value:

"sync" command descriptor

Definition at line 52 of file sync_cmd.c.

struct command sync_command __command
Initial value:
 {
        .name = "sync",
        .exec = sync_exec,
}

Sync commands.

Definition at line 80 of file sync_cmd.c.