[問題]VFS的概念

看板LinuxDev作者時間17年前 (2008/07/07 18:44), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/4 (看更多)
http://www.jollen.org/blog/2006/05/linux_2_system_calls.html 不好意思 裏頭有提到jollen裏頭說到VFS(virtual file system) 我不知道這個VFS是不是 我們常說的file system ex:ext3、ext2之類的 以下是我對這個概念了解 還請高手們指點一下 通常 在user space 切到 kernel space需要經由一個system call | | user application device driver 而user ap 與 device driver 透過一個device file作個媒介(放在/dev 下) 這個device file 可以是一個字元裝置檔/區塊裝置檔(依你的device driver而定) 之後 我們只要針對這個device file引用system call的函式 即可與device driver 作溝通 只是 device file 依我們的file system來規畫 就如上所說 今天 我是ext3的 file system 這個device file就是ext3格式的 如果 我是ext2的 file system 這個device file就是ext2格式 也就是 jollen所說的 『Linux 驅動程式與 user application 間的溝通方式是透過 system call, 實際上 user application 是以 device file 與裝置驅動程式溝通。 要達成此目的,驅動程式必須建構在此「file」之上,因此 Linux 驅動程式必須透過 VFS(virtual file system)層來實作 system call。 』 以下的code int main(int argc, char *argv[]) { int devfd; devfd = open("/dev/debug", O_RDONLY); //open() system call函式 // debug是一個device file if (devfd == -1) { printf("Can't open /dev/debug\n"); return -1; } ioctl(devfd, IOCTL_WRITE, num); //ioctl() system call函式 close(devfd); return 0;} 以上 是我的想法 想請大大們指正我的想法 -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.161.170.127 ※ 編輯: markchen 來自: 118.161.170.127 (07/07 18:44)
文章代碼(AID): #18SVECnW (LinuxDev)
討論串 (同標題文章)
以下文章回應了本文
1
1
完整討論串 (本文為第 1 之 4 篇):
1
1
0
1
文章代碼(AID): #18SVECnW (LinuxDev)