From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Fri, 15 Apr 2016 06:55:26 -0700 Subject: single, comprehensive kernel data types document? In-Reply-To: References: <20160415122724.GA7389@kroah.com> <3e0913de8af67a2489ffa472ea0186f0@mail.vivaldi.net> Message-ID: <20160415135525.GB8315@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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