]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Mail index extension introductions now add a "no resizes" flag to the
authorTimo Sirainen <tss@iki.fi>
Wed, 18 Jun 2008 05:08:45 +0000 (08:08 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 18 Jun 2008 05:08:45 +0000 (08:08 +0300)
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.

--HG--
branch : HEAD

src/lib-index/mail-index-sync-ext.c
src/lib-index/mail-transaction-log-append.c
src/lib-index/mail-transaction-log.h

index dce1e702c6618ba5cdd3ff5963d7df29cd02dcda..a75dfa9050350b6d10aa0a8cbf093ecdc8af00da 100644 (file)
@@ -446,6 +446,7 @@ int mail_index_sync_ext_intro(struct mail_index_sync_map_ctx *ctx,
        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 mail_index_sync_map_ctx *ctx,
        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 mail_index_sync_map_ctx *ctx,
                /* 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
index 85c4d492a7408f575dd51ac0b1cf2ca051d05c5a..ced0c4dd1fcc8f0eac8121a2537f7b9bb631d05e 100644 (file)
@@ -264,6 +264,7 @@ static void log_append_ext_intro(struct log_append_context *ctx,
                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);
        }
index a8df86673b75d121d06c1ec8222d3bf20fca065b..25e0dc2a4a355213de33603c96526eb1b7af7303 100644 (file)
@@ -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[]; */
 };