日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux创始人数据结构,Linux 通用数据结构说明

發(fā)布時間:2025/3/8 linux 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux创始人数据结构,Linux 通用数据结构说明 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

device_driver include/linux/device.h struct device_driver {

const char???????????? * name; /* 驅(qū)動名稱 */

struct bus_type??????? * bus;? /* 總線類型 */

struct completion????? unloaded;? /* 卸載事件通知機制 */ struct kobject????????????????????? kobj; /* sys 中的對象 */

struct klist?????????? klist_devices; /* 設備列表 */ struct klist_node?????????????????????? knode_bus; /* 總線結點列表 */

struct module????????? * owner;/* 所有者 */

/* 設備驅(qū)動通用方法 */

int???? (*probe)?? ?(struct device * dev); /* 探測設備 */ int??? (*remove)? ?(struct device * dev); /* 移除設備 */ void??? (*shutdown)???? (struct device * dev); /* 關閉設備 */

/* 掛起設備?????? ?*/

int??? (*suspend)???? (struct device * dev, pm_message_t state, u32 level); int?????? (*resume)????? (struct device * dev, u32 level); /* 恢復 */

};

platform_device include/linux/device.h struct platform_device {

const char???? * name;? /* 名稱 */

u32??????????? id;????? /* 設備編號, -1 表示不支持同類多個設備 */ struct device dev;?????????????? /* 設備 */

u32??????????? num_resources; /* 資源數(shù) */ struct resource * resource; /* 資源列表 */

};

3. resource struct resource {

const char name;????????? /*

資源名稱 */

unsigned

long start, end; /* 開始位置和結束位置 */ unsigned long flags;???????????????????????? /* 資源類型 */

/* 資源在資源樹中的父親,兄弟和孩子

*/ struct resource *parent, *sibling, *child;

};

4. device include/linux/device.h

struct device {

struct klist?????????? klist_children;

/* 在設備列表中的孩子列表 */ struct klist_node?????????????????????? knode_parent;?? /* 兄弟結點 */

struct

klist_node? knode_driver;?? /* 驅(qū)動結點 */ struct klist_node?? knode_bus;??? /* 總線結點 */ struct device?? parent; /* 父親?? ?*/

struct kobject kobj;?????????????????? /* sys結點 */ char

bus_id[BUS_ID_SIZE];

struct semaphore

sem;??? /* 同步驅(qū)動的信號量 */

struct bus_type * bus;??????? /* 總線類型??????? ?*/

struct device_driver *driver;?? /* 設備驅(qū)動????? */ void? *driver_data;

/* 驅(qū)動的私有數(shù)據(jù)? ?*/

void?????????? *platform_data; /* 平臺指定的數(shù)據(jù),為 device

核心驅(qū)動保留 */ void?????????????? *firmware_data; /* 固件指定的數(shù)據(jù),為 device

核心驅(qū)動保留 */ struct dev_pm_info

power;???? /* 設備電源管理信息 ?*/

u64??????????? *dma_mask;????? /* DMA掩碼???????? ?*/

u64??????????? coherent_dma_mask;

struct

list_head dma_pools;???? /* DMA緩沖池????? ?*/

struct dma_coherent_mem *dma_mem; /* 連續(xù) DMA 內(nèi)存的起始位置

*/

void??? (*release)(struct device * dev);? /*

釋放設置方法 */

};

nand_hw_control

include/linux/mtd/nand.h struct nand_hw_control {

spinlock_t?? lock;? ?/* 自旋鎖,用于硬件控制 */ struct nand_chip *active; /* 正在處理 MTD 設備

*/ wait_queue_head_t wq;???? ?/* 等待隊列??? */

};

nand_chip

include/linux/mtd/nand.h struct nand_chip {

void??? iomem?? *IO_ADDR_R; /* 讀地址 */ void??? iomem?????????????? *IO_ADDR_W; /* 寫地址 */

/* 字節(jié)操作?? */

u_char???????? (*read_byte)(struct mtd_info *mtd);? /*

讀一個字節(jié) */

void?????????? (*write_byte)(struct mtd_info *mtd, u_char byte); /* 寫一個字節(jié) */

/*

雙字節(jié)操作 */

u16??????????? (*read_word)(struct mtd_info mtd); /* 讀一個字 */

void?????????? (*write_word)(struct mtd_info *mtd, u16 word); /* 寫一個字 */

/*

buffer 操作 */

void?????????? (*write_buf)(struct mtd_info *mtd, const u_char *buf, int len); void?????????????? (*read_buf)(struct mtd_info

*mtd, u_char *buf, int len);

int??????????? (*verify_buf)(struct

mtd_info *mtd, const u_char

*buf, int len);

/*

選擇一個操作芯片 */

void?????????? (*select_chip)(struct

mtd_info *mtd, int chip);

/*

壞塊檢查操作 */

int??????????? (*block_bad)(struct

mtd_info *mtd, loff_t ofs, int getchip);

/*

壞塊標記操作 */

int??????????? (*block_markbad)(struct

mtd_info *mtd, loff_t ofs);

/*

硬件控制操作 */

void?????????? (*hwcontrol)(struct

mtd_info *mtd, int cmd);

/*

設備準備操作 */

int??????????? (*dev_ready)(struct

mtd_info *mtd);

/*

命令發(fā)送操作 */

void?????????? (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int

page_addr);

/*

等待命令完成 */

int??????????? (*waitfunc)(struct mtd_info

*mtd, struct nand_chip

*this, int state);

/*

計算 ECC 碼操作 */

int??????????? (*calculate_ecc)(struct

mtd_info *mtd, const u_char *dat,

u_char

*ecc_code);

/*

數(shù)據(jù)糾錯操作 */

int??????????? (*correct_data)(struct mtd_info *mtd, u_char *dat, u_char *read_ecc,

u_char *calc_ecc);

/*

開啟硬件 ECC */

void?????????? (*enable_hwecc)(struct

mtd_info *mtd, int mode);

/* 擦除操作???? */

void?????????? (*erase_cmd)(struct

mtd_info *mtd, int page);

/* 檢查壞塊表?? */

int??????????? (*scan_bbt)(struct

mtd_info *mtd);

int??????????? eccmode;?? /* ECC 模式????? */

int??????????? eccsize;?? /* ECC 計算時使用的字節(jié)數(shù) */

int??????????? eccbytes;? /*

ECC 碼的字節(jié)數(shù) */

int??????????? eccsteps;? /*

ECC 碼計算的步驟數(shù) */

int??????????? chip_delay;

/* 芯片的延遲時間 */ spinlock_t?????????????? chip_lock;? /*

芯片訪問的自旋鎖 */ wait_queue_head_t wq;??????????? /* 芯片訪問的等待隊列 */ nand_state_t? state;? /*

Nand Flash 狀態(tài) */

int??????????? page_shift; /* 頁右移的位數(shù),即 column

地址位數(shù) */

int??????????? phys_erase_shift; /* 塊右移的位數(shù), 即 column 和頁一共的地址位數(shù) */ int?????????????? bbt_erase_shift; /* 壞塊頁表的位數(shù) */

int??????????? chip_shift; /* 該芯片總共的地址位數(shù) */

u_char???????? *data_buf;? /*

數(shù)據(jù)緩沖區(qū) */

u_char???????? *oob_buf;? /*

oob 緩沖區(qū) */

int??????????? oobdirty;? /*

oob 緩沖區(qū)是否需要重新初始化 */

u_char???????? *data_poi;? /* 數(shù)據(jù)緩沖區(qū)指針 */ unsigned int?????????????? options;?? /*

芯片專有選項 */

int??????????? badblockpos;/* 壞塊標示字節(jié)在 OOB 中的位置 */

int??????????? numchips;? /* 芯片的個數(shù)?? */

unsigned

long

chipsize;

/*

在多個芯片組中, 一個芯片的大小 */

int

pagemask;

/* 每個芯片頁數(shù)的屏蔽字, 通過它取出每個芯片包含多少個頁 */

int

pagebuf;

/*

在頁緩沖區(qū)中的頁號 */

struct nand_oobinfo??? *autooob; /* oob 信息 */ uint8_t? *bbt;????????????????????? /* 壞塊頁表 */

struct nand_bbt_descr?????????????? *bbt_td;

/* 壞塊表描述 */

struct nand_bbt_descr? *bbt_md; /*

壞塊表鏡像描述 */

struct nand_bbt_descr? *badblock_pattern; /* 壞塊檢測模板 */

struct nand_hw_control *controller; /* 硬件控制 */

void?????????? *priv;

/* 私有數(shù)據(jù)結構 */

/*

進行附加錯誤檢查 */

int??????????? (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);

};

mtd_info include/linux/mtd/mtd.h struct mtd_info {

u_char type;?? /* 設備類型?? */ u_int32_t flags; /* 設備標志位組 */ u_int32_t

size; /* 總共設備的大小 */ u_int32_t

erasesize;? /* 擦除塊的大小 */

u_int32_t

oobblock; /* OOB 塊的大小,如:512 個字節(jié)有一個 OOB */ u_int32_t oobsize; /* OOB數(shù)據(jù)的大小,如:一個 OOB 塊有 16 個字節(jié)

*/ u_int32_t ecctype; /* ECC 校驗的類型 */

u_int32_t eccsize;? /* ECC 碼的大小? */

char

*name;??????? /* 設備名稱?????? */

int

index;???????? /* 設備編號?????? */

/* oobinfo

信息,它可以通過 MEMSETOOBINFO ioctl 命令來設置 */ struct nand_oobinfo oobinfo;

u_int32_t

oobavail;? /* OOB區(qū)的有效字節(jié)數(shù),為文件系統(tǒng)提供 */

/* 數(shù)據(jù)擦除邊界信息???????? */

int numeraseregions;

struct mtd_erase_region_info *eraseregions;

u_int32_t

bank_size; /* 保留 */

/*

擦除操作 */

int (*erase) (struct mtd_info *mtd,

struct erase_info *instr);

/* 指向某個執(zhí)行代碼位置 */

int (*point) (struct mtd_info *mtd,

loff_t from,

size_t len, size_t *retlen, u_char **mtdbuf);

/*

取消指向 */

void (*unpoint)

(struct mtd_info *mtd, u_char *

addr, loff_t from, size_t len);

/*

讀/寫操作 */

int (*read) (struct

mtd_info *mtd, loff_t

from, size_t len, size_t *retlen, u_char *buf); int (*write) (struct mtd_info

*mtd, loff_t to, size_t

len,

size_t *retlen, const u_char *buf);

/* 帶 ECC 碼的讀/寫操作 */

int

(*read_ecc) (struct mtd_info

*mtd, loff_t from, size_t len,

size_t *retlen, u_char *buf,

u_char *eccbuf, struct nand_oobinfo *oobsel);

int (*write_ecc) (struct mtd_info

*mtd, loff_t to, size_t len, size_t *retlen,

const u_char *buf, u_char *eccbuf, struct

nand_oobinfo *oobsel);

/* 帶 OOB 碼的讀/寫操作 */

int

(*read_oob) (struct mtd_info

*mtd, loff_t from, size_t len,

size_t *retlen, u_char *buf);

int

(*write_oob) (struct mtd_info

*mtd, loff_t to, size_t

len, size_t *retlen, const u_char *buf);

/* 提供訪問保護寄存器區(qū)的方法 */

int (*get_fact_prot_info) (struct

mtd_info *mtd, struct

otp_info *buf, size_t

len); int (*read_fact_prot_reg) (struct

mtd_info *mtd, loff_t

from, size_t len,

size_t *retlen, u_char *buf);

int (*get_user_prot_info) (struct

mtd_info *mtd, struct

otp_info *buf, size_t

len); int (*read_user_prot_reg) (struct

mtd_info *mtd, loff_t

from, size_t len,

size_t *retlen, u_char *buf);

int (*write_user_prot_reg) (struct

mtd_info *mtd, loff_t from, size_t len,

size_t *retlen, u_char *buf);

int (*lock_user_prot_reg) (struct

mtd_info *mtd, loff_t from, size_t len);

/* 提供 readv

和 writev 方法???????? */

int

(*readv) (struct mtd_info

*mtd, struct kvec *vecs, unsigned long count, loff_t from, size_t *retlen);

int

(*readv_ecc) (struct mtd_info

*mtd, struct kvec *vecs, unsigned long count, loff_t from, size_t *retlen, u_char *eccbuf,

struct nand_oobinfo *oobsel);

int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);

int (*writev_ecc) (struct mtd_info

*mtd, const struct kvec *vecs,

unsigned long count, loff_t to, size_t *retlen, u_char *eccbuf, struct

nand_oobinfo *oobsel);

/*

同步操作 */

void (*sync) (struct mtd_info *mtd);

/* 芯片級支持的加/解鎖操作 */

int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len);

int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len);

/* 電源管理操作?????????? */

int (*suspend) (struct mtd_info *mtd); void (*resume) (struct mtd_info *mtd);

/* 壞塊管理操作?????????? */

int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);

/* 重啟前的通知事件??????? */

struct

notifier_block reboot_notifier; void *priv; /* 私有數(shù)據(jù)結構 */

struct module

*owner; /* 模塊所有者 */ int usecount; /* 使用次數(shù) */

};

總結

以上是生活随笔為你收集整理的Linux创始人数据结构,Linux 通用数据结构说明的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。