这一节主要讲linux的数据类型,主要是为了方便理解接下来将大端、小段字节序定义的源码。
首先,来看看 include/linux/types.h 源码:
------------------------------------------------------------------
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H
#include <asm/types.h>
#ifndef __ASSEMBLY__
#include <linux/posix_types.h>
/*
* Below are truly Linux-specific types that should never collide with
* any application/library that wants linux/types.h.
*/
#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
#else
#define __bitwise__
#endif
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif
//_be32只是一个带有bitwise属性的整型类型,
//而这个属性对gcc本身没有任何作用,
//所以如果不利用sparse,__be32和__u32没有任何差别&#x
首先,来看看 include/linux/types.h 源码:
------------------------------------------------------------------
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H
#include <asm/types.h>
#ifndef __ASSEMBLY__
#include <linux/posix_types.h>
/*
* Below are truly Linux-specific types that should never collide with
* any application/library that wants linux/types.h.
*/
#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
#else
#define __bitwise__
#endif
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif
//_be32只是一个带有bitwise属性的整型类型,
//而这个属性对gcc本身没有任何作用,
//所以如果不利用sparse,__be32和__u32没有任何差别&#x