Messages in this thread | | | From | Justin He <> | Subject | RE: [PATCH 09/14] d_path: introduce struct prepend_buffer | Date | Fri, 25 Jun 2021 00:43:22 +0000 |
| |
Hi Enrico
> -----Original Message----- > From: Enrico Weigelt, metux IT consult <lkml@metux.net> > Sent: Thursday, June 24, 2021 5:30 PM > To: Justin He <Justin.He@arm.com>; Al Viro <viro@zeniv.linux.org.uk>; Linus > Torvalds <torvalds@linux-foundation.org> > Cc: Petr Mladek <pmladek@suse.com>; Steven Rostedt <rostedt@goodmis.org>; > Sergey Senozhatsky <senozhatsky@chromium.org>; Andy Shevchenko > <andriy.shevchenko@linux.intel.com>; Rasmus Villemoes > <linux@rasmusvillemoes.dk>; Jonathan Corbet <corbet@lwn.net>; Heiko > Carstens <hca@linux.ibm.com>; Vasily Gorbik <gor@linux.ibm.com>; Christian > Borntraeger <borntraeger@de.ibm.com>; Eric W . Biederman > <ebiederm@xmission.com>; Darrick J. Wong <darrick.wong@oracle.com>; Peter > Zijlstra (Intel) <peterz@infradead.org>; Ira Weiny <ira.weiny@intel.com>; > Eric Biggers <ebiggers@google.com>; Ahmed S. Darwish > <a.darwish@linutronix.de>; open list:DOCUMENTATION <linux- > doc@vger.kernel.org>; Linux Kernel Mailing List <linux- > kernel@vger.kernel.org>; linux-s390 <linux-s390@vger.kernel.org>; linux- > fsdevel <linux-fsdevel@vger.kernel.org> > Subject: Re: [PATCH 09/14] d_path: introduce struct prepend_buffer > > Hi folks, > > <snip> > > >> 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 ? > 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)
| |