kernel system call open - Linux

By Isla
at 2016-06-10T10:30
at 2016-06-10T10:30
Table of Contents
最近想追一下 kernel ,就從網路上常見的 chrdev driver 開始看起
知道在
init_xxx(){
register_chrdev(major, name, &fops)
}
module_init(init_xxx)
註冊 driver 。到 register_chrdev 去看,裡面的內容大致說---註冊 struct cdev
到系統,以及對 cdev 的成員賦值。例如: kobject 或者 file operation 等等..
另外在 write 奧秘這篇網誌我看到,他open file 後會得到 file descriptor,
再透過 file descriptor 得到 file 結構,再透過 file 結構內的 ops 得到
driver method。
綜合上面兩個,我還是不知道他是如何透過 open 將 file 結構和 driver 內的
file_operations 結構關聯在一起,能有大大指點嗎? 謝謝。
--
知道在
init_xxx(){
register_chrdev(major, name, &fops)
}
module_init(init_xxx)
註冊 driver 。到 register_chrdev 去看,裡面的內容大致說---註冊 struct cdev
到系統,以及對 cdev 的成員賦值。例如: kobject 或者 file operation 等等..
另外在 write 奧秘這篇網誌我看到,他open file 後會得到 file descriptor,
再透過 file descriptor 得到 file 結構,再透過 file 結構內的 ops 得到
driver method。
綜合上面兩個,我還是不知道他是如何透過 open 將 file 結構和 driver 內的
file_operations 結構關聯在一起,能有大大指點嗎? 謝謝。
--
Tags:
Linux
All Comments

By Frederic
at 2016-06-10T20:18
at 2016-06-10T20:18

By Isla
at 2016-06-12T12:29
at 2016-06-12T12:29
Related Posts
電視盒接pi

By Doris
at 2016-06-10T00:02
at 2016-06-10T00:02
請問在 Ubuntu 16.04 上面該怎麼跑 wine-staging 呢?

By Caitlin
at 2016-06-07T17:29
at 2016-06-07T17:29
怎麼寫正式的Linux命令工具

By Yedda
at 2016-06-06T19:35
at 2016-06-06T19:35
如何等到檔案出現後才執行另外的程式

By Connor
at 2016-06-06T16:40
at 2016-06-06T16:40
NVidia driver不支援kernel 4.6

By Jacob
at 2016-06-05T20:28
at 2016-06-05T20:28