Implemented rewindind a directory in lowntfs-3g

Rewinding a directory is done by freeing the current list of files and
rebuilding it. Only seeking to the beginning of the list is implemented.
pull/2/head
Jean-Pierre André 2015-04-17 11:38:33 +02:00
parent 5741f54529
commit 0d01fcabfc
1 changed files with 10 additions and 0 deletions

View File

@ -1171,6 +1171,16 @@ static void ntfs_fuse_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
fill = (ntfs_fuse_fill_context_t*)(long)fi->fh;
if (fill && (fill->ino == ino)) {
if (fill->filled && !off) {
/* Rewinding : make sure to clear existing results */
current = fill->first;
while (current) {
current = current->next;
free(fill->first);
fill->first = current;
}
fill->filled = FALSE;
}
if (!fill->filled) {
/* initial call : build the full list */
first = (ntfs_fuse_fill_item_t*)ntfs_malloc