rtems_rfs_dir_read searches the directory inode's entries list starting at the specified offset until an empty entry (last entry) is encountered. It fills in a struct dirent with the name of the entry, length of the name, ino of the entry, and the absolute offset of the entry in the parent directory's entries list.
Unfortunately, the stock implementation of rtems_rfs_dir_read returns a somewhat arbitrary offset (as dirent::d_off), while rtems_rfs_dir_lookup_ino always returns the correct offset. This change fixes that logic so the returned offset is accurate. Tested by comparing the offset returned in dirent with the result of rtems_rfs_dir_lookup_ino. --- cpukit/libfs/src/rfs/rtems-rfs-dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/libfs/src/rfs/rtems-rfs-dir.c b/cpukit/libfs/src/rfs/rtems-rfs-dir.c index 58bf305f4e..ceaafc59a1 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-dir.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-dir.c @@ -602,7 +602,7 @@ rtems_rfs_dir_read (rtems_rfs_file_system* fs, } memset (dirent, 0, sizeof (struct dirent)); - dirent->d_off = offset; + dirent->d_off = rtems_rfs_block_get_pos (fs, &map.bpos); dirent->d_reclen = sizeof (struct dirent); *length += elength; -- 2.14.2.920.gcf0c67979c-goog _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel