On Mon, Sep 17, 2012 at 11:02:13PM +0700, Robert Elz wrote: > Date: Mon, 17 Sep 2012 17:47:08 +0200 > From: Manuel Bouyer <bou...@antioche.eu.org> > Message-ID: <20120917154708.ga25...@asim.lip6.fr> > > | But this assumes that the mfi driver is compiled in. it doesn't > | look right, especially in the context of modules. > > Sure - the point is that you just do whatever the system would do > in order to call the ioctl() function, other than actually calling it, > to the point where you believe that it is the mfi driver, or that it > isn't. > > Of course, it doesn't need to be the d_ioctl that gets tested, you > could use anything that's in cdevsw[] - and you can test anything > that you can find (including the file name the module was dynamically > loaded from). > > What you do now (if it is a module) is that it must have already been > loaded (because we have a fd that refers to it), so its functions are > all there to test.
Sorry but I can't see how a kernel with COMPAT_LINUX but without mfi would compile. > > Personally, I wouldn't test at all, I'[d just assume it is an mfi > if it is an mfi looking ioctl cmd, call the device's d_ioctl() in the > normal way (after doing whatever arg/cmd massaging is needed to get > from the compat interface to the native ioctl), and if it succeeds, > you're done, if it fails, you just revert to the original everything > and let whatever happens, happen (it wasn't mfi after all.) that's what my patch does. -- Manuel Bouyer <bou...@antioche.eu.org> NetBSD: 26 ans d'experience feront toujours la difference --