Reading a file in the driver
Hi,
I am reading some data from a file byte by byte in my driver. Although it's not a good thing to read a file in the driver I have to do it. My file is quite big can contain about 1000 lines each line containing anywhere from 0 to 500 characters. I believe carry out 500000 reads is not a good thing.
Any suggestions on how I can improve ??
Thanks and Regards,
David
Signature · 6 lines
__________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup Meet Singles http://corp.mail.com/lavalife
Quoted 3 lines · David Anderson
I am reading some data from a file byte by byte in my driver. Although it's not a good thing to read a file in the driver I have to do it. My file is quite big can contain about 1000 lines each line containing anywhere from 0 to 500 characters. I believe carry out 500000 reads is not a good thing.
Any suggestions on how I can improve ??
Sure, do it from userland. Make a device node to which userland can write the file you want. This nicely removes the policy problem of *which* file to read from *what* location and puts it were it belongs: userland. With this setup you can even read files from such exotic locations like other servers or SQL databases.
If the driver needs to initiate the file reading, just startup a userland helper that does the reads for you. See for example how the hotplug subsystem calls /sbin/hotplug.
Erik
Signature · 3 lines
J.A.K. (Erik) Mouw [email protected] [email protected] http://www-ict.its.tudelft.nl/~erik/