Linux Kernel Linked List Explained
参见:http://isis.poly.edu/kulesh/stuff/src/klist/
Introduction:
Linux kernel is mostly written in the C language. Unlike many other languages C does not have
a good collection of data structures built into it or supported by a collection of standard libraries.
Therefore, you're probably excited to hear that you can borrow a good implementation of a
circularly-linked list in C from the Linux kernel source tree.
The file include/linux/list.h
in the source tree implements a type oblivious, easy-to-use, circularly-linked list in the C
language. The implementation is efficient and portable-- otherwise it would not have made it
into the kernel. Whenever someone needs a list in the Linux kernel they rely on this
implementation to strung up any data structure they have. With very little modifications
(removing hardware prefetching of list items) we can also use this list in our applications.
A usable version of this file is available
here for download
.
Some of the advantages of using this list are:
Type Oblivious:
This list can be used to strung up any data structure you have in mind.
Portable:
Though I haven't tried in every platform it is safe to assume the list implementation
is very portable. Otherwise it would not have made it into the kernel source tree.
Easy to Use:
Since the list is type oblivious same functions are used to initialize, access,
and traverse any list of items strung together using this list implementation.
Readable:
The macros and inlined functions of the list implementation makes the resulting
code very elegant and readable.
Saves Time:
Stops you from reinventing the wheel. Using the list really saves a lot of
debugging time and repetitively creating lists for every data structure
you need to link.
Linux implementation of the linked list is different from the many
linked list
implementations you might have seen. Usually a linked list contains
the items that are to be linked. For example:
struct my_li
相关文档:
linux下的文件结构,看看每个文件夹都是干吗用的
/bin 二进制可执行命令
/dev 设备特殊文件
/etc 系统管理和配置文件
/etc/rc.d 启动的配置文件和脚本
/home 用户主目录的基点,比如用户user的主目录就是/home/user,可以用~user表示
/lib 标准程序设计库,又叫动态链接共享库,作用类似windows里的.dll文件
/ ......
1、 一些头文件的作用:
<assert.h>:ANSI C。提供断言,assert(表达式)
<glib.h>:GCC。GTK,GNOME的基础库,提供很多有用的函数,如有数据结构操作函数。使用glib只需要包含<glib.h>
<dirent.h>:GCC。文件夹操作函数。struct dirent,struct DIR,opendir(),closedir(),readdir(),readdi ......
在Linux
中通过locale
来设置程序运行的不同语言环境,locale
由ANSI C
提供支持。locale
的命名规则为<
语言>_<
地区>.<
字符集编码>
,如zh_CN.UTF-8
,zh
代表中文,CN
代表大陆地区,UTF-8
表示字符集。在locale
环境中,有一组变量,代表国际化环境中的不同设置:
1. & ......
烧写2410-S linux 操作系统:
在windows xp下进行,需要的文件在光盘中的img目录和flashvivi目录下提供。
烧写2410-S linux 操作系统包括烧写vivi,kernel,root三个步骤,除此我们还要烧写yaffs.tar,这四个文件在img目录中。
vivi ----linux操作系统启动的bootloader;
zImage----linu ......
Linux Makefile文件的介绍
1. Makefile介绍
注意是“Makefile”,第一个字母大写,其余的都是小写。Makefile关系到了整个工程的编译规则,一个工程中的源文件不计数,其按类型、功能、模块分别放在若干个目录中,Makefile定义了一系列的规则来指定,哪些文件需要先编译, ......