Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1211796rdh; Mon, 25 Sep 2023 06:31:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/rmtSF/43Tne0RDWwDIxHN8dKCmglkV0HuuokaOsPkv3Sx4ylQLcX8gsL7/S20T1PH+aK X-Received: by 2002:a05:6e02:218b:b0:34c:dbeb:a2a2 with SMTP id j11-20020a056e02218b00b0034cdbeba2a2mr9304362ila.21.1695648702469; Mon, 25 Sep 2023 06:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695648702; cv=none; d=google.com; s=arc-20160816; b=0xpdhB7magqM6B3EImbJVfT2/pOCkUgEwtyc8CJM9dCrURmKmp18UQT0OWpNjNpoVy SisrAxWDUx3VvHVdaGnekS/ogxCWbPFDVKCyrUM/Eo74RpCkwTSrKg7aZlZFUMt6ii6A +AGIsFsH79A6N8g6C2LTNLxc+f3vpVx8YYHyp/YXxcaW7Qjzihf3rju+S/kz2camIx6L p55B6yKCOfsqji53lVjBO10kjbPWJQvuU4QJyMMlfmKL6D4xN6iY4UrBzibYhyNF5bGz 5n1GUSJ4xMQtg2l+aXojFP6lfe9ejJXV2MldwiuAmRVcl3ZswstbYVJmgKez9XjiMwi4 vJoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=TGopKX9x2V8mcz3BxqMVtaz4fK9R6/LJlCrlMM4xHJU=; fh=v8a13lpFSZWlL4AptTEJnmXnlqoWXhGCGCgvrcnCT9I=; b=qf1TdL83i2MfLIzykYxgMceI6mq2ZW3JgbHj7rn6whaM3fTZlalzpNvkr++3H3onHw 6+kwtumL1qfRUs0OxaPi7wu4tm8cp7Yg4vRsQVS3HOYylkyFEUKce72jsKkLsJPiyZnF Ewfb6AHjgo8DBVF2wOQ/JPI/C39PtioqQqvzpx93XvSBcNetH6M8EYalhvW553mnR19W B2QL5BlnkPVuEAcpP4b7/tiW9QAFyZG8CdAN1Qg6gZVKc34EtIlmiJBt9I1YzvhrYcIC LruPCJYO+ZKNXllsun+kdmkrJjmrXJI8yG/Fbe1TJVVNKYDsLKp8p8ONmzj6aKjSsEGw ycKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VhEEkhxM; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id w20-20020a63fb54000000b00564beb6145fsi9511551pgj.765.2023.09.25.06.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 06:31:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VhEEkhxM; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 101048075DF0; Mon, 25 Sep 2023 06:27:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231537AbjIYN1u (ORCPT + 99 others); Mon, 25 Sep 2023 09:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231615AbjIYN1t (ORCPT ); Mon, 25 Sep 2023 09:27:49 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 856BF11D for ; Mon, 25 Sep 2023 06:27:40 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3A98C433C8; Mon, 25 Sep 2023 13:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695648460; bh=XKYbn3+oFkvQmfmcaZJt0QnJKjTwoXQBRD8QhYLaoEM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=VhEEkhxMEp19yHn3UgN/b5030yN9YKCwQK57680Z/oDXEZZZkxFuLK83Qd++mVPp7 J6/YAUztVefYWtJjO8i5QUUtevvJBRcvG1Hqtx//eX3cUvQ2VMCdRKkup+D8HMcgG1 f/ptWsYFMNYV1Md6BSVs1dlKYVtXEMwuSQZrY2xCiiNsOpWgHVgveUG05bqoVSHtjk ThYuTYh62+7aCOJKTULLhZxqIjzWNLvRb5Bvwelumqd3lh+P+bALC9e3QpC4gG8E7c FMItkszO+BINhSdgM57efigGTIyTHAefOt55hB5ev6nHoliROTYhVhoJGKZqFA+1pC ov1B2BqNKZkwg== Subject: [PATCH v1 1/8] NFSD: Add nfsd4_encode_count4() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 25 Sep 2023 09:27:38 -0400 Message-ID: <169564845894.6013.1502101691833380449.stgit@klimt.1015granger.net> In-Reply-To: <169564827064.6013.5014460767978657478.stgit@klimt.1015granger.net> References: <169564827064.6013.5014460767978657478.stgit@klimt.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 06:27:47 -0700 (PDT) From: Chuck Lever This is a synonym for nfsd4_encode_uint32_t() that matches the name of the XDR type. It will get at least one more use in a subsequent patch. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 13 +++++++++---- fs/nfsd/xdr4.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2356c56ef4c4..bc802f187c63 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4615,12 +4615,17 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, union nfsd4_op_u *u) { struct nfsd4_write *write = &u->write; + struct xdr_stream *xdr = resp->xdr; - if (xdr_stream_encode_u32(resp->xdr, write->wr_bytes_written) < 0) - return nfserr_resource; - if (xdr_stream_encode_u32(resp->xdr, write->wr_how_written) < 0) + /* count */ + nfserr = nfsd4_encode_count4(xdr, write->wr_bytes_written); + if (nfserr) + return nfserr; + /* committed */ + if (xdr_stream_encode_u32(xdr, write->wr_how_written) != XDR_UNIT) return nfserr_resource; - return nfsd4_encode_verifier4(resp->xdr, &write->wr_verifier); + /* writeverf */ + return nfsd4_encode_verifier4(xdr, &write->wr_verifier); } static __be32 diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 52322acc1e9f..43b9c53b7795 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -93,6 +93,7 @@ nfsd4_encode_uint32_t(struct xdr_stream *xdr, u32 val) #define nfsd4_encode_aceflag4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_acemask4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_acetype4(x, v) nfsd4_encode_uint32_t(x, v) +#define nfsd4_encode_count4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_mode4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_nfs_lease4(x, v) nfsd4_encode_uint32_t(x, v)