Skip to content

Commit a1ca20b

Browse files
pcercueiQuzarDC
authored andcommitted
fs: Use init flags for fs_init / fs_shutdown
These will be called if any of the FS flags have been set, which retains the previous behaviour. However, in the case where none of the VFS drivers have been enabled, the fs_init / fs_shutdown now will be garbage-collected. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
1 parent d74e77a commit a1ca20b

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

include/kos/init.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ __BEGIN_DECLS
5454
KOS_INIT_FLAG(flags, INIT_NET, net_shutdown); \
5555
KOS_INIT_FLAG(flags, INIT_NET, eth_init); \
5656
KOS_INIT_FLAG(flags, INIT_NET, eth_shutdown); \
57+
KOS_INIT_FLAG(flags, INIT_FS_ALL, fs_init); \
58+
KOS_INIT_FLAG(flags, INIT_FS_ALL, fs_shutdown); \
5759
KOS_INIT_FLAG(flags, INIT_FS_ROMDISK, fs_romdisk_init); \
5860
KOS_INIT_FLAG(flags, INIT_FS_ROMDISK, fs_romdisk_shutdown); \
5961
KOS_INIT_FLAG(flags, INIT_FS_NULL, fs_null_init); \

kernel/arch/dreamcast/kernel/init.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ KOS_INIT_FLAG_WEAK(dcload_init, true);
132132
KOS_INIT_FLAG_WEAK(fs_dcload_init_console, true);
133133
KOS_INIT_FLAG_WEAK(fs_dcload_shutdown, true);
134134
KOS_INIT_FLAG_WEAK(fs_dclsocket_shutdown, true);
135+
KOS_INIT_FLAG_WEAK(fs_init, true);
135136
KOS_INIT_FLAG_WEAK(fs_dev_init, true);
136137
KOS_INIT_FLAG_WEAK(fs_dev_shutdown, true);
138+
KOS_INIT_FLAG_WEAK(fs_shutdown, true);
137139
KOS_INIT_FLAG_WEAK(fs_null_init, true);
138140
KOS_INIT_FLAG_WEAK(fs_null_shutdown, true);
139141
KOS_INIT_FLAG_WEAK(fs_pty_init, true);
@@ -198,9 +200,7 @@ int __weak_symbol arch_auto_init(void) {
198200

199201
nmmgr_init();
200202

201-
if(__kos_init_flags & INIT_FS_ALL)
202-
fs_init(); /* VFS */
203-
203+
KOS_INIT_FLAG_CALL(fs_init); /* VFS */
204204
KOS_INIT_FLAG_CALL(fs_dev_init); /* /dev */
205205
KOS_INIT_FLAG_CALL(fs_null_init); /* /dev/null */
206206
KOS_INIT_FLAG_CALL(fs_pty_init); /* Pty */
@@ -267,8 +267,7 @@ void __weak_symbol arch_auto_shutdown(void) {
267267

268268
/* As a workaround, shut down the base FS before fs_pty
269269
to avoid triggering bugs. */
270-
if(__kos_init_flags & INIT_FS_ALL)
271-
fs_shutdown();
270+
KOS_INIT_FLAG_CALL(fs_shutdown);
272271

273272
KOS_INIT_FLAG_CALL(fs_pty_shutdown);
274273

0 commit comments

Comments
 (0)