From: Timo Sirainen Date: Tue, 6 Dec 2011 23:46:42 +0000 (+0200) Subject: lib-index: Added mail_index_reset_fscked() X-Git-Tag: 2.1.rc2~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a3f549a3cb1d6dd980a4fa3db284653e256dae7;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Added mail_index_reset_fscked() --- diff --git a/src/lib-index/mail-index-fsck.c b/src/lib-index/mail-index-fsck.c index 4970faeb54..21f14eefd3 100644 --- a/src/lib-index/mail-index-fsck.c +++ b/src/lib-index/mail-index-fsck.c @@ -431,6 +431,8 @@ int mail_index_fsck(struct mail_index *index) i_warning("fscking index file %s", index->filepath); + index->fscked = TRUE; + if (index->log->head == NULL) { /* we're trying to open the index files, but there wasn't any .log file. */ @@ -469,3 +471,11 @@ void mail_index_fsck_locked(struct mail_index *index) ret = mail_index_fsck(index); i_assert(ret == 0); } + +bool mail_index_reset_fscked(struct mail_index *index) +{ + bool ret = index->fscked; + + index->fscked = FALSE; + return ret; +} diff --git a/src/lib-index/mail-index-private.h b/src/lib-index/mail-index-private.h index ad7d5209eb..58064b67fd 100644 --- a/src/lib-index/mail-index-private.h +++ b/src/lib-index/mail-index-private.h @@ -241,6 +241,7 @@ struct mail_index { unsigned int modseqs_enabled:1; unsigned int initial_create:1; unsigned int initial_mapped:1; + unsigned int fscked:1; }; extern struct mail_index_module_register mail_index_module_register; diff --git a/src/lib-index/mail-index.h b/src/lib-index/mail-index.h index 8ed6fba4ff..99c66885a1 100644 --- a/src/lib-index/mail-index.h +++ b/src/lib-index/mail-index.h @@ -360,6 +360,9 @@ void mail_index_mark_corrupted(struct mail_index *index); /* Check and fix any found problems. Returns -1 if we couldn't lock for sync, 0 if everything went ok. */ int mail_index_fsck(struct mail_index *index); +/* Returns TRUE if mail_index_fsck() has been called since the last + mail_index_reset_fscked() call. */ +bool mail_index_reset_fscked(struct mail_index *index); /* Synchronize changes in view. You have to go through all records, or view will be marked inconsistent. Only sync_mask type records are