1 #define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
2 #define _MINIX 1 /* tell headers to include MINIX stuff */
3 #define _SYSTEM 1 /* tell headers that this is the kernel */
5 #include <minix/config.h>
14 #include <minix/callnr.h>
15 #include <minix/type.h>
16 #include <minix/const.h>
17 #include <minix/com.h>
18 #include <minix/syslib.h>
19 #include <minix/sysutil.h>
20 #include <minix/vfsif.h>
21 #include <minix/endpoint.h>
22 #include <minix/sysinfo.h>
23 #include <minix/u64.h>
24 #include <minix/sysinfo.h>
25 #include <minix/type.h>
26 #include <minix/ipc.h>
29 #include <sys/times.h>
30 #include <sys/types.h>
34 #include <minix/vtreefs.h>
38 static void init_hook(void) {
42 devman_init_devices();
48 static int message_hook (message
*m
)
52 return do_add_device(m
);
54 return do_del_device(m
);
56 return do_bind_device(m
);
58 return do_unbind_device(m
);
65 (struct inode
*inode
, off_t offset
, char **ptr
, size_t *len
, cbdata_t cbdata
)
67 struct devman_inode
*d_inode
= (struct devman_inode
*) cbdata
;
69 return d_inode
->read_fn(ptr
, len
, offset
, d_inode
->data
);
73 int main (int argc
, char* argv
[])
76 struct fs_hooks hooks
;
77 struct inode_stat root_stat
;
79 /* fill in the hooks */
80 memset(&hooks
, 0, sizeof(hooks
));
81 hooks
.init_hook
= init_hook
;
82 hooks
.read_hook
= read_hook
; /* read will never be called */
83 hooks
.message_hook
= message_hook
; /* handle the ds_update call */
85 root_stat
.mode
= S_IFDIR
| S_IRUSR
| S_IRGRP
| S_IROTH
;
89 root_stat
.dev
= NO_DEV
;
91 /* limit the number of indexed entries */
92 start_vtreefs(&hooks
, 1024 , &root_stat
, 0);