Customizing a device drive


I am working on a legacy system that is build on QNX4 operating system. Due to some customer constraints and hardware changes, we are investigating the use of the hard drive as a “virtual” replacement for the floppy drive. I am using the word “virtual”, because we have a suit of legacy applications that are hard coded to use the floppy drive directly, and we want these application to start using the hard drive instead WITHOUT recompiling the applications (and testing them, and so on).

What would be nice is if we can compile a new /dev/fd0 (or something similar) that talks to a hard drive partition rather than the floppy. A symbolic link will not be enough, because we need to intercept some of the IO calls from these applications, do some extra logic and then write them out.

I would really appreciate it if some one can give me a link to some tools resources that can get me started on this path (open source code, licensed libraries, code examples).

Thanks in advance for the help.

What about creating the smallest partition possible on the HD (not to waste space) and then mount it under the name /dev/fd0, of course if your software requires and EXACT size of 1.44M this could be a problem.

The best of course would be to get the source to Fsys.floppy which to my knowledge isnt available. I dont think there is any official or unofficial documentation about the interfaces supported by Fsys.floppy. I think there is some stuff on qnx ftp site to help you write a Filesystem driver.

Also you can find on that same ftp site an iomngr library that will support all various messages an io manager may have to deal with.

Can you give me the address of the FTP site? It would be great to see some samples for handling custom file systesm. Since QNX support many filesystems, I was hoping to see the source code for such example.

Building an I/O manager that is equivalent to Fsys for simulating a floppy would be a daunting task.
An alternative would be building an Fsys driver that instead of doing hardware I/O calls to read sectors, would use the file system to read and write a floppy image file on the hard disk.
This is actually quite tricky if you think about it. An application calls Fsys to read a file on the floppy. Fsys calls your psuedo-driver. Your driver calls Fsys which then calls the hard disk driver.
As you might guess, this could cause a problem. I’ve done something like this in the distant past.
The problem is that Fsys drivers, when called by Fsys are the Fsys process. Fsys cannot send itself a message. The solution is for the driver to maintain itself as a separate process.
Then you there needs to be communication between the driver running as Fsys and as itself.
This can be accomplished using message passing, and possibly shared memory.