dovecot-2.0: lib-storage: Removed input parameter from mailbox_a...

dovecot at dovecot.org dovecot at dovecot.org
Fri Feb 12 23:29:38 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/b7c8221cea5b
changeset: 10690:b7c8221cea5b
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Feb 12 23:27:16 2010 +0200
description:
lib-storage: Removed input parameter from mailbox_alloc(), added mailbox_open_stream()

diffstat:

40 files changed, 168 insertions(+), 210 deletions(-)
src/doveadm/doveadm-mail.c                               |    2 
src/dsync/dsync-worker-local.c                           |   13 -
src/imap/cmd-append.c                                    |    2 
src/imap/cmd-copy.c                                      |    2 
src/imap/cmd-create.c                                    |    2 
src/imap/cmd-delete.c                                    |    2 
src/imap/cmd-select.c                                    |    2 
src/imap/imap-status.c                                   |    2 
src/lda/main.c                                           |   16 +-
src/lib-lda/mail-deliver.c                               |    2 
src/lib-storage/index/cydir/cydir-storage.c              |   11 -
src/lib-storage/index/dbox-common/dbox-storage.c         |    6 
src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c |    6 
src/lib-storage/index/dbox-multi/mdbox-storage.c         |    6 
src/lib-storage/index/dbox-multi/mdbox-storage.h         |    3 
src/lib-storage/index/dbox-single/sdbox-storage.c        |    8 -
src/lib-storage/index/dbox-single/sdbox-storage.h        |    5 
src/lib-storage/index/index-storage.c                    |   23 --
src/lib-storage/index/index-storage.h                    |    1 
src/lib-storage/index/maildir/maildir-storage.c          |   11 -
src/lib-storage/index/mbox/mbox-storage.c                |   12 -
src/lib-storage/index/raw/raw-storage.c                  |   26 +--
src/lib-storage/mail-storage-private.h                   |    5 
src/lib-storage/mail-storage.c                           |   35 +++-
src/lib-storage/mail-storage.h                           |    9 -
src/lib-storage/test-mail-storage.h                      |    3 
src/lib-storage/test-mailbox.c                           |    3 
src/lmtp/commands.c                                      |    5 
src/plugins/autocreate/autocreate-plugin.c               |    2 
src/plugins/expire/expire-tool.c                         |    2 
src/plugins/imap-acl/imap-acl-plugin.c                   |    4 
src/plugins/imap-quota/imap-quota-plugin.c               |    2 
src/plugins/lazy-expunge/lazy-expunge-plugin.c           |    6 
src/plugins/listescape/listescape-plugin.c               |    5 
src/plugins/mbox-snarf/mbox-snarf-plugin.c               |    7 
src/plugins/quota/quota-count.c                          |    2 
src/plugins/trash/trash-plugin.c                         |    2 
src/plugins/virtual/virtual-storage.c                    |   13 -
src/plugins/zlib/zlib-plugin.c                           |  108 ++++++--------
src/pop3/pop3-client.c                                   |    2 

diffs (truncated from 1063 to 300 lines):

