xref: /minix/minix/lib/libhgfs/link.c (revision 9f988b79)
1 /* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
2 
3 #include "inc.h"
4 
5 #include <sys/stat.h>
6 
7 /*===========================================================================*
8  *				hgfs_mkdir				     *
9  *===========================================================================*/
10 int hgfs_mkdir(const char *path, int mode)
11 {
12 /* Create a new directory.
13  */
14 
15   RPC_REQUEST(HGFS_REQ_MKDIR);
16   RPC_NEXT8 = HGFS_MODE_TO_PERM(mode);
17 
18   path_put(path);
19 
20   return rpc_query();
21 }
22 
23 /*===========================================================================*
24  *				hgfs_unlink				     *
25  *===========================================================================*/
26 int hgfs_unlink(const char *path)
27 {
28 /* Delete a file.
29  */
30 
31   RPC_REQUEST(HGFS_REQ_UNLINK);
32 
33   path_put(path);
34 
35   return rpc_query();
36 }
37 
38 /*===========================================================================*
39  *				hgfs_rmdir				     *
40  *===========================================================================*/
41 int hgfs_rmdir(const char *path)
42 {
43 /* Remove an empty directory.
44  */
45 
46   RPC_REQUEST(HGFS_REQ_RMDIR);
47 
48   path_put(path);
49 
50   return rpc_query();
51 }
52 
53 /*===========================================================================*
54  *				hgfs_rename				     *
55  *===========================================================================*/
56 int hgfs_rename(const char *opath, const char *npath)
57 {
58 /* Rename a file or directory.
59  */
60 
61   RPC_REQUEST(HGFS_REQ_RENAME);
62 
63   path_put(opath);
64   path_put(npath);
65 
66   return rpc_query();
67 }
68