X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fnfsstat%2Fnfsstat.c;h=eb6e45d2a7f11056bcec5105884f80ebd1cf17c4;hp=d9d119eb5f81ddb3c898c72fba618a363556df67;hb=2357159ef3896a2f8d3fd74fb5d97a9a7d42986b;hpb=9b640cdaa36e25e0f6e14a7a53237488717d4187 diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c index d9d119e..eb6e45d 100644 --- a/utils/nfsstat/nfsstat.c +++ b/utils/nfsstat/nfsstat.c @@ -30,7 +30,7 @@ static unsigned int cltproc2info[20], cltproc2info_tmp[20]; /* NFSv2 call counts static unsigned int srvproc3info[24], srvproc3info_tmp[24]; /* NFSv3 call counts ([0] == 22) */ static unsigned int cltproc3info[24], cltproc3info_tmp[24]; /* NFSv3 call counts ([0] == 22) */ static unsigned int srvproc4info[4], srvproc4info_tmp[4]; /* NFSv4 call counts ([0] == 2) */ -static unsigned int cltproc4info[34], cltproc4info_tmp[34]; /* NFSv4 call counts ([0] == 32) */ +static unsigned int cltproc4info[37], cltproc4info_tmp[37]; /* NFSv4 call counts ([0] == 35) */ static unsigned int srvproc4opsinfo[42], srvproc4opsinfo_tmp[42]; /* NFSv4 call counts ([0] == 40) */ static unsigned int srvnetinfo[5], srvnetinfo_tmp[5]; /* 0 # of received packets * 1 UDP packets @@ -93,13 +93,14 @@ static const char * nfssrvproc4name[2] = { "compound", }; -static const char * nfscltproc4name[32] = { +static const char * nfscltproc4name[35] = { "null", "read", "write", "commit", "open", "open_conf", "open_noat", "open_dgrd", "close", "setattr", "fsinfo", "renew", "setclntid", "confirm", "lock", "lockt", "locku", "access", "getattr", "lookup", "lookup_root", "remove", "rename", "link", "symlink", "create", "pathconf", - "statfs", "readlink", "readdir", "server_caps", "delegreturn", + "statfs", "readlink", "readdir", "server_caps", "delegreturn", "getacl", + "setacl", "fs_locations" }; static const char * nfssrvproc4opname[40] = { @@ -570,7 +571,7 @@ parse_statfile(const char *name, struct statinfo *statp) ip->valptr[i] = atoi(sp); total += ip->valptr[i]; } - ip->valptr[i] = total; + ip->valptr[cnt - 1] = total; } fclose(fp); @@ -637,10 +638,16 @@ get_stats(const char *file, statinfo *info, int *opt, int other_opt, const char } } +/* + * This is for proc2/3/4-type stats, where, in the /proc files, the first entry's value + * denotes the number of subsequent entries. statinfo value arrays contain an additional + * field at the end which contains the sum of all previous elements in the array -- so, + * there are stats if the sum's greater than the entry-count. + */ static int has_stats(const unsigned int *info) { - return (info[0] && info[info[0] + 1] != info[0]); + return (info[0] && info[info[0] + 1] > info[0]); } /* clone 'src' to 'dest' */