Remove building with NOCRYPTO option
[minix.git] / minix / servers / devman / main.c
blob74a427cf53abd1f3fd311d68a12d50b37479f1e7
1 #define _SYSTEM 1 /* tell headers that this is the kernel */
3 #include <minix/config.h>
4 #include <errno.h>
5 #include <unistd.h>
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <string.h>
9 #include <lib.h>
10 #include <minix/timers.h>
12 #include <minix/callnr.h>
13 #include <minix/type.h>
14 #include <minix/const.h>
15 #include <minix/com.h>
16 #include <minix/syslib.h>
17 #include <minix/sysutil.h>
18 #include <minix/vfsif.h>
19 #include <minix/endpoint.h>
20 #include <minix/sysinfo.h>
21 #include <minix/u64.h>
22 #include <minix/sysinfo.h>
23 #include <minix/type.h>
24 #include <minix/ipc.h>
26 #include <sys/time.h>
27 #include <sys/times.h>
28 #include <sys/types.h>
29 #include <sys/stat.h>
32 #include <minix/vtreefs.h>
33 #include "devman.h"
34 #include "proto.h"
36 static void init_hook(void) {
37 static int first = 1;
39 if (first) {
40 devman_init_devices();
41 first = 0;
46 static void message_hook(message *m, int __unused ipc_status)
48 switch (m->m_type) {
49 case DEVMAN_ADD_DEV:
50 do_add_device(m);
51 case DEVMAN_DEL_DEV:
52 do_del_device(m);
53 case DEVMAN_BIND:
54 do_bind_device(m);
55 case DEVMAN_UNBIND:
56 do_unbind_device(m);
60 static ssize_t
61 read_hook
62 (struct inode *inode, char *ptr, size_t len, off_t offset, cbdata_t cbdata)
64 struct devman_inode *d_inode = (struct devman_inode *) cbdata;
66 return d_inode->read_fn(ptr, len, offset, d_inode->data);
70 int main (int argc, char* argv[])
73 static struct fs_hooks hooks;
74 static struct inode_stat root_stat;
76 /* fill in the hooks */
77 memset(&hooks, 0, sizeof(hooks));
78 hooks.init_hook = init_hook;
79 hooks.read_hook = read_hook;
80 hooks.message_hook = message_hook; /* handle the ds_update call */
82 root_stat.mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
83 root_stat.uid = 0;
84 root_stat.gid = 0;
85 root_stat.size = 0;
86 root_stat.dev = NO_DEV;
88 /* run VTreeFS */
89 run_vtreefs(&hooks, 1024, 0, &root_stat, 0, BUF_SIZE);
91 return 0;