[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNL7j2GfSbUCetZ0@smile.fi.intel.com>
Date: Wed, 23 Jun 2021 12:14:55 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jia He <justin.he@....com>
Cc: Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Jonathan Corbet <corbet@....net>,
Alexander Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Eric Biggers <ebiggers@...gle.com>,
"Ahmed S. Darwish" <a.darwish@...utronix.de>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
Matthew Wilcox <willy@...radead.org>,
Christoph Hellwig <hch@...radead.org>, nd@....com
Subject: Re: [PATCH v2 2/4] lib/vsprintf.c: make '%pD' print the full path of
file
On Wed, Jun 23, 2021 at 01:50:09PM +0800, Jia He wrote:
> Previously, the specifier '%pD' is for printing dentry name of struct
> file. It may not be perfect (by default it only prints one component.)
>
> As suggested by Linus [1]:
> > A dentry has a parent, but at the same time, a dentry really does
> > inherently have "one name" (and given just the dentry pointers, you
> > can't show mount-related parenthood, so in many ways the "show just
> > one name" makes sense for "%pd" in ways it doesn't necessarily for
> > "%pD"). But while a dentry arguably has that "one primary component",
> > a _file_ is certainly not exclusively about that last component.
>
> Hence change the behavior of '%pD' to print the full path of that file.
>
> If someone invokes snprintf() with small but positive space,
> prepend_name_with_len() moves or truncates the string partially. More
> than that, kasprintf() will pass NULL @buf and @end as the parameters,
> and @end - @buf can be negative in some case. Hence make it return at
> the very beginning with false in these cases.
>
> Precision is never going to be used with %p (or any of its kernel
> extensions) if -Wformat is turned on.
...
> + char *p;
> + const struct path *path;
> + int prepend_len, widen_len, dpath_len;
Reversed xmas tree order?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists