]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added mail_transaction_log_get_tail().
authorTimo Sirainen <tss@iki.fi>
Wed, 15 Jul 2009 22:29:21 +0000 (18:29 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 15 Jul 2009 22:29:21 +0000 (18:29 -0400)
--HG--
branch : HEAD

src/lib-index/mail-transaction-log.c
src/lib-index/mail-transaction-log.h

index 9fc6e9de43e773271d476c24ae165a3dc95a355c..dc1debeab47069a4d15fdaa7cef115066a004fd1 100644 (file)
@@ -487,6 +487,18 @@ void mail_transaction_log_get_head(struct mail_transaction_log *log,
        *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)
 {
index 3e43340fe3eebfaadcec71ae1f92447e045b4a88..3566e207730889d905d45c27d9776de71cbbf428 100644 (file)
@@ -245,6 +245,9 @@ void mail_transaction_log_sync_unlock(struct mail_transaction_log *log);
 /* 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);