X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=statcache.cc;h=3594ba4b10c35f1a0a7a6a78662f192257cabc63;hb=6bb973b965a30832c3e2d9f6a24e80d3309ef89e;hp=8e48c793733561b12f6cd2892d1f00f848bd6b7f;hpb=94357fda0976dd353bcea97764a08db245113c8f;p=cumulus.git diff --git a/statcache.cc b/statcache.cc index 8e48c79..3594ba4 100644 --- a/statcache.cc +++ b/statcache.cc @@ -1,5 +1,5 @@ -/* LBS: An LFS-inspired filesystem backup system Copyright (C) 2007 Michael - * Vrable +/* LBS: An LFS-inspired filesystem backup system + * Copyright (C) 2007 Michael Vrable * * To speed backups, we maintain a "stat cache" containing selected information * about all regular files, including modification times and the list of blocks @@ -30,9 +30,9 @@ #include #include -#include "format.h" #include "ref.h" #include "statcache.h" +#include "util.h" using std::list; using std::map; @@ -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()); @@ -125,12 +128,13 @@ void StatCache::ReadNext() old_checksum = ""; old_contents.clear(); - /* First, read in the filename. TODO: Unescaping. */ + /* First, read in the filename. */ getline(cache, old_name); if (!cache) { end_of_cache = true; return; } + old_name = uri_decode(old_name); /* Start reading in the fields which follow the filename. */ string field = ""; @@ -173,7 +177,7 @@ void StatCache::ReadNext() if (fields.count("inode")) old_inode = parse_int(fields["inode"]); if (fields.count("size")) - old_inode = parse_int(fields["size"]); + old_size = parse_int(fields["size"]); old_checksum = fields["checksum"];