Re: motivation behind pr_xxx macros

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

 



Hi....

On Sun, Jan 30, 2011 at 22:11, Himanshu Aggarwal
<lkml.himanshu@xxxxxxxxx> wrote:
> While writing some code on 2.6.32, I have come across some of these
> macros that in turn call printk:
>
> pr_emerg
> pr_alert
> ...
> pr_debug
>
> Is there any case when should these macros be preferred over explicit
> printk statements?

I personally think it's a matter of "putting another layer of
abstraction". That way, if somehow the definition of...let's "emerg"
facility differ, you don't need to change the whole code. Just edit
the pr_emerg and you're back into the game.

IIRC too, it might have something to do with dynamic printk
activation...something like "ok I need to turn that, that and that
printk...on...". So to ease that thing, wrapper is created ...and it
decide what it has to do when printk() is enabled or not.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux