nfs-utils: "nfsstat -m" should report nfsv4 mounts too.
Subsystems (2)
PATCH 1/1 nfs-utils: "nfsstat -m" should report nfsv4 mounts too.
nfsstat -m lists all current nfs mounts, with the mount options. It does this by reading /proc/mounts and looking for mounts of type "nfs".
It really should check for "nfs4" as well. For simplicity, just check the first 3 characters of the type.
utils/nfsstat/nfsstat.c +1 -1
@@ -716,7 +716,7 @@ mounts(const char *name)if (!(type =strtok (NULL ," \t" )))continue ; -if (strcmp (type,"nfs" )) { +if (strncmp (type,"nfs" ,3 )) {continue ; }
Quoted 14 lines · On Thursday June 5, [email protected] wrote:
nfsstat -m lists all current nfs mounts, with the mount options. It does this by reading
/proc/mountsand looking for mounts of type "nfs".
It really should check for "nfs4" as well. For simplicity, just check the first 3 characters of the type.Signed-off-by NeilBrown <[email protected]>utils/nfsstat/nfsstat.c +0
-0
utils/nfsstat/nfsstat.c mounts(const char *name) · line 722
Quoted 8 lines
utils/nfsstat/nfsstat.c +1
-1@@ -716,7 +716,7 @@ mounts(const char *name)if (!(type =strtok (NULL ," \t" )))continue ; -if (strcmp (type,"nfs" )) { +if (strncmp (type,"nfs" ,3 )) {continue ; }
(stupid. stupid. stupid).
That will, of course, report the "nfsd" mount as well, which we don't want. So let's try again.
NeilBrown
utils/nfsstat/nfsstat.c +1 -1
@@ -716,7 +716,7 @@ mounts(const char *name)if (!(type =strtok (NULL ," \t" )))continue ; -if (strcmp (type,"nfs" )) { +if (strcmp (type,"nfs" ) &&strcmp (type,"nfs4" )) {continue ; }
A message that is not in the archive (sent off-list or not yet received): 18503.29397.511629.809568-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org
Quoted 11 lines · Neil Brown
That will, of course, report the "nfsd" mount as well, which we don't want. So let's try again.
NeilBrown
utils/nfsstat/nfsstat.c +0
-0
utils/nfsstat/nfsstat.c mounts(const char *name) · line 721
Quoted 7 lines
utils/nfsstat/nfsstat.c +1
-1@@ -716,7 +716,7 @@ mounts(const char *name)if (!(type =strtok (NULL ," \t" )))continue ; -if (strcmp (type,"nfs" )) { +if (strcmp (type,"nfs" ) &&strcmp (type,"nfs4" )) {continue ; }
Don't you want an OR?
+ if (strcmp(type, "nfs") || strcmp(type,"nfs4")) {
Scott
A message that is not in the archive (sent off-list or not yet received): 4CC1DC65-88C3-4F26-8FF2-016F6C1173CE-vV262kQ/[email protected]
Quoted 23 lines · Scott Atchley
Quoted 11 lines · Neil Brown
That will, of course, report the "nfsd" mount as well, which we don't want. So let's try again.
NeilBrown
utils/nfsstat/nfsstat.c +0
-0utils/nfsstat/nfsstat.c mounts(const char *name) · line 721
Quoted 7 lines
utils/nfsstat/nfsstat.c +1
-1@@ -716,7 +716,7 @@ mounts(const char *name)if (!(type =strtok (NULL ," \t" )))continue ; -if (strcmp (type,"nfs" )) { +if (strcmp (type,"nfs" ) &&strcmp (type,"nfs4" )) {continue ; }Don't you want an OR?
Review
Quoted 1 line
(quoted diff) +1
-0+ if (strcmp(type, "nfs") || strcmp(type,"nfs4")) {
Thanks for reviewing the patch (always appreciated), but no - I don't want OR.
What I really want is to eradicate all usages of
if (strcmp(X,Y))
in the world and make them
if (strcmp(X,Y) != 0)Then it is clearer that it is a "!=" test.
In this case, the condition as I had it means"
If type is not nfs and type is not nfs4
(then continue)
which is what I want.
Your version says:
If type is not nfs or type is not nfs4
and that will always be true.
+ if (strcmp(type, "nfs") != 0 && strcmp(type, "nfs4") != 0)) {
NeilBrown
A message that is not in the archive (sent off-list or not yet received): 35792.192.168.1.70.1212667686.squirrel-eq65iwfR9nKIECXXMXunQA@public.gmane.org
Quoted 17 lines · NeilBrown
Thanks for reviewing the patch (always appreciated), but no - I don't want OR.
What I really want is to eradicate all usages of
if (strcmp(X,Y))
in the world and make them
if (strcmp(X,Y)!= 0)Then it is clearer that it is a "!=" test.
In this case, the condition as I had it means"If type is not nfs and type is not nfs4
(then continue)
which is what I want.Your version says:
If type is not nfs or type is not nfs4
Quoted 7 lines
and that will always be true.
+ if (
strcmp(type, "nfs")!= 0 &&strcmp(type, "nfs4")!
= 0)) {NeilBrown
Ahh, I did not provide much of a review since I missed your intent. :-)
Scott