summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2019-08-16 22:20:05 +0200
committerMichael Brown2019-08-16 23:19:48 +0200
commit6df2c6ab768a3898b9db01295520a64030af59bc (patch)
treef3988c0a83ee00ebe4ce72f61d1f8aecc4ef204e
parent[build] Add predefined shortcut for Raspberry Pi builds (diff)
downloadipxe-6df2c6ab768a3898b9db01295520a64030af59bc.tar.gz
ipxe-6df2c6ab768a3898b9db01295520a64030af59bc.tar.xz
ipxe-6df2c6ab768a3898b9db01295520a64030af59bc.zip
[process] Add PROC_INIT() for initialising static processes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/include/ipxe/process.h18
1 files 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
@@ -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