Files
erofs-freebsd-out-tree/tests/statfs_probe.c
T
2026-08-13 10:44:59 +02:00

25 lines
673 B
C

#include <sys/mount.h>
#include <err.h>
#include <inttypes.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
struct statfs sb;
if (argc != 2)
errx(2, "usage: statfs_probe path");
if (statfs(argv[1], &sb) != 0)
err(1, "statfs %s", argv[1]);
printf("fstype=%s bsize=%ju iosize=%ju blocks=%ju bfree=%ju "
"bavail=%jd files=%ju ffree=%ju readonly=%d from=%s on=%s\n",
sb.f_fstypename, (uintmax_t)sb.f_bsize, (uintmax_t)sb.f_iosize,
(uintmax_t)sb.f_blocks, (uintmax_t)sb.f_bfree,
(intmax_t)sb.f_bavail, (uintmax_t)sb.f_files,
(uintmax_t)sb.f_ffree, (sb.f_flags & MNT_RDONLY) != 0,
sb.f_mntfromname, sb.f_mntonname);
return (0);
}