Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1385591rdb; Mon, 2 Oct 2023 08:04:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHB8Lv0JzRE5gZdxZC9LqmRNPfKgwRKjXBSZ4RO4sm+8R4evmdok6606XIprvVb+3k67NHe X-Received: by 2002:a17:90a:fe8e:b0:271:90d6:f335 with SMTP id co14-20020a17090afe8e00b0027190d6f335mr11454205pjb.25.1696259044324; Mon, 02 Oct 2023 08:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696259044; cv=none; d=google.com; s=arc-20160816; b=TdYk74WxfcGuYtPqF6wH80lo17lWnjKx9nnbPpst8LmWx/b73MwJGPJKPgwr3g+H0o lJx1ySG+ShHwuyDE7a6TF6mNECcv1fJauVL6pZefMjn5yb8XJ+C7HXqyZmLWiSHwNybs o0Ci2Ie3i2ij9S7xObpINv2Kap30dbsF1wAP9qIhzjUgzte8VKaWUQ87Mf9vBOQ76rMQ JKIT/DSeEB9+thcnYSDVafTtkw0+aNwGn6KLtt7vD0KE0sVu5FQAm/hpqhAJFm1KY0sd jnIv1LlzZ3hwMbPPwUcPmQH5Aecd4exsqO955y2JITE3g4kVd2QCnuHZEvijoYE9/xmK gS7g== 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=IVvvE9pfmzP4UoIK6fKROZtCzUgeljibcN4BksOxGis=; fh=v8a13lpFSZWlL4AptTEJnmXnlqoWXhGCGCgvrcnCT9I=; b=MF9ZY7Aquj1y0uVgAri/ZED/Zf+AgfS4JbNk7ljQUnIdRdHTw/1QalW6xBQ8uvcbjQ VcvFT+3G7uqb8e+eIgPSBJb51rBBl8peggfOPSGsdV/A9YEpNvTXz6+Gip/gKGCTNNcp uhRA770IXGtj/GtWZSy0wxV/fX9kFCaxQYRvYvogJ6DDw7+iv81a43KVJrqpvn2yFnde D9+C6IWF5NjZleHTqWu/jwdGOueyy7iXz5a+wknzoHYVEVC1Dgh1LgnERMEs607/gfoT dIJJQ4P5jP80XzZRPJtVzP/emCAiue2dWJbbRk6JTOfocretud87jpsdE9U662jPsd3z jJLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FTGX2Oww; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id r7-20020a17090a560700b0027766994586si7580133pjf.71.2023.10.02.08.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 08:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FTGX2Oww; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id A844E808A93F; Mon, 2 Oct 2023 07:51:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237881AbjJBOvf (ORCPT + 99 others); Mon, 2 Oct 2023 10:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237875AbjJBOve (ORCPT ); Mon, 2 Oct 2023 10:51:34 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA988E for ; Mon, 2 Oct 2023 07:51:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD702C433C8; Mon, 2 Oct 2023 14:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696258291; bh=0AhSkFrOERAZoJz26CpYCs5MqqGuWmGnX5QVGhtBr8k=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=FTGX2Owwnc+3T4lMY4Fodcsg+KNbOPGs1Hdawuhv6PqG9v3cnE22UXpaZ+a3QBeXe KzOAcToapCfqrd4Dg5dfIyOL0IX9ig6smjMn5w6NtlwnNUdaex0zw0GXAOC5Y4D/36 /hVrOjv8y50hZ7XB7XPGw3PYR7nvi/StzBVKzgg+BUFJuj67NB+t/8jCMAZqK4UlpG JPXIj0aAIzK6TAWqlYPMJ8x42FDliUUk/TpDA3+v+ZdhghJq/j4LCeVIAPJ4mNGgKg D3J8jy+dkC9QHvEUM+zQHor4zN0z1wgXufJBAzF7KyzXQQ+3mySVGO4Xw+FdUWrgbq w48XZoyX91aSA== Subject: [PATCH v1 3/4] NFSD: Restructure nfsd4_encode_create_session() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 02 Oct 2023 10:51:30 -0400 Message-ID: <169625829068.1640.10434820352878652525.stgit@klimt.1015granger.net> In-Reply-To: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> References: <169625819958.1640.14102064750083176117.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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 02 Oct 2023 07:51:35 -0700 (PDT) From: Chuck Lever Convert nfsd4_encode_create_session() to use the conventional XDR encoding utilities. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 21 ++++++++++++--------- fs/nfsd/xdr4.h | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 01820492c013..505f397a6e5b 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4822,16 +4822,19 @@ nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr, { struct nfsd4_create_session *sess = &u->create_session; struct xdr_stream *xdr = resp->xdr; - __be32 *p; - - p = xdr_reserve_space(xdr, 24); - if (!p) - return nfserr_resource; - p = xdr_encode_opaque_fixed(p, sess->sessionid.data, - NFS4_MAX_SESSIONID_LEN); - *p++ = cpu_to_be32(sess->seqid); - *p++ = cpu_to_be32(sess->flags); + /* csr_sessionid */ + nfserr = nfsd4_encode_sessionid4(xdr, &sess->sessionid); + if (nfserr != nfs_ok) + return nfserr; + /* csr_sequence */ + nfserr = nfsd4_encode_sequenceid4(xdr, sess->seqid); + if (nfserr != nfs_ok) + return nfserr; + /* csr_flags */ + nfserr = nfsd4_encode_uint32_t(xdr, sess->flags); + if (nfserr != nfs_ok) + return nfserr; /* csr_fore_chan_attrs */ nfserr = nfsd4_encode_channel_attrs4(xdr, &sess->fore_channel); if (nfserr != nfs_ok) diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index a9ff01034ac1..7983eb679ba7 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -96,6 +96,7 @@ nfsd4_encode_uint32_t(struct xdr_stream *xdr, u32 val) #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) +#define nfsd4_encode_sequenceid4(x, v) nfsd4_encode_uint32_t(x, v) /** * nfsd4_encode_uint64_t - Encode an XDR uint64_t type result