Re: [PATCH] can-isotp: Add error message if txqueuelen is too small.

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

 



Am 26.04.21 um 01:59 schrieb Vincent MAILHOL:
> On Mon. 26 Apr 2021 at 01:45, Patrick Menschel <menschel.p@xxxxxxxxx> wrote:
>>
>> Am 25.04.21 um 17:35 schrieb Vincent MAILHOL:
>>> On Sun. 26 Apr 2021 at 00:10, Patrick Menschel <menschel.p@xxxxxxxxx> wrote:
>>> Speaking of comprehensive error messages, it would be great to
>>> print the mnemotechnic of the error code instead of its value:
>>> |                       pr_notice_once("can-isotp: %s: can_send_ret
>>> %pe : tx queue is full\n",
>>> |                                      __func__, ERR_PTR(err));
>>>
>> Thanks Vincent,
>>
>> it's the first time I see this format string %pe , is it new or kernel
>> specific?
> 
> Yes, this is fairly recent and it is kernel specific (and I love it).
> 
> It was added in commit 57f5677e535ba ("printf: add support for
> printing symbolic error names").
> Ref: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=57f5677e535ba24b8926a7125be2ef8d7f09323c

Now that is really neat, sort of like python's __member__.name attribute
of the Enum type.
https://docs.python.org/3/library/enum.html#allowed-members-and-attributes-of-enumerations
I use it all the time since I moved away from ctypes.
Saves at least 2 lines per log message.

Proves that the very nature of best practice is convenience.

I'll do a v2 and substitute for every occurrence of err in that file
while I'm at it.

Regards,
Patrick



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux