xref: /minix/minix/lib/libhgfs/hgfs.c (revision 7f5f010b)
1 /* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
2 
3 #include "inc.h"
4 
5 struct sffs_table hgfs_table = {
6   .t_open	= hgfs_open,
7   .t_read	= hgfs_read,
8   .t_write	= hgfs_write,
9   .t_close	= hgfs_close,
10 
11   .t_readbuf	= hgfs_readbuf,
12   .t_writebuf	= hgfs_writebuf,
13 
14   .t_opendir	= hgfs_opendir,
15   .t_readdir	= hgfs_readdir,
16   .t_closedir	= hgfs_closedir,
17 
18   .t_getattr	= hgfs_getattr,
19   .t_setattr	= hgfs_setattr,
20 
21   .t_mkdir	= hgfs_mkdir,
22   .t_unlink	= hgfs_unlink,
23   .t_rmdir	= hgfs_rmdir,
24   .t_rename	= hgfs_rename,
25 
26   .t_queryvol	= hgfs_queryvol,
27 };
28 
29 /*===========================================================================*
30  *				hgfs_init				     *
31  *===========================================================================*/
32 int hgfs_init(const struct sffs_table **tablep)
33 {
34 /* Initialize the library. Return OK on success, or a negative error code
35  * otherwise. If EAGAIN is returned, shared folders are disabled.
36  */
37   int r;
38 
39   time_init();
40 
41   r = rpc_open();
42 
43   if (r == OK)
44 	*tablep = &hgfs_table;
45 
46   return r;
47 }
48 
49 /*===========================================================================*
50  *				hgfs_cleanup				     *
51  *===========================================================================*/
52 void hgfs_cleanup()
53 {
54 /* Clean up state.
55  */
56 
57   rpc_close();
58 }
59 
60