From 6df2c6ab768a3898b9db01295520a64030af59bc Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 16 Aug 2019 21:20:05 +0100 Subject: [process] Add PROC_INIT() for initialising static processes Signed-off-by: Michael Brown --- src/include/ipxe/process.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/include/ipxe/process.h b/src/include/ipxe/process.h index 0d059f8a..d5e13aa0 100644 --- a/src/include/ipxe/process.h +++ b/src/include/ipxe/process.h @@ -122,6 +122,18 @@ extern void process_add ( struct process *process ); extern void process_del ( struct process *process ); extern void step ( void ); +/** + * Initialise a static process + * + * @v process Process + * @v desc Process descriptor + */ +#define PROC_INIT( _process, _desc ) { \ + .list = LIST_HEAD_INIT ( (_process).list ), \ + .desc = (_desc), \ + .refcnt = NULL, \ + } + /** * Initialise process without adding to process list * @@ -180,11 +192,7 @@ process_running ( struct process *process ) { */ #define PERMANENT_PROCESS( name, step ) \ static struct process_descriptor name ## _desc = PROC_DESC_PURE ( step ); \ -struct process name __permanent_process = { \ - .list = LIST_HEAD_INIT ( name.list ), \ - .desc = & name ## _desc, \ - .refcnt = NULL, \ -}; +struct process name __permanent_process = PROC_INIT ( name, & name ## _desc ); /** * Find debugging colourisation for a process -- cgit v1.2.3-55-g7522