1 #ifndef _IPXE_PROCESS_H 2 #define _IPXE_PROCESS_H 43 void ( *
step ) (
void *object );
55 #define PROC_STEP( object_type, step ) \ 56 ( ( ( ( typeof ( step ) * ) NULL ) == \ 57 ( ( void ( * ) ( object_type *object ) ) NULL ) ) ? \ 58 ( void ( * ) ( void *object ) ) step : \ 59 ( void ( * ) ( void *object ) ) step ) 68 #define process_offset( object_type, name ) \ 69 ( ( ( ( typeof ( ( ( object_type * ) NULL )->name ) * ) NULL ) \ 70 == ( ( struct process * ) NULL ) ) \ 71 ? offsetof ( object_type, name ) \ 72 : offsetof ( object_type, name ) ) 82 #define PROC_DESC( object_type, process, _step ) { \ 84 .offset = process_offset ( object_type, process ), \ 85 .step = PROC_STEP ( object_type, _step ), \ 97 #define PROC_DESC_ONCE( object_type, process, _step ) { \ 99 .offset = process_offset ( object_type, process ), \ 100 .step = PROC_STEP ( object_type, _step ), \ 112 #define PROC_DESC_PURE( _step ) { \ 115 .step = PROC_STEP ( struct process, _step ), \ 123 extern void step (
void );
131 #define PROC_INIT( _process, _desc ) { \ 132 .list = LIST_HEAD_INIT ( (_process).list ), \ 180 #define PERMANENT_PROCESSES __table ( struct process, "processes" ) 188 #define __permanent_process __table_entry ( PERMANENT_PROCESSES, 01 ) 193 #define PERMANENT_PROCESS( name, step ) \ 194 static struct process_descriptor name ## _desc = PROC_DESC_PURE ( step ); \ 195 struct process name __permanent_process = PROC_INIT ( name, & name ## _desc ); 205 #define PROC_COL( process ) process_object ( process ) 208 #define PROC_FMT "%p %s()" 216 #define PROC_DBG( process ) process_object ( process ), (process)->desc->name
size_t offset
Offset of process within containing object.
static void process_init(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process and add to process list.
const char * name
Process name.
struct list_head list
List of processes.
static void(*) struct refcnt refcnt)
A doubly-linked list entry (or list head)
void process_del(struct process *process)
Remove process from process list.
#define list_empty(list)
Test whether a list is empty.
void * process_object(struct process *process)
Get pointer to object containing process.
void process_add(struct process *process)
Add process to process list.
static void process_init_stopped(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process without adding to process list.
static int process_running(struct process *process)
Check if process is running.
#define INIT_LIST_HEAD(list)
Initialise a list head.
void step(void)
Single-step a single process.
int reschedule
Automatically reschedule the process.
struct process_descriptor * desc
Process descriptor.
void(* step)(void *object)
Single-step the process.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct refcnt * refcnt
Reference counter.