1 /*
2 * This file contains the main function for the server. It waits for a request
3 * and then send a response.
4 */
5
6 #include "inc.h"
7 #include <minix/optset.h>
8
9 static struct optset optset_table[] = {
10 { "norock", OPT_BOOL, &opt.norock, TRUE },
11 { NULL, 0, NULL, 0 }
12 };
13
sef_cb_init_fresh(int __unused type,sef_init_info_t * __unused info)14 static int sef_cb_init_fresh(int __unused type,
15 sef_init_info_t * __unused info)
16 {
17 /* Initialize the iso9660fs server. */
18 int i;
19
20 /* Defaults */
21 opt.norock = FALSE;
22
23 /* If we have been given an options string, parse options here. */
24 for (i = 1; i < env_argc - 1; i++)
25 if (!strcmp(env_argv[i], "-o"))
26 optset_parse(optset_table, env_argv[++i]);
27
28 setenv("TZ","",1); /* Used to calculate the time */
29
30 lmfs_buf_pool(NR_BUFS);
31
32 return OK;
33 }
34
sef_cb_signal_handler(int signo)35 static void sef_cb_signal_handler(int signo)
36 {
37 /* Only check for termination signal, ignore anything else. */
38 if (signo != SIGTERM) return;
39
40 fsdriver_terminate();
41 }
42
sef_local_startup(void)43 static void sef_local_startup(void)
44 {
45 /* Register init callbacks. */
46 sef_setcb_init_fresh(sef_cb_init_fresh);
47 sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
48
49 /* Register signal callbacks. */
50 sef_setcb_signal_handler(sef_cb_signal_handler);
51
52 /* Let SEF perform startup. */
53 sef_startup();
54 }
55
main(int argc,char * argv[])56 int main(int argc, char *argv[])
57 {
58 /* SEF local startup. */
59 env_setargs(argc, argv);
60 sef_local_startup();
61
62 fsdriver_task(&isofs_table);
63
64 return 0;
65 }
66