39 Commits

Author SHA1 Message Date
Haoxi Tan 1a52814a4e Merge branch 'master' into fill-stat-info-from-cache 2024-11-05 08:05:23 +10:00
Jan Palus 5f767dec5b Fill stat info when returning cached data for readdir
Uncached and cached results for readdir were inconsistent -- the former
returned correct stat info for directory entries while the latter
didn't. That's because only names of entries were saved in cache without
stat info. In turn this leads to issues like
https://github.com/junegunn/fzf/issues/3832 since directory traversal
library (https://github.com/charlievieth/fastwalk in this case) relies
on proper stat info returned by readdir. Hence when unchached result was
returned it gave proper outcome, while with cached result it was wrong.

Cache stat info next to entry name to fix the issue. While file
attributes are saved in cache already, they use full path as key. To
avoid potentially plenty of allocations, string copying and cache
lookups to get each attr, let's keep a copy of stat struct independently
to be on the fast path.
2024-06-17 11:48:44 +02:00
Jan Palus 8bb9d33d16 Fix memleak in cache after readlink 2024-06-17 00:10:02 +02:00
Cam Cope d54c7ecbd6 Fixup whitespace and configure CI to keep it that way 2021-08-30 15:35:33 +01:00
Michael Forney 4d866526dc Fix some inconsistent whitespace (#192) 2019-11-23 11:06:05 +00:00
Nikolaus Rath 63300fd564 Accept -o cache_* options for backward compatibility.
Fixes: #73.
2017-08-03 18:26:19 +02:00
Nikolaus Rath 34146444ce Switch to libfuse 3.0. 2017-07-08 12:25:13 +02:00
Nikolaus Rath c711bf738f Re-enabled cache support. 2017-07-08 00:34:01 +02:00
Nikolaus Rath 0908f570dc Dropped obsolete FUSE 2.x #ifdefs 2017-06-20 11:29:19 -07:00
Rian Hunter 74bfa3850a Support the lack of paths when cache is off
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.
2016-06-01 23:27:01 -07:00
Julio Merino 391f676705 Explicitly qualify unsigned as unsigned int 2016-02-10 23:18:35 -05:00
Julio Merino c1e799b4da Expose the cache clean interval settings as flags
Allow the user to customize the cache regular and minimum clean intervals
as flags via the new cache_clean_interval and cache_min_clean_interval
options.

While doing this, rename the internal variables and constants to suffix
them with their unit (seconds).
2016-02-10 23:18:35 -05:00
Julio Merino ebfeebd468 Expose the maximum cache size setting as a flag
Allow the user to customize the size of the sshfs cache by adding a new
max_cache_size flag and turning the hardcoded constant into a variable.
2016-02-10 23:18:35 -05:00
Julio Merino d1ddbbcae5 Qualify timeout identifiers with their unit
All timeouts are in seconds, so add a suffix to the identifier names to
clearly denote the unit.
2016-02-10 23:18:35 -05:00
Miklos Szeredi 48122e8043 sshfs-return-the-correct-x_ok-access
sshfs-fuse always returned 0 in access(file, X_OK) calls, causing nautilus
to prompt "Do you want to run "login.defs", or display its contents?" for
text files that were not executable.

Reported by: Alkis Georgopoulos
2014-02-10 14:09:13 +01:00
Miklos Szeredi c5949f06fa fix unused but set variables
cache.c: In function ‘cache_add_attr’:
cache.c:167:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
cache.c: In function ‘cache_add_dir’:
cache.c:188:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
cache.c: In function ‘cache_add_link’:
cache.c:212:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
2012-02-08 10:21:33 +01:00
Miklos Szeredi c7dbdc1f77 Fix harmless glib assertations with "cache=no" 2008-10-08 18:23:33 +00:00
Miklos Szeredi 4b28b15c34 Fix bug in caching which could cause file corruption for append mode writes 2008-05-06 15:10:28 +00:00
Miklos Szeredi 37b408459a change indenting 2007-12-10 18:21:52 +00:00
Miklos Szeredi eff1631428 Fix spurious cache entries remaining after renaming a directory 2007-04-18 10:24:10 +00:00
Miklos Szeredi d045a9be5e fix 2006-11-11 10:11:55 +00:00
Miklos Szeredi 4046be4487 fixes 2006-08-16 12:57:23 +00:00
Miklos Szeredi 8468900705 fix 2006-02-16 17:02:25 +00:00
Miklos Szeredi 3f854ace05 fix 2006-01-09 16:51:06 +00:00
Miklos Szeredi 57a490e12a fix 2005-12-16 11:15:26 +00:00
Miklos Szeredi eddbd3967b fix 2005-12-09 20:30:32 +00:00
Miklos Szeredi 891a3e5d87 updated to use libfuse's option parsing 2005-12-09 17:43:06 +00:00
Miklos Szeredi 642d16587c fix 2005-10-28 12:12:57 +00:00
Miklos Szeredi 205f9ac27e revert create method 2005-09-08 15:33:35 +00:00
Miklos Szeredi 95381c9bb4 fix 2005-08-23 15:41:02 +00:00
Miklos Szeredi 28495b3bb2 reconnection 2005-08-13 21:17:11 +00:00
Miklos Szeredi effd586502 fix 2005-04-13 11:38:40 +00:00
Miklos Szeredi b3aac4e035 whitespace fix 2005-03-04 11:22:31 +00:00
Miklos Szeredi 9693a8bf05 fix 2005-02-24 16:37:54 +00:00
Miklos Szeredi 838fed1a3a fix 2005-02-09 15:12:51 +00:00
Miklos Szeredi d5696036a5 caching improvements 2005-02-08 11:15:46 +00:00
Miklos Szeredi 240b5f7bb5 fix 2005-02-07 17:08:27 +00:00
Miklos Szeredi 39b1a10bdb directory caching 2005-02-07 16:58:43 +00:00
Miklos Szeredi 386a7f67ab cleanup 2005-02-07 16:12:46 +00:00