Mercurial > ecos
changeset 2473:9f64d4601b5b
* cdl/ramfs.cdl: Use CYGPKG_FS_RAM_RET_DIRENT_DTYPE to control
whether ram sets file type in ramfs_fo_dirread.
* src/ramfs.c: Set file type in ramfs_fo_dirread.
* tests/ramfs1.c: Test the new d_type in dirent when present.
| author | asl |
|---|---|
| date | Thu, 01 May 2008 09:31:49 +0000 |
| parents | c5e3739b3c9a |
| children | 82f8f3f7c561 |
| files | packages/fs/ram/current/ChangeLog packages/fs/ram/current/cdl/ramfs.cdl packages/fs/ram/current/src/ramfs.c packages/fs/ram/current/tests/ramfs1.c |
| diffstat | 4 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/fs/ram/current/ChangeLog +++ b/packages/fs/ram/current/ChangeLog @@ -1,3 +1,11 @@ +2008-04-02 Xinghua Yang <yxinghua@sunnorth.com.cn> + Taiyun Wang <taiyun@sunnorth.com.cn> + + * cdl/ramfs.cdl: Use CYGPKG_FS_RAM_RET_DIRENT_DTYPE to control + whether ram sets file type in ramfs_fo_dirread. + * src/ramfs.c: Set file type in ramfs_fo_dirread. + * tests/ramfs1.c: Test the new d_type in dirent when present. + 2006-10-05 Andrew Lunn <andrew.lunn@ascom.ch Paluch Sebastian <the_sorcerer&op.pl>
--- a/packages/fs/ram/current/cdl/ramfs.cdl +++ b/packages/fs/ram/current/cdl/ramfs.cdl @@ -188,6 +188,18 @@ cdl_package CYGPKG_FS_RAM { blocks that are referenced from a file or directory node." } + cdl_option CYGPKG_FS_RAM_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 RAM 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/ram/current/src/ramfs.c +++ b/packages/fs/ram/current/src/ramfs.c @@ -2370,6 +2370,9 @@ static int ramfs_fo_dirread (struct memcpy( nbuf, d->name, fraglen); nbuf += fraglen; nlen -= fraglen; +#ifdef CYGPKG_FS_RAM_RET_DIRENT_DTYPE + ent->d_type = d->node->mode; +#endif // if we hit the last entry, we have a successful transfer if( d->last || nlen == 0)
--- a/packages/fs/ram/current/tests/ramfs1.c +++ b/packages/fs/ram/current/tests/ramfs1.c @@ -138,6 +138,9 @@ static void listdir( char *name, int sta break; num++; diag_printf("<INFO>: entry %14s",entry->d_name); +#ifdef CYGPKG_FS_RAM_RET_DIRENT_DTYPE + diag_printf(" d_type %2x", entry->d_type); +#endif if( statp ) { char fullname[PATH_MAX]; @@ -166,6 +169,10 @@ static void listdir( char *name, int sta sbuf.st_mode,sbuf.st_ino,sbuf.st_nlink, (unsigned long) sbuf.st_size); } +#ifdef CYGPKG_FS_FAT_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");