diff -r 46ae2e53d688 -r b7c8221cea5b src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/doveadm/doveadm-mail.c	Fri Feb 12 23:27:16 2010 +0200
@@ -46,7 +46,7 @@ mailbox_find_and_open(struct mail_user *
 	if (ns == NULL)
 		i_fatal("Can't find namespace for mailbox %s", mailbox);
 
-	box = mailbox_alloc(ns->list, mailbox, NULL, MAILBOX_FLAG_KEEP_RECENT |
+	box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_KEEP_RECENT |
 			    MAILBOX_FLAG_IGNORE_ACLS);
 	if (mailbox_open(box) < 0) {
 		i_fatal("Opening mailbox %s failed: %s", orig_mailbox,
diff -r 46ae2e53d688 -r b7c8221cea5b src/dsync/dsync-worker-local.c
--- a/src/dsync/dsync-worker-local.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/dsync/dsync-worker-local.c	Fri Feb 12 23:27:16 2010 +0200
@@ -505,7 +505,7 @@ local_worker_mailbox_iter_next(struct ds
 		return 1;
 	}
 
-	box = mailbox_alloc(info->ns->list, storage_name, NULL, flags);
+	box = mailbox_alloc(info->ns->list, storage_name, flags);
 	if (mailbox_sync(box, 0) < 0 ||
 	    mailbox_get_guid(box, mailbox_guid) < 0) {
 		struct mail_storage *storage = mailbox_get_storage(box);
@@ -700,7 +700,7 @@ static int local_mailbox_open(struct loc
 		return -1;
 	}
 
-	box = mailbox_alloc(lbox->ns->list, lbox->storage_name, NULL, flags);
+	box = mailbox_alloc(lbox->ns->list, lbox->storage_name, flags);
 	if (mailbox_sync(box, 0) < 0 ||
 	    mailbox_get_guid(box, mailbox_guid) < 0) {
 		struct mail_storage *storage = mailbox_get_storage(box);
@@ -1003,8 +1003,7 @@ local_worker_mailbox_alloc(struct local_
 				 &dsync_box->mailbox_guid);
 	if (lbox != NULL) {
 		/* use the existing known mailbox name */
-		return mailbox_alloc(lbox->ns->list, lbox->storage_name,
-				     NULL, 0);
+		return mailbox_alloc(lbox->ns->list, lbox->storage_name, 0);
 	}
 
 	name = dsync_box->name;
@@ -1018,7 +1017,7 @@ local_worker_mailbox_alloc(struct local_
 						 dsync_box, creating);
 	local_dsync_worker_add_mailbox(worker, ns, name,
 				       &dsync_box->mailbox_guid);
-	return mailbox_alloc(ns->list, name, NULL, 0);
+	return mailbox_alloc(ns->list, name, 0);
 }
 
 static int
@@ -1091,7 +1090,7 @@ local_worker_create_mailbox(struct dsync
 
 	local_dsync_worker_add_mailbox(worker, ns, new_name,
 				       &dsync_box->mailbox_guid);
-	box = mailbox_alloc(ns->list, new_name, NULL, 0);
+	box = mailbox_alloc(ns->list, new_name, 0);
 	(void)local_worker_create_allocated_mailbox(worker, box, dsync_box);
 	mailbox_free(&box);
 }
@@ -1116,7 +1115,7 @@ local_worker_delete_mailbox(struct dsync
 
 	mailbox_list_set_changelog_timestamp(lbox->ns->list,
 					     dsync_box->last_change);
-	box = mailbox_alloc(lbox->ns->list, lbox->storage_name, NULL, 0);
+	box = mailbox_alloc(lbox->ns->list, lbox->storage_name, 0);
 	if (mailbox_delete(box) < 0) {
 		struct mail_storage *storage = mailbox_get_storage(box);
 
diff -r 46ae2e53d688 -r b7c8221cea5b src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/imap/cmd-append.c	Fri Feb 12 23:27:16 2010 +0200
@@ -464,7 +464,7 @@ get_mailbox(struct client_command_contex
 	    mailbox_equals(cmd->client->mailbox, ns, name))
 		return cmd->client->mailbox;
 
-	box = mailbox_alloc(ns->list, name, NULL, MAILBOX_FLAG_SAVEONLY |
+	box = mailbox_alloc(ns->list, name, MAILBOX_FLAG_SAVEONLY |
 			    MAILBOX_FLAG_KEEP_RECENT);
 	if (mailbox_open(box) < 0) {
 		client_send_storage_error(cmd, mailbox_get_storage(box));
diff -r 46ae2e53d688 -r b7c8221cea5b src/imap/cmd-copy.c
--- a/src/imap/cmd-copy.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/imap/cmd-copy.c	Fri Feb 12 23:27:16 2010 +0200
@@ -118,7 +118,7 @@ bool cmd_copy(struct client_command_cont
 	if (mailbox_equals(client->mailbox, dest_ns, mailbox))
 		destbox = client->mailbox;
 	else {
-		destbox = mailbox_alloc(dest_ns->list, mailbox, NULL,
+		destbox = mailbox_alloc(dest_ns->list, mailbox,
 					MAILBOX_FLAG_SAVEONLY |
 					MAILBOX_FLAG_KEEP_RECENT);
 		if (mailbox_open(destbox) < 0) {
diff -r 46ae2e53d688 -r b7c8221cea5b src/imap/cmd-create.c
--- a/src/imap/cmd-create.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/imap/cmd-create.c	Fri Feb 12 23:27:16 2010 +0200
@@ -44,7 +44,7 @@ bool cmd_create(struct client_command_co
 	if (ns == NULL)
 		return TRUE;
 
-	box = mailbox_alloc(ns->list, mailbox, NULL, 0);
+	box = mailbox_alloc(ns->list, mailbox, 0);
 	if (mailbox_create(box, NULL, directory) < 0)
 		client_send_storage_error(cmd, mailbox_get_storage(box));
 	else
diff -r 46ae2e53d688 -r b7c8221cea5b src/imap/cmd-delete.c
--- a/src/imap/cmd-delete.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/imap/cmd-delete.c	Fri Feb 12 23:27:16 2010 +0200
@@ -25,7 +25,7 @@ bool cmd_delete(struct client_command_co
 	if (ns == NULL)
 		return TRUE;
 
-	box = mailbox_alloc(ns->list, name, NULL, 0);
+	box = mailbox_alloc(ns->list, name, 0);
 	if (client->mailbox != NULL &&
 	    mailbox_backends_equal(box, client->mailbox)) {
 		/* deleting selected mailbox. close it first */
diff -r 46ae2e53d688 -r b7c8221cea5b src/imap/cmd-select.c
--- a/src/imap/cmd-select.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/imap/cmd-select.c	Fri Feb 12 23:27:16 2010 +0200
@@ -267,7 +267,7 @@ select_open(struct imap_select_context *
 
 	if (readonly)
 		flags |= MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT;
-	ctx->box = mailbox_alloc(ctx->ns->list, mailbox, NULL, flags);
+	ctx->box = mailbox_alloc(ctx->ns->list, mailbox, flags);
 	if (mailbox_open(ctx->box) < 0) {
 		client_send_storage_error(ctx->cmd,
 					  mailbox_get_storage(ctx->box));
diff -r 46ae2e53d688 -r b7c8221cea5b src/imap/imap-status.c
--- a/src/imap/imap-status.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/imap/imap-status.c	Fri Feb 12 23:27:16 2010 +0200
@@ -66,7 +66,7 @@ int imap_status_get(struct client_comman
 		box = client->mailbox;
 	} else {
 		/* open the mailbox */
-		box = mailbox_alloc(ns->list, mailbox, NULL,
+		box = mailbox_alloc(ns->list, mailbox,
 				    MAILBOX_FLAG_READONLY |
 				    MAILBOX_FLAG_KEEP_RECENT);
 		if (client->enabled_features != 0)
diff -r 46ae2e53d688 -r b7c8221cea5b src/lda/main.c
--- a/src/lda/main.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lda/main.c	Fri Feb 12 23:27:16 2010 +0200
@@ -405,16 +405,20 @@ int main(int argc, char *argv[])
 	if (path == NULL) {
 		input = create_raw_stream(&ctx, 0, &mtime);
 		box = mailbox_alloc(raw_ns->list, "Dovecot Delivery Mail",
-				    input, MAILBOX_FLAG_NO_INDEX_FILES);
+				    MAILBOX_FLAG_NO_INDEX_FILES);
+		if (mailbox_open_stream(box, input) < 0) {
+			i_fatal("Can't open delivery mail as raw: %s",
+				mail_storage_get_last_error(box->storage, &error));
+		}
 		i_stream_unref(&input);
 	} else {
 		mtime = (time_t)-1;
-		box = mailbox_alloc(raw_ns->list, path, NULL,
+		box = mailbox_alloc(raw_ns->list, path,
 				    MAILBOX_FLAG_NO_INDEX_FILES);
-	}
-	if (mailbox_open(box) < 0) {
-		i_fatal("Can't open delivery mail as raw: %s",
-			mail_storage_get_last_error(box->storage, &error));
+		if (mailbox_open(box) < 0) {
+			i_fatal("Can't open delivery mail as raw: %s",
+				mail_storage_get_last_error(box->storage, &error));
+		}
 	}
 	if (mailbox_sync(box, 0) < 0) {
 		i_fatal("Can't sync delivery mail: %s",
diff -r 46ae2e53d688 -r b7c8221cea5b src/lib-lda/mail-deliver.c
--- a/src/lib-lda/mail-deliver.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lib-lda/mail-deliver.c	Fri Feb 12 23:27:16 2010 +0200
@@ -106,7 +106,7 @@ mailbox_open_or_create_synced(struct mai
 		return NULL;
 	}
 
-	box = mailbox_alloc(ns->list, name, NULL, flags);
+	box = mailbox_alloc(ns->list, name, flags);
 	if (mailbox_open(box) == 0)
 		return box;
 
diff -r 46ae2e53d688 -r b7c8221cea5b src/lib-storage/index/cydir/cydir-storage.c
--- a/src/lib-storage/index/cydir/cydir-storage.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lib-storage/index/cydir/cydir-storage.c	Fri Feb 12 23:27:16 2010 +0200
@@ -35,8 +35,7 @@ cydir_storage_get_list_settings(const st
 
 static struct mailbox *
 cydir_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
-		    const char *name, struct istream *input,
-		    enum mailbox_flags flags)
+		    const char *name, enum mailbox_flags flags)
 {
 	struct cydir_mailbox *mbox;
 	struct index_mailbox_context *ibox;
@@ -53,7 +52,7 @@ cydir_mailbox_alloc(struct mail_storage 
 	mbox->box.list = list;
 	mbox->box.mail_vfuncs = &cydir_mail_vfuncs;
 
-	index_storage_mailbox_alloc(&mbox->box, name, input, flags,
+	index_storage_mailbox_alloc(&mbox->box, name, flags,
 				    CYDIR_INDEX_PREFIX);
 	mail_index_set_fsync_types(mbox->box.index,
 				   MAIL_INDEX_SYNC_TYPE_APPEND |
@@ -71,12 +70,6 @@ static int cydir_mailbox_open(struct mai
 static int cydir_mailbox_open(struct mailbox *box)
 {
 	struct stat st;
-
-	if (box->input != NULL) {
-		mail_storage_set_critical(box->storage,
-			"cydir doesn't support streamed mailboxes");
-		return -1;
-	}
 
 	if (stat(box->path, &st) == 0) {
 		/* exists, open it */
diff -r 46ae2e53d688 -r b7c8221cea5b src/lib-storage/index/dbox-common/dbox-storage.c
--- a/src/lib-storage/index/dbox-common/dbox-storage.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lib-storage/index/dbox-common/dbox-storage.c	Fri Feb 12 23:27:16 2010 +0200
@@ -98,12 +98,6 @@ static int dbox_mailbox_create_indexes(s
 
 int dbox_mailbox_open(struct mailbox *box)
 {
-	if (box->input != NULL) {
-		mail_storage_set_critical(box->storage,
-			"dbox doesn't support streamed mailboxes");
-		return -1;
-	}
-
 	if (dbox_cleanup_if_exists(box->list, box->path)) {
 		return index_storage_mailbox_open(box, FALSE);
 	} else if (errno == ENOENT) {
diff -r 46ae2e53d688 -r b7c8221cea5b src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c	Fri Feb 12 23:27:16 2010 +0200
@@ -406,8 +406,7 @@ rebuild_mailbox(struct mdbox_storage_reb
 	int ret;
 
 	box = mdbox_mailbox_alloc(&ctx->storage->storage.storage,
-				  ns->list, name, NULL,
-				  MAILBOX_FLAG_READONLY |
+				  ns->list, name, MAILBOX_FLAG_READONLY |
 				  MAILBOX_FLAG_KEEP_RECENT |
 				  MAILBOX_FLAG_IGNORE_ACLS);
 	if (dbox_mailbox_open(box) < 0) {
@@ -543,8 +542,7 @@ static int rebuild_restore_msg(struct md
 		ctx->prev_msg.box : NULL;
 	while (box == NULL) {
 		box = mdbox_mailbox_alloc(storage, ctx->default_list,
-					  mailbox, NULL,
-					  MAILBOX_FLAG_READONLY |
+					  mailbox, MAILBOX_FLAG_READONLY |
 					  MAILBOX_FLAG_KEEP_RECENT |
 					  MAILBOX_FLAG_IGNORE_ACLS);
 		if (dbox_mailbox_open(box) == 0)
diff -r 46ae2e53d688 -r b7c8221cea5b src/lib-storage/index/dbox-multi/mdbox-storage.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c	Fri Feb 12 23:27:16 2010 +0200
@@ -88,8 +88,7 @@ static void mdbox_storage_destroy(struct
 
 struct mailbox *
 mdbox_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
-		    const char *name, struct istream *input,
-		    enum mailbox_flags flags)
+		    const char *name, enum mailbox_flags flags)
 {
 	struct mdbox_mailbox *mbox;
 	struct index_mailbox_context *ibox;
@@ -106,8 +105,7 @@ mdbox_mailbox_alloc(struct mail_storage 
 	mbox->box.list = list;
 	mbox->box.mail_vfuncs = &mdbox_mail_vfuncs;
 
-	index_storage_mailbox_alloc(&mbox->box, name, input, flags,
-				    DBOX_INDEX_PREFIX);
+	index_storage_mailbox_alloc(&mbox->box, name, flags, DBOX_INDEX_PREFIX);
 	mail_index_set_fsync_types(mbox->box.index,
 				   MAIL_INDEX_SYNC_TYPE_APPEND |
 				   MAIL_INDEX_SYNC_TYPE_EXPUNGE);
diff -r 46ae2e53d688 -r b7c8221cea5b src/lib-storage/index/dbox-multi/mdbox-storage.h
--- a/src/lib-storage/index/dbox-multi/mdbox-storage.h	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage.h	Fri Feb 12 23:27:16 2010 +0200
@@ -51,8 +51,7 @@ extern struct mail_vfuncs mdbox_mail_vfu
 
 struct mailbox *
 mdbox_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
-		    const char *name, struct istream *input,
-		    enum mailbox_flags flags);
+		    const char *name, enum mailbox_flags flags);
 
 int mdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r,
 		    struct dbox_file **file_r);
diff -r 46ae2e53d688 -r b7c8221cea5b src/lib-storage/index/dbox-single/sdbox-storage.c
--- a/src/lib-storage/index/dbox-single/sdbox-storage.c	Fri Feb 12 21:31:49 2010 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.c	Fri Feb 12 23:27:16 2010 +0200
@@ -35,10 +35,9 @@ static struct mail_storage *sdbox_storag
 	return &storage->storage.storage;
 }


More information about the dovecot-cvs mailing list