file, inode與cdev的總結

2021-07-26 15:31:51 字數 716 閱讀 1432

file, inode, cdev物件的描述

struct file物件:描述程序中開啟open乙個檔案的資訊:檔名,標誌(可讀寫),檔案偏移

open("/dev/led", o_rdwr|o_creat, 0666);

struct file

struct cdev物件:描述乙個字元裝置物件資訊(裝置號+檔案操作物件),任何乙個字元裝置驅動都有該物件,

struct cdev ;

struct inode物件: 描述檔案系統中的某個檔案的屬性(檔案許可權,型別,uid,gid,修改時間等)

struct inode

inode與cdev物件的關係

file,fd,inode與cdev物件的關係

file,fd,inode與cdev物件的構建順序

申請裝置號(alloc_chrdev_region/register_chrdev_region)-->建立cdev物件( cdev_alloc->cdev_init->cdev_add)->建立inode節點(mknod或class_create+device_create)->開啟檔案file-->得到fd。

linux字元cdev和inode的聯絡

好長時間沒怎麼看書了,最近把字元裝置驅動部分又複習了一下,寫個筆記.char device driver struct cdev struct kobj map probes 255 struct mutex lock static struct char device struct chrdevs...

linux字元cdev和inode的聯絡

struct cdev probes 255 struct mutex lock static struct char device struct chrdevs chrdev major hash size define chrdev major hash size 255 下面本文通過一下三個方...

linux字元cdev和Inode的關係

本文所說的inode是struct inode結構體,並不是在inode塊中的inode結點。char device driver struct cdev probes 255 struct mutex lock static struct char device struct chrdevs ch...