Types. h header file Learning
Throughout the types. h header file, we can see that it is a renaming or definition of some data types, as well as a definition of the general DMA address and its 64-bit features. The following is the source code of the types. h header file. The main learning content is in the annotations.
# Ifndef _ i1__types_h # define _ i1__types_h # ifndef _ ASSEMBLY _/*** throughout this header file, it is found that this header file is mainly used to define * The type and rename * // rename unsigned short to umode_ttypedef unsigned short umode_t;/** _ xx is OK: it doesn' t pollute the POSIX namespace. use these in the * header files exported to user space ** _ xx is also acceptable. It does not affect the POSIX namespace. Use these names in the header file exported to the user space. ** // rename signed char and unsigned char // you can understand this, because a char occupies a byte length, // that is, 8 digits, this is why typedef _ signed _ char _ s8; typedef unsigned char _ u8; // rename the signed short and unsigned short types to occupy two bytes, that is, 16-bit typedef _ signed _ short _ s16; typedef unsigned short _; // rename signed int and unsigned int // The int type occupies four bytes, that is, 32-bit typedef _ signed _/* _ KERNEL _ */_ int _ s32; typedef unsigned int _ u32; // specify a _ GNUC _ and an undefined _ STRIC T_ANSI _ // rename long // long occupies 8 bytes, 64-bit # if defined (_ GNUC __)&&! Defined (_ STRICT_ANSI _) typedef _ signed _ long _ s64; typedef unsigned long _ u64; # endif/* _ ASSEMBLY _ * // ** These Aren' t exported outside the kernel to avoid name space clashes ** to avoid namespace conflicts, these will not be exported to the KERNEL outside */# ifdef _ KERNEL _/a macro definition, define BITS_PER_LONG // as 32 # define BITS_PER_LONG 32 // If _ ASSEMBLY _ is not defined # ifndef _ ASSEMBLY _ // same as typedef signed char s8; typedef unsigned char u8; typedef signed short s16; typedef unsigned short 2010; typedef signed int s32; typedef unsigned int u32; typedef signed long s64; typedef unsigned long u64; /* DMA addresses come in generic and 64-bit flavors. * // defines the general DMA address and 64-bit features # ifdef extends u64 dma_addr_t; # elsetypedef u32 dma_addr_t; # endiftypedef u64 handler; # ifdef CONFIG_LBDtypedef u64 sector_t; # define definition # endif # ifdef CONFIG_LSFtypedef u64 blkcnt_t; # define HAVE_BLKCNT_T # endif/* _ ASSEMBLY _ */# endif/* _ KERNEL _ */# endif