[Ilugc] Query on drivers?
- From: m.sujith@xxxxxxxxx (Sujith M)
- Date: Tue Aug 23 10:52:20 2005
When a read system call is issued on some opened file etc... why is that
the driver has to copy data from the HDD to kernel and then from kernel
to userspace mem. Why can't it be copied from HDD to user space?
Assuming that the user space mem can be made not to swap out.
To make the underlying filesystem specifics transparent to the user space
application.
When you type 'ls' in /tmp or /mnt/windows_drive or /mnt/cdrom it shows the
list of files , right ? But 'ls' is actually a small binary and how does it
recognize the filesystem semantics ?
Because it follows a fixed set of system calls like this,
1.opendir() , readddir(), closedir()
2.stat() for every file to get attributes.
(The calls may not be the actual ones, but u get the idea)
Now the VFS layer in the kernel fills a 'stat' structure for every file in
that directory and ls just retrieves them to display it in user space.
In this manner any filesystem in the planet can be built in linux just by
defining a fixed of sematics.
Sujith.
Other related posts: