Accessing filesystem from a KLD

Seb sebastien.b at
Sat Jul 2 10:11:48 GMT 2005

Andrey Simonenko wrote :
> You got page fault from namei(), which is called from vn_open() to lookup
> a path name.  namei() tries to obtain a reference on current directory for
> the current thread.  This current directory (fd_cdir field) is NULL in
> your kthread.  At this point a page fault in kernel address space is
> generated.

You were right :) It works now.

> Can you change fd_cdir in kthread to rootvnode I don't know, haven't
> checked this yet.  

It works - and that's what NDISulator does. You also need to set fd_rdir.

Thanks !

Mike Silbersack wrote :
> Ask damien.bergamini at for his code that does exactly what you're 
> asking for. :)

I've looked at Damien's source, but AFAIK in his driver, the firmware is 
loaded from userspace through an ioctl call on the network interface.

More information about the freebsd-hackers mailing list