[PATCH 31/31] mount.nfs: Squelch compiler warnings in nfs_strerror()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Address compiler warnings:

    error.c: In function ‘nfs_strerror’:
    error.c:341: warning: comparison between signed and unsigned
    error.c:342: warning: comparison between signed and unsigned

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---

 utils/mount/error.c |   12 ++++++------
 utils/mount/error.h |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/utils/mount/error.c b/utils/mount/error.c
index 5c9d3f2..4cc9e09 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -300,6 +300,8 @@ void umount_error(int err, const char *dev)
 #define EDQUOT	ENOSPC
 #endif
 
+#define ARRAY_SIZE(x)		(sizeof(x) / sizeof((x)[0])) 
+
 static struct {
 	enum nfsstat stat;
 	int errnum;
@@ -329,19 +331,17 @@ static struct {
 #endif
 	/* Throw in some NFSv3 values for even more fun (HP returns these) */
 	{ 71,			EREMOTE		},
-
-	{ -1,			EIO		}
 };
 
-char *nfs_strerror(int stat)
+char *nfs_strerror(unsigned int stat)
 {
-	int i;
+	unsigned int i;
 	static char buf[256];
 
-	for (i = 0; nfs_errtbl[i].stat != -1; i++) {
+	for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
 		if (nfs_errtbl[i].stat == stat)
 			return strerror(nfs_errtbl[i].errnum);
 	}
-	sprintf(buf, _("unknown nfs status return value: %d"), stat);
+	sprintf(buf, _("unknown nfs status return value: %u"), stat);
 	return buf;
 }
diff --git a/utils/mount/error.h b/utils/mount/error.h
index 7126de5..42b28cf 100644
--- a/utils/mount/error.h
+++ b/utils/mount/error.h
@@ -24,7 +24,7 @@
 #ifndef _NFS_UTILS_MOUNT_ERROR_H
 #define _NFS_UTILS_MOUNT_ERROR_H
 
-char *nfs_strerror(int);
+char *nfs_strerror(unsigned int);
 
 void mount_error(const char *, const char *, int);
 void rpc_mount_errors(char *, int, int);

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux