Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7895:5bedea448cf9 HEAD
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 18 Jun 2008 08:08:45 +0300 |
parents | 15f01af8449a |
children | efb782e078b9 |
files | src/lib-index/mail-index-sync-ext.c src/lib-index/mail-transaction-log-append.c src/lib-index/mail-transaction-log.h |
diffstat | 3 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 @@ 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 @@ /* 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
--- 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 @@ 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); }
--- 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 @@ /* 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 @@ 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[]; */ };