Programming方面的一些知识:
1. By convention, all kernel prefixes are lowercase.
2. The file /proc/kallsyms holds all the symbols that the kernel knows about and which are therefore accessible
to your modules since they share the kernel's codespace.
3. 结构体赋值方法的不同
GCC:
struct file_operations fops = {
read: device_read,
write: device_write,
open: device_open,
release: device_release
};
C99:
struct file_operations fops = {
.read = device_read,
.write = device_write,
.open = device_open,
.release = device_release
};
4. Normally a negative return value means the registration failed
5. major number分配方法
a. major number can be dynamically assigned by kernel.
b. must look throught documenet/devices.txt and then get an unused one
6. /proc/modules which provides the list of modules
/proc/meminfo which stats memory usage statistics
阅读(611) | 评论(0) | 转发(0) |