2010-01-26 00:18:02 +01:00
|
|
|
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
|
|
|
|
|
|
|
|
#include "inc.h"
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* hgfs_mkdir *
|
|
|
|
*===========================================================================*/
|
2014-02-24 14:00:17 +01:00
|
|
|
int hgfs_mkdir(char *path, int mode)
|
2010-01-26 00:18:02 +01:00
|
|
|
{
|
|
|
|
/* Create a new directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
RPC_REQUEST(HGFS_REQ_MKDIR);
|
|
|
|
RPC_NEXT8 = HGFS_MODE_TO_PERM(mode);
|
|
|
|
|
|
|
|
path_put(path);
|
|
|
|
|
|
|
|
return rpc_query();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* hgfs_unlink *
|
|
|
|
*===========================================================================*/
|
2014-02-24 14:00:17 +01:00
|
|
|
int hgfs_unlink(char *path)
|
2010-01-26 00:18:02 +01:00
|
|
|
{
|
|
|
|
/* Delete a file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
RPC_REQUEST(HGFS_REQ_UNLINK);
|
|
|
|
|
|
|
|
path_put(path);
|
|
|
|
|
|
|
|
return rpc_query();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* hgfs_rmdir *
|
|
|
|
*===========================================================================*/
|
2014-02-24 14:00:17 +01:00
|
|
|
int hgfs_rmdir(char *path)
|
2010-01-26 00:18:02 +01:00
|
|
|
{
|
|
|
|
/* Remove an empty directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
RPC_REQUEST(HGFS_REQ_RMDIR);
|
|
|
|
|
|
|
|
path_put(path);
|
|
|
|
|
|
|
|
return rpc_query();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* hgfs_rename *
|
|
|
|
*===========================================================================*/
|
2014-02-24 14:00:17 +01:00
|
|
|
int hgfs_rename(char *opath, char *npath)
|
2010-01-26 00:18:02 +01:00
|
|
|
{
|
|
|
|
/* Rename a file or directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
RPC_REQUEST(HGFS_REQ_RENAME);
|
|
|
|
|
|
|
|
path_put(opath);
|
|
|
|
path_put(npath);
|
|
|
|
|
|
|
|
return rpc_query();
|
|
|
|
}
|