single, comprehensive kernel data types document?

Daniel. danielhilst at gmail.com
Fri Apr 15 12:28:57 EDT 2016


2016-04-15 10:55 GMT-03:00 Greg KH <greg at kroah.com>:
> 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?
I don't :),

Thanks for the reply
>
> thanks,
>
> greg k-h

Regards,


-- 
"Do or do not. There is no try"
  Yoda Master



More information about the Kernelnewbies mailing list