Browse Source

[process] Add PROC_INIT() for initialising static processes

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 5 years ago
parent
commit
6df2c6ab76
1 changed files with 13 additions and 5 deletions
  1. 13
    5
      src/include/ipxe/process.h

+ 13
- 5
src/include/ipxe/process.h View File

@@ -122,6 +122,18 @@ extern void process_add ( struct process *process );
122 122
 extern void process_del ( struct process *process );
123 123
 extern void step ( void );
124 124
 
125
+/**
126
+ * Initialise a static process
127
+ *
128
+ * @v process		Process
129
+ * @v desc		Process descriptor
130
+ */
131
+#define PROC_INIT( _process, _desc ) {					      \
132
+		.list = LIST_HEAD_INIT ( (_process).list ),		      \
133
+		.desc = (_desc),					      \
134
+		.refcnt = NULL,						      \
135
+	}
136
+
125 137
 /**
126 138
  * Initialise process without adding to process list
127 139
  *
@@ -180,11 +192,7 @@ process_running ( struct process *process ) {
180 192
  */
181 193
 #define PERMANENT_PROCESS( name, step )					      \
182 194
 static struct process_descriptor name ## _desc = PROC_DESC_PURE ( step );     \
183
-struct process name __permanent_process = {				      \
184
-	.list = LIST_HEAD_INIT ( name.list ),				      \
185
-	.desc = & name ## _desc,					      \
186
-	.refcnt = NULL,							      \
187
-};
195
+struct process name __permanent_process = PROC_INIT ( name, & name ## _desc );
188 196
 
189 197
 /**
190 198
  * Find debugging colourisation for a process

Loading…
Cancel
Save