dovecot-2.2: lib-index: Added v2.2+ forwards compatibility to do...

dovecot at dovecot.org dovecot at dovecot.org
Sat Jan 5 01:14:34 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/55e84bb452e6
changeset: 15527:55e84bb452e6
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 27 09:53:33 2012 +0200
description:
lib-index: Added v2.2+ forwards compatibility to dovecot.index.cache

diffstat:

 src/lib-index/mail-cache-private.h     |  3 ++-
 src/lib-index/mail-cache-transaction.c |  6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 174d7e974326 -r 55e84bb452e6 src/lib-index/mail-cache-private.h
--- a/src/lib-index/mail-cache-private.h	Tue Nov 27 09:13:57 2012 +0200
+++ b/src/lib-index/mail-cache-private.h	Tue Nov 27 09:53:33 2012 +0200
@@ -47,7 +47,8 @@
 	   compatibility. */
 	uint8_t version;
 	uint8_t compat_sizeof_uoff_t;
-	uint8_t unused[2];
+	uint8_t minor_version;
+	uint8_t unused;
 
 	uint32_t indexid;
 	uint32_t file_seq;
diff -r 174d7e974326 -r 55e84bb452e6 src/lib-index/mail-cache-transaction.c
--- a/src/lib-index/mail-cache-transaction.c	Tue Nov 27 09:13:57 2012 +0200
+++ b/src/lib-index/mail-cache-transaction.c	Tue Nov 27 09:53:33 2012 +0200
@@ -315,6 +315,9 @@
 
 	i_assert(cache->locked);
 
+	if (hdr->minor_version > 0)
+		return FALSE; /* this is record_count field in v2.2+ */
+
 	offset = hdr->hole_offset; prev_offset = 0;
 	while (offset != 0) {
 		if (pread_full(cache->fd, &hole, sizeof(hole), offset) <= 0) {
@@ -481,7 +484,8 @@
 		/* we can just set used_file_size back */
 		cache->hdr_modified = TRUE;
 		cache->hdr_copy.used_file_size = offset;
-	} else if (size >= MAIL_CACHE_MIN_HOLE_SIZE) {
+	} else if (size >= MAIL_CACHE_MIN_HOLE_SIZE &&
+		   cache->hdr_copy.minor_version == 0) {
 		/* set it up as a hole */
 		hole.next_offset = cache->hdr_copy.hole_offset;
 		hole.size = size;


More information about the dovecot-cvs mailing list