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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 8DBB3C49EA5 for ; Thu, 24 Jun 2021 09:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63580613EE for ; Thu, 24 Jun 2021 09:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbhFXJdz (ORCPT ); Thu, 24 Jun 2021 05:33:55 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:57041 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230438AbhFXJdy (ORCPT ); Thu, 24 Jun 2021 05:33:54 -0400 Received: from [192.168.1.155] ([77.7.27.132]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M1aQN-1lzNx301vv-0038oh; Thu, 24 Jun 2021 11:30:02 +0200 Subject: Re: [PATCH 09/14] d_path: introduce struct prepend_buffer To: Justin He , Al Viro , Linus Torvalds Cc: Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , "Eric W . Biederman" , "Darrick J. Wong" , "Peter Zijlstra (Intel)" , Ira Weiny , Eric Biggers , "Ahmed S. Darwish" , "open list:DOCUMENTATION" , Linux Kernel Mailing List , linux-s390 , linux-fsdevel References: <20210519004901.3829541-1-viro@zeniv.linux.org.uk> <20210519004901.3829541-9-viro@zeniv.linux.org.uk> From: "Enrico Weigelt, metux IT consult" Message-ID: Date: Thu, 24 Jun 2021 11:29:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:sfvpKXDvULCjkaT9y937Ne5z1GzyOh9VPvzaOLJhF711BVKrxXE f7pUlG4so5Lu5QVaxlpQ2EL9HlPzxRK+AUMobdzoHIoDqRHY1aZB144FoW/ZwiXoEgl48ze AGdnd2i+XzkZyMjmzkqaZNScRJjYVhQ245nlW5NIEt2vw7fLjJq9X4kI4JwNVnJv+1YTwOq dC5faiBRfFkNqGZh+sv/A== X-UI-Out-Filterresults: notjunk:1;V03:K0:veNOQNF1Dic=:Bw67innQLSKyp38PPApyoz qkcVF04DbgFNG6/wlk4Q6bSVdWbcXxklL5Rt32Vr1L0tXBqbrTfJAgsnBZkCHfqdYwIinD2xs Tn0x1VjHNWOT+9rOglTzxbnuSByKb2XDsa6CXqGPYo5cbiGdC/8aehbtBsftzci2SCZYBip/k TOrplAElsbpsxalCqChiK4APit7eK4g+l0Joen26PAMan8wD1N8j0ysMN2vVYdbk2qIYXUke/ lyNh9KE70mmCBoteyuN5vBMikoAhincbsmp9SEjqiKS5De4DkIY1QH9UVxItKrIDlaI9pfEHD VZ5TJdTSlKliAEIdjj2G0dsofuk8GpnoYWg37blWDuMwESvj7/iSFa0bKbCaWiMuxuvEdD7Fr FBJJoe/Ulm0jSvmdh1WGloCnW7AbngUjUCVesgkNH780rg5CiIJ/Tz0YqFQ2mHTCPdKIjuywk eKqI1GOY3s6TzBTc8J/QXuYAs15vPEGjpuCWjpDXmCcCQk9UNe3Nubc+AIumK6pQTogzKJoam ZNIOVYJtMSeljuF3KU57jY= Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org Hi folks, >> We've a lot of places where we have pairs of form (pointer to end >> of buffer, amount of space left in front of that). These sit in pairs of >> variables located next to each other and usually passed by reference. >> Turn those into instances of new type (struct prepend_buffer) and pass >> reference to the pair instead of pairs of references to its fields. >> >> Declared and initialized by DECLARE_BUFFER(name, buf, buflen). >> >> extract_string(prepend_buffer) returns the buffer contents if >> no overflow has happened, ERR_PTR(ENAMETOOLONG) otherwise. >> All places where we used to have that boilerplate converted to use >> of that helper. this smells like a generic enough thing to go into lib, doesn't it ? --mtx -- --- Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren GPG/PGP-Schlüssel zu. --- Enrico Weigelt, metux IT consult Free software and Linux embedded engineering info@metux.net -- +49-151-27565287