소스 검색

[process] Add PROC_INIT() for initialising static processes

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 5 년 전
부모
커밋
6df2c6ab76
1개의 변경된 파일13개의 추가작업 그리고 5개의 파일을 삭제
  1. 13
    5
      src/include/ipxe/process.h

+ 13
- 5
src/include/ipxe/process.h 파일 보기

122
 extern void process_del ( struct process *process );
122
 extern void process_del ( struct process *process );
123
 extern void step ( void );
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
  * Initialise process without adding to process list
138
  * Initialise process without adding to process list
127
  *
139
  *
180
  */
192
  */
181
 #define PERMANENT_PROCESS( name, step )					      \
193
 #define PERMANENT_PROCESS( name, step )					      \
182
 static struct process_descriptor name ## _desc = PROC_DESC_PURE ( step );     \
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
  * Find debugging colourisation for a process
198
  * Find debugging colourisation for a process

Loading…
취소
저장