First you declare the context at the beginning of your program:
struct nfs_context *nfs = NULL;
Here we'll hold the information you want:
struct statvfs st;
Then we initialize the context:
nfs = nfs_init_context();
Mount the share:
struct client client;
client.server = server;
client.export = path;
client.is_finished = 0;
ret = nfs_mount(nfs, client.server, client.export);
And you can use nfs_statvfs
like so;
ret = nfs_statvfs(nfs, path, &st);
Where nfs
is the context from earlier, path
is some filename or directory, and st
is the struct that will hold the information. ret
contains errno
if there was a problem.
Here's statvfs
:
struct statvfs {
uint32_t f_bsize;
uint32_t f_frsize;
uint64_t f_blocks;
uint64_t f_bfree;