]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Rename mail_cache_unlock() to mail_cache_flush_and_unlock()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 30 Mar 2020 14:22:38 +0000 (17:22 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:42 +0000 (12:41 +0300)
This describes better what it does, because it's not just unlocking.

src/lib-index/mail-cache-compress.c
src/lib-index/mail-cache-fields.c
src/lib-index/mail-cache-private.h
src/lib-index/mail-cache-sync-update.c
src/lib-index/mail-cache-transaction.c
src/lib-index/mail-cache.c

index 088c71a5b6dd8ebb6f6b390fdac3e9652bd57e10..3f0a9d6ccb0a2efa48713b8a6945eed0298eb4b7 100644 (file)
@@ -366,7 +366,7 @@ mail_cache_compress_write(struct mail_cache *cache,
        array_free(&ext_offsets);
 
        if (*unlock) {
-               (void)mail_cache_unlock(cache);
+               (void)mail_cache_flush_and_unlock(cache);
                *unlock = FALSE;
        }
 
@@ -435,7 +435,7 @@ static int mail_cache_compress_locked(struct mail_cache *cache,
                cache->need_compress_file_seq = 0;
 
                if (*unlock) {
-                       (void)mail_cache_unlock(cache);
+                       (void)mail_cache_flush_and_unlock(cache);
                        *unlock = FALSE;
                }
 
@@ -511,7 +511,7 @@ mail_cache_compress_full(struct mail_cache *cache,
        ret = mail_cache_compress_locked(cache, compress_file_seq, trans, &unlock);
        cache->compressing = FALSE;
        if (unlock) {
-               if (mail_cache_unlock(cache) < 0)
+               if (mail_cache_flush_and_unlock(cache) < 0)
                        ret = -1;
        }
        if (ret < 0) {
index ac2c33a9b71364e2dd8f807abaa6aced0b750e73..dc2e753d862c5060fa00d05f1cb6c035e649a072 100644 (file)
@@ -563,7 +563,7 @@ int mail_cache_header_fields_update(struct mail_cache *cache)
        T_BEGIN {
                ret = mail_cache_header_fields_update_locked(cache);
        } T_END;
-       if (mail_cache_unlock(cache) < 0)
+       if (mail_cache_flush_and_unlock(cache) < 0)
                ret = -1;
        return ret;
 }
index 981cd62caa35f9a14d16c22c633ed7884f5697bc..b063622ddb3980aae024db895ffe3a5b7a2c563c 100644 (file)
@@ -212,7 +212,7 @@ struct mail_cache_lookup_iterate_ctx {
 int mail_cache_lock(struct mail_cache *cache);
 int mail_cache_try_lock(struct mail_cache *cache);
 /* Returns -1 if cache is / just got corrupted, 0 if ok. */
-int mail_cache_unlock(struct mail_cache *cache);
+int mail_cache_flush_and_unlock(struct mail_cache *cache);
 
 int mail_cache_write(struct mail_cache *cache, const void *data, size_t size,
                     uoff_t offset);
index 4db24084cd08e7103ee740129207511fb2f6728e..a79745dd5ed5d6da1396a6d619a98b1273cd4ed8 100644 (file)
@@ -17,7 +17,7 @@ void mail_cache_expunge_count(struct mail_cache *cache, unsigned int count)
                else
                         cache->hdr_copy.record_count = 0;
                cache->hdr_modified = TRUE;
-               (void)mail_cache_unlock(cache);
+               (void)mail_cache_flush_and_unlock(cache);
        }
 }
 
index bb40023c3c98c9df7d59dd8379076f7ca5921d96..7353d902605063f2b613652eef1aa1e30d0b64b4 100644 (file)
@@ -156,7 +156,7 @@ void mail_cache_transaction_rollback(struct mail_cache_transaction_ctx **_ctx)
                if (mail_cache_transaction_lock(ctx) > 0) {
                        ctx->cache->hdr_copy.deleted_record_count +=
                                ctx->records_written;
-                       (void)mail_cache_unlock(ctx->cache);
+                       (void)mail_cache_flush_and_unlock(ctx->cache);
                }
        }
 
@@ -219,7 +219,7 @@ static int mail_cache_transaction_lock(struct mail_cache_transaction_ctx *ctx)
                   it to free up some space. */
                if (cache->hdr->continued_record_count > 0 ||
                    cache->hdr->deleted_record_count > 0) {
-                       (void)mail_cache_unlock(cache);
+                       (void)mail_cache_flush_and_unlock(cache);
                        (void)mail_cache_transaction_compress(ctx);
                        return mail_cache_transaction_lock(ctx);
                }
@@ -467,7 +467,7 @@ mail_cache_transaction_flush(struct mail_cache_transaction_ctx *ctx)
        i_assert(ctx->last_rec_pos <= ctx->cache_data->used);
 
        if (mail_cache_transaction_update_fields(ctx) < 0) {
-               (void)mail_cache_unlock(ctx->cache);
+               (void)mail_cache_flush_and_unlock(ctx->cache);
                return -1;
        }
 
@@ -495,7 +495,7 @@ mail_cache_transaction_flush(struct mail_cache_transaction_ctx *ctx)
                ctx->records_written++;
                mail_cache_transaction_update_index(ctx, write_offset);
        }
-       if (mail_cache_unlock(ctx->cache) < 0)
+       if (mail_cache_flush_and_unlock(ctx->cache) < 0)
                ret = -1;
        return ret;
 }
index fa7ae1f4727a3e7dce148903a3bdc94837b3c2ac..1e4149225f3fa0b930d0aa5bee2850063aa7f594 100644 (file)
@@ -825,7 +825,7 @@ mail_cache_lock_full(struct mail_cache *cache, bool nonblock)
        if (cache->read_buf != NULL)
                buffer_set_used_size(cache->read_buf, 0);
        if ((ret = mail_cache_map_all(cache)) <= 0) {
-               (void)mail_cache_unlock(cache);
+               (void)mail_cache_flush_and_unlock(cache);
                return ret;
        }
        cache->hdr_copy = *cache->hdr;
@@ -842,7 +842,7 @@ int mail_cache_try_lock(struct mail_cache *cache)
        return mail_cache_lock_full(cache, TRUE);
 }
 
-int mail_cache_unlock(struct mail_cache *cache)
+int mail_cache_flush_and_unlock(struct mail_cache *cache)
 {
        int ret = 0;