From patchwork Wed Nov 17 17:45:34 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: 333621 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 oAHHiIhj023808 for ; Wed, 17 Nov 2010 17:45:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935107Ab0KQRpk (ORCPT ); Wed, 17 Nov 2010 12:45:40 -0500 Received: from mail-iw0-f174.google.com ([209.85.214.174]:49866 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934635Ab0KQRpj (ORCPT ); Wed, 17 Nov 2010 12:45:39 -0500 Received: by iwn35 with SMTP id 35so2373733iwn.19 for ; Wed, 17 Nov 2010 09:45:39 -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=3m/kwHsJfui4gNx81v9wdPIdx6yXNdJCVsgnEV1QhR8=; b=iw1NPuQTi59XpMxmDQATCgmogzwHgYPkv5ibVwWAZSBHHGPdrzkITXhhuiaIi1Xo+0 GI9XkJkxCXXTgQDFGxvRIb1Qjdfne9g7f6WvG5O4tL3XEZdBYOIDEZ+YWWCvmV+jmMj2 Forpc0nSZudBINOj4vh71/y26BqG10Y7AgNUo= 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=huBkiJ3IPINnNyxNUMc9DZEfvwHkkFrXT+NlKeaYZchRPQibS5asi+ZpLqTEIN0cUY 8vq9iDr3cY7eVwnWIvrHRiDXRf0xDinVOP23aA04KJ+NmB2Oxx2WNpmDvqNZiZjPSqgl jiJNGrjR99iVIi4oGcqtQ84Y6bdulVay/TnMQ= Received: by 10.231.36.199 with SMTP id u7mr3895126ibd.169.1290015938096; Wed, 17 Nov 2010 09:45:38 -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 i16sm2423662ibl.18.2010.11.17.09.45.35 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 17 Nov 2010 09:45:36 -0800 (PST) From: Chuck Lever Subject: [PATCH 12/17] NFS: Update xdr_encode_foo() functions that we're keeping To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org Date: Wed, 17 Nov 2010 12:45:34 -0500 Message-ID: <20101117174534.29177.72207.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:45:40 +0000 (UTC) diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 831a987..1a7e25e 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c @@ -167,14 +167,6 @@ out_overflow: * Encode/decode time. */ static inline __be32 * -xdr_encode_time3(__be32 *p, const struct timespec *timep) -{ - *p++ = htonl(timep->tv_sec); - *p++ = htonl(timep->tv_nsec); - return p; -} - -static inline __be32 * xdr_decode_time3(__be32 *p, struct timespec *timep) { timep->tv_sec = ntohl(*p++); @@ -219,52 +211,6 @@ xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr) } static inline __be32 * -xdr_encode_sattr(__be32 *p, const struct iattr *attr) -{ - if (attr->ia_valid & ATTR_MODE) { - *p++ = xdr_one; - *p++ = htonl(attr->ia_mode & S_IALLUGO); - } else { - *p++ = xdr_zero; - } - if (attr->ia_valid & ATTR_UID) { - *p++ = xdr_one; - *p++ = htonl(attr->ia_uid); - } else { - *p++ = xdr_zero; - } - if (attr->ia_valid & ATTR_GID) { - *p++ = xdr_one; - *p++ = htonl(attr->ia_gid); - } else { - *p++ = xdr_zero; - } - if (attr->ia_valid & ATTR_SIZE) { - *p++ = xdr_one; - p = xdr_encode_hyper(p, (__u64) attr->ia_size); - } else { - *p++ = xdr_zero; - } - if (attr->ia_valid & ATTR_ATIME_SET) { - *p++ = xdr_two; - p = xdr_encode_time3(p, &attr->ia_atime); - } else if (attr->ia_valid & ATTR_ATIME) { - *p++ = xdr_one; - } else { - *p++ = xdr_zero; - } - if (attr->ia_valid & ATTR_MTIME_SET) { - *p++ = xdr_two; - p = xdr_encode_time3(p, &attr->ia_mtime); - } else if (attr->ia_valid & ATTR_MTIME) { - *p++ = xdr_one; - } else { - *p++ = xdr_zero; - } - return p; -} - -static inline __be32 * xdr_decode_wcc_attr(__be32 *p, struct nfs_fattr *fattr) { p = xdr_decode_hyper(p, &fattr->pre_size); @@ -453,6 +399,21 @@ static void encode_nfs_fh3(struct xdr_stream *xdr, const struct nfs_fh *fh) } /* + * nfstime3 + * + * struct nfstime3 { + * uint32 seconds; + * uint32 nseconds; + * }; + */ +static __be32 *xdr_encode_nfstime3(__be32 *p, const struct timespec *timep) +{ + *p++ = cpu_to_be32(timep->tv_sec); + *p++ = cpu_to_be32(timep->tv_nsec); + return p; +} + +/* * sattr3 * * enum time_how { @@ -538,7 +499,45 @@ static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr) nbytes += 8; p = xdr_reserve_space(xdr, nbytes); - xdr_encode_sattr(p, attr); + if (attr->ia_valid & ATTR_MODE) { + *p++ = xdr_one; + *p++ = cpu_to_be32(attr->ia_mode & S_IALLUGO); + } else + *p++ = xdr_zero; + + if (attr->ia_valid & ATTR_UID) { + *p++ = xdr_one; + *p++ = cpu_to_be32(attr->ia_uid); + } else + *p++ = xdr_zero; + + if (attr->ia_valid & ATTR_GID) { + *p++ = xdr_one; + *p++ = cpu_to_be32(attr->ia_gid); + } else + *p++ = xdr_zero; + + if (attr->ia_valid & ATTR_SIZE) { + *p++ = xdr_one; + p = xdr_encode_hyper(p, (u64)attr->ia_size); + } else + *p++ = xdr_zero; + + if (attr->ia_valid & ATTR_ATIME_SET) { + *p++ = xdr_two; + p = xdr_encode_nfstime3(p, &attr->ia_atime); + } else if (attr->ia_valid & ATTR_ATIME) { + *p++ = xdr_one; + } else + *p++ = xdr_zero; + + if (attr->ia_valid & ATTR_MTIME_SET) { + *p++ = xdr_two; + xdr_encode_nfstime3(p, &attr->ia_mtime); + } else if (attr->ia_valid & ATTR_MTIME) { + *p = xdr_one; + } else + *p = xdr_zero; } /* @@ -605,7 +604,7 @@ static void encode_sattrguard3(struct xdr_stream *xdr, if (args->guard) { p = xdr_reserve_space(xdr, 4 + 8); *p++ = xdr_one; - xdr_encode_time3(p, &args->guardtime); + xdr_encode_nfstime3(p, &args->guardtime); } else { p = xdr_reserve_space(xdr, 4); *p = xdr_zero;