summaryrefslogtreecommitdiffstats
path: root/utils/nfsstat/nfsstat.c
diff options
context:
space:
mode:
authordavid m. richter <richterd@citi.umich.edu>2007-08-07 19:52:50 -0400
committerNeil Brown <neilb@suse.de>2007-08-09 11:08:28 +1000
commit2357159ef3896a2f8d3fd74fb5d97a9a7d42986b (patch)
tree348da1221e5f82260c18de990f3046eb4b828721 /utils/nfsstat/nfsstat.c
parentb5c12733e88b04f5bc269546169ad91079c61783 (diff)
downloadnfs-utils-2357159ef3896a2f8d3fd74fb5d97a9a7d42986b.tar.gz
nfs-utils-2357159ef3896a2f8d3fd74fb5d97a9a7d42986b.tar.xz
nfs-utils-2357159ef3896a2f8d3fd74fb5d97a9a7d42986b.zip
nfsstat: add a comment to has_stats()
Clarify what has_stats() is actually doing. Signed-off-by: David M. Richter <richterd@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/nfsstat/nfsstat.c')
-rw-r--r--utils/nfsstat/nfsstat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c
index d27624e..eb6e45d 100644
--- a/utils/nfsstat/nfsstat.c
+++ b/utils/nfsstat/nfsstat.c
@@ -638,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' */