当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > Linux 核心--16.Linux数据结构

Unix/Linux
Linux命令Man解释:useradd:帐号建立或更新
Linux 网管 123 --- 第7章. 自订的组态及管理内容 -7.使用 Linuxc
Linux 网管 123 --- 第8章. 备份及回存程序 -1.伺服器备份程序
Linux 网管 123 --- 第8章. 备份及回存程序 -2.伺服器回存程序(tar.
Linux 网管 123 --- 第8章. 备份及回存程序 -3.Cisco 路由器组态备
Linux 网管 123 --- 第9章. 各种杂项管理工作 -1.检查储存空间
Linux 网管 123 --- 第9章. 各种杂项管理工作 -2.管理进程
Linux 网管 123 --- 第9章. 各种杂项管理工作 -3.进程的启动及停止
Linux 网管 123 --- 第9章. 各种杂项管理工作 -4.使用 Cron 及 C
Linux 网管 123 --- 第10章. 升级 Linux 及其他应用软体 -1.使用
Linux 网管 123 --- 1. 前言 2. 简介
Linux 网管 123 --- 第3章. 概观 Linux
Linux 网管 123 --- 第4章. 安装及硬体组态 - 1.建立一张安装磁片
轻轻松松的安装Slackware Linux -- 4.如何在硬碟建置Linux系统
轻轻松松的安装Slackware Linux -- 5.其他非标准安装程序解析
如何重新设定时区
Linux中有没有支援 Solairs x86 的档案系统?有的话要如何mount?
MBR如果被覆盖了怎麽办?
如何使用命令trap来捕捉信号?
如何进行增量备份?

Unix/Linux 中的 Linux 核心--16.Linux数据结构


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 79 ::
收藏到网摘: n/a

  第十五章 Linux核心数据结构 

本章列出了Linux实用的主要数据结构。 


block_dev_struct
此结构用于向核心登记块设备,它还被buffer cache实用。所有此类结构都位于blk_dev数组中。 

struct blk_dev_struct {
    void (*request_fn)(void);
    struct request * current_request;
    struct request   plug;
    struct tq_struct plug_tq;
};

buffer_head
此结构包含关于buffer cache中一块缓存的信息。 

/* bh state bits */
#define BH_Uptodate  0   /* 1 if the buffer contains valid data      */
#define BH_Dirty     1   /* 1 if the buffer is dirty                 */
#define BH_Lock      2   /* 1 if the buffer is locked                */
#define BH_Req       3   /* 0 if the buffer has been invalidated     */
#define BH_Touched   4   /* 1 if the buffer has been touched (aging) */
#define BH_Has_aged  5   /* 1 if the buffer has been aged (aging)    */
#define BH_Protected 6   /* 1 if the buffer is protected             */
#define BH_FreeOnIO  7   /* 1 to discard the buffer_head after IO    */

struct buffer_head {
  /* First cache line: */
  unsigned long      b_blocknr;    /* block number                   */
  kdev_t             b_dev;        /* device (B_FREE = free)         */
  kdev_t             b_rdev;       /* Real device                    */
  unsigned long      b_rsector;    /* Real buffer location on disk   */
  struct buffer_head *b_next;      /* Hash queue list                */
  struct buffer_head *b_this_page; /* circular list of buffers in one 
                                      page                           */

  /* Second cache line: */
  unsigned long      b_state;      /* buffer state bitmap (above)    */
  struct buffer_head *b_next_free;
  unsigned int       b_count;      /* users using this block         */
  unsigned long      b_size;       /* block size                     */

  /* Non-performance-critical data follows. */
  char               *b_data;      /* pointer to data block          */
  unsigned int       b_list;       /* List that this buffer appears  */
  unsigned long      b_flushtime;  /* Time when this (dirty) buffer
                                    * should be written              */
  unsigned long      b_lru_time;   /* Time when this buffer was 
                                    * last used.                     */
  struct wait_queue  *b_wait;
  struct buffer_head *b_prev;      /* doubly linked hash list        */
  struct buffer_head *b_prev_free; /* doubly linked list of buffers  */
  struct buffer_head *b_reqnext;   /* request queue                  */
};

device
系统中每个网络设备都用一个设备数据结构来表示。 

struct device 
{

  /*
   * This is the first field of the "visible" part of this structure
   * (i.e. as seen by users in the "Space.c" file).  It is the name
   * the interface.
   */
  char                    *name;

  /* I/O specific fields