2010-01-26 00:18:02 +01:00
|
|
|
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
|
|
|
|
|
|
|
|
#include "inc.h"
|
|
|
|
|
2012-04-09 18:08:26 +02:00
|
|
|
struct sffs_table hgfs_table = {
|
|
|
|
.t_open = hgfs_open,
|
|
|
|
.t_read = hgfs_read,
|
|
|
|
.t_write = hgfs_write,
|
|
|
|
.t_close = hgfs_close,
|
|
|
|
|
|
|
|
.t_readbuf = hgfs_readbuf,
|
|
|
|
.t_writebuf = hgfs_writebuf,
|
|
|
|
|
|
|
|
.t_opendir = hgfs_opendir,
|
|
|
|
.t_readdir = hgfs_readdir,
|
|
|
|
.t_closedir = hgfs_closedir,
|
|
|
|
|
|
|
|
.t_getattr = hgfs_getattr,
|
|
|
|
.t_setattr = hgfs_setattr,
|
|
|
|
|
|
|
|
.t_mkdir = hgfs_mkdir,
|
|
|
|
.t_unlink = hgfs_unlink,
|
|
|
|
.t_rmdir = hgfs_rmdir,
|
|
|
|
.t_rename = hgfs_rename,
|
|
|
|
|
|
|
|
.t_queryvol = hgfs_queryvol,
|
|
|
|
};
|
|
|
|
|
2010-01-26 00:18:02 +01:00
|
|
|
/*===========================================================================*
|
|
|
|
* hgfs_init *
|
|
|
|
*===========================================================================*/
|
2012-04-09 18:08:26 +02:00
|
|
|
int hgfs_init(const struct sffs_table **tablep)
|
2010-01-26 00:18:02 +01:00
|
|
|
{
|
|
|
|
/* Initialize the library. Return OK on success, or a negative error code
|
2012-04-09 17:17:42 +02:00
|
|
|
* otherwise. If EAGAIN is returned, shared folders are disabled.
|
2010-01-26 00:18:02 +01:00
|
|
|
*/
|
2012-04-09 18:08:26 +02:00
|
|
|
int r;
|
2010-01-26 00:18:02 +01:00
|
|
|
|
|
|
|
time_init();
|
|
|
|
|
2012-04-09 18:08:26 +02:00
|
|
|
r = rpc_open();
|
|
|
|
|
|
|
|
if (r == OK)
|
|
|
|
*tablep = &hgfs_table;
|
|
|
|
|
|
|
|
return r;
|
2010-01-26 00:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* hgfs_cleanup *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
void hgfs_cleanup()
|
2010-01-26 00:18:02 +01:00
|
|
|
{
|
|
|
|
/* Clean up state.
|
|
|
|
*/
|
|
|
|
|
|
|
|
rpc_close();
|
|
|
|
}
|
2012-04-09 18:08:26 +02:00
|
|
|
|