Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Open() Function In Device Drivers

Posted by: vasanth Feb 26 2005, 05:42 AM

what is the difference between the two functions open(path of the file,flags) and the open function found in device drivers i.e open( struct file,inode).is there any relation between the two functions? which one to use to open devices? if first one,whats the use of the seconf function?
thanks in advance

Posted by: Hemant Feb 26 2005, 08:10 PM

Both are different.I will try to explain how?

When a device driver programmer writes a device driver,he has to follow the unix standards.
For example,i am writting a sound card device driver,then i must provide methods with which the device can be opened(open()),some data could be written,send(write()),and some data could be read.Thus to give uniform programming interface to the programmers who will write application level programs(not kernel stuff),device driver programmers try to use same name for functions.

Now the standars unix system call,open().Which can be used to open a file can also be used to open a device.But the difference is...When it tries to open a file on the disk.....This open() system call will in turn invoke,the open() method provided by the disk device driver.If a network card is opened....then our standard unix system will use the open() method provided by the network driver.

Posted by: vasanth Feb 28 2005, 03:23 AM

Thanks for the info.

Powered by Invision Power Board (
© Invision Power Services (