From patchwork Sun May 6 17:19:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 10382909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08DF46037F for ; Sun, 6 May 2018 17:20:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC981287DE for ; Sun, 6 May 2018 17:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0B7528ABE; Sun, 6 May 2018 17:20:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0938287DE for ; Sun, 6 May 2018 17:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824AbeEFRT6 (ORCPT ); Sun, 6 May 2018 13:19:58 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34739 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769AbeEFRTy (ORCPT ); Sun, 6 May 2018 13:19:54 -0400 Received: by mail-wr0-f176.google.com with SMTP id p18-v6so25679409wrm.1; Sun, 06 May 2018 10:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1TQidRaHChtHzOFqccL97UDeuyfYvSeYjOKbZpSeKdE=; b=eKiF2K6n7YmqedpTwMygd/8/erMyDijVrHxu058c1EZPVSPfmXehiWWwqFGqN+wlpT UJIOZk0gaTLFpN2K2lKjSGPhDgsLSaR/dS3tB81n1kKyHEB1hz4XFeT4O9VXDVT7PJhL 9+FKyERagfLPAgbldZ5LGBmAMQHjP75KrWBcTkW+CMPfJFw87tb1kblXXULWTW3YE2Rp 6AoDfogTPeWr0EH2MMhw1qGXOz3kUoXs0+la+nAZOTEWLfJa7bfVsjaWj9ELo7kjZ7vv 0ESDjC6OVAGQiAmGuALdpjEfa8hYEC42UYqThUws4jxqOZlomDDWL8KF/i8LZFqr7VAV aGSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1TQidRaHChtHzOFqccL97UDeuyfYvSeYjOKbZpSeKdE=; b=iHZ6lcDPpgO2b2drlwcHkqlcrGmv10v/F2gXxUEdFiVEjdmYe/MggPezmn1LeVbB+c U/xJLiU+kvo6PSMxQVe7Ir40HWc/Bd4tUc6QoAQF1hoVhlgOTpsRAGdDAxQOASny4k3A TImLtUbD3GNQGU8XSRIFKGLIUvSEjesNnvYMESe3c9nQnjGYTcsMt4hvd7KIuKwJN/2h WIKVyZMGdxAcZQI5MIUuRdnGvWGmg13Yn2ADMADztIqvOGtWdTKjlgXM7TXZx9PnO8Gx T8ykWjnzBobhdgleukf9zDovTu2HLLe2kgXMQmAWWfixf64aIpoPVfQr0tOMW/hwPYJx pq5A== X-Gm-Message-State: ALQs6tBMRpBxZSSIqYwB6pOlgYhm7UNcdZ+S76b8FXsbfInJPcSzrv21 wuP8tspwlbvcBfa2n/0trg== X-Google-Smtp-Source: AB8JxZptpObpLtHoPuLPIpyt52iLN28pgxu+mLP5jSnIsyDPvREA389U90vzOuNV5uGMYPApStTBmw== X-Received: by 2002:adf:86b2:: with SMTP id 47-v6mr26948810wrx.256.1525627192659; Sun, 06 May 2018 10:19:52 -0700 (PDT) Received: from avx2 (nat4-minsk-pool-46-53-177-92.telecom.by. [46.53.177.92]) by smtp.gmail.com with ESMTPSA id s5-v6sm10474397wra.48.2018.05.06.10.19.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 May 2018 10:19:51 -0700 (PDT) Date: Sun, 6 May 2018 20:19:49 +0300 From: Alexey Dobriyan To: Christoph Hellwig Cc: Andrew Morton , Alexander Viro , 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: Re: simplify procfs code for seq_file instances V2 Message-ID: <20180506171948.GA769@avx2> References: <20180425154827.32251-1-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180425154827.32251-1-hch@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Apr 25, 2018 at 05:47:47PM +0200, Christoph Hellwig wrote: > Changes since V1: > - open code proc_create_data to avoid setting not fully initialized > entries live > - use unsigned int for state_size Need this to maintain sizeof(struct proc_dir_entry): Otherwise ACK fs/proc/ part. diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 6d171485c45b..a318ae5b36b4 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -48,8 +48,8 @@ struct proc_dir_entry { const struct seq_operations *seq_ops; int (*single_show)(struct seq_file *, void *); }; - unsigned int state_size; void *data; + unsigned int state_size; unsigned int low_ino; nlink_t nlink; kuid_t uid; @@ -62,9 +62,9 @@ struct proc_dir_entry { umode_t mode; u8 namelen; #ifdef CONFIG_64BIT -#define SIZEOF_PDE_INLINE_NAME (192-139) +#define SIZEOF_PDE_INLINE_NAME (192-155) #else -#define SIZEOF_PDE_INLINE_NAME (128-87) +#define SIZEOF_PDE_INLINE_NAME (128-95) #endif char inline_name[SIZEOF_PDE_INLINE_NAME]; } __randomize_layout; diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index baf1994289ce..7d94fa005b0d 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c @@ -40,7 +40,7 @@ static struct net *get_proc_net(const struct inode *inode) static int seq_open_net(struct inode *inode, struct file *file) { - size_t state_size = PDE(inode)->state_size; + unsigned int state_size = PDE(inode)->state_size; struct seq_net_private *p; struct net *net;