]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[process] Add PROC_INIT() for initialising static processes
authorMichael Brown <mcb30@ipxe.org>
Fri, 16 Aug 2019 20:20:05 +0000 (21:20 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 16 Aug 2019 21:19:48 +0000 (22:19 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/process.h

index 0d059f8a12f01d0dd9988df60738032ded05e84d..d5e13aa0473d42cbcd912c808c072464e880adc7 100644 (file)
@@ -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