]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/nfs/nfs2xdr.c
NFS: Use the "nfs_stat" enum for nfs_stat_to_errno()'s argument
[mirror_ubuntu-artful-kernel.git] / fs / nfs / nfs2xdr.c
index c79977304af899b8036cbc7c4db68705304cb992..2da9824d432adc3d8f082d861e4e2e0aaba89918 100644 (file)
@@ -804,7 +804,7 @@ nfs_xdr_statfsres(struct rpc_rqst *req, __be32 *p, struct nfs2_fsstat *res)
  * We need to translate between nfs status return values and
  * the local errno values which may not be the same.
  */
-static struct {
+static const struct {
        int stat;
        int errno;
 } nfs_errtbl[] = {
@@ -844,20 +844,22 @@ static struct {
        { -1,                   -EIO            }
 };
 
-/*
- * Convert an NFS error code to a local one.
- * This one is used jointly by NFSv2 and NFSv3.
+/**
+ * nfs_stat_to_errno - convert an NFS status code to a local errno
+ * @status: NFS status code to convert
+ *
+ * Returns a local errno value, or -EIO if the NFS status code is
+ * not recognized.  This function is used jointly by NFSv2 and NFSv3.
  */
-int
-nfs_stat_to_errno(int stat)
+int nfs_stat_to_errno(enum nfs_stat status)
 {
        int i;
 
        for (i = 0; nfs_errtbl[i].stat != -1; i++) {
-               if (nfs_errtbl[i].stat == stat)
+               if (nfs_errtbl[i].stat == (int)status)
                        return nfs_errtbl[i].errno;
        }
-       dprintk("nfs_stat_to_errno: bad nfs status return value: %d\n", stat);
+       dprintk("NFS: Unrecognized nfs status value: %u\n", status);
        return nfs_errtbl[i].errno;
 }