Re: single, comprehensive kernel data types document?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 15, 2016 at 08:04:53AM -0400, Robert P. J. Day wrote:
> 
>   is there a single, decent online doc that explains the proper data
> types (int16_t, int32_t and so on) to use in kernel code?

First off, never use int16_t and friends, that's not ok :)

Second, it's simple, use:
	u8
	u16
	u32
	u64
and friends in kernel code (s8, s16, and so on for signed values.)

'int' is a return type, and for loops and other things that you know
will fit in that size.

> including the relationship with types to be used in code to be
> exported to user space (include/uapi/linux/types.h)?

For values that cross the user/kernel boundry, add '__' to the front of
the variable:
	__u8
	__u16
	__u32
and so on.  NEVER use 'int' or 'long' crossing that boundry, it's not
going to work properly.

I think one of the chapters in LDD3 describes all of this, you might
want to re-read it for the details.

hope this helps,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux