RE: [PATCH 09/14] d_path: introduce struct prepend_buffer
From: Justin He <hidden>
Date: 2021-06-25 00:43:40
Also in:
linux-fsdevel, linux-s390, lkml
Hi Enrico
-----Original Message----- From: Enrico Weigelt, metux IT consult <redacted> Sent: Thursday, June 24, 2021 5:30 PM To: Justin He <redacted>; Al Viro <viro@zeniv.linux.org.uk>; Linus Torvalds [off-list ref] Cc: Petr Mladek <pmladek@suse.com>; Steven Rostedt <rostedt@goodmis.org>; Sergey Senozhatsky [off-list ref]; Andy Shevchenko [off-list ref]; Rasmus Villemoes [off-list ref]; Jonathan Corbet [off-list ref]; Heiko Carstens [off-list ref]; Vasily Gorbik [off-list ref]; Christian Borntraeger [off-list ref]; Eric W . Biederman [off-list ref]; Darrick J. Wong [off-list ref]; Peter Zijlstra (Intel) [off-list ref]; Ira Weiny [off-list ref]; Eric Biggers [off-list ref]; Ahmed S. Darwish [off-list ref]; open list:DOCUMENTATION <linux- doc@vger.kernel.org>; Linux Kernel Mailing List <linux- kernel@vger.kernel.org>; linux-s390 [off-list ref]; linux- fsdevel [off-list ref] Subject: Re: [PATCH 09/14] d_path: introduce struct prepend_buffer Hi folks, <snip>quoted
quoted
We've a lot of places where we have pairs of form (pointer toendquoted
quoted
of buffer, amount of space left in front of that). These sit in pairsofquoted
quoted
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 ?
Maybe, but the struct prepend_buffer also needs to be moved into lib. Is it necessary? Is there any other user of struct prepend_buffer? -- Cheers, Justin (Jia He)