📄 00000016.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: coolzhang (coolzhang), 信区: Linux <BR>标 题: linux bible 第十五章 Linux核心数据结构 <BR>发信站: BBS 水木清华站 (Mon Oct 25 18:02:12 1999) <BR> <BR>发信人: coolzhang (coolzhang), 信区: UNIX <BR>标 题: linux bible 第十五章 Linux核心数据结构 <BR>发信站: 武汉白云黄鹤站 (Mon Oct 25 17:33:51 1999), 站内信件 <BR>第十五章 Linux核心数据结构 <BR>本章列出了Linux实用的主要数据结构。 <BR>block_dev_struct <BR>此结构用于向核心登记块设备,它还被buffer <BR>cache实用。所有此类结构都位于blk_dev数组中。 <BR>struct blk_dev_struct { <BR> void (*request_fn)(void); <BR> struct request * current_request; <BR> struct request plug; <BR> struct tq_struct plug_tq; <BR>}; <BR>buffer_head <BR>此结构包含关于buffer cache中一块缓存的信息。 <BR>/* bh state bits */ <BR>#define BH_Uptodate 0 /* 1 if the buffer contains valid data */ <BR>#define BH_Dirty 1 /* 1 if the buffer is dirty */ <BR>#define BH_Lock 2 /* 1 if the buffer is locked */ <BR>#define BH_Req 3 /* 0 if the buffer has been invalidated */ <BR>#define BH_Touched 4 /* 1 if the buffer has been touched (aging) */ <BR>#define BH_Has_aged 5 /* 1 if the buffer has been aged (aging) */ <BR>#define BH_Protected 6 /* 1 if the buffer is protected */ <BR>#define BH_FreeOnIO 7 /* 1 to discard the buffer_head after IO */ <BR>struct buffer_head { <BR> /* First cache line: */ <BR> unsigned long b_blocknr; /* block number */ <BR> kdev_t b_dev; /* device (B_FREE = free) */ <BR> kdev_t b_rdev; /* Real device */ <BR> unsigned long b_rsector; /* Real buffer location on disk */ <BR> struct buffer_head *b_next; /* Hash queue list */ <BR> struct buffer_head *b_this_page; /* circular list of buffers in one <BR> page */ <BR> /* Second cache line: */ <BR> unsigned long b_state; /* buffer state bitmap (above) */ <BR> struct buffer_head *b_next_free; <BR> unsigned int b_count; /* users using this block */ <BR> unsigned long b_size; /* block size */ <BR> /* Non-performance-critical data follows. */ <BR> char *b_data; /* pointer to data block */ <BR> unsigned int b_list; /* List that this buffer appears */ <BR> unsigned long b_flushtime; /* Time when this (dirty) buffer <BR> * should be written */ <BR> unsigned long b_lru_time; /* Time when this buffer was <BR> * last used. */ <BR> struct wait_queue *b_wait; <BR> struct buffer_head *b_prev; /* doubly linked hash list */ <BR> struct buffer_head *b_prev_free; /* doubly linked list of buffers */ <BR> struct buffer_head *b_reqnext; /* request queue */ <BR>}; <BR>device <BR>系统中每个网络设备都用一个设备数据结构来表示。 <BR>struct device <BR>{ <BR> /* <BR> * This is the first field of the "visible" part of this structure <BR> * (i.e. as seen by users in the "Space.c" file). It is the name <BR> * the interface. <BR> */ <BR> char *name; <BR> /* I/O specific fields */ <BR> unsigned long rmem_end; /* shmem "recv" end */ <BR> unsigned long rmem_start; /* shmem "recv" start */ <BR> unsigned long mem_end; /* shared mem end */ <BR> unsigned long mem_start; /* shared mem start */ <BR> unsigned long base_addr; /* device I/O address */ <BR> unsigned char irq; /* device IRQ number */ <BR> /* Low-level status flags. */ <BR> volatile unsigned char start, /* start an operation */ <BR> interrupt; /* interrupt arrived */ <BR> unsigned long tbusy; /* transmitter busy */ <BR> struct device *next; <BR> /* The device initialization function. Called only once. */ <BR> int (*init)(struct device *dev); <BR> /* Some hardware also needs these fields, but they are not part of <BR> the usual set specified in Space.c. */ <BR> unsigned char if_port; /* Selectable AUI,TP, */ <BR> unsigned char dma; /* DMA channel */ <BR> struct enet_statistics* (*get_stats)(struct device *dev); <BR> /* <BR> * This marks the end of the "visible" part of the structure. All <BR> * fields hereafter are internal to the system, and may change at <BR> * will (read: may be cleaned up at will). <BR> */ <BR> /* These may be needed for future network-power-down code. */ <BR> unsigned long trans_start; /* Time (jiffies) of <BR> last transmit */ <BR> unsigned long last_rx; /* Time of last Rx */ <BR> unsigned short flags; /* interface flags (BSD)*/ <BR> unsigned short family; /* address family ID */ <BR> unsigned short metric; /* routing metric */ <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -