Returning directory entries

In the example for the read I/O function handler above, we saw how to return data. As mentioned in the description of the read I/O function handler (in the “Alphabetical listing of Connect and I/O functions”), the read I/O function handler may return directory entries as well. Since this isn't something that everyone will want to do, I discuss it here.

First of all, let's look at why and when you'd want to return directory entries rather than raw data from the read I/O function handler.

If you discretely manifest entries in the pathname space, and those entries are not marked with the _RESMGR_FLAG_DIR, then you won't have to return directory entries in the read I/O function handler. If you think about this from a “filesystem” perspective, you're effectively creating “file” types of objects. If, on the other hand, you do specify _RESMGR_FLAG_DIR, then you're creating a “directory” type of object. Nobody other than you knows what the contents of that directory are, so you have to be the one to supply this data. That's exactly why you'd return directory entries from your read I/O function handler.