~martanne/ciopfs

c48d6f29fcd26ba82deb2bc7f9d0fd2f2cf9bb1a — Marc Andre Tanner 11 years ago 8c40a59
readdir: don't process everything in one go

Use seekdir and telldir instead and let fuse call us multiple times.

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>
1 files changed, 7 insertions(+), 2 deletions(-)

M ciopfs.c
M ciopfs.c => ciopfs.c +7 -2
@@ 425,7 425,12 @@ static int ciopfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
		goto out;
	}

	strcpy(dnamebuf, p);
	if (!dp) {
		ret = -EBADF;
		goto out;
	}

	seekdir(dp, offset);

	while ((de = readdir(dp)) != NULL) {
		struct stat st;


@@ 465,7 470,7 @@ static int ciopfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
				dname = de->d_name;
		}
		debug("dname: %s\n", dname);
		if (filler(buf, dname, &st, 0))
		if (filler(buf, dname, &st, telldir(dp)))
			break;
	}