typedefu8;
typedefu16;
typedefu32;
typedefu64;
保证是8-位,16-位,32-位和64-位无符号整型值的类型.对等的有符号类型也存在.在用户空
间,你可用__u8,__u16,等等来引用这些类型.
#include<asm/page.h>
PAGE_SIZE
PAGE_SHIFT
给当前体系定义每页的字节数,以及页偏移的位数(对于4KB页是12,8KB是13)的符号.
#include<asm/byteorder.h>
__LITTLE_ENDIAN
__BIG_ENDIAN
这2个符号只有一个定义,依赖体系.
#include<asm/byteorder.h>
u32__cpu_to_le32(u32);
u32__le32_to_cpu(u32);
在已知字节序和处理器字节序之间转换的函数.有超过60个这样的函数:在include/linux/
byteorder/中的各种文件有完整的列表和它们以何种方式定义.
#include<asm/unaligned.h>
get_unaligned(ptr);
put_unaligned(val,ptr);
一些体系需要使用这些宏保护不对齐的数据存取.这些宏定义扩展成通常的指针解引用,为
那些允许你存取不对齐数据的体系.
#include<linux/err.h>
void*ERR_PTR(longerror);
longPTR_ERR(constvoid*ptr);
longIS_ERR(constvoid*ptr);
允许错误码由返回指针值的函数返回.
#include<linux/list.h>
list_add(structlist_head*new,structlist_head*head);
list_add_tail(structlist_head*new,structlist_head*head);
list_del(structlist_head*entry);
list_del_init(structlist_head*entry);
list_empty(structlist_head*head);
list_entry(entry,type,member);
list_move(structlist_head*entry,structlist_head*head);
list_move_tail(structlist_head*entry,structlist_head*head);
list_splice(structlist_head*list,structlist_head*head);
操作环形,双向链表的函数.
list_for_each(structlist_head*cursor,structlist_head*list)
list_for_each_prev(structlist_head*cursor,structlist_head*list)
list_for_each_safe(structlist_head*cursor,structlist_head*next,structlist_head*list)
list_for_each_entry(type*cursor,structlist_head*list,member)
list_for_each_entry_safe(type*cursor,type*nextstructlist_head*list,member)
方便的宏定义,用在遍历链表上.