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
);
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
},
26 /*===========================================================================*
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
);
38 le_CPU
= (*(unsigned char *) &test_endian
== 0 ? 0 : 1);
40 /* Server isn't tested on big endian CPU */
43 /* The fsdriver library does the actual work here. */
44 fsdriver_task(&ext2_table
);
49 /*===========================================================================*
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. */
64 /*===========================================================================*
66 *===========================================================================*/
67 static int sef_cb_init_fresh(int UNUSED(type
), sef_init_info_t
*UNUSED(info
))
69 /* Initialize the Minix file server. */
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
) {
94 /* just a small number before we find out the block size at mount time */
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;
110 fsdriver_terminate();