Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1773580imm; Wed, 16 May 2018 02:53:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZow01+l5Kg3DirBKRrDyHqg8X2S6rpsqqQOJvTUB1PrUc72kQ2rw5eJz67EU18K2mvM2cXE X-Received: by 2002:a62:1083:: with SMTP id 3-v6mr169601pfq.229.1526464391000; Wed, 16 May 2018 02:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526464390; cv=none; d=google.com; s=arc-20160816; b=D2m9AqmR1uUgW/FZTgKG+jKkHlc5ahI1Ey9EA6+DqnZt2PBaq8cqf5Ff8n7D4q5jvK l/9W1ScG5ruRfMh3Gp5OANduTcw87pCkIFgcxJl0hBr/zF9xWqkrTsmgAPxbdDxxxpk2 FdBtAURdf4Co0SBp2Eni6e2Byq7BPjjFnIMCq040jctH8Bo9EW2J9/OUABPHyrndU7m3 IjOafQ9VFFY+NhJFt0ZHPnImHmFrr+Rn6BvVQbUmLTaAwC2Fer05bnazo18s67uPy4qu FnFRpat7XUOj029PEf/x1OYCSxfc+hFbEt7f941K3BsH2Shv+iTlEY8xMNvtvDuqNRfe jsPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TRt1lG3OdxJRpIpf7RcWczklpOtBBYajuntYc4OKW8c=; b=EG+lXQsOC/gVnJMcAZ7Vt4GjfTj2HiEE/gSSojOFEg6jmKdo1tPtix1PqP2Jf0oDS2 WOUSN/X51GHLfGo0QBrzoTlmqua6HpmjdcJ8Z63oP8wUoLGR0dZHYzdgvHDrr5XmIEJB RXtY8u8ytKgyVoOlzeZXlLuuqmpeS4yeDtgDieR9uZB5b4DpMAJhgVBRifsflGnxWUnC 3yYuKCMnHIaF5ne1JLqBVTwFnkLs7ncWpYpns1T/+uxUBPrbUzpMehTOKr+0axWE5D3Y Yljxhvyg/ywdYy5aazcB/94TuG0eI3V86CMIKsdtMB6+Bn1PISoiTTkzjr7R/IvYeioZ ncbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nqzLA+Wk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b61-v6si2206967plc.500.2018.05.16.02.52.57; Wed, 16 May 2018 02:53:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nqzLA+Wk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107AbeEPJu5 (ORCPT + 99 others); Wed, 16 May 2018 05:50:57 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48502 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753198AbeEPJq4 (ORCPT ); Wed, 16 May 2018 05:46:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TRt1lG3OdxJRpIpf7RcWczklpOtBBYajuntYc4OKW8c=; b=nqzLA+Wka4Oj6Y26a7dgSu+H7 ld7/7BOvF7tK/oJEfvJuLJqnTG86DRtTwOO3ONjFOiFca1HgtX0RiYPVGfdxUqCGkOMvKlp/n8aoZ pl3KGzEMCgQ99VShrmUOOSTzK4z0zBie4HAsPjCQuy5So+pMGxfWqkiW+26ZmJ0TgNupW2KNn7/lD BYowxXpDQSJEk1IyMM4wmtHf5M5GMEC/TwrYqpL13eG3zZoJTkb9JP+kLhUKhCfSU6P0Dg4x5mSfA rd0job4HngpnVgEV4GkSchkbxNTpnpHhIOgkwdbmPHmruys8wl7D0HG8d/BYFq2ct7I8+pkyNsKwA 3nOSbhaIA==; Received: from 089144199016.atnat0008.highway.a1.net ([89.144.199.16] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIt0b-0007v7-2M; Wed, 16 May 2018 09:46:09 +0000 From: Christoph Hellwig To: Andrew Morton , Alexander Viro Cc: Alexey Dobriyan , Greg Kroah-Hartman , Jiri Slaby , Alessandro Zummo , Alexandre Belloni , linux-acpi@vger.kernel.org, drbd-dev@lists.linbit.com, linux-ide@vger.kernel.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, devel@driverdev.osuosl.org, linux-afs@lists.infradead.org, linux-ext4@vger.kernel.org, jfs-discussion@lists.sourceforge.net, netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 32/42] neigh: switch to proc_create_seq_data Date: Wed, 16 May 2018 11:43:36 +0200 Message-Id: <20180516094346.20506-33-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516094346.20506-1-hch@lst.de> References: <20180516094346.20506-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org And use proc private data directly instead of doing a detour through seq->private. Signed-off-by: Christoph Hellwig --- net/core/neighbour.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ce519861be59..1fb43bff417d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -59,7 +59,7 @@ static int pneigh_ifdown_and_unlock(struct neigh_table *tbl, struct net_device *dev); #ifdef CONFIG_PROC_FS -static const struct file_operations neigh_stat_seq_fops; +static const struct seq_operations neigh_stat_seq_ops; #endif /* @@ -1558,8 +1558,8 @@ void neigh_table_init(int index, struct neigh_table *tbl) panic("cannot create neighbour cache statistics"); #ifdef CONFIG_PROC_FS - if (!proc_create_data(tbl->id, 0, init_net.proc_net_stat, - &neigh_stat_seq_fops, tbl)) + if (!proc_create_seq_data(tbl->id, 0, init_net.proc_net_stat, + &neigh_stat_seq_ops, tbl)) panic("cannot create neighbour proc dir entry"); #endif @@ -2786,7 +2786,7 @@ EXPORT_SYMBOL(neigh_seq_stop); static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) { - struct neigh_table *tbl = seq->private; + struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); int cpu; if (*pos == 0) @@ -2803,7 +2803,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) static void *neigh_stat_seq_next(struct seq_file *seq, void *v, loff_t *pos) { - struct neigh_table *tbl = seq->private; + struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); int cpu; for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) { @@ -2822,7 +2822,7 @@ static void neigh_stat_seq_stop(struct seq_file *seq, void *v) static int neigh_stat_seq_show(struct seq_file *seq, void *v) { - struct neigh_table *tbl = seq->private; + struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); struct neigh_statistics *st = v; if (v == SEQ_START_TOKEN) { @@ -2861,25 +2861,6 @@ static const struct seq_operations neigh_stat_seq_ops = { .stop = neigh_stat_seq_stop, .show = neigh_stat_seq_show, }; - -static int neigh_stat_seq_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &neigh_stat_seq_ops); - - if (!ret) { - struct seq_file *sf = file->private_data; - sf->private = PDE_DATA(inode); - } - return ret; -}; - -static const struct file_operations neigh_stat_seq_fops = { - .open = neigh_stat_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - #endif /* CONFIG_PROC_FS */ static inline size_t neigh_nlmsg_size(void) -- 2.17.0