diff options
author | Michael Brown <mcb30@ipxe.org> | 2019-08-16 21:20:05 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2019-08-16 22:19:48 +0100 |
commit | 6df2c6ab768a3898b9db01295520a64030af59bc (patch) | |
tree | f3988c0a83ee00ebe4ce72f61d1f8aecc4ef204e | |
parent | c63ef427a2b18d318b313a4adf6267bb4dfa0c1c (diff) | |
download | ipxe-6df2c6ab768a3898b9db01295520a64030af59bc.tar.gz |
[process] Add PROC_INIT() for initialising static processes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/include/ipxe/process.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/include/ipxe/process.h b/src/include/ipxe/process.h index 0d059f8a1..d5e13aa04 100644 --- a/src/include/ipxe/process.h +++ b/src/include/ipxe/process.h @@ -123,6 +123,18 @@ 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 * * @v process Process @@ -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 |