dovecot-2.0: index-storage: Code cleanup.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jul 31 02:19:49 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/ac98c24da6ee
changeset: 9700:ac98c24da6ee
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 30 19:19:42 2009 -0400
description:
index-storage: Code cleanup.
diffstat:
3 files changed, 12 insertions(+), 12 deletions(-)
src/lib-storage/index/dbox/dbox-storage.c | 5 +++--
src/lib-storage/index/index-storage.c | 16 ++++++++--------
src/lib-storage/index/index-storage.h | 3 +--
diffs (81 lines):
diff -r f123bb8afd1c -r ac98c24da6ee src/lib-storage/index/dbox/dbox-storage.c
--- a/src/lib-storage/index/dbox/dbox-storage.c Thu Jul 30 19:11:33 2009 -0400
+++ b/src/lib-storage/index/dbox/dbox-storage.c Thu Jul 30 19:19:42 2009 -0400
@@ -155,14 +155,15 @@ dbox_mailbox_alloc(struct mail_storage *
mbox->ibox.box.storage = storage;
mbox->ibox.box.list = list;
mbox->ibox.mail_vfuncs = &dbox_mail_vfuncs;
- mbox->ibox.keep_index_backups = TRUE;
- mbox->ibox.index_never_in_memory = TRUE;
index_storage_mailbox_alloc(&mbox->ibox, name, input, flags,
DBOX_INDEX_PREFIX);
mail_index_set_fsync_types(mbox->ibox.index,
MAIL_INDEX_SYNC_TYPE_APPEND |
MAIL_INDEX_SYNC_TYPE_EXPUNGE);
+
+ mbox->ibox.index_flags |= MAIL_INDEX_OPEN_FLAG_KEEP_BACKUPS |
+ MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY;
mbox->storage = (struct dbox_storage *)storage;
mbox->alt_path =
diff -r f123bb8afd1c -r ac98c24da6ee src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c Thu Jul 30 19:11:33 2009 -0400
+++ b/src/lib-storage/index/index-storage.c Thu Jul 30 19:19:42 2009 -0400
@@ -385,13 +385,11 @@ int index_storage_mailbox_open(struct ma
i_assert(!box->opened);
- index_flags = mail_storage_settings_to_index_flags(box->storage->set);
- if (!ibox->move_to_memory)
- index_flags |= MAIL_INDEX_OPEN_FLAG_CREATE;
- if (ibox->keep_index_backups)
- index_flags |= MAIL_INDEX_OPEN_FLAG_KEEP_BACKUPS;
- if (ibox->index_never_in_memory) {
- index_flags |= MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY;
+ index_flags = ibox->index_flags;
+ if (ibox->move_to_memory)
+ ibox->index_flags &= ~MAIL_INDEX_OPEN_FLAG_CREATE;
+
+ if ((index_flags & MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY) != 0) {
if (mail_index_is_in_memory(ibox->index)) {
mail_storage_set_critical(box->storage,
"Couldn't create index file");
@@ -414,7 +412,7 @@ int index_storage_mailbox_open(struct ma
ret = mail_index_open(ibox->index, index_flags, lock_method);
if (ret <= 0 || ibox->move_to_memory) {
- if (ibox->index_never_in_memory) {
+ if ((index_flags & MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY) != 0) {
mail_storage_set_index_error(ibox);
return -1;
}
@@ -483,6 +481,8 @@ void index_storage_mailbox_alloc(struct
MAILBOX_LIST_PATH_TYPE_MAILBOX);
ibox->box.path = p_strdup(box->pool, path);
+ ibox->index_flags = MAIL_INDEX_OPEN_FLAG_CREATE |
+ mail_storage_settings_to_index_flags(box->storage->set);
ibox->keep_recent = (flags & MAILBOX_FLAG_KEEP_RECENT) != 0;
ibox->keep_locked = (flags & MAILBOX_FLAG_KEEP_LOCKED) != 0;
diff -r f123bb8afd1c -r ac98c24da6ee src/lib-storage/index/index-storage.h
--- a/src/lib-storage/index/index-storage.h Thu Jul 30 19:11:33 2009 -0400
+++ b/src/lib-storage/index/index-storage.h Thu Jul 30 19:19:42 2009 -0400
@@ -19,6 +19,7 @@ struct index_mailbox {
struct index_mailbox {
struct mailbox box;
union mail_index_view_module_context view_module_ctx;
+ enum mail_index_open_flags index_flags;
struct mail_index *index;
struct mail_index_view *view;
@@ -55,8 +56,6 @@ struct index_mailbox {
unsigned int sent_readonly_flags_warning:1;
unsigned int notify_pending:1;
unsigned int move_to_memory:1;
- unsigned int keep_index_backups:1;
- unsigned int index_never_in_memory:1;
};
struct index_transaction_context {
More information about the dovecot-cvs
mailing list