summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-07-01 21:19:38 +0000
committerLennart Poettering <lennart@poettering.net>2005-07-01 21:19:38 +0000
commit673290b900fb828891ac20d9779d5488e74cddfa (patch)
tree9765c286ac16dd773a01c40fa43c651cd4016450
parent5889555ab4749b3d93ffcc35af11fc7750b6d533 (diff)
* Do no longer save device info in the MD cache. To reenable this, use the new option --check-dev
git-svn-id: file:///home/lennart/svn/public/syrep/trunk@84 07ea20a6-d2c5-0310-9e02-9ef735347d72
-rw-r--r--man/syrep.1.xml.in7
-rw-r--r--src/cache.c26
-rw-r--r--src/syrep.c4
-rw-r--r--src/syrep.ggo1
4 files changed, 32 insertions, 6 deletions
diff --git a/man/syrep.1.xml.in b/man/syrep.1.xml.in
index 76d2d2d..a3c0828 100644
--- a/man/syrep.1.xml.in
+++ b/man/syrep.1.xml.in
@@ -202,6 +202,13 @@
<optdesc>Use cache in a read only fashion</optdesc>
</option>
+ <option>
+ <p><opt>--check-dev</opt> (option)</p>
+ <optdesc>Store information about the device where the file
+ resides when storing an entry about it in the message digest
+ cache. Since nowadays device identifiers cannot be longer
+ considered stable, this options defaults to off.</optdesc>
+ </option>
</section>
<section name="Showing differences between two snapshots">
<option>
diff --git a/src/cache.c b/src/cache.c
index 6722b55..969b0c0 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -35,6 +35,8 @@
#include "cache.h"
#include "md5util.h"
+#include "cmdline.h"
+#include "syrep.h"
struct syrep_cache_key {
uint64_t dev;
@@ -176,23 +178,37 @@ int md_cache_get(struct syrep_md_cache *c, const char *path, uint8_t digest[16])
}
memset(&k, 0, sizeof(k));
- k.dev = (uint64_t) st.st_dev;
k.inode = (uint64_t) st.st_ino;
k.date = (uint32_t) st.st_mtime;
k.size = (uint64_t) st.st_size;
- if (!c)
- j = 0;
- else
+ j = 0;
+
+ if (c) {
+ k.dev = args.check_dev_flag ? (uint64_t) st.st_dev : (uint64_t) -1;
+
if ((j = get(c, &k, digest)) < 0)
goto finish;
+
+ if (!j) {
+ /* Perhaps the setting of check_dev_flag was different
+ * when this cache was created? So let's try to make the
+ * best use of that cache */
+ k.dev = args.check_dev_flag ? (uint64_t) -1 : (uint64_t) st.st_dev;
+
+ if ((j = get(c, &k, digest)) < 0)
+ goto finish;
+ }
+ }
if (!j)
if (fdmd5(fd, st.st_size, digest) < 0)
goto finish;
- if (c && !c->ro)
+ if (c && !c->ro) {
+ k.dev = args.check_dev_flag ? (uint64_t) st.st_dev : (uint64_t) -1;
put(c, &k, digest, c->timestamp);
+ }
r = 0;
diff --git a/src/syrep.c b/src/syrep.c
index f9509d3..c73acbe 100644
--- a/src/syrep.c
+++ b/src/syrep.c
@@ -575,7 +575,9 @@ static int help(FILE *f, const char *argv0) {
" --no-cache Don't use a message digest cache\n"
" --no-purge Don't purge obsolete entries from cache\n"
" after update run\n"
- " --ro-cache Use read only cache\n\n"
+ " --ro-cache Use read only cache\n"
+ " --check-dev Store information about the device where\n"
+ " a file resides in the MD cache\n\n"
" --diff SNAPSHOT SNAPSHOT Show difference between two repositories\n"
" or snapshots\n"
diff --git a/src/syrep.ggo b/src/syrep.ggo
index 79c6cd5..d6edb52 100644
--- a/src/syrep.ggo
+++ b/src/syrep.ggo
@@ -41,6 +41,7 @@ option "update" - "Update a repository snapshot" flag off
option "no-purge" - "update: Don't pruge obsolete entries from cache after update run" flag off
option "ro-cache" - "update: Use read only cache" flag off
option "progress" p "update: Show progress" flag off
+ option "check-dev" - "update: Honour stat() st_dev field" flag off
option "diff" - "Show difference between two repositories or snapshots" flag off
option "sizes" s "diff: show file sizes to copy (works online on repositories)" flag off