summaryrefslogtreecommitdiff
path: root/minix/lib/libhgfs/info.c
blob: 420977200e00ae662921aff1ef7af3a6c2fc28d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */

#include "inc.h"

/*===========================================================================*
 *				hgfs_queryvol				     *
 *===========================================================================*/
int hgfs_queryvol(const char *path, u64_t *free, u64_t *total)
{
/* Retrieve information about available and total volume space associated with
 * a given path.
 */
  u32_t lo, hi;
  int r;

  RPC_REQUEST(HGFS_REQ_QUERYVOL);

  path_put(path);

  /* It appears that this call always fails with EACCES ("permission denied")
   * on read-only folders. As far as I can tell, this is a VMware bug.
   */
  if ((r = rpc_query()) != OK)
	return r;

  lo = RPC_NEXT32;
  hi = RPC_NEXT32;
  *free = make64(lo, hi);

  lo = RPC_NEXT32;
  hi = RPC_NEXT32;
  *total = make64(lo, hi);

  return OK;
}