Generally speaking, returning directory entries is just like returning raw data, except:
The first point means that you cannot return, for example, seven and a half struct dirent entries. If eight of these structures don't fit into the allotted space, then you must return only seven.
The second point is fairly obvious; it's mentioned here only because filling in the struct dirent can be a little tricky compared to the "raw data" approach for a "normal" io_read().