diff options
author | Eric Wong <normalperson@yhbt.net> | 2014-03-05 14:45:44 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-03-05 14:45:44 +0100 |
commit | 6bf2e6f07c133f7b145a4726c5d962f14c650ca7 (patch) | |
tree | 7ab3a9941edad868c961404f0bbee23967990118 /lib/modules | |
parent | 0096c126aa4548df66c658afeb18a5a5356a2c57 (diff) |
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.
Diffstat (limited to 'lib/modules')
-rw-r--r-- | lib/modules/iconv.c | 10 | ||||
-rw-r--r-- | lib/modules/subdir.c | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/modules/iconv.c b/lib/modules/iconv.c index 7438ecb..7d96c17 100644 --- a/lib/modules/iconv.c +++ b/lib/modules/iconv.c @@ -172,20 +172,22 @@ static int iconv_opendir(const char *path, struct fuse_file_info *fi) } static int iconv_dir_fill(void *buf, const char *name, - const struct stat *stbuf, off_t off) + const struct stat *stbuf, off_t off, + enum fuse_fill_dir_flags flags) { struct iconv_dh *dh = buf; char *newname; int res = 0; if (iconv_convpath(dh->ic, name, &newname, 1) == 0) { - res = dh->prev_filler(dh->prev_buf, newname, stbuf, off); + res = dh->prev_filler(dh->prev_buf, newname, stbuf, off, flags); free(newname); } return res; } static int iconv_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) { struct iconv *ic = iconv_get(); char *newpath; @@ -196,7 +198,7 @@ static int iconv_readdir(const char *path, void *buf, fuse_fill_dir_t filler, dh.prev_buf = buf; dh.prev_filler = filler; err = fuse_fs_readdir(ic->next, newpath, &dh, iconv_dir_fill, - offset, fi); + offset, fi, flags); free(newpath); } return err; diff --git a/lib/modules/subdir.c b/lib/modules/subdir.c index eb56d36..05eccdf 100644 --- a/lib/modules/subdir.c +++ b/lib/modules/subdir.c @@ -181,14 +181,15 @@ static int subdir_opendir(const char *path, struct fuse_file_info *fi) static int subdir_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, - struct fuse_file_info *fi) + struct fuse_file_info *fi, + enum fuse_readdir_flags flags) { struct subdir *d = subdir_get(); char *newpath; int err = subdir_addpath(d, path, &newpath); if (!err) { err = fuse_fs_readdir(d->next, newpath, buf, filler, offset, - fi); + fi, flags); free(newpath); } return err; |