I think those errors must come from the user-space build, which doesn't
know about printk.  In source that is built in both kernel and user
space you generally need to surround printk's with

#ifdef _KERNEL
#endif

As Saso points out, cmn_err() is the appropriate debug message interface
if you wanted to get your patch merged.  But for a throw-away debug
patch, printk may be more convenient on Linux because it avoids having
to deal with the SPL debug log infrastructure.

Ned

On Tue, Dec 10, 2013 at 01:47:28PM -0800, Punit Mutha wrote:
> hello,
> i have a naive doubt about adding printk in zfs module.
> 
> 
> i am trying to add debug statements in zfs code and
> 
> facing this weird compiler error.
> 
> .../../module/zfs/dmu.c: In function ?dmu_object_size_from_db?:
> .../../module/zfs/dmu.c:2006: error: ?KERN_INFO? undeclared (first use in this
> function)
> .../../module/zfs/dmu.c:2006: error: expected ?)? before string constant
> .../../module/zfs/dmu.c:2018: error: expected ?)? before string constant
> 
> so it is complaining about usage of printk in dmu.c
> 
> but it didnt complained about printk usage in zvol.c
> 
> as far as i see there are no difference in compilation flags.
> 
> google search tells that i need to include /lib/modules in makefile..
> 
> but i think all arguments are same for zvol.c and that for dmu.c
> 
> Regards
> Punit

> _______________________________________________
> developer mailing list
> [email protected]
> http://lists.open-zfs.org/mailman/listinfo/developer

_______________________________________________
developer mailing list
[email protected]
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to