首页 > 其他 > 详细

main.c 流程-buffer初始化

时间:2017-07-05 23:36:47      阅读:370      评论:0      收藏:0      [点我收藏+]

void buffer_init(long buffer_end)函数的理解:

 *   0         0x100000          0x400000                    0x10 00000(16M)
 *    ----------------------------------------------------------
 *   |   kernel  | memery buffer   |   main memory              |             
 *    ----------------------------------------------------------

以上图为例,该段主要初始化memery buffer部分,并且前地址地段储存缓存头部,高端储存缓存块(1K);

缓存头部struct buffer_head

 1 struct buffer_head {
 2     char * b_data;            /* pointer to data block (1024 bytes) */
 3     unsigned long b_blocknr;    /* block number */
 4     unsigned short b_dev;        /* device (0 = free) */
 5     unsigned char b_uptodate;
 6     unsigned char b_dirt;        /* 0-clean,1-dirty */
 7     unsigned char b_count;        /* users using this block */
 8     unsigned char b_lock;        /* 0 - ok, 1 -locked */
 9     struct task_struct * b_wait;
10     struct buffer_head * b_prev;
11     struct buffer_head * b_next;
12     struct buffer_head * b_prev_free;
13     struct buffer_head * b_next_free;
14 };

用环形双链表链接:

node0 <--->node1<--> ...... <-->noden<-->node0

 

main.c 流程-buffer初始化

原文:http://www.cnblogs.com/qianzhilan/p/6091644.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!