[dovecot-cvs] dovecot/src/lib-storage/index index-status.c, 1.38, 1.39 index-storage.c, 1.94, 1.95 index-storage.h, 1.108, 1.109 index-transaction.c, 1.15, 1.16
tss at dovecot.org
tss at dovecot.org
Sun Dec 10 13:00:50 UTC 2006
Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv1567/index
Modified Files:
index-status.c index-storage.c index-storage.h
index-transaction.c
Log Message:
Make sure the mailbox is opened when transaction is started (fixes deliver).
Also did some other API cleanups, mailbox index opening can't fail anymore.
Index: index-status.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-status.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- index-status.c 25 Nov 2006 22:17:41 -0000 1.38
+++ index-status.c 10 Dec 2006 13:00:44 -0000 1.39
@@ -40,10 +40,8 @@
struct index_mailbox *ibox = (struct index_mailbox *)box;
int ret;
- if (!box->opened) {
- if (index_storage_mailbox_open(ibox) < 0)
- return -1;
- }
+ if (!box->opened)
+ index_storage_mailbox_open(ibox);
ret = index_storage_get_status_locked(ibox, items, status);
mail_index_view_unlock(ibox->view);
Index: index-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- index-storage.c 9 Dec 2006 23:22:09 -0000 1.94
+++ index-storage.c 10 Dec 2006 13:00:44 -0000 1.95
@@ -315,7 +315,7 @@
ibox->last_notify_type = MAILBOX_LOCK_NOTIFY_NONE;
}
-int index_storage_mailbox_open(struct index_mailbox *ibox)
+void index_storage_mailbox_open(struct index_mailbox *ibox)
{
struct mail_storage *storage = &ibox->storage->storage;
enum mail_index_open_flags index_flags;
@@ -338,11 +338,8 @@
directly into memory now. */
ret = mail_index_open(ibox->index, index_flags,
storage->lock_method);
- if (ret <= 0) {
- mail_storage_set_index_error(ibox);
- index_storage_mailbox_free(&ibox->box);
- return -1;
- }
+ if (ret <= 0)
+ i_panic("in-memory index creation failed");
}
}
@@ -352,13 +349,12 @@
ibox->keyword_names = mail_index_get_keywords(ibox->index);
ibox->box.opened = TRUE;
- return 0;
}
-int index_storage_mailbox_init(struct index_mailbox *ibox,
- struct mail_index *index, const char *name,
- enum mailbox_open_flags flags,
- bool move_to_memory)
+void index_storage_mailbox_init(struct index_mailbox *ibox,
+ struct mail_index *index, const char *name,
+ enum mailbox_open_flags flags,
+ bool move_to_memory)
{
struct mail_storage *storage = &ibox->storage->storage;
@@ -387,7 +383,7 @@
array_idx_set(&index->mail_index_module_contexts,
mail_storage_mail_index_module_id, &ibox);
- return (flags & MAILBOX_OPEN_FAST) != 0 ? 0 :
+ if ((flags & MAILBOX_OPEN_FAST) == 0)
index_storage_mailbox_open(ibox);
}
Index: index-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- index-storage.h 6 Dec 2006 15:08:25 -0000 1.108
+++ index-storage.h 10 Dec 2006 13:00:44 -0000 1.109
@@ -114,11 +114,11 @@
enum file_lock_method lock_method);
void index_storage_deinit(struct index_storage *storage);
-int index_storage_mailbox_init(struct index_mailbox *ibox,
- struct mail_index *index, const char *name,
- enum mailbox_open_flags flags,
- bool move_to_memory);
-int index_storage_mailbox_open(struct index_mailbox *ibox);
+void index_storage_mailbox_init(struct index_mailbox *ibox,
+ struct mail_index *index, const char *name,
+ enum mailbox_open_flags flags,
+ bool move_to_memory);
+void index_storage_mailbox_open(struct index_mailbox *ibox);
void index_storage_mailbox_free(struct mailbox *box);
bool index_storage_is_readonly(struct mailbox *box);
Index: index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-transaction.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- index-transaction.c 28 Jun 2006 16:31:06 -0000 1.15
+++ index-transaction.c 10 Dec 2006 13:00:45 -0000 1.16
@@ -62,6 +62,9 @@
struct mail_index_transaction *t;
struct index_transaction_context *it;
+ if (!box->opened)
+ index_storage_mailbox_open(ibox);
+
t = mail_index_transaction_begin(ibox->view,
(flags & MAILBOX_TRANSACTION_FLAG_HIDE) != 0,
(flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0);
More information about the dovecot-cvs
mailing list