process.h File Reference

Processes. More...

#include <gpxe/list.h>
#include <gpxe/refcnt.h>
#include <gpxe/tables.h>

Go to the source code of this file.

Data Structures

struct  process
 A process. More...

Defines

#define PERMANENT_PROCESSES   __table ( struct process, "processes" )
 Permanent process table.
#define __permanent_process   __table_entry ( PERMANENT_PROCESSES, 01 )
 Declare a permanent process.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void process_add (struct process *process)
 Add process to process list.
void process_del (struct process *process)
 Remove process from process list.
void step (void)
 Single-step a single process.
static void process_init_stopped (struct process *process, void(*step)(struct process *process), struct refcnt *refcnt)
 Initialise process without adding to process list.
static void process_init (struct process *process, void(*step)(struct process *process), struct refcnt *refcnt)
 Initialise process and add to process list.


Detailed Description

Processes.

Definition in file process.h.


Define Documentation

#define PERMANENT_PROCESSES   __table ( struct process, "processes" )

Permanent process table.

Definition at line 70 of file process.h.

Referenced by init_processes().

#define __permanent_process   __table_entry ( PERMANENT_PROCESSES, 01 )

Declare a permanent process.

Permanent processes will be automatically added to the process list at initialisation time.

Definition at line 78 of file process.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

void process_add ( struct process process  ) 

Add process to process list.

Parameters:
process Process
It is safe to call process_add() multiple times; further calls will have no effect.

Definition at line 44 of file process.c.

References DBGC, process::list, list_add_tail, list_empty(), ref_get(), and process::refcnt.

Referenced by ib_cmrc_close(), init_processes(), net80211_autoassociate(), and process_init().

00044                                              {
00045         if ( list_empty ( &process->list ) ) {
00046                 DBGC ( process, "PROCESS %p starting\n", process );
00047                 ref_get ( process->refcnt );
00048                 list_add_tail ( &process->list, &run_queue );
00049         } else {
00050                 DBGC ( process, "PROCESS %p already started\n", process );
00051         }
00052 }

void process_del ( struct process process  ) 

Remove process from process list.

Parameters:
process Process
It is safe to call process_del() multiple times; further calls will have no effect.

Definition at line 62 of file process.c.

References DBGC, INIT_LIST_HEAD, process::list, list_del, list_empty(), ref_put(), and process::refcnt.

Referenced by http_done(), http_step(), hw_finished(), ib_cmrc_shutdown(), iscsi_detach(), net80211_netdev_close(), net80211_step_associate(), numeric_step(), and tls_close().

00062                                              {
00063         if ( ! list_empty ( &process->list ) ) {
00064                 DBGC ( process, "PROCESS %p stopping\n", process );
00065                 list_del ( &process->list );
00066                 INIT_LIST_HEAD ( &process->list );
00067                 ref_put ( process->refcnt );
00068         } else {
00069                 DBGC ( process, "PROCESS %p already stopped\n", process );
00070         }
00071 }

void step ( void   ) 

Single-step a single process.

This executes a single step of the first process in the run queue, and moves the process to the end of the run queue.

Definition at line 79 of file process.c.

References DBGC2, process::list, list_add_tail, list_del, list_for_each_entry, and process::step.

Referenced by aoe_discover(), ata_command(), ath5k_hw_rf_check_gainf_readback(), ath5k_hw_rf_gainf_corr(), comboot_resolv(), getchar(), getchar_timeout(), iflinkwait(), int22(), iwlist(), md5_transform(), monojob_wait(), open(), process_init(), process_init_stopped(), pxe_menu_select(), pxenv_tftp_get_fsize(), pxenv_tftp_open(), pxenv_tftp_read(), pxenv_tftp_read_file(), pxenv_udp_read(), read_user(), scsi_command(), select(), and spi_bit_transfer().

00079                    {
00080         struct process *process;
00081 
00082         list_for_each_entry ( process, &run_queue, list ) {
00083                 list_del ( &process->list );
00084                 list_add_tail ( &process->list, &run_queue );
00085                 DBGC2 ( process, "PROCESS %p executing\n", process );
00086                 process->step ( process );
00087                 DBGC2 ( process, "PROCESS %p finished executing\n", process );
00088                 break;
00089         }
00090 }

static void process_init_stopped ( struct process process,
void(*)(struct process *process step,
struct refcnt refcnt 
) [inline, static]

Initialise process without adding to process list.

Parameters:
process Process
step Process' step() method

Definition at line 47 of file process.h.

References INIT_LIST_HEAD, and step().

Referenced by ib_cmrc_open(), net80211_alloc(), and process_init().

00049                                                {
00050         INIT_LIST_HEAD ( &process->list );
00051         process->step = step;
00052         process->refcnt = refcnt;
00053 }

static void process_init ( struct process process,
void(*)(struct process *process step,
struct refcnt refcnt 
) [inline, static]

Initialise process and add to process list.

Parameters:
process Process
step Process' step() method

Definition at line 62 of file process.h.

References process_add(), process_init_stopped(), and step().

Referenced by add_tls(), http_open_filter(), hw_open(), iscsi_attach(), and numeric_resolv().

00064                                        {
00065         process_init_stopped ( process, step, refcnt );
00066         process_add ( process );
00067 }


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