Hi all,

I'm looking to write an I/O interface in C that can use the following means to perform I/O.
open/read DIRECT
fopen/fread STREAM
open/mmap MMAPPED

A typical generic read would be:

iRead(hndl, char *buf, size_t sz);

This is trivial for the DIRECT and STREAM versions. Since the underlying read/fread maybe called. But I'm at a loss for the mmap version:

iRead(hndl, char **buf, size_t sz );

I'd like for the application code to be able to map and have its buffers returning a directly accessible address.

I'm thinking that maybe the iOpen call provide a buffer for reading. That way the I/O may be buffered and a pointer to the internal buffer returned. In other words, make the read/fread interfaces look like the mmap interface. That way the application code could use either method interchangably.

Any thoughts of better ways to do this?