Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp980477rwb; Thu, 22 Sep 2022 08:39:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YF09q4ySQKG6/1ULDd2LBj1q+C6gXTaNoeS2FI9V/K9EDbC1/wuRm7aQxL3E7XSKv8UkS X-Received: by 2002:a05:6402:3547:b0:451:3be6:d55b with SMTP id f7-20020a056402354700b004513be6d55bmr3939452edd.57.1663861178060; Thu, 22 Sep 2022 08:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663861178; cv=none; d=google.com; s=arc-20160816; b=oINhWbzNDD+EinQIpEBlMNIsfATEhO4aNIatBKOdJxAHBaFhfdHDTCBKj2p9ik1DyK 6upILMmuXRRMtcve1qu+g/EsTHh/y4tlGLpD6OUCTu6oyLab69RHVfGj33HnjfY3dU+d KhlStMizd58OwJFXoo/kiXn2Z6STPtnmLHYlEqTx7TTfG9KMLv1R9Qgp8ZNEVL3C5PUS s4T2zlCViOuAfXGa0mYL763iEjRfSXrefQgmkbwZl81AssRplG5pI7wzbexwkmHiNtE8 qe+MPSfpVhdrU0SW0eZjh4p93Z+AFXbaSq/0wpWVvjVRS0BixPkQZZiol6jp2q8VdX25 MA+Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TtgxK6ckaBCWwoLG2OnTqcXv+V6COTjwN1wqmgFHSPU=; b=D+qZxGZC0Y4iVGrqllkjHFINhCYnnGzkCHPH5HOZbqk+p/B051HDSPBS6lS28teWa/ xc06IdScaokQopWISD0STFJKQCWA6r/v/f1cSF2y3hzrnq0NnZVTY2TceGJtSoKYhi30 CMlMeJ7o66amvJZN+RzcVpcDJppydtSYDHaRiejp1GLClORHYOlvg7giiQN90/v1GEkc Q5YZIAah0M8xys2/QN5X7Twwg+lTLQ/smsYsnly3JWpQxCQtyV1/2lsIAd9PA5vpXTjg 81GE5DLd8FhL6S9vwGHnkwEMcfM8JqYQbkr+IUjaaJ8v8Nx/Mo77XwKLqrnKwhhIq3Vb mYRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a1709064fc700b0077d56246329si5929519ejw.404.2022.09.22.08.39.04; Thu, 22 Sep 2022 08:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbiIVPb2 (ORCPT + 99 others); Thu, 22 Sep 2022 11:31:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231990AbiIVPb0 (ORCPT ); Thu, 22 Sep 2022 11:31:26 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24F47FB330; Thu, 22 Sep 2022 08:31:24 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MYK013XH9zlXMy; Thu, 22 Sep 2022 23:27:13 +0800 (CST) Received: from kwepemm600015.china.huawei.com (7.193.23.52) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 23:31:22 +0800 Received: from huawei.com (10.175.101.6) by kwepemm600015.china.huawei.com (7.193.23.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 23:31:21 +0800 From: ChenXiaoSong To: , CC: , , , , Subject: [PATCH 3/5] nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops Date: Fri, 23 Sep 2022 00:31:54 +0800 Message-ID: <20220922163156.2027440-4-chenxiaosong2@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220922163156.2027440-1-chenxiaosong2@huawei.com> References: <20220922163156.2027440-1-chenxiaosong2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600015.china.huawei.com (7.193.23.52) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code. inode is converted from seq_file->file instead of seq_file->private in client_info_show(). Signed-off-by: ChenXiaoSong --- fs/nfsd/nfs4state.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c5d199d7e6b4..4017721a04c7 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2478,7 +2478,7 @@ static const char *cb_state2str(int state) static int client_info_show(struct seq_file *m, void *v) { - struct inode *inode = m->private; + struct inode *inode = file_inode(m->file); struct nfs4_client *clp; u64 clid; @@ -2518,17 +2518,7 @@ static int client_info_show(struct seq_file *m, void *v) return 0; } -static int client_info_open(struct inode *inode, struct file *file) -{ - return single_open(file, client_info_show, inode); -} - -static const struct file_operations client_info_fops = { - .open = client_info_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(client_info); static void *states_start(struct seq_file *s, loff_t *pos) __acquires(&clp->cl_lock) -- 2.31.1