Re: [PATCH 2/4] lib/vsprintf.c: Make %p{D,d} mean as much components as possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 2021-04-28 21:59:27, Jia He wrote:
> From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> 
> We have '%pD'(no digit following) for printing a filename. It may not be
> perfect (by default it only prints one component.
> 
> %pD4 should be more than good enough, but we should make plain "%pD" mean
> "as much of the path that is reasonable" rather than "as few components as
> possible" (ie 1).

Could you please provide link to the discussion where this idea was
came from?

It would be great to add and example into the commit message how
it improved the output.

Also please explain why it is useful/safe to change the behavior
for all existing users. It seems that you checked them and prevented
any regression by the other patches in this patchset.

Anyway, some regressions are fixed by the followup patches.
It would break bisection.

We either need to prevent the regression before this patch.
Or the changes have to be done in this patch. For example,
it would be perfectly fine to update test_printf.c in
this patch.

> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

If you want to keep Linus as the author and do more changes, you might
describe here changes done by you, for example:

[justin.he@xxxxxxx: update documentation and test_printf]
Signed-off-by: Jia He <justin.he@xxxxxxx>

Or you might make you the author and add

Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

> ---
>  Documentation/core-api/printk-formats.rst | 3 ++-
>  lib/vsprintf.c                            | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
> index 9be6de402cb9..aa76cbec0dae 100644
> --- a/Documentation/core-api/printk-formats.rst
> +++ b/Documentation/core-api/printk-formats.rst

Plese, update also the pattern:

-	%pd{,2,3,4}
-	%pD{,2,3,4}
+	%pd{1,2,3,4}
+	%pD{1,2,3,4}

> @@ -413,7 +413,8 @@ dentry names
>  For printing dentry name; if we race with :c:func:`d_move`, the name might
>  be a mix of old and new ones, but it won't oops.  %pd dentry is a safer
>  equivalent of %s dentry->d_name.name we used to use, %pd<n> prints ``n``
> -last components.  %pD does the same thing for struct file.
> +last components.  %pD does the same thing for struct file. By default, %p{D,d}
> +is equal to %p{D,d}4.
>  
>  Passed by reference.

Best Regards,
Petr



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux