Date: Wed, 29 Jun 2005 11:55:50 +0200 From: Seb <sebastien.b@swissinfo.org> To: freebsd-hackers@freebsd.org Subject: Re: Accessing filesystem from a KLD Message-ID: <200506291155.50929.sebastien.b@swissinfo.org> In-Reply-To: <20050629091211.GA438@pm514-9.comsys.ntu-kpi.kiev.ua> References: <200506251203.13569.sebastien.b@swissinfo.org> <200506291051.01760.sebastien.b@swissinfo.org> <20050629091211.GA438@pm514-9.comsys.ntu-kpi.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
> Why not to use VOP_READ? See how it is called in dev/md.c:mdstart_vnode, > check kern/vfs_vnops.c:vn_open_cred for information how to lookup a file > name and open it. That's what I do, however I use the wrapper functions vn_open(), vn_rdwr() and so. But I have a problem, when I call this code : void *request_firmware(const char *name, size_t *size) { int flags; char filename[40]; struct nameidata nd; struct thread *td = curthread; [...] NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, &filename[0], td); flags = FREAD; vn_open(&nd, &flags, 0, -1); [...] } from the KLD handler function (for testing) it works. But when I call it from a thread created by kthread_create() in another KLD, I have a page fault. A few printfs show that the call to vn_open() is responsible for the fault. I have not forgotten to lock Giant in my kernel thread. Any ideas ? Thanks, Sebastien
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506291155.50929.sebastien.b>