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