dovecot-1.2: Mail index extension introductions now add a "no re...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 18 12:09:57 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/5bedea448cf9
changeset: 7895:5bedea448cf9
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 18 08:08:45 2008 +0300
description:
Mail index extension introductions now add a "no resizes" flag to the
intro records. If it's found, the header and record sizes are used only if
the extension doesn't exist yet, otherwise they're ignored.

diffstat:

3 files changed, 11 insertions(+), 2 deletions(-)
src/lib-index/mail-index-sync-ext.c         |    5 ++++-
src/lib-index/mail-transaction-log-append.c |    1 +
src/lib-index/mail-transaction-log.h        |    7 ++++++-

diffs (64 lines):

diff -r 15f01af8449a -r 5bedea448cf9 src/lib-index/mail-index-sync-ext.c
--- a/src/lib-index/mail-index-sync-ext.c	Wed Jun 18 08:03:57 2008 +0300
+++ b/src/lib-index/mail-index-sync-ext.c	Wed Jun 18 08:08:45 2008 +0300
@@ -446,6 +446,7 @@ int mail_index_sync_ext_intro(struct mai
 	const struct mail_index_ext *ext;
 	const char *name, *error;
 	uint32_t ext_map_idx;
+	bool no_resize;
 
 	/* default to ignoring the following extension updates in case this
 	   intro is corrupted */
@@ -496,6 +497,7 @@ int mail_index_sync_ext_intro(struct mai
 	ext_hdr.hdr_size = u->hdr_size;
 	ext_hdr.record_size = u->record_size;
 	ext_hdr.record_align = u->record_align;
+	no_resize = (u->flags & MAIL_TRANSACTION_EXT_INTRO_FLAG_NO_RESIZE) != 0;
 
 	/* make sure the header looks valid before doing anything with it */
 	if (mail_index_map_ext_hdr_check(&map->hdr, &ext_hdr,
@@ -509,7 +511,8 @@ int mail_index_sync_ext_intro(struct mai
 		/* exists already */
 		if (u->reset_id == ext->reset_id) {
 			/* check if we need to resize anything */
-			sync_ext_resize(u, ext_map_idx, ctx);
+			if (!no_resize)
+				sync_ext_resize(u, ext_map_idx, ctx);
 			ctx->cur_ext_ignore = FALSE;
 		} else {
 			/* extension was reset and this transaction hadn't
diff -r 15f01af8449a -r 5bedea448cf9 src/lib-index/mail-transaction-log-append.c
--- a/src/lib-index/mail-transaction-log-append.c	Wed Jun 18 08:03:57 2008 +0300
+++ b/src/lib-index/mail-transaction-log-append.c	Wed Jun 18 08:08:45 2008 +0300
@@ -264,6 +264,7 @@ static void log_append_ext_intro(struct 
 		intro->hdr_size = rext->hdr_size;
 		intro->record_size = rext->record_size;
 		intro->record_align = rext->record_align;
+		intro->flags = MAIL_TRANSACTION_EXT_INTRO_FLAG_NO_RESIZE;
 		intro->name_size = idx != (uint32_t)-1 ? 0 :
 			strlen(rext->name);
 	}
diff -r 15f01af8449a -r 5bedea448cf9 src/lib-index/mail-transaction-log.h
--- a/src/lib-index/mail-transaction-log.h	Wed Jun 18 08:03:57 2008 +0300
+++ b/src/lib-index/mail-transaction-log.h	Wed Jun 18 08:08:45 2008 +0300
@@ -84,6 +84,11 @@ struct mail_transaction_header_update {
 	/* unsigned char data[]; */
 };
 
+enum {
+	/* Ignore hdr_size, record_size and record_align */
+	MAIL_TRANSACTION_EXT_INTRO_FLAG_NO_RESIZE = 0x01
+};
+
 struct mail_transaction_ext_intro {
 	/* old extension: set ext_id. don't set name.
 	   new extension: ext_id = (uint32_t)-1. give name. */
@@ -92,7 +97,7 @@ struct mail_transaction_ext_intro {
 	uint32_t hdr_size;
 	uint16_t record_size;
 	uint16_t record_align;
-	uint16_t unused_padding;
+	uint16_t flags;
 	uint16_t name_size;
 	/* unsigned char name[]; */
 };


More information about the dovecot-cvs mailing list