From patchwork Wed Nov 17 17:44:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 333541 X-Patchwork-Delegate: Trond.Myklebust@netapp.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAHHiIhb023808 for ; Wed, 17 Nov 2010 17:44:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935014Ab0KQRoR (ORCPT ); Wed, 17 Nov 2010 12:44:17 -0500 Received: from mail-iw0-f174.google.com ([209.85.214.174]:35298 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934871Ab0KQRoQ (ORCPT ); Wed, 17 Nov 2010 12:44:16 -0500 Received: by iwn35 with SMTP id 35so2372245iwn.19 for ; Wed, 17 Nov 2010 09:44:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:subject:to:cc :date:message-id:in-reply-to:references:user-agent:mime-version :content-type:content-transfer-encoding; bh=4QS604oezOLuscxI7YiaUI9/67OcC/n1cqLz2G2GmK8=; b=W8AV+uoh9C+2GuhTY1DwwbYvFQlYuAKu4JKc+gvwf+J2qeryxKQpyDcfu5XxrPjnkZ Vx4FMd1+MLiy3dvyATHWykqVYxa0XyZKjsWM9HwpQkqajnqJhjDH4EEC04aZZ5URw0Fc dXoekTqbIMGhm4O23GvgKAu4Xy6L+6zpRhxGE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=h9RCllKnWVcAc58fFeCwE0YDQ0G+uRxjCZ9ujfvDE22k7TTEeo53i3brqtoSJgJlT+ tMeqmf8sDrmPKB1UOmnj5Pz/ZrhU8AGzy9LlafjXo3y86VbS5m9UTWWJm7OsuGd2dKvc VGKhG9cG/VqgcEDkegEX+oq3dmnCXKGoz7N7I= Received: by 10.231.36.197 with SMTP id u5mr7469099ibd.110.1290015854661; Wed, 17 Nov 2010 09:44:14 -0800 (PST) Received: from matisse.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net [99.26.161.222]) by mx.google.com with ESMTPS id gy41sm2414891ibb.17.2010.11.17.09.44.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 17 Nov 2010 09:44:13 -0800 (PST) From: Chuck Lever Subject: [PATCH 04/17] NFS: Use the "nfs_stat" enum for nfs_stat_to_errno()'s argument To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org Date: Wed, 17 Nov 2010 12:44:11 -0500 Message-ID: <20101117174411.29177.27455.stgit@matisse.1015granger.net> In-Reply-To: <20101117174112.29177.69734.stgit@matisse.1015granger.net> References: <20101117174112.29177.69734.stgit@matisse.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 17 Nov 2010 17:44:19 +0000 (UTC) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 1ccf4fb..cddf49d 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -185,7 +185,7 @@ extern int __init nfs_init_directcache(void); extern void nfs_destroy_directcache(void); /* nfs2xdr.c */ -extern int nfs_stat_to_errno(int); +extern int nfs_stat_to_errno(enum nfs_stat); extern struct rpc_procinfo nfs_procedures[]; extern __be32 *nfs_decode_dirent(struct xdr_stream *, struct nfs_entry *, struct nfs_server *, int); diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index 53db70e..1c5a2fa 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c @@ -802,7 +802,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[] = { @@ -842,20 +842,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; }