Accessing filesystem from a KLD
ssouhlal at FreeBSD.org
Sat Jun 25 10:15:26 GMT 2005
On Jun 25, 2005, at 6:03 AM, Seb wrote:
> How can I access the filesystem from a kernel module ?
> In fact, I want my device driver to retreive a firmware image
> stored on the
> filesystem (instead of putting the firmware data in a static array at
> compile-time) for memory usage and legal concerns. Blocking calls
> are OK.
> I have searched the manpages and the web, but I haven't found anything
You can use vn_open() to open the file, and then read it using vn_rdwr
(), and finally, vn_close() to close it. Look at src/sys/kern/
link_elf_obj.c for an example.
Suleiman Souhlal | ssouhlal at vt.edu
The FreeBSD Project | ssouhlal at FreeBSD.org
More information about the freebsd-hackers