iPXE
sync.c File Reference

Wait for pending operations to complete. More...

#include <stddef.h>
#include <ipxe/job.h>
#include <ipxe/monojob.h>
#include <ipxe/pending.h>
#include <usr/sync.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static int sync_progress (struct interface *intf, struct job_progress *progress __unused)
 Report progress.
int sync (unsigned long timeout)
 Wait for pending operations to complete.

Variables

static struct interface_operation sync_intf_op []
 Synchroniser interface operations.
static struct interface_descriptor sync_intf_desc
 Synchroniser interface descriptor.
static struct interface sync_intf = INTF_INIT ( sync_intf_desc )
 Synchroniser.

Detailed Description

Wait for pending operations to complete.

Definition in file sync.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ sync_progress()

int sync_progress ( struct interface * intf,
struct job_progress *progress __unused )
static

Report progress.

Parameters
intfInterface
progressProgress report to fill in
Return values
ongoing_rcOngoing job status code (if known)

Definition at line 46 of file sync.c.

47 {
48
49 /* Terminate successfully if no pending operations remain */
50 if ( ! have_pending() )
51 intf_close ( intf, 0 );
52
53 return 0;
54}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition interface.c:250
static int have_pending(void)
Check if any operations are pending.
Definition pending.h:36

References __unused, have_pending(), and intf_close().

◆ sync()

int sync ( unsigned long timeout)

Wait for pending operations to complete.

Parameters
timeoutTimeout period, in ticks (0=indefinite)
Return values
rcReturn status code

Definition at line 74 of file sync.c.

74 {
75
76 /* Attach synchroniser and wait for completion */
78 return monojob_wait ( NULL, timeout );
79}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
void timeout(int)
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition interface.c:108
struct interface monojob
Definition monojob.c:57
int monojob_wait(const char *string, unsigned long timeout)
Wait for single foreground job to complete.
Definition monojob.c:82
static struct interface sync_intf
Synchroniser.
Definition sync.c:66

References intf_plug_plug(), monojob, monojob_wait(), NULL, sync_intf, and timeout().

Referenced by COMMAND(), efi_autoexec_network(), falcon_xaui_link_ok(), and sync_exec().

Variable Documentation

◆ sync_intf_op

struct interface_operation sync_intf_op[]
static
Initial value:
= {
}
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition interface.h:33
An object interface.
Definition interface.h:125
Job progress.
Definition job.h:16
static int sync_progress(struct interface *intf, struct job_progress *progress __unused)
Report progress.
Definition sync.c:46

Synchroniser interface operations.

Definition at line 57 of file sync.c.

57 {
59};

◆ sync_intf_desc

struct interface_descriptor sync_intf_desc
static
Initial value:
=
#define INTF_DESC_PURE(operations)
Define an object interface descriptor for a pure-interface object.
Definition interface.h:116
static struct interface_operation sync_intf_op[]
Synchroniser interface operations.
Definition sync.c:57

Synchroniser interface descriptor.

Definition at line 62 of file sync.c.

◆ sync_intf

struct interface sync_intf = INTF_INIT ( sync_intf_desc )
static

Synchroniser.

Definition at line 66 of file sync.c.

Referenced by sync().