summaryrefslogtreecommitdiff
path: root/netfs/fuse
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-06-03 20:10:39 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-06-03 20:10:39 +0100
commit70a376ccb1f89d5efdac65f465f2eabedc3df559 (patch)
tree1ea9818547ea1e5e428966fedea7ae9c1bf04125 /netfs/fuse
parentCheck for FUSE_READDIR_PLUS should be bit-wise, not equality (diff)
downloadnetfs-70a376ccb1f89d5efdac65f465f2eabedc3df559.tar.bz2
netfs-70a376ccb1f89d5efdac65f465f2eabedc3df559.tar.xz
netfs-70a376ccb1f89d5efdac65f465f2eabedc3df559.zip
Compose cache keys using std::filesystem::path and its hash_valuesnetfs-1.5.1
Diffstat (limited to 'netfs/fuse')
-rw-r--r--netfs/fuse/fuseApp.cpp4
-rw-r--r--netfs/fuse/fuseApp.h2
-rw-r--r--netfs/fuse/fuseDirs.cpp4
-rw-r--r--netfs/fuse/fuseFiles.cpp2
4 files changed, 6 insertions, 6 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index f21c8c3..0018b20 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -16,8 +16,8 @@
#include <uriParse.h>
namespace AdHoc {
- template class Cache<struct stat, std::string>;
- template class CallCacheable<struct stat, std::string>;
+ template class Cache<struct stat, std::size_t>;
+ template class CallCacheable<struct stat, std::size_t>;
}
NetFS::FuseApp::FuseApp(Ice::StringSeq && a) : iceArgs(std::move(a)) { }
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index 790f88a..b2166df 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -120,7 +120,7 @@ namespace NetFS {
EntryTypeConverter converter;
- using StatCache = AdHoc::Cache<struct stat, std::string>;
+ using StatCache = AdHoc::Cache<struct stat, std::size_t>;
StatCache statCache;
};
}
diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp
index dd5f0db..3ea7c0d 100644
--- a/netfs/fuse/fuseDirs.cpp
+++ b/netfs/fuse/fuseDirs.cpp
@@ -47,13 +47,13 @@ namespace NetFS {
{
try {
auto od = getProxy<OpenDirPtr>(fi->fh);
- const std::string path(p);
+ const std::filesystem::path path {p};
auto expiry = time(nullptr) + 2;
if (flags & FUSE_READDIR_PLUS) {
for (const auto & e : od->remote->listdir()) {
if (auto stat = converter.convert(e.second); stat.st_mode) {
filler(buf, e.first.c_str(), nullptr, 0, FUSE_FILL_DIR_PLUS);
- const std::string k(path + e.first);
+ const auto k {std::filesystem::hash_value(path / e.first)};
statCache.remove(k);
statCache.add(k, stat, expiry);
}
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index 29a0096..149e8b3 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -376,7 +376,7 @@ namespace NetFS {
*s = converter.convert(remote->fgetattr());
}
else {
- if (auto cacehedStat = statCache.get(p)) {
+ if (auto cacehedStat = statCache.get(std::filesystem::hash_value(p))) {
*s = *cacehedStat;
}
else {