Skip to content

Commit

Permalink
meson: handle fuse versions with buggy dt_type handling
Browse files Browse the repository at this point in the history
Link: libfuse/libfuse#591
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner (Microsoft) committed Mar 13, 2022
1 parent 6dc6057 commit 888ab80
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,17 @@ libfuse = dependency('fuse3', required: false)
if libfuse.found()
conf.set10('HAVE_FUSE3', true)
conf.set('FUSE_USE_VERSION', 35)
if libfuse.version().version_compare('>=3.10.3')
conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', true)
else
conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', false)
endif
else
libfuse = dependency('fuse', version: '>= 2.6')
if libfuse.found()
conf.set10('HAVE_FUSE', true)
conf.set('FUSE_USE_VERSION', 26)
conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', true)
endif
endif

Expand Down
2 changes: 2 additions & 0 deletions src/bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,9 @@ static void __attribute__((destructor)) lxcfs_exit(void)
void *lxcfs_fuse_init(struct fuse_conn_info *conn, void *data)
{
struct fuse_context *fc = fuse_get_context();
#if HAVE_FUSE_RETURNS_DT_TYPE
can_use_sys_cpu = true;
#endif
has_versioned_opts = true;
return fc->private_data;
}
6 changes: 3 additions & 3 deletions src/lxcfs_fuse_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ static inline int dir_fillerat(fuse_fill_dir_t filler, DIR *dp,
int ret;

ret = fstatat(dirfd(dp), name, &st, AT_SYMLINK_NOFOLLOW);
if (ret)
return DIR_FILLER(filler, buf, name, NULL, off);
if (!ret)
return DIR_FILLER(filler, buf, name, &st, off);

return DIR_FILLER(filler, buf, name, &st, off);
return DIR_FILLER(filler, buf, name, NULL, off);
}

#endif /* __LXCFS_FUSE_COMPAT_H */

0 comments on commit 888ab80

Please sign in to comment.