xref: /minix/minix/lib/libhgfs/info.c (revision e3b78ef1)
1 /* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
2 
3 #include "inc.h"
4 
5 /*===========================================================================*
6  *				hgfs_queryvol				     *
7  *===========================================================================*/
8 int hgfs_queryvol(const char *path, u64_t *free, u64_t *total)
9 {
10 /* Retrieve information about available and total volume space associated with
11  * a given path.
12  */
13   u32_t lo, hi;
14   int r;
15 
16   RPC_REQUEST(HGFS_REQ_QUERYVOL);
17 
18   path_put(path);
19 
20   /* It appears that this call always fails with EACCES ("permission denied")
21    * on read-only folders. As far as I can tell, this is a VMware bug.
22    */
23   if ((r = rpc_query()) != OK)
24 	return r;
25 
26   lo = RPC_NEXT32;
27   hi = RPC_NEXT32;
28   *free = make64(lo, hi);
29 
30   lo = RPC_NEXT32;
31   hi = RPC_NEXT32;
32   *total = make64(lo, hi);
33 
34   return OK;
35 }
36