/* @(#)test9.c 1.4 90/01/03 NFS Rev 2 Testsuite
* 1.4 Lachman ONC Test Suite source
* Uses the following important system calls against the server:
* mkdir() (for initial directory creation if not -m)
#include <sys/fs/nfs/time.h>
int Tflag
= 0; /* print timing */
int Hflag
= 0; /* print help message */
int Fflag
= 0; /* test function only; set count to 1, negate -t */
int Nflag
= 0; /* Suppress directory operations */
fprintf(stdout
, "usage: %s [-htfn] [count]\n", Myname
);
fprintf(stdout
, " Flags: h Help - print this usage info\n");
fprintf(stdout
, " t Print execution time statistics\n");
fprintf(stdout
, " f Test function only (negate -t)\n");
fprintf(stdout
, " n Suppress test directory create operations\n");
int count
= 1500; /* times to do statfs call */
while (argc
&& **argv
== '-') {
for (opts
= &argv
[0][1]; *opts
; opts
++) {
case 'f': /* funtionality */
case 'n': /* No Test Directory create */
error("unknown option '%c'", *opts
);
count
= getparm(*argv
, 1, "count");
fprintf(stdout
, "%s: statfs\n", Myname
);
for (ct
= 0; ct
< count
; ct
++) {
if (statfs(".", &sfsb
, sizeof(sfsb
), 0) < 0) {
if (statfs(".", &sfsb
) < 0) {
error("can't do statfs on \".\"");
fprintf(stdout
, "\ttype=%d, bsize=%d, blocks=%d, bfree=%d\n\
\t bavail=%d, files=%d, ffree=%d, vol=%s, pack=%s\n",
sfsb
.f_fstyp
, sfsb
.f_bsize
, sfsb
.f_blocks
, sfsb
.f_bfree
,
sfsb
.f_bfree
, sfsb
.f_files
, sfsb
.f_ffree
, sfsb
.f_fname
,
fprintf(stdout
, "\ttype=%d, bsize=%d, blocks=%d, bfree=%d\n\
\t bavail=%d, files=%d, ffree=%d, fsid=%d %d\n",
sfsb
.f_type
, sfsb
.f_bsize
, sfsb
.f_blocks
, sfsb
.f_bfree
,
sfsb
.f_bavail
, sfsb
.f_files
, sfsb
.f_ffree
,
sfsb
.f_fsid
.val
[0], sfsb
.f_fsid
.val
[1]);
sfsb
.f_fsid
[0], sfsb
.f_fsid
[1]);
fprintf(stdout
, "\t%d statfs calls", count
);
fprintf(stdout
, " in %d.%-2d seconds",
time
.tv_sec
, time
.tv_usec
/ 10000);