Request: struct dirent in DirHandle.h include d_reclen

08 Oct 2012

I was wondering if it would be possible to change the definition of the struct dirent in DirHandle.h as follows:

struct dirent {
   char           d_name[NAME_MAX+1];
   unsigned short d_reclen;
};

I believe this corresponds with the standard on Linux.

If d_reclen were present in dirent, then FATDirHandle::readdir would be able to pass the file size information (which is already available, but confined to FATDirHandle!) as follows:

    FRESULT res = f_readdir(&dir, &finfo);
    cur_entry.d_reclen = finfo.fsize;

For file systems that don't support reading the file size, the field could be left 0 (or set equal to some #defined INVALID_RECLEN maybe?).

Thanks.