1 /* VTreeFS - vtreefs.c - initialization and message loop */
5 static unsigned int inodes
;
6 static struct inode_stat
*root_stat
;
7 static index_t root_entries
;
8 static size_t buf_size
;
9 static size_t extra_size
;
12 * Initialize internal state. This is the only place where dynamic memory
13 * allocation takes place.
16 init_server(int __unused type
, sef_init_info_t
* __unused info
)
20 /* Initialize the virtual tree. */
21 if ((r
= init_inodes(inodes
, root_stat
, root_entries
)) != OK
)
22 panic("init_inodes failed: %d", r
);
24 /* Initialize extra data. */
25 if ((r
= init_extra(inodes
, extra_size
)) != OK
)
26 panic("init_extra failed: %d", r
);
28 /* Initialize the I/O buffer. */
29 if ((r
= init_buf(buf_size
)) != OK
)
30 panic("init_buf failed: %d", r
);
36 * We received a signal.
52 sef_local_startup(void)
54 sef_setcb_init_fresh(init_server
);
55 sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL
);
57 sef_setcb_signal_handler(got_signal
);
63 * We have received a message that is not a file system request from VFS.
64 * Call the message hook, if there is one.
67 fs_other(const message
* m_ptr
, int ipc_status
)
71 if (vtreefs_hooks
->message_hook
!= NULL
) {
73 * Not all of vtreefs's users play nice with the message, so
74 * make a copy to allow it to be modified.
78 vtreefs_hooks
->message_hook(&msg
, ipc_status
);
83 * This is the main routine of this service. It uses the main loop as provided
84 * by the fsdriver library. The routine returns once the file system has been
85 * unmounted and the process is signaled to exit.
88 run_vtreefs(struct fs_hooks
* hooks
, unsigned int nr_inodes
,
89 size_t inode_extra
, struct inode_stat
* istat
,
90 index_t nr_indexed_entries
, size_t bufsize
)
94 * Use global variables to work around the inability to pass parameters
95 * through SEF to the initialization function..
97 vtreefs_hooks
= hooks
;
99 extra_size
= inode_extra
;
101 root_entries
= nr_indexed_entries
;
106 fsdriver_task(&vtreefs_table
);