xref: /minix3/minix/lib/libhgfs/link.c (revision 94e65446c4f963450ea94b8becc02cec062675cd)
1433d6423SLionel Sambuc /* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
2433d6423SLionel Sambuc 
3433d6423SLionel Sambuc #include "inc.h"
4433d6423SLionel Sambuc 
5433d6423SLionel Sambuc #include <sys/stat.h>
6433d6423SLionel Sambuc 
7433d6423SLionel Sambuc /*===========================================================================*
8433d6423SLionel Sambuc  *				hgfs_mkdir				     *
9433d6423SLionel Sambuc  *===========================================================================*/
hgfs_mkdir(const char * path,int mode)10*94e65446SDavid van Moolenbroek int hgfs_mkdir(const char *path, int mode)
11433d6423SLionel Sambuc {
12433d6423SLionel Sambuc /* Create a new directory.
13433d6423SLionel Sambuc  */
14433d6423SLionel Sambuc 
15433d6423SLionel Sambuc   RPC_REQUEST(HGFS_REQ_MKDIR);
16433d6423SLionel Sambuc   RPC_NEXT8 = HGFS_MODE_TO_PERM(mode);
17433d6423SLionel Sambuc 
18433d6423SLionel Sambuc   path_put(path);
19433d6423SLionel Sambuc 
20433d6423SLionel Sambuc   return rpc_query();
21433d6423SLionel Sambuc }
22433d6423SLionel Sambuc 
23433d6423SLionel Sambuc /*===========================================================================*
24433d6423SLionel Sambuc  *				hgfs_unlink				     *
25433d6423SLionel Sambuc  *===========================================================================*/
hgfs_unlink(const char * path)26*94e65446SDavid van Moolenbroek int hgfs_unlink(const char *path)
27433d6423SLionel Sambuc {
28433d6423SLionel Sambuc /* Delete a file.
29433d6423SLionel Sambuc  */
30433d6423SLionel Sambuc 
31433d6423SLionel Sambuc   RPC_REQUEST(HGFS_REQ_UNLINK);
32433d6423SLionel Sambuc 
33433d6423SLionel Sambuc   path_put(path);
34433d6423SLionel Sambuc 
35433d6423SLionel Sambuc   return rpc_query();
36433d6423SLionel Sambuc }
37433d6423SLionel Sambuc 
38433d6423SLionel Sambuc /*===========================================================================*
39433d6423SLionel Sambuc  *				hgfs_rmdir				     *
40433d6423SLionel Sambuc  *===========================================================================*/
hgfs_rmdir(const char * path)41*94e65446SDavid van Moolenbroek int hgfs_rmdir(const char *path)
42433d6423SLionel Sambuc {
43433d6423SLionel Sambuc /* Remove an empty directory.
44433d6423SLionel Sambuc  */
45433d6423SLionel Sambuc 
46433d6423SLionel Sambuc   RPC_REQUEST(HGFS_REQ_RMDIR);
47433d6423SLionel Sambuc 
48433d6423SLionel Sambuc   path_put(path);
49433d6423SLionel Sambuc 
50433d6423SLionel Sambuc   return rpc_query();
51433d6423SLionel Sambuc }
52433d6423SLionel Sambuc 
53433d6423SLionel Sambuc /*===========================================================================*
54433d6423SLionel Sambuc  *				hgfs_rename				     *
55433d6423SLionel Sambuc  *===========================================================================*/
hgfs_rename(const char * opath,const char * npath)56*94e65446SDavid van Moolenbroek int hgfs_rename(const char *opath, const char *npath)
57433d6423SLionel Sambuc {
58433d6423SLionel Sambuc /* Rename a file or directory.
59433d6423SLionel Sambuc  */
60433d6423SLionel Sambuc 
61433d6423SLionel Sambuc   RPC_REQUEST(HGFS_REQ_RENAME);
62433d6423SLionel Sambuc 
63433d6423SLionel Sambuc   path_put(opath);
64433d6423SLionel Sambuc   path_put(npath);
65433d6423SLionel Sambuc 
66433d6423SLionel Sambuc   return rpc_query();
67433d6423SLionel Sambuc }
68