FAT | RFS | XFS | ZFS
vstat()
PROTOTYPE
#include <posix.h>
int vstat(const char *path, union vstat *info);
DESCRIPTION
vstat() is a non-standard routine that writes information about the volume specified by path to the vstat union indicated by info. path is the volume name, the path to any file on the volume, or NULL to select the volume holding the CWD. Paths starting with ‘/’ are absolute. Otherwise they are relative to the CWD.
The vstat union contains a structure for each file system: The user manual for each file system describes its vstat structure in detail. The vstat union is defined in “posix.h” and reproduced below:
union vstat
{
int vol_type; /* FAT_VOL, RFS_VOL, XFS_VOL, ZFS_VOL, ... */
vstat_rfs rfs;
vstat_zfs zfs;
vstat_fat fat;
vstat_xfs xfs;
};
If successful, vstat() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| EFAULT | info equals NULL. |
| ENAMETOOLONG | A name in path exceeds the effective maximum file name length. |
| ENOENT | path is the empty string or includes a name that was not found. |
| ENOTDIR | One of the non-leaf path components is not a directory. |
EXAMPLE
union vstat;
/*-------------------------------------------------------------------*/
/* Get and report the FTL's garbage level. */
/*-------------------------------------------------------------------*/
if (vstat(vol_name, &stats))
error("vstat() failed");
printf("Garbage percentage = %u\n", stats.xfs.media.ftl.garbage_level);