LDD3学习笔记(14):内核中的数据类型
来源:互联网 发布:ubuntu install ssh 编辑:程序博客网 时间:2024/06/14 23:00
typedef u8;
typedef u16;
typedef u32;
typedef u64;
保证是 8-位, 16-位, 32-位 和64-位 无符号整型值的类型. 对等的有符号类型也存在. 在用户空
间, 你可用 __u8, __u16, 等等来引用这些类型.
#include <asm/page.h>
PAGE_SIZE
PAGE_SHIFT
给当前体系定义每页的字节数, 以及页偏移的位数( 对于 4 KB 页是 12, 8 KB 是 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(long error);
long PTR_ERR(const void *ptr);
long IS_ERR(const void *ptr);
允许错误码由返回指针值的函数返回.
#include <linux/list.h>
list_add(struct list_head *new, struct list_head *head);
list_add_tail(struct list_head *new, struct list_head *head);
list_del(struct list_head *entry);
list_del_init(struct list_head *entry);
list_empty(struct list_head *head);
list_entry(entry, type, member);
list_move(struct list_head *entry, struct list_head *head);
list_move_tail(struct list_head *entry, struct list_head *head);
list_splice(struct list_head *list, struct list_head *head);
操作环形, 双向链表的函数.
list_for_each(struct list_head *cursor, struct list_head *list)
list_for_each_prev(struct list_head *cursor, struct list_head *list)
list_for_each_safe(struct list_head *cursor, struct list_head *next, struct list_head *list)
list_for_each_entry(type *cursor, struct list_head *list, member)
list_for_each_entry_safe(type *cursor, type *next struct list_head *list, member)
方便的宏定义, 用在遍历链表上.
- LDD3学习笔记(14):内核中的数据类型
- LDD3读书笔记(第10章 内核数据类型)
- LDD3学习笔记(7):调试技术
- LDD3学习笔记(11):内存分配
- LDD3学习笔记(13):中断处理
- LDD3学习笔记(15):PCI驱动
- LDD3学习笔记(16):USB驱动
- LDD3学习笔记(19):块驱动
- LDD3学习笔记(20):网络驱动
- LDD3学习笔记(21):tty驱动
- LDD3学习笔记(22):感想
- LDD3学习笔记(一)
- [LDD3速记]_内核的数据类型
- LDD3笔记(一)
- 【学习笔记】mysql中的数据类型(一)
- 【学习笔记】mysql中的数据类型(二)
- ldd3学习笔记:调试技术
- <Debugging Techniques> LDD3 学习笔记
- 黑马程序员 (7)JAVA高新技术 1
- Java中覆盖toString()
- POJ 1844 Sum
- Repeater 批量删除
- 关于断言与错误处理,以及测试用例的设计
- LDD3学习笔记(14):内核中的数据类型
- hdu1243 反恐训练营
- 我的专业微博我做主!
- C# 读取excel里的图片并显示在页面上
- java tomcat 报错
- Android Out Of Memory(OOM) 的详细研究
- OA开发日志之Ext整合jQuery
- Splitting string Oracle PL/SQL
- 类似状态栏的显示