job.h File Reference

Job control interfaces. More...

#include <stddef.h>
#include <gpxe/interface.h>

Go to the source code of this file.

Data Structures

struct  job_progress
 Job progress. More...
struct  job_interface_operations
 Job control interface operations. More...
struct  job_interface
 A job control interface. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void job_done (struct job_interface *job, int rc)
void job_kill (struct job_interface *job)
void job_progress (struct job_interface *job, struct job_progress *progress)
void ignore_job_done (struct job_interface *job, int rc)
void ignore_job_kill (struct job_interface *job)
void ignore_job_progress (struct job_interface *job, struct job_progress *progress)
static void job_init (struct job_interface *job, struct job_interface_operations *op, struct refcnt *refcnt)
 Initialise a job control interface.
static __attribute__ ((always_inline)) struct job_interface *intf_to_job(struct interface *intf)
 Get job control interface from generic object communication interface.
static void job_plug (struct job_interface *job, struct job_interface *dest)
 Plug a job control interface into a new destination interface.
static void job_plug_plug (struct job_interface *a, struct job_interface *b)
 Plug two job control interfaces together.
static void job_unplug (struct job_interface *job)
 Unplug a job control interface.
static void job_nullify (struct job_interface *job)
 Stop using a job control interface.

Variables

struct job_interface null_job
 Null job control interface.
struct job_interface_operations null_job_ops
 Null job control interface operations.


Detailed Description

Job control interfaces.

Definition in file job.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

void job_done ( struct job_interface job,
int  rc 
)

Definition at line 31 of file job.c.

References dest, job_interface_operations::done, job_unplug(), and job_interface::op.

Referenced by dhcp_finished(), downloader_finished(), and monojob_wait().

00031                                                     {
00032         struct job_interface *dest = job_get_dest ( job );
00033 
00034         job_unplug ( job );
00035         dest->op->done ( dest, rc );
00036         job_put ( dest );
00037 }

void job_kill ( struct job_interface job  ) 

Definition at line 39 of file job.c.

References dest, job_unplug(), job_interface_operations::kill, and job_interface::op.

Referenced by monojob_wait().

00039                                             {
00040         struct job_interface *dest = job_get_dest ( job );
00041 
00042         job_unplug ( job );
00043         dest->op->kill ( dest );
00044         job_put ( dest );
00045 }

void job_progress ( struct job_interface job,
struct job_progress progress 
)

Definition at line 47 of file job.c.

References dest, job_interface::op, and job_interface_operations::progress.

00048                                                     {
00049         struct job_interface *dest = job_get_dest ( job );
00050 
00051         dest->op->progress ( dest, progress );
00052         job_put ( dest );
00053 }

void ignore_job_done ( struct job_interface job,
int  rc 
)

void ignore_job_kill ( struct job_interface job  ) 

void ignore_job_progress ( struct job_interface job,
struct job_progress progress 
)

static void job_init ( struct job_interface job,
struct job_interface_operations op,
struct refcnt refcnt 
) [inline, static]

Initialise a job control interface.

Parameters:
job Job control interface
op Job control interface operations
refcnt Containing object reference counter, or NULL

Definition at line 86 of file job.h.

References interface::dest, job_interface::intf, null_job, job_interface::op, and interface::refcnt.

Referenced by create_downloader(), start_dhcp(), and start_pxebs().

00088                                                       {
00089         job->intf.dest = &null_job.intf;
00090         job->intf.refcnt = refcnt;
00091         job->op = op;
00092 }

static __attribute__ ( (always_inline)   )  [inline, static]

Get job control interface from generic object communication interface.

Drop reference to job control interface.

Get reference to destination job control interface.

Parameters:
intf Generic object communication interface
Return values:
job Job control interface
Parameters:
job Job control interface
Return values:
dest Destination interface
Parameters:
job Job control interface

Definition at line 100 of file job.h.

References container_of.

00101                                        {
00102         return container_of ( intf, struct job_interface, intf );
00103 }

static void job_plug ( struct job_interface job,
struct job_interface dest 
) [inline, static]

Plug a job control interface into a new destination interface.

Parameters:
job Job control interface
dest New destination interface

Definition at line 132 of file job.h.

References job_interface::intf, and plug().

00133                                                             {
00134         plug ( &job->intf, &dest->intf );
00135 }

static void job_plug_plug ( struct job_interface a,
struct job_interface b 
) [inline, static]

Plug two job control interfaces together.

Parameters:
a Job control interface A
b Job control interface B

Definition at line 143 of file job.h.

References job_interface::intf, and plug_plug().

Referenced by create_downloader(), start_dhcp(), and start_pxebs().

00144                                                               {
00145         plug_plug ( &a->intf, &b->intf );
00146 }

static void job_unplug ( struct job_interface job  )  [inline, static]

Unplug a job control interface.

Parameters:
job Job control interface

Definition at line 153 of file job.h.

References job_interface::intf, null_job, and plug().

Referenced by job_done(), and job_kill().

00153                                                             {
00154         plug ( &job->intf, &null_job.intf );
00155 }

static void job_nullify ( struct job_interface job  )  [inline, static]

Stop using a job control interface.

Parameters:
job Job control interface
After calling this method, no further messages will be received via the interface.

Definition at line 165 of file job.h.

References null_job_ops, and job_interface::op.

Referenced by dhcp_finished(), and downloader_finished().

00165                                                              {
00166         job->op = &null_job_ops;
00167 };


Variable Documentation

Null job control interface.

This is the interface to which job control interfaces are connected when unplugged. It will never generate messages, and will silently absorb all received messages.

Definition at line 91 of file job.c.

Referenced by job_init(), and job_unplug().

Null job control interface operations.

Definition at line 78 of file job.c.

Referenced by job_nullify().


Generated on Tue Apr 6 20:01:51 2010 for gPXE by  doxygen 1.5.7.1