From 1f5847c5aec12e3a83fcace0afe7ff36d8d19e0a Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Fri, 20 Jul 2007 14:10:33 -0700 Subject: [PATCH] Include scheme name in statcache file, so localdb directory can be shared. --- scandir.cc | 3 ++- statcache.cc | 5 ++++- statcache.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scandir.cc b/scandir.cc index dba840d..6e672c6 100644 --- a/scandir.cc +++ b/scandir.cc @@ -683,7 +683,8 @@ int main(int argc, char *argv[]) /* Initialize the stat cache, for skipping over unchanged files. */ statcache = new StatCache; - statcache->Open(localdb_dir.c_str(), desc_buf); + statcache->Open(localdb_dir.c_str(), desc_buf, + backup_scheme.size() ? backup_scheme.c_str() : NULL); scanfile(".", false); diff --git a/statcache.cc b/statcache.cc index 86886c0..099eb70 100644 --- a/statcache.cc +++ b/statcache.cc @@ -79,10 +79,13 @@ static int pathcmp(const char *path1, const char *path2) return pathcmp(slash1 + 1, slash2 + 1); } -void StatCache::Open(const char *path, const char *snapshot_name) +void StatCache::Open(const char *path, const char *snapshot_name, + const char *snapshot_scheme) { oldpath = path; oldpath += "/statcache"; + if (snapshot_scheme != NULL) + oldpath = oldpath + "-" + snapshot_scheme; newpath = oldpath + "." + snapshot_name; oldcache = new ifstream(oldpath.c_str()); diff --git a/statcache.h b/statcache.h index 6186f88..6e4af2c 100644 --- a/statcache.h +++ b/statcache.h @@ -35,7 +35,8 @@ class StatCache { public: - void Open(const char *path, const char *snapshot_name); + void Open(const char *path, const char *snapshot_name, + const char *snapshot_scheme); void Close(); bool Find(const std::string &path, const struct stat *stat_buf); void Save(const std::string &path, struct stat *stat_buf, -- 2.20.1