mail-cache-transaction.c revision e37fbcda56ab154557e84f990012502be53aa6c6
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Copyright (C) 2003-2004 Timo Sirainen */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen uint32_t reserved_space_offset, reserved_space;
edd318d5866ac3fbc6e8df28fb24a4dfef93c884Timo Sirainenstatic int mail_cache_link_unlocked(struct mail_cache *cache,
edd318d5866ac3fbc6e8df28fb24a4dfef93c884Timo Sirainenmail_cache_get_transaction(struct mail_cache_view *view,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ctx = i_new(struct mail_cache_transaction_ctx, 1);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ctx->reservations = buffer_create_dynamic(system_pool, 256);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ctx->cache_file_seq = ctx->cache->hdr->file_seq;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen view->trans_view = mail_index_transaction_open_updated_view(t);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstatic void mail_cache_transaction_reset(struct mail_cache_transaction_ctx *ctx)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ctx->cache_file_seq = ctx->cache->hdr->file_seq;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstatic void mail_cache_transaction_free(struct mail_cache_transaction_ctx *ctx)
5e9bb72de1209cd39fdf3e95bdb26e047cc5594eTimo Sirainen ctx->view->trans_seq1 = ctx->view->trans_seq2 = 0;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstatic int mail_cache_transaction_lock(struct mail_cache_transaction_ctx *ctx)
return ret;
while (offset != 0) {
return FALSE;
return FALSE;
if (offset == 0)
return FALSE;
if (prev_offset == 0)
return FALSE;
return TRUE;
if (!locked) {
if (!locked)
int commit)
int ret;
if (!locked) {
return ret;
commit);
if (!locked)
if (ret < 0)
if (old_offset != 0) {
write_offset) < 0)
old_offset) < 0)
*seq_idx = i;
if (commit) {
seq_limit = 0;
if (ret <= 0) {
return ret;
seq_limit++;
&write_size) < 0)
void *data;
int ret = 0;
return ret;
if (size > 0) {
} while (size > 0);
unsigned int field)
const void *data;
int ret = 0;
t_push();
&hdr_offset) < 0)
hdr_offset) < 0) {
t_pop();
return ret;
unsigned int fixed_size;
sizeof(data_size32));
&cache_rec) < 0)