Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / fs / ext2 / main.c
blobb6acfae66dd3bcfdafdfb80212b1e82e6eaea8d0
1 #include "fs.h"
2 #include "buf.h"
3 #include "inode.h"
4 #include <string.h>
5 #include <minix/optset.h>
7 /* SEF functions and variables. */
8 static void sef_local_startup(void);
9 static int sef_cb_init_fresh(int type, sef_init_info_t *info);
10 static void sef_cb_signal_handler(int signo);
12 EXTERN int env_argc;
13 EXTERN char **env_argv;
15 static struct optset optset_table[] = {
16 { "sb", OPT_INT, &opt.block_with_super, 0 },
17 { "orlov", OPT_BOOL, &opt.use_orlov, TRUE },
18 { "oldalloc", OPT_BOOL, &opt.use_orlov, FALSE },
19 { "mfsalloc", OPT_BOOL, &opt.mfsalloc, TRUE },
20 { "reserved", OPT_BOOL, &opt.use_reserved_blocks, TRUE },
21 { "prealloc", OPT_BOOL, &opt.use_prealloc, TRUE },
22 { "noprealloc", OPT_BOOL, &opt.use_prealloc, FALSE },
23 { NULL, 0, NULL, 0 }
26 /*===========================================================================*
27 * main *
28 *===========================================================================*/
29 int main(int argc, char *argv[])
31 /* This is the main routine of this service. */
32 unsigned short test_endian = 1;
34 /* SEF local startup. */
35 env_setargs(argc, argv);
36 sef_local_startup();
38 le_CPU = (*(unsigned char *) &test_endian == 0 ? 0 : 1);
40 /* Server isn't tested on big endian CPU */
41 ASSERT(le_CPU == 1);
43 /* The fsdriver library does the actual work here. */
44 fsdriver_task(&ext2_table);
46 return 0;
49 /*===========================================================================*
50 * sef_local_startup *
51 *===========================================================================*/
52 static void sef_local_startup()
54 /* Register init callbacks. */
55 sef_setcb_init_fresh(sef_cb_init_fresh);
57 /* Register signal callbacks. */
58 sef_setcb_signal_handler(sef_cb_signal_handler);
60 /* Let SEF perform startup. */
61 sef_startup();
64 /*===========================================================================*
65 * sef_cb_init_fresh *
66 *===========================================================================*/
67 static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
69 /* Initialize the Minix file server. */
70 int i;
72 /* Defaults */
73 opt.use_orlov = TRUE;
74 opt.mfsalloc = FALSE;
75 opt.use_reserved_blocks = FALSE;
76 opt.block_with_super = 0;
77 opt.use_prealloc = FALSE;
79 /* If we have been given an options string, parse options from there. */
80 for (i = 1; i < env_argc - 1; i++)
81 if (!strcmp(env_argv[i], "-o"))
82 optset_parse(optset_table, env_argv[++i]);
84 lmfs_may_use_vmcache(1);
86 /* Init inode table */
87 for (i = 0; i < NR_INODES; ++i) {
88 inode[i].i_count = 0;
89 cch[i] = 0;
92 init_inode_cache();
94 /* just a small number before we find out the block size at mount time */
95 lmfs_buf_pool(10);
97 return(OK);
100 /*===========================================================================*
101 * sef_cb_signal_handler *
102 *===========================================================================*/
103 static void sef_cb_signal_handler(int signo)
105 /* Only check for termination signal, ignore anything else. */
106 if (signo != SIGTERM) return;
108 fs_sync();
110 fsdriver_terminate();