Re: [PATCH 1/7] vsprintf: Add %pTN to print task name

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

 



Petr Mladek <pmladek@xxxxxxxx> writes:

> On Fri 2024-12-13 13:46:04, Yafang Shao wrote:
>> Since the task->comm is guaranteed to be NUL-ternimated, we can print it
>> directly. Add a new vsnprintf format specifier "%pTN" to print task comm,
>> where 'p' represents the task Pointer, 'T' stands for Task, and 'N' denots
>> Name. With this abstraction, the user no longer needs to care about
>> retrieving task name.
>
> What is the advantage, please?
>
> Honestly, I believe that the meaning of
>
> 	printk("%s\n", task->comm);
>
> is much more clear than using a cryptic %pXYZ modifier:
>
> 	printk("%pTN\n", task);
>
>
> The %pXYZ modifiers makes sense only when the formatting of the printed
> information needs some processing. But this is a plain string.
> IMHO, it is not worth it. In fact, I believe that it is a
> counter productive.

I agree, it makes the code harder to read for someone who is not
familiar with all the %p magic we have (like me).

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux