xref: /minix3/minix/lib/libhgfs/info.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 /*===========================================================================*
6433d6423SLionel Sambuc  *				hgfs_queryvol				     *
7433d6423SLionel Sambuc  *===========================================================================*/
hgfs_queryvol(const char * path,u64_t * free,u64_t * total)8*94e65446SDavid van Moolenbroek int hgfs_queryvol(const char *path, u64_t *free, u64_t *total)
9433d6423SLionel Sambuc {
10433d6423SLionel Sambuc /* Retrieve information about available and total volume space associated with
11433d6423SLionel Sambuc  * a given path.
12433d6423SLionel Sambuc  */
13433d6423SLionel Sambuc   u32_t lo, hi;
14433d6423SLionel Sambuc   int r;
15433d6423SLionel Sambuc 
16433d6423SLionel Sambuc   RPC_REQUEST(HGFS_REQ_QUERYVOL);
17433d6423SLionel Sambuc 
18433d6423SLionel Sambuc   path_put(path);
19433d6423SLionel Sambuc 
20433d6423SLionel Sambuc   /* It appears that this call always fails with EACCES ("permission denied")
21433d6423SLionel Sambuc    * on read-only folders. As far as I can tell, this is a VMware bug.
22433d6423SLionel Sambuc    */
23433d6423SLionel Sambuc   if ((r = rpc_query()) != OK)
24433d6423SLionel Sambuc 	return r;
25433d6423SLionel Sambuc 
26433d6423SLionel Sambuc   lo = RPC_NEXT32;
27433d6423SLionel Sambuc   hi = RPC_NEXT32;
28433d6423SLionel Sambuc   *free = make64(lo, hi);
29433d6423SLionel Sambuc 
30433d6423SLionel Sambuc   lo = RPC_NEXT32;
31433d6423SLionel Sambuc   hi = RPC_NEXT32;
32433d6423SLionel Sambuc   *total = make64(lo, hi);
33433d6423SLionel Sambuc 
34433d6423SLionel Sambuc   return OK;
35433d6423SLionel Sambuc }
36