include/linux/crc-ccitt.h and userspace programs

From: city_hunter
Date: Thu Aug 26 2004 - 06:22:22 EST



Greetings,
I encountered a problem this morning while compiling a program which
includes /usr/include/net/ppp_defs.h

I know that userspace programs are highly discouraged from including
directly kernel headers, but /usr/include/net/ppp_defs.h is not supposed
to be one of them, right?
Problem is that net/ppp_defs.h includes linux/ppp_defs.h, which in turn
includes linux/crc-ccitt.h

This last header makes use of some types (u16,u8) that, if I am not wrong,
only exist when you're compiling something kernel-related (if __KERNEL__
is defined,asm/types.h will typedef u16 and the others).

So the program goes in error because u16 and u8 were never defined.

Who made the mistake here? :) (me?)

If crc-ccitt.h gets included in userspace program, then shouldn't it use
__u16 and __u8? Can I safely replace u16 with __u16 and so on in
crc-ccitt.h to have everything compile ok?

Thanks in advance for your advices,
and please CC me as I'm not subscribed.

Regards,
Giacomo Lozito
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/