Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1777859imm; Wed, 16 May 2018 02:58:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoTafZUpiACxxVCa6Ts2hrOHkbOTeRlhoxKXvj/0FKB2ewXpj30pZGsIaB907LGNvGB2hJr X-Received: by 2002:a62:9c93:: with SMTP id u19-v6mr240131pfk.74.1526464697405; Wed, 16 May 2018 02:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526464697; cv=none; d=google.com; s=arc-20160816; b=09X5bh1DULut0AwWcU9FWxCogjcRdhGWJOr3p9jnkvOKNcw787XP5AkfCWmRFPpuF8 IZnHR6O5ReJWLMttWqduen3DqqgIbcvLgPKShKiSKUQV8d5rKHvpVTlOuIfjFX63ZzMO qW5AnYgFxWwcOclweISWuzqkPHVcC2Ml4lvKkajGLHkxb6/OZtEmny7GdZU+V6eizYVS aH4mDANOuMLS8pFXcqSbdr7W7VZhGd8zURS7CgTE7iRl0ULBRrloYU3qKZgYSIoa5SDA B54W/r3qt1ViJ0GDOuFl1xzbfZfNkc2JyVevVfv44oNuhBQwdGQ5sIzou80rG28vzXKl PFSA== 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=SNrHWn9W2FuYRWu3VqtGPQFh08ahxN+WgYaSaDAmjZA=; b=mYRgRYIT/T9T4Apo0NKXdE0dgzh2gRRZbCUIQ6JuPAwLsUT0GTMEJr/jQDPmic3+zk Mxr9h1+pLnoCRfLOSQtHuXbOyHw0LxHWLWzQyh7Nf5CgzjcD42bEomAjyZvhJ0O2guL/ IRA3ZAyDhAPKRLKKZKfDZGxXQPDXyrC2HpAFuQjJzeSYdnsg0qp4sU996PqeJJsf71EV CRlhg0VQDOb7Xb4BmlFNU03UfP+1SC2LY+3EoyeB6O151l2rnjftQeD5S+LnVwfuajh0 6amRuSIxAtlsC03RXdpmYpgh3QwCgdb0hOCEFhxDJB/nXQUnPBTKTfIFIZrOkYy+Y8SQ Y5gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bkIfeJBa; 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 b9-v6si2064085pli.427.2018.05.16.02.58.03; Wed, 16 May 2018 02:58:17 -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=bkIfeJBa; 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 S1753339AbeEPJ4D (ORCPT + 99 others); Wed, 16 May 2018 05:56:03 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48226 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752358AbeEPJqc (ORCPT ); Wed, 16 May 2018 05:46:32 -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=SNrHWn9W2FuYRWu3VqtGPQFh08ahxN+WgYaSaDAmjZA=; b=bkIfeJBaFmB+eKwzTiheFCyfm NLhK/uaGEC0FK71DSngrFKuN8IfENr56C3ed69FXYto2qrHZTmx96r+sc1oToT5wZQZ3ZZrDXyByp Zb3n0rd9NTJDPWVe7ATYOaosPw9GK1rP5fHN5h3d+iGiBlP9mQHG8dyEMe+nguN57YvMCpD/GzKrp 0akntE8AhQyVXwilZSFkkUOCdAeXFpKfrmyZYH6/OOcbo9HwHeCHsjDVO9CcuXSukocFdYqfvoE6B STwjKbUNxNphOMnr+y2UGMZUWIloq6cK0qf39aheEKn943+PVQaLaNvE+/Ie5Etx/iMztyrHkHk2+ 97URcwnqg==; 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 1fIt0j-0007xa-Ik; Wed, 16 May 2018 09:46:18 +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 34/42] netfilter/x_tables: switch to proc_create_seq_private Date: Wed, 16 May 2018 11:43:38 +0200 Message-Id: <20180516094346.20506-35-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 remove proc boilerplate code. Signed-off-by: Christoph Hellwig --- net/netfilter/x_tables.c | 42 ++++++---------------------------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 344dd01a5027..0e314f95a4a3 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -1648,22 +1648,6 @@ static const struct seq_operations xt_match_seq_ops = { .show = xt_match_seq_show, }; -static int xt_match_open(struct inode *inode, struct file *file) -{ - struct nf_mttg_trav *trav; - trav = __seq_open_private(file, &xt_match_seq_ops, sizeof(*trav)); - if (!trav) - return -ENOMEM; - return 0; -} - -static const struct file_operations xt_match_ops = { - .open = xt_match_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_private, -}; - static void *xt_target_seq_start(struct seq_file *seq, loff_t *pos) { return xt_mttg_seq_start(seq, pos, true); @@ -1698,22 +1682,6 @@ static const struct seq_operations xt_target_seq_ops = { .show = xt_target_seq_show, }; -static int xt_target_open(struct inode *inode, struct file *file) -{ - struct nf_mttg_trav *trav; - trav = __seq_open_private(file, &xt_target_seq_ops, sizeof(*trav)); - if (!trav) - return -ENOMEM; - return 0; -} - -static const struct file_operations xt_target_ops = { - .open = xt_target_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_private, -}; - #define FORMAT_TABLES "_tables_names" #define FORMAT_MATCHES "_tables_matches" #define FORMAT_TARGETS "_tables_targets" @@ -1787,8 +1755,9 @@ int xt_proto_init(struct net *net, u_int8_t af) strlcpy(buf, xt_prefix[af], sizeof(buf)); strlcat(buf, FORMAT_MATCHES, sizeof(buf)); - proc = proc_create_data(buf, 0440, net->proc_net, &xt_match_ops, - (void *)(unsigned long)af); + proc = proc_create_seq_private(buf, 0440, net->proc_net, + &xt_match_seq_ops, sizeof(struct nf_mttg_trav), + (void *)(unsigned long)af); if (!proc) goto out_remove_tables; if (uid_valid(root_uid) && gid_valid(root_gid)) @@ -1796,8 +1765,9 @@ int xt_proto_init(struct net *net, u_int8_t af) strlcpy(buf, xt_prefix[af], sizeof(buf)); strlcat(buf, FORMAT_TARGETS, sizeof(buf)); - proc = proc_create_data(buf, 0440, net->proc_net, &xt_target_ops, - (void *)(unsigned long)af); + proc = proc_create_seq_private(buf, 0440, net->proc_net, + &xt_target_seq_ops, sizeof(struct nf_mttg_trav), + (void *)(unsigned long)af); if (!proc) goto out_remove_matches; if (uid_valid(root_uid) && gid_valid(root_gid)) -- 2.17.0