single, comprehensive kernel data types document?
Greg KH
greg at kroah.com
Fri Apr 15 09:55:26 EDT 2016
On Fri, Apr 15, 2016 at 10:09:35AM -0300, Daniel. wrote:
> I've been using *aways* u8, u16, u32 in kernel code (driver code) and
> *aways* __u8, __u16, __u32
> for code that goes to both (usualy ioctl definition headers). What is
> happening here is that __u8 from
> userspace is being "casted" to u8 in driver during an ioctl call, is
> that a problem? This is the "right
> way to do it", right?
Yes, that is correct.
> Also, LDD3 stats this:
>
> It's important to remember that these types are Linux specific, and
> using them hinders porting software to other Unix flavors. Systems
> with recent compilers support the C99-standard types, such as uint8_t
> and uint32_t; if portability is a concern, those types can be used in
> favor of the Linux-specific variety [1].
>
> So using C99 standard types for userspace headers (ioctl headers for
> example) are okay!?
No, they aren't, you can not used those types for ioctl headers.
You can get away with using it in kernel-only code, but really, why
would you want to?
thanks,
greg k-h
More information about the Kernelnewbies
mailing list