Skip to content

Commit

Permalink
Support the lack of paths when cache is off
Browse files Browse the repository at this point in the history
Before FUSE 2.9, FUSE had to emulate unlink() if a file was still open
via renaming to a hidden file.  This was due to the requirement that a
valid "path" argument must be submitted for many FUSE operations. FUSE
2.9 introduced the flag_nullpath_ok and flag_nopath flags that allow a
FUSE file system to signal to FUSE that the "path" argument may be NULL
in certain operations.

sshfs doesn't require paths if the cache isn't used so communicate
that information to the FUSE layer.
  • Loading branch information
rianhunter committed Jun 2, 2016
1 parent 0f6f33b commit 74bfa38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ static void cache_unity_fill(struct fuse_cache_operations *oper,
cache_oper->ftruncate = oper->oper.ftruncate;
cache_oper->fgetattr = oper->oper.fgetattr;
#endif
#if FUSE_VERSION >= 29
cache_oper->flag_nullpath_ok = oper->oper.flag_nullpath_ok;
cache_oper->flag_nopath = oper->oper.flag_nopath;
#endif
}

static void cache_fill(struct fuse_cache_operations *oper,
Expand All @@ -548,6 +552,10 @@ static void cache_fill(struct fuse_cache_operations *oper,
cache_oper->ftruncate = oper->oper.ftruncate ? cache_ftruncate : NULL;
cache_oper->fgetattr = oper->oper.fgetattr ? cache_fgetattr : NULL;
#endif
#if FUSE_VERSION >= 29
cache_oper->flag_nullpath_ok = 0;
cache_oper->flag_nopath = 0;
#endif

}

Expand Down
4 changes: 4 additions & 0 deletions sshfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3372,6 +3372,10 @@ static struct fuse_cache_operations sshfs_oper = {
.create = sshfs_create,
.ftruncate = sshfs_ftruncate,
.fgetattr = sshfs_fgetattr,
#endif
#if FUSE_VERSION >= 29
.flag_nullpath_ok = 1,
.flag_nopath = 1,
#endif
},
.cache_getdir = sshfs_getdir,
Expand Down

0 comments on commit 74bfa38

Please sign in to comment.