From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15103C433E1 for ; Fri, 17 Jul 2020 21:09:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E159720704 for ; Fri, 17 Jul 2020 21:09:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1kzl0sfr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kww5M3lR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726763AbgGQVJQ (ORCPT ); Fri, 17 Jul 2020 17:09:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbgGQVJQ (ORCPT ); Fri, 17 Jul 2020 17:09:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD044C0619D2; Fri, 17 Jul 2020 14:09:15 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595020153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3w+ao2j8ay23f31a30wpVaCk0kihcfgtNCvHELIfRFU=; b=1kzl0sfrZ7taaFJmHtXuxb+2+VK3RzOThFfpi6WPS/pjMerD2iOCqo4Gh7rnioDjwH1+fM AwKOHJvhwwjtvHIGTEYF5BHu23HGtbsS7pvtrnUCZ6Cuy4Kf4fz+ld0s4baEGjsd3KJE2H ER10e82G0mJ697THBRhbrYUhfv2NiXLZzEI/or0BiWM0u6GeSCt72+pIKzuidRcznDoXC8 ezclLO9EPYws2ZSEafNYRULhuO//6+Y146WjQd08qbG5UHuobz+gFoV/Qo1KaYf7KBUKDZ cvCOqikRObZX26pZSiDnkDcElVGXgGdsIt/Xvvmpdh7pyqo2JK6vRaMWG9Np3A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595020153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3w+ao2j8ay23f31a30wpVaCk0kihcfgtNCvHELIfRFU=; b=kww5M3lRBUaackEbMwnaUu4Ao/j/lsU7sZWKX2eJvhwKqoqhE6Hcxea2IS+zxjtWCk1cG+ EV4p26b8gB7gKGDQ== To: Christoph Hellwig , Al Viro , Linus Torvalds , Stephen Rothwell Cc: Luis Chamberlain , Matthew Wilcox , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 15/23] seq_file: switch over direct seq_read method calls to seq_read_iter In-Reply-To: <20200707174801.4162712-16-hch@lst.de> References: <20200707174801.4162712-1-hch@lst.de> <20200707174801.4162712-16-hch@lst.de> Date: Fri, 17 Jul 2020 23:09:13 +0200 Message-ID: <87eep9rgqu.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christoph Hellwig writes: > Switch over all instances used directly as methods using these sed > expressions: > > sed -i -e 's/\.read\(\s*=\s*\)seq_read/\.read_iter\1seq_read_iter/g' This sucks, really. I just got a patch against this converting the changed version to DEFINE_SHOW_ATTRIBUTE(somefile) and thereby removing the whole open coded gunk. If we do a tree wide change like this, then can we pretty please use a coccinelle script to convert all trivial instances to use DEFINE_SHOW_ATTRIBUTE so we don't have to touch the same place over and over. Out of 375 places changed in your patch something about 2/3rd fall into the trivial category: static int debug_stats_open(struct inode *inode, struct file *filp) { return single_open(filp, debug_stats_show, NULL); } static const struct file_operations debug_stats_fops = { .open = debug_stats_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; which can be replaced by: DEFINE_SHOW_ATTRIBUTE(debug_stats); removing 12 lines of gunk and one central place to do the iter change. I'm pretty sure that quite some of the others which have only an additional write function can be replaced by a new macro DEFINE_RW_ATTRIBUTE() or such. Needs some thought and maybe some cocci help from Julia, but that's way better than this brute force sed thing which results in malformed crap like this: static const struct file_operations debug_stats_fops = { .open = debug_stats_open, .read_iter = seq_read_iter, .llseek = seq_lseek, .release = single_release, }; and proliferates the copy and paste voodoo programming. Thanks, tglx