Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp69768rdb; Mon, 18 Sep 2023 08:28:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4RgsEwXcH0J81W0zkVylltPMgJmVOI+qkgcxMtuBNQPxc4nlb4swN+BdMMFyJ2GTV0HCG X-Received: by 2002:a17:902:f54c:b0:1bf:7d3b:4405 with SMTP id h12-20020a170902f54c00b001bf7d3b4405mr7437514plf.14.1695050919795; Mon, 18 Sep 2023 08:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695050919; cv=none; d=google.com; s=arc-20160816; b=ZmgRCBzCHWuHsDEa80N/BclJ1a9gDvOFnoYCbpB4UEq2tpWFbR9ihQbdZK74O7Hn1f 5B1jm9AStCecENfnngZbXuSyvBghk/Jy6jVuwgYeeJMnKlJumhCGRnUOLoPUra4D+MXu UAquoosJKeaRE7p/ZpjUPBclIJMKb3wWhH0vu8H9GBIWTTTSxOdtso2T0dOzT/EhM5CO SaFmvlWHVeRAslKFo7Zx/KJJlWM5qd/5UAJ6syJjVKeiSbz97WcOrKyi7eoUzFuf+O34 A2hEgMl1EjOuAHCZ2w/yIhXgUTlAmo4UgKZMs2Twf5XbO0/wICy9vyyU2mjyP4RSsUA5 yH3A== 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=azySQUKC2wZ+6yFWViW36crD+qk5DZ15S36nQPYsK88=; fh=v8a13lpFSZWlL4AptTEJnmXnlqoWXhGCGCgvrcnCT9I=; b=wtTvgTXNGLp7ZyfYwyp+C94DADvcXr+MSPwnk3txdVWKfqRgMY9yovZXNj9Z26MTlQ GjBlFTVzQdNVJuhYi66oafJ8BB1JWRqe/WkAw9sgtAZSePke7njLa6OhesD2iebcp4gF XSyG3JY91D6xLSUTjJMNZPaqjcs2LdPcei/3Z3fAwJJO0s6cDecA5E52+PX6kG5tuDtK Gj8N8NlpX2Pcb1pRJX+Jd8akc+KZYiUUN4TitZiXUg0gE/KFd2Pj6hOvwJFrBXhl8l4a 38QtE4N5A8ksnkAuP7gNXnj2WtPpgOSq53kNIj7GjNgEXscDUx06BSvOZwL43c/pqOxr 2Dsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kDQFiNm3; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.31 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. [23.128.96.31]) by mx.google.com with ESMTPS id e5-20020a17090301c500b001bbc7ed95efsi8625824plh.44.2023.09.18.08.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 08:28:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kDQFiNm3; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.31 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 B164E81DE6B2; Mon, 18 Sep 2023 08:25:37 -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 S229731AbjIRPZj (ORCPT + 99 others); Mon, 18 Sep 2023 11:25:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbjIRPZj (ORCPT ); Mon, 18 Sep 2023 11:25:39 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF420112 for ; Mon, 18 Sep 2023 08:23:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AE35C16ABD; Mon, 18 Sep 2023 14:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695045708; bh=8CPNAvxyxVIf7F9VE53I/wnnOhhBYNY6uynGY3wEaJ8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=kDQFiNm3y2s0C2V0eWQayIgKCwuLXHlmHYh+WOLCrbvXwIgvRLHnJMINyJirk2op8 +5jcAzlHX7qEGItH4SAW7iACWluBb91N3PQII73yGijIMsmdL1L8GHHoVGs6oUzDIF Uj9cxB6djweaKuqYoz2ODpXvpcMF9r3NL12uI9n3WNadOLB9k5vvWwO9bEUIAXZUQ8 eYRBRmsW6Jc68FLi2BQQ5p/smMYR0iMmrU77uN/+MiUud4zB2Q+UjfGOuR/pRBS6sw UMVooQXGOBbi9P9f6i9EV4kDlwwbk7sj4LpylXLJBnqt4IPWhxQOXbLDpe5dBko8oh /Id4w3SuPL/JQ== Subject: [PATCH v1 47/52] NFSD: Add nfsd4_encode_fattr4_suppattr_exclcreat() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 18 Sep 2023 10:01:47 -0400 Message-ID: <169504570724.133720.15944434921909768890.stgit@manet.1015granger.net> In-Reply-To: <169504501081.133720.4162400017732492854.stgit@manet.1015granger.net> References: <169504501081.133720.4162400017732492854.stgit@manet.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, 18 Sep 2023 08:25:37 -0700 (PDT) From: Chuck Lever Refactor the encoder for FATTR4_SUPPATTR_EXCLCREAT into a helper. In a subsequent patch, this helper will be called from a bitmask loop. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index aca0301dc949..02a28d07d6e4 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3319,6 +3319,20 @@ static __be32 nfsd4_encode_fattr4_layout_blksize(struct xdr_stream *xdr, #endif +static __be32 nfsd4_encode_fattr4_suppattr_exclcreat(struct xdr_stream *xdr, + const struct nfsd4_fattr_args *args) +{ + struct nfsd4_compoundres *resp = args->rqstp->rq_resp; + u32 supp[3]; + + memcpy(supp, nfsd_suppattrs[resp->cstate.minorversion], sizeof(supp)); + supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0; + supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1; + supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2; + + return nfsd4_encode_bitmap4(xdr, supp[0], supp[1], supp[2]); +} + /* * Note: @fhp can be NULL; in this case, we might have to compose the filehandle * ourselves. @@ -3692,14 +3706,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, } #endif /* CONFIG_NFSD_PNFS */ if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) { - u32 supp[3]; - - memcpy(supp, nfsd_suppattrs[minorversion], sizeof(supp)); - supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0; - supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1; - supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2; - - status = nfsd4_encode_bitmap4(xdr, supp[0], supp[1], supp[2]); + status = nfsd4_encode_fattr4_suppattr_exclcreat(xdr, &args); if (status) goto out; }