Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6771:fd9effba151d HEAD
Moved mailbox_deleted to struct mailbox. Added and used
mailbox_set_deleted() which also sets an error message to storage.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 11 Nov 2007 16:02:25 +0200 |
parents | 083681d2f4fb |
children | b78cfc60f6a1 |
files | src/lib-storage/index/dbox/dbox-sync-rebuild.c src/lib-storage/index/index-storage.c src/lib-storage/index/index-storage.h src/lib-storage/index/maildir/maildir-sync.c src/lib-storage/mail-storage-private.h src/lib-storage/mail-storage.c |
diffstat | 6 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox/dbox-sync-rebuild.c Sun Nov 11 15:48:59 2007 +0200 +++ b/src/lib-storage/index/dbox/dbox-sync-rebuild.c Sun Nov 11 16:02:25 2007 +0200 @@ -272,7 +272,7 @@ dir = opendir(path); if (dir == NULL) { if (errno == ENOENT) { - ctx->mbox->ibox.mailbox_deleted = TRUE; + mailbox_set_deleted(&ctx->mbox->ibox.box); return -1; } mail_storage_set_critical(storage,
--- a/src/lib-storage/index/index-storage.c Sun Nov 11 15:48:59 2007 +0200 +++ b/src/lib-storage/index/index-storage.c Sun Nov 11 16:02:25 2007 +0200 @@ -465,8 +465,7 @@ { struct index_mailbox *ibox = (struct index_mailbox *) box; - return mail_index_view_is_inconsistent(ibox->view) || - ibox->mailbox_deleted; + return mail_index_view_is_inconsistent(ibox->view); } void mail_storage_set_index_error(struct index_mailbox *ibox)
--- a/src/lib-storage/index/index-storage.h Sun Nov 11 15:48:59 2007 +0200 +++ b/src/lib-storage/index/index-storage.h Sun Nov 11 16:02:25 2007 +0200 @@ -64,7 +64,6 @@ unsigned int notify_pending:1; unsigned int move_to_memory:1; unsigned int fsync_disable:1; - unsigned int mailbox_deleted:1; }; struct index_transaction_context {
--- a/src/lib-storage/index/maildir/maildir-sync.c Sun Nov 11 15:48:59 2007 +0200 +++ b/src/lib-storage/index/maildir/maildir-sync.c Sun Nov 11 16:02:25 2007 +0200 @@ -342,7 +342,7 @@ return 0; if (errno == ENOENT) { /* if mailbox gets deleted under us, don't log an error */ - mbox->ibox.mailbox_deleted = TRUE; + mailbox_set_deleted(&mbox->ibox.box); return -1; } @@ -369,7 +369,7 @@ dirp = opendir(path); if (dirp == NULL) { if (errno == ENOENT) { - ctx->mbox->ibox.mailbox_deleted = TRUE; + mailbox_set_deleted(&ctx->mbox->ibox.box); return -1; } mail_storage_set_critical(storage,
--- a/src/lib-storage/mail-storage-private.h Sun Nov 11 15:48:59 2007 +0200 +++ b/src/lib-storage/mail-storage-private.h Sun Nov 11 16:02:25 2007 +0200 @@ -196,6 +196,8 @@ /* When FAST open flag is used, the mailbox isn't actually opened until it's synced for the first time. */ unsigned int opened:1; + /* Mailbox was deleted while we had it open. */ + unsigned int mailbox_deleted:1; }; struct mail_vfuncs { @@ -316,6 +318,7 @@ bool mail_storage_set_error_from_errno(struct mail_storage *storage); void mail_set_expunged(struct mail *mail); +void mailbox_set_deleted(struct mailbox *box); enum mailbox_list_flags mail_storage_get_list_flags(enum mail_storage_flags storage_flags);
--- a/src/lib-storage/mail-storage.c Sun Nov 11 15:48:59 2007 +0200 +++ b/src/lib-storage/mail-storage.c Sun Nov 11 16:02:25 2007 +0200 @@ -741,5 +741,12 @@ bool mailbox_is_inconsistent(struct mailbox *box) { - return box->v.is_inconsistent(box); + return box->mailbox_deleted || box->v.is_inconsistent(box); } + +void mailbox_set_deleted(struct mailbox *box) +{ + mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, + "Mailbox was deleted under us"); + box->mailbox_deleted = TRUE; +}