How to choose format specifier for boolean variables in Linux kernel?

Fox Chen foxhlchen at gmail.com
Mon May 24 10:22:18 EDT 2021


On Mon, May 24, 2021 at 6:51 PM 慕冬亮 <mudongliangabcd at gmail.com> wrote:
>
> Hi all,
>
> how do I choose format specifier for boolean variables in Linux
> kernel? For example,
>
> bool bup;
> pr_alert("%XXX", bup);
>
> What should "XXX" be in the Linux kernel?
>
> --
> My best regards to you.
>
>      No System Is Safe!
>      Dongliang Mu
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Check commit 6e21828743 ("Generic boolean")
IIUC bool is defined as Bool_. You can treat it as an integer with the
value 0 or 1.


thanks,
fox



More information about the Kernelnewbies mailing list