Mercurial > ecos
changeset 2474:82f8f3f7c561
* cdl/romfs.cdl: Use CYGPKG_FS_ROM_RET_DIRENT_DTYPE to control
whether fatfs sets file type in romfs_fo_dirread.
* src/romfs.c: Set file type in romfs_fo_dirread.
* tests/romfs1.c: Test the new d_type in dirent when present.
| author | asl |
|---|---|
| date | Thu, 01 May 2008 09:33:12 +0000 |
| parents | 9f64d4601b5b |
| children | e302e779e69b |
| files | packages/fs/rom/current/ChangeLog packages/fs/rom/current/cdl/romfs.cdl packages/fs/rom/current/src/romfs.c packages/fs/rom/current/tests/romfs1.c |
| diffstat | 4 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/fs/rom/current/ChangeLog +++ b/packages/fs/rom/current/ChangeLog @@ -1,3 +1,11 @@ +2006-11-13 Xinghua Yang <yxinghua@sunnorth.com.cn> + Taiyun Wang <taiyun@sunnorth.com.cn> + + * cdl/romfs.cdl: Use CYGPKG_FS_ROM_RET_DIRENT_DTYPE to control + whether fatfs sets file type in romfs_fo_dirread. + * src/romfs.c: Set file type in romfs_fo_dirread. + * tests/romfs1.c: Test the new d_type in dirent when present. + 2006-11-13 Oyvind Harboe <oyvind.harboe@zylin.com> * support/file2c.tcl : align romdisk data to 4 bytes. With a bit
--- a/packages/fs/rom/current/cdl/romfs.cdl +++ b/packages/fs/rom/current/cdl/romfs.cdl @@ -83,6 +83,20 @@ cdl_package CYGPKG_FS_ROM { used to create a rom filesystem image." } + cdl_option CYGPKG_FS_ROM_RET_DIRENT_DTYPE { + display "Support for fileio's struct dirent d_type field" + flavor bool + default_value 0 + active_if CYGPKG_FILEIO_DIRENT_DTYPE + + description " + This option controls whether the ROM filesystem supports + setting fileio's struct dirent d_type field. + If this option is enabled, d_type will be set. Otherwise, + nothing will be done, d_type's value will be zero because + fileio already sets it." + } + # ---------------------------------------------------------------- # Tests
--- a/packages/fs/rom/current/src/romfs.c +++ b/packages/fs/rom/current/src/romfs.c @@ -1077,6 +1077,9 @@ static int romfs_fo_dirread (struct for ( i = 0 ; i < nlen && d->name[i] ; i++, nbuf++ ) *nbuf = d->name[i]; +#ifdef CYGPKG_FS_ROM_RET_DIRENT_DTYPE + ent->d_type = (((romfs_disk *)fp->f_mte->data)->node[d->node]).mode; +#endif // A successful read. Terminate the entry name with a NUL, set the // residue and set the file offset to restart at the next
--- a/packages/fs/rom/current/tests/romfs1.c +++ b/packages/fs/rom/current/tests/romfs1.c @@ -56,6 +56,7 @@ #include <pkgconf/io_fileio.h> #include <pkgconf/isoinfra.h> #include <pkgconf/system.h> +#include <pkgconf/fs_rom.h> #include <unistd.h> #include <fcntl.h> @@ -142,6 +143,9 @@ static void listdir( char *name, int sta break; diag_printf("<INFO>: entry %14s",entry->d_name); +#ifdef CYGPKG_FS_ROM_RET_DIRENT_DTYPE + diag_printf(" d_type %2x", entry->d_type); +#endif if( statp ) { char fullname[PATH_MAX]; @@ -169,6 +173,10 @@ static void listdir( char *name, int sta diag_printf(" [mode %08x ino %08x nlink %d size %ld]", sbuf.st_mode,sbuf.st_ino,sbuf.st_nlink,sbuf.st_size); } +#ifdef CYGPKG_FS_ROM_RET_DIRENT_DTYPE + if ((entry->d_type & S_IFMT) != (sbuf.st_mode & S_IFMT)) + CYG_TEST_FAIL("File mode's don't match between dirent and stat"); +#endif } diag_printf("\n");
