From 6bf2e6f07c133f7b145a4726c5d962f14c650ca7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Mar 2014 14:45:44 +0100 Subject: libfuse: implement readdirplus for high-level API Reuse the old "readdir" callback, but add a flags argument, that has FUSE_READDIR_PLUS in case this is a "plus" version. Filesystems can safely ignore this flag, but if they want they can add optimizations based on it: i.e. only retrieve the full attributes in PLUS mode. The filler function is also given a flags argument and the filesystem can set FUSE_FILL_DIR_PLUS if all the attributes in "stat" are valid. --- example/hello.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'example/hello.c') diff --git a/example/hello.c b/example/hello.c index d26d826..3c24c8b 100755 --- a/example/hello.c +++ b/example/hello.c @@ -65,17 +65,19 @@ static int hello_getattr(const char *path, struct stat *stbuf) } static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler, - off_t offset, struct fuse_file_info *fi) + off_t offset, struct fuse_file_info *fi, + enum fuse_readdir_flags flags) { (void) offset; (void) fi; + (void) flags; if (strcmp(path, "/") != 0) return -ENOENT; - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); - filler(buf, hello_path + 1, NULL, 0); + filler(buf, ".", NULL, 0, 0); + filler(buf, "..", NULL, 0, 0); + filler(buf, hello_path + 1, NULL, 0, 0); return 0; } -- cgit v1.2.3