1 #ifndef _IPXE_PROCESS_H 2 #define _IPXE_PROCESS_H 44 void ( *
step ) (
void *object );
56 #define PROC_STEP( object_type, step ) \ 57 ( ( ( ( typeof ( step ) * ) NULL ) == \ 58 ( ( void ( * ) ( object_type *object ) ) NULL ) ) ? \ 59 ( void ( * ) ( void *object ) ) step : \ 60 ( void ( * ) ( void *object ) ) step ) 69 #define process_offset( object_type, name ) \ 70 ( ( ( ( typeof ( ( ( object_type * ) NULL )->name ) * ) NULL ) \ 71 == ( ( struct process * ) NULL ) ) \ 72 ? offsetof ( object_type, name ) \ 73 : offsetof ( object_type, name ) ) 83 #define PROC_DESC( object_type, process, _step ) { \ 85 .offset = process_offset ( object_type, process ), \ 86 .step = PROC_STEP ( object_type, _step ), \ 98 #define PROC_DESC_ONCE( object_type, process, _step ) { \ 100 .offset = process_offset ( object_type, process ), \ 101 .step = PROC_STEP ( object_type, _step ), \ 113 #define PROC_DESC_PURE( _step ) { \ 116 .step = PROC_STEP ( struct process, _step ), \ 124 extern void step (
void );
132 #define PROC_INIT( _process, _desc ) { \ 133 .list = LIST_HEAD_INIT ( (_process).list ), \ 181 #define PERMANENT_PROCESSES __table ( struct process, "processes" ) 189 #define __permanent_process __table_entry ( PERMANENT_PROCESSES, 01 ) 194 #define PERMANENT_PROCESS( name, step ) \ 195 static struct process_descriptor name ## _desc = PROC_DESC_PURE ( step ); \ 196 struct process name __permanent_process = PROC_INIT ( name, & name ## _desc ); 206 #define PROC_COL( process ) process_object ( process ) 209 #define PROC_FMT "%p %s()" 217 #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.
struct ena_llq_option desc
Descriptor counts.
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.