tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pass-through linux ioctl for mfi(4)



    Date:        Mon, 17 Sep 2012 17:47:08 +0200
    From:        Manuel Bouyer <bouyer%antioche.eu.org@localhost>
    Message-ID:  <20120917154708.GA25378%asim.lip6.fr@localhost>

  | 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.

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.)

kre


Home | Main Index | Thread Index | Old Index