Procházet zdrojové kódy

Merge branch 'master' of /pub/scm/gpxe

tags/v0.9.3
Marty Connor před 17 roky
rodič
revize
6be8cdbb6f

+ 4
- 1
src/core/main.c Zobrazit soubor

@@ -16,6 +16,7 @@ Literature dealing with the network protocols:
16 16
 
17 17
 #include <gpxe/heap.h>
18 18
 #include <gpxe/init.h>
19
+#include <gpxe/process.h>
19 20
 #include <gpxe/device.h>
20 21
 #include <gpxe/shell.h>
21 22
 #include <gpxe/shell_banner.h>
@@ -29,8 +30,10 @@ Literature dealing with the network protocols:
29 30
  * Call this function only once, before doing (almost) anything else.
30 31
  */
31 32
 static void startup ( void ) {
32
-	hide_etherboot();
33 33
 	init_heap();
34
+	init_processes();
35
+
36
+	hide_etherboot();
34 37
 	call_init_fns();
35 38
 	probe_devices();
36 39
 }

+ 18
- 0
src/core/process.c Zobrazit soubor

@@ -30,6 +30,12 @@
30 30
 /** Process run queue */
31 31
 static LIST_HEAD ( run_queue );
32 32
 
33
+/** Registered permanent processes */
34
+static struct process processes[0]
35
+	__table_start ( struct process, processes );
36
+static struct process processes_end[0]
37
+	__table_end ( struct process, processes );
38
+
33 39
 /**
34 40
  * Add process to process list
35 41
  *
@@ -72,3 +78,15 @@ void step ( void ) {
72 78
 		break;
73 79
 	}
74 80
 }
81
+
82
+/**
83
+ * Initialise processes
84
+ *
85
+ */
86
+void init_processes ( void ) {
87
+	struct process *process;
88
+
89
+	for ( process = processes ; process < processes_end ; process++ ) {
90
+		process_add ( process );
91
+	}
92
+}

+ 0
- 1
src/include/gpxe/init.h Zobrazit soubor

@@ -42,7 +42,6 @@ struct init_fn {
42 42
 #define	INIT_LOADBUF	08
43 43
 #define	INIT_PCMCIA	09
44 44
 #define	INIT_RPC	11
45
-#define INIT_PROCESS	12
46 45
 
47 46
 /* Macro for creating an initialisation function table entry */
48 47
 #define INIT_FN( init_order, init_func, reset_func, exit_func )	\

+ 11
- 0
src/include/gpxe/process.h Zobrazit soubor

@@ -9,6 +9,7 @@
9 9
 
10 10
 #include <gpxe/list.h>
11 11
 #include <gpxe/refcnt.h>
12
+#include <gpxe/tables.h>
12 13
 
13 14
 /** A process */
14 15
 struct process {
@@ -33,6 +34,7 @@ struct process {
33 34
 extern void process_add ( struct process *process );
34 35
 extern void process_del ( struct process *process );
35 36
 extern void step ( void );
37
+extern void init_processes ( void );
36 38
 
37 39
 /**
38 40
  * Initialise process without adding to process list
@@ -62,4 +64,13 @@ process_init ( struct process *process,
62 64
 	process_add ( process );
63 65
 }
64 66
 
67
+/**
68
+ * Declare a permanent process
69
+ *
70
+ * Permanent processes will be automatically added to the process list
71
+ * at initialisation time.
72
+ */
73
+#define __permanent_process \
74
+	__table ( struct process, processes, 01 )
75
+
65 76
 #endif /* _GPXE_PROCESS_H */

+ 1
- 8
src/net/netdevice.c Zobrazit soubor

@@ -448,13 +448,6 @@ static void net_step ( struct process *process __unused ) {
448 448
 }
449 449
 
450 450
 /** Networking stack process */
451
-static struct process net_process = {
451
+struct process net_process __permanent_process = {
452 452
 	.step = net_step,
453 453
 };
454
-
455
-/** Initialise the networking stack process */
456
-static void init_net ( void ) {
457
-	process_add ( &net_process );
458
-}
459
-
460
-INIT_FN ( INIT_PROCESS, init_net, NULL, NULL );

+ 1
- 8
src/net/retry.c Zobrazit soubor

@@ -167,13 +167,6 @@ static void retry_step ( struct process *process __unused ) {
167 167
 }
168 168
 
169 169
 /** Retry timer process */
170
-static struct process retry_process = {
170
+struct process retry_process __permanent_process = {
171 171
 	.step = retry_step,
172 172
 };
173
-
174
-/** Initialise the retry timer module */
175
-static void init_retry ( void ) {
176
-	process_add ( &retry_process );
177
-}
178
-
179
-INIT_FN ( INIT_PROCESS, init_retry, NULL, NULL );

Načítá se…
Zrušit
Uložit