Help - Search - Members - Calendar
Full Version: Open() Function In Device Drivers
Linuxhelp > Support > Programming in Linux
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
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.
Thanks for the info.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.