Linux 核心--16.Linux数据结构( 四 )


struct linux_binfmt * next;
long *use_count;
int (*load_binary)(struct linux_binprm *, structpt_regs * regs);
int (*load_shlib)(int fd);
int (*core_dump)(long signr, struct pt_regs * regs);
};

mem_map_t
用来保存每个物理页面的信息 。

typedef struct page {
/* these must be first (free area handling) */
struct page*next;
struct page*prev;
struct inode *inode;
unsigned longoffset;
struct page*next_hash;
atomic_t count;
unsigned flags; /* atomic flags, some possibly
 updated asynchronously */
unsigned dirty:16,
 age:8;
struct wait_queue*wait;
struct page*prev_hash;
struct buffer_head *buffers;
unsigned longswap_unlock_entry;
unsigned longmap_nr;/* page->map_nr == page - mem_map */
} mem_map_t;

mm_struct
用来描叙某任务或进程的虚拟内存 。

struct mm_struct {
int count;
pgd_t * pgd;
unsigned long context;
unsigned long start_code, end_code, start_data, end_data;
unsigned long start_brk, brk, start_stack, start_mmap;
unsigned long arg_start, arg_end, env_start, env_end;
unsigned long rss, total_vm, locked_vm;
unsigned long def_flags;
struct vm_area_struct * mmap;
struct vm_area_struct * mmap_avl;
struct semaphore mmap_sem;
};

pci_bus
表示系统中的一个PCI总线 。

struct pci_bus {
struct pci_bus*parent; /* parent bus this bridge is on */
struct pci_bus*children; /* chain of P2P bridges on this bus */
struct pci_bus*next; /* chain of all PCI buses */

struct pci_dev*self; /* bridge device as seen by parent */
struct pci_dev*devices;/* devices behind this bridge */

void*sysdata;/* hook for sys-specific extension */

unsigned charnumber; /* bus number */
unsigned charprimary;/* number of primary bridge */
unsigned charsecondary;/* number of secondary bridge */
unsigned charsubordinate;/* max number of subordinate buses */
};

pci_dev
表示系统中的每个PCI设备,包括PCI-PCI和PCI-PCI桥接器 。

/*
 * There is one pci_dev structure for each slot-number/function-number
 * combination:
 */
struct pci_dev {
struct pci_bus*bus;/* bus this device is on */
struct pci_dev*sibling;/* next device on this bus */
struct pci_dev*next; /* chain of all devices */

void*sysdata;/* hook for sys-specific extension */

unsigned intdevfn; /* encoded device & function index */
unsigned shortvendor;
unsigned shortdevice;
unsigned intclass; /* 3 bytes: (base,sub,prog-if) */
unsigned intmaster : 1;/* set if device is master capable */
/*
 * In theory, the irq level can be read from configuration
 * space and all would be fine.However, old PCI chips don"t
 * support these registers and return 0 instead.For example,
 * the Vision864-P rev 0 chip can uses INTA, but returns 0 in
 * the interrupt line and pin registers.pci_init()
 * initializes this field with the value at PCI_INTERRUPT_LINE
 * and it is the job of pcibios_fixup() to change it if
 * necessary.The field must not be 0 unless the device
 * cannot generate interrupts at all.
 */
unsigned charirq;/* irq generated by this device */
};

request
被用来向系统的块设备发送请求 。它总是向buffer cache读出或写入数据块 。

推荐阅读