Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp981546rwb; Thu, 22 Sep 2022 08:40:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ef+JyPBXWLSdXF/WrijGC9taLkjyHmYkhAqegVt5/5FU7ZK1j5VlKbnietdFmJ1pab+IU X-Received: by 2002:a17:90a:e513:b0:200:2275:2d27 with SMTP id t19-20020a17090ae51300b0020022752d27mr4443346pjy.162.1663861222542; Thu, 22 Sep 2022 08:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663861222; cv=none; d=google.com; s=arc-20160816; b=XhqeSxuFHRyE9d3fB6Kf4MwEGMSWF2H3cnP1dtyl2xGXJ+QpdbuC8LBJgDzD1+QKwk Hl4MaZ5EEdzHaovXFBdCIUVldjGxiI3nJqZEbGS1V8fuj2kDfrAbPh3o/m3oFkB4cYN8 6ERzWjJMhirn0Jy/1fhcFfbk5lCKsBf7AOeufPKf7QJFHEq9I1asejZ0vC2z5avD9Lva 0SBOX5cjarpgp6lnCUeOu/oaMaFT07HGlYjJxV2biP8PUzIRhQO18t9CPQKBEw+8sskR IOAk0CUX3Hqwatr64bM2kXsnklcp21OLvyfk30hB4fIsnzvrMgp/Tt6z7SwObWXybzkN sQDQ== 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=1PuDN/66gpLJeXgsiPwTzE8Dge/tMXQdcK24Ety8rIU=; b=VSuvQO+FnwZS2+ivYN6cQiUdWyB2Xxsnk4kVGmnys8MelODCSjkjb79iyQ+F1GQ8b4 DAcrQyGpnZJ0iHbaFSnEKyXazZHOY2vWmqiFoXtPetWpxudEoXAmgFnkeUiG7WrUzzQq JSETE4iS3rJiobq9YusZp8iw4W4i9BSQ3c3PSDMS9ks/qMNdqqxRwtLTt9ReKKYnRiIo RTLSfJ9uOsCgqoVHpe5LuqGymroVye53++138zojB75IhUeyNh3lKmx5GN0+tfPUk28s nuctnkVuSKk9q8Fgw/sIfoWSG9w+NfIGSrAHvhfVOsmLhvjeXGiDdkfneMIY31GQvVIj Pcog== 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 b189-20020a6334c6000000b0043961d06a20si6783999pga.592.2022.09.22.08.40.01; Thu, 22 Sep 2022 08:40:22 -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 S231939AbiIVPb0 (ORCPT + 99 others); Thu, 22 Sep 2022 11:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbiIVPbY (ORCPT ); Thu, 22 Sep 2022 11:31:24 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E59BFB317; Thu, 22 Sep 2022 08:31:23 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MYK0C3gL3zWgvF; Thu, 22 Sep 2022 23:27:23 +0800 (CST) Received: from kwepemm600015.china.huawei.com (7.193.23.52) by dggemv711-chm.china.huawei.com (10.1.198.66) 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:20 +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:19 +0800 From: ChenXiaoSong To: , CC: , , , , Subject: [PATCH 1/5] nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE to define nfsd_proc_ops Date: Fri, 23 Sep 2022 00:31:52 +0800 Message-ID: <20220922163156.2027440-2-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_PROC_SHOW_ATTRIBUTE helper macro to simplify the code. Signed-off-by: ChenXiaoSong --- fs/nfsd/stats.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index a8c5a02a84f0..777e24e5da33 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c @@ -32,7 +32,7 @@ struct svc_stat nfsd_svcstats = { .program = &nfsd_program, }; -static int nfsd_proc_show(struct seq_file *seq, void *v) +static int nfsd_show(struct seq_file *seq, void *v) { int i; @@ -72,17 +72,7 @@ static int nfsd_proc_show(struct seq_file *seq, void *v) return 0; } -static int nfsd_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, nfsd_proc_show, NULL); -} - -static const struct proc_ops nfsd_proc_ops = { - .proc_open = nfsd_proc_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = single_release, -}; +DEFINE_PROC_SHOW_ATTRIBUTE(nfsd); int nfsd_percpu_counters_init(struct percpu_counter counters[], int num) { -- 2.31.1