#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include <sys/types.h>
#include <sys/statvfs.h>

int
main(int argc, char *argv[])
{
	struct statvfs sfs;
	if (statvfs(argv[1], &sfs) == -1)
		err(EXIT_FAILURE, "statvfs `%s'", argv[1]);

#define P(b, a)	printf("%.20s = %#j" b "\n", # a, (intmax_t)sfs.a)
#define S(a)	printf("%.20s = %s\n", # a, (intmax_t)sfs.a)

	P("x", f_flag);
	P("d", f_bsize);
	P("d", f_frsize);
	P("d", f_iosize);

	P("d", f_blocks);
	P("d", f_bfree);
	P("d", f_bavail);
	P("d", f_bresvd);

	P("d", f_files);
	P("d", f_ffree);
	P("d", f_favail);
	P("d", f_fresvd);

	P("d", f_syncreads);
	P("d", f_syncwrites);

	P("d", f_asyncreads);
	P("d", f_asyncwrites);

	// fsid_t		f_fsidx;	/* NetBSD compatible fsid */
	P("d", f_fsid);
	P("d", f_namemax);
	P("d", f_owner);

	// uint64_t	f_spare[4];	/* spare space */

	S(f_fstypename);
	S(f_mntonname);
	S(f_mntfromname);
	S(f_mntfromlabel);

	return 0;
}
