Subject: Re: Kernel API question 2
To: Brett Lymn <email@example.com>
From: Iain Hibbert <firstname.lastname@example.org>
Date: 03/24/2006 13:06:25
On Fri, 24 Mar 2006, Brett Lymn wrote:
> On Fri, Mar 24, 2006 at 10:42:46AM +0100, Filka Michal wrote:
> > I have one more question. The last parameter of NDINIT is described as
> > "the calling process.". However, if I call it from my driver I needn't
> > to be in any process context ... So, is NULL allowed or should I use any
> > "kernel process identifier"?
> No - you need a process context so that credentials and so forth can
> be checked to see if you are allowed to open the file or not. The
> kernel routines are not designed for reading data from a filesystem
> without a process requesting it so what you seem to be trying to do is
> very difficult.
since the filesystem is not available until quite late in the boot
process, such a thing can not generally be done in the device _attach
routine in any case.
there is a working example in the tree (dev/usb/ubtbcmfw.c) that tries to
get around this by sleeping and trying again a bit later on failure.
alternatively, I'm not sure how many devices have been changed to use the
new firmload(9) framework but the way I did it was to have device
configuration triggered by a userland program via ioctl(2) so the callers
credentials are used..