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.


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


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



◆ sync_progress()

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

Report progress.

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

Definition at line 45 of file sync.c.

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

References have_pending(), and intf_close().

◆ sync()

int sync ( unsigned long  timeout)

Wait for pending operations to complete.

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

Definition at line 73 of file sync.c.

73  {
75  /* Attach synchroniser and wait for completion */
77  return monojob_wait ( NULL, timeout );
78 }
int monojob_wait(const char *string, unsigned long timeout)
Wait for single foreground job to complete.
Definition: monojob.c:81
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:107
struct interface monojob
Definition: monojob.c:56
static struct interface sync_intf
Definition: sync.c:65
void timeout(int)
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

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[]
Initial value:
= {
static int sync_progress(struct interface *intf, struct job_progress *progress __unused)
Report progress.
Definition: sync.c:45
An object interface.
Definition: interface.h:124
Job progress.
Definition: job.h:15
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32

Synchroniser interface operations.

Definition at line 56 of file sync.c.

◆ sync_intf_desc

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

Synchroniser interface descriptor.

Definition at line 61 of file sync.c.

◆ sync_intf

struct interface sync_intf = INTF_INIT ( sync_intf_desc )


Definition at line 65 of file sync.c.

Referenced by sync().