DEBUG macros definition

Let's take a look at a group of codes:

#undef PDEBUG            /* undef it, just in case */
#ifdef SCULL_DEBUG
#  ifdef __KERNEL__
     /* This one if debugging is on, and kernel space */
#    define PDEBUG(fmt, args...) printk( KERN_DEBUG "scull: " fmt, ## args)
#  else
     /* This one for user space */
#    define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
#  endif
#else
#  define PDEBUG(fmt, args...) /* not debugging: nothing */
#endif

these few lines of codes defined macros used for SCULL_DEBUG: PDEBUG.

note the kernel space version and user space version.

 

 

posted @ 2013-07-07 13:42  &Flare  阅读(179)  评论(0编辑  收藏  举报