iPXE
Functions | Variables
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. More...
 
int sync (unsigned long timeout)
 Wait for pending operations to complete. More...
 

Variables

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

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

static 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 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 }
int monojob_wait(const char *string, unsigned long timeout)
Wait for single foreground job to complete.
Definition: monojob.c:82
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
static struct interface sync_intf
Synchroniser.
Definition: sync.c:66
void timeout(int)
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

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

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

Variable Documentation

◆ sync_intf_op

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

Synchroniser interface operations.

Definition at line 57 of file sync.c.

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