This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
fat and readdir
- From: Artem Romanov <moggiozzi at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Mon, 11 Apr 2011 23:38:06 +0400
- Subject: [ECOS] fat and readdir
I heve code:
ret = mount("/dev/synthdisk0/" , "/", "fatfs");
DIR *dirp = opendir( "/dir3/" );
while (true) {
struct dirent *entry = readdir( dirp );
if( entry == NULL ) break;
printf("%s",entry->d_name);
}
And have directory(filesystem fat16):
/mnt/loop/dir3# ls
dir1 dir2 file1 file2 mmm text
Why I get list1 instead list2?
list1:
.
..
Af
FILE1
Af
FILE2
Ad
DIR1
Ad
DIR2
At
TEXT
Am
MMM
list2:
.
..
FILE1
FILE2
DIR1
DIR2
TEXT
MMM
I think this is a mistake and should correct in
/packages/fs/fat/current/src/fatfs_supp.c in function
static int
read_next_raw_dentry(fatfs_disk_t *disk,
fatfs_data_pos_t *pos,
fat_raw_dir_entry_t *dentry)
{
...
- else if (!DENTRY_IS_DELETED(dentry))
+ else if (!DENTRY_IS_DELETED(dentry) && dentry->attr != 15)
...
}
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss