dovecot-2.0: Added mail_transaction_log_get_tail().

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 16 01:32:05 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/c8be44ff1090
changeset: 9635:c8be44ff1090
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jul 15 18:29:21 2009 -0400
description:
Added mail_transaction_log_get_tail().

diffstat:

2 files changed, 15 insertions(+)
src/lib-index/mail-transaction-log.c |   12 ++++++++++++
src/lib-index/mail-transaction-log.h |    3 +++

diffs (35 lines):

diff -r 7fc9e93fe745 -r c8be44ff1090 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c	Wed Jul 15 18:28:59 2009 -0400
+++ b/src/lib-index/mail-transaction-log.c	Wed Jul 15 18:29:21 2009 -0400
@@ -487,6 +487,18 @@ void mail_transaction_log_get_head(struc
 	*file_offset_r = log->head->sync_offset;
 }
 
+void mail_transaction_log_get_tail(struct mail_transaction_log *log,
+				   uint32_t *file_seq_r)
+{
+	struct mail_transaction_log_file *tail, *file = log->files;
+
+	for (tail = file; file->next != NULL; file = file->next) {
+		if (file->hdr.file_seq + 1 != file->next->hdr.file_seq)
+			tail = file->next;
+	}
+	*file_seq_r = tail->hdr.file_seq;
+}
+
 bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
 				       uint32_t file_seq, uoff_t file_offset)
 {
diff -r 7fc9e93fe745 -r c8be44ff1090 src/lib-index/mail-transaction-log.h
--- a/src/lib-index/mail-transaction-log.h	Wed Jul 15 18:28:59 2009 -0400
+++ b/src/lib-index/mail-transaction-log.h	Wed Jul 15 18:29:21 2009 -0400
@@ -245,6 +245,9 @@ void mail_transaction_log_sync_unlock(st
 /* Returns the current head. Works only when log is locked. */
 void mail_transaction_log_get_head(struct mail_transaction_log *log,
 				   uint32_t *file_seq_r, uoff_t *file_offset_r);
+/* Returns the current tail from which all files are open to head. */
+void mail_transaction_log_get_tail(struct mail_transaction_log *log,
+				   uint32_t *file_seq_r);
 /* Returns TRUE if given seq/offset is current head log's rotate point. */
 bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
 				       uint32_t file_seq, uoff_t file_offset);


More information about the dovecot-cvs mailing list