It was thus said that the Great Tony Duell once stated:
As long as there are no critical timing issues,
and you don't need
interrupts it's not hard.
That's the problem. To determine the sector layout there _are_ critical
timing issues.
To read or write a given sector there are no real problems. You load the
floppy controller (and DMA chip) registers with the right values, it goes
off and does it. It doesn't matter if your task is switched out at the
end of that, the data will be there when your task runs again, etc.
But to read the IDs, it appears you _have_ to submit the next command as
soon as you get the results from the current one, or risk missing a
sector. And as far as I can see there's no way to be sure of doing that
on a multitasking system.
The only way I see this happening is to modify the floppy device driver to
support a call to do this. I don't know the low level details involved (do
you issue the command and wait for an IRQ, or just keep polling?) but I
wouldn't attempt to do such a thing in userland if it's that time critical.
-spc ('tis just another ioctl() away ... )