dovecot-2.0: lib-storage: Split mailbox_close() and mailbox_free...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 7 17:52:41 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/8b138b29dc01
changeset: 10662:8b138b29dc01
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 07 17:50:08 2010 +0200
description:
lib-storage: Split mailbox_close() and mailbox_free() functionality.

diffstat:

35 files changed, 119 insertions(+), 96 deletions(-)
src/doveadm/doveadm-mail.c                               |    2 -
src/dsync/dsync-worker-local.c                           |   24 +++++++-------
src/imap/cmd-append.c                                    |    4 +-
src/imap/cmd-close.c                                     |    2 -
src/imap/cmd-copy.c                                      |    4 +-
src/imap/cmd-create.c                                    |    2 -
src/imap/cmd-delete.c                                    |    4 +-
src/imap/cmd-logout.c                                    |    2 -
src/imap/cmd-select.c                                    |    6 +--
src/imap/cmd-unselect.c                                  |    2 -
src/imap/imap-client.c                                   |    2 -
src/imap/imap-status.c                                   |    2 -
src/lda/main.c                                           |    2 -
src/lib-index/mail-index-alloc-cache.c                   |    6 ++-
src/lib-index/mail-index-alloc-cache.h                   |    2 -
src/lib-lda/mail-deliver.c                               |    8 ++--
src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c |   14 ++++----
src/lib-storage/index/dbox-multi/mdbox-storage.c         |    4 +-
src/lib-storage/index/index-storage.c                    |   20 +++++++----
src/lib-storage/index/maildir/maildir-storage.c          |    2 -
src/lib-storage/mail-storage.c                           |   23 +++++++++++--
src/lib-storage/mail-storage.h                           |    6 ++-
src/lmtp/client.c                                        |    2 -
src/lmtp/commands.c                                      |    4 +-
src/plugins/autocreate/autocreate-plugin.c               |    2 -
src/plugins/expire/expire-tool.c                         |    4 +-
src/plugins/imap-acl/imap-acl-plugin.c                   |   18 +++++-----
src/plugins/imap-quota/imap-quota-plugin.c               |    2 -
src/plugins/lazy-expunge/lazy-expunge-plugin.c           |   18 +++++-----
src/plugins/mbox-snarf/mbox-snarf-plugin.c               |    2 -
src/plugins/quota/quota-count.c                          |    6 +--
src/plugins/quota/quota-storage.c                        |    2 -
src/plugins/trash/trash-plugin.c                         |    4 +-
src/plugins/virtual/virtual-storage.c                    |    6 +--
src/pop3/pop3-client.c                                   |    2 -

diffs (truncated from 893 to 300 lines):

diff -r bd06d9b159fa -r 8b138b29dc01 src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/doveadm/doveadm-mail.c	Sun Feb 07 17:50:08 2010 +0200
@@ -72,7 +72,7 @@ static void cmd_force_resync(struct mail
 		i_fatal("Forcing a resync on mailbox %s failed: %s", mailbox,
 			mail_storage_get_last_error(storage, NULL));
 	}
-	mailbox_close(&box);
+	mailbox_free(&box);
 }
 
 static void
diff -r bd06d9b159fa -r 8b138b29dc01 src/dsync/dsync-worker-local.c
--- a/src/dsync/dsync-worker-local.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/dsync/dsync-worker-local.c	Sun Feb 07 17:50:08 2010 +0200
@@ -510,7 +510,7 @@ local_worker_mailbox_iter_next(struct ds
 
 		i_error("Failed to sync mailbox %s: %s", info->name,
 			mail_storage_get_last_error(storage, NULL));
-		mailbox_close(&box);
+		mailbox_free(&box);
 		_iter->failed = TRUE;
 		return -1;
 	}
@@ -541,7 +541,7 @@ local_worker_mailbox_iter_next(struct ds
 
 	local_dsync_worker_add_mailbox(worker, info->ns, storage_name,
 				       &dsync_box_r->mailbox_guid);
-	mailbox_close(&box);
+	mailbox_free(&box);
 	return 1;
 }
 
@@ -706,7 +706,7 @@ static int local_mailbox_open(struct loc
 
 		i_error("Failed to sync mailbox %s: %s", lbox->storage_name,
 			mail_storage_get_last_error(storage, NULL));
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return -1;
 	}
 
@@ -716,7 +716,7 @@ static int local_mailbox_open(struct loc
 			lbox->storage_name, dsync_guid_to_str(guid),
 			binary_to_hex(status.mailbox_guid,
 				      sizeof(status.mailbox_guid)));
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return -1;
 	}
 	*box_r = box;
@@ -771,7 +771,7 @@ iter_local_mailbox_close(struct local_ds
 		iter->iter.failed = TRUE;
 	}
 	(void)mailbox_transaction_commit(&trans);
-	mailbox_close(&box);
+	mailbox_free(&box);
 }
 
 static struct dsync_worker_msg_iter *
@@ -1078,7 +1078,7 @@ local_worker_create_mailbox(struct dsync
 
 	ret = local_worker_create_allocated_mailbox(worker, box, dsync_box);
 	if (ret != 0) {
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return;
 	}
 
@@ -1088,13 +1088,13 @@ local_worker_create_mailbox(struct dsync
 			       dsync_guid_to_str(&dsync_box->mailbox_guid),
 			       NULL);
 	ns = mailbox_get_namespace(box);
-	mailbox_close(&box);
+	mailbox_free(&box);
 
 	local_dsync_worker_add_mailbox(worker, ns, new_name,
 				       &dsync_box->mailbox_guid);
 	box = mailbox_alloc(ns->list, new_name, NULL, 0);
 	(void)local_worker_create_allocated_mailbox(worker, box, dsync_box);
-	mailbox_close(&box);
+	mailbox_free(&box);
 }
 
 static void
@@ -1217,7 +1217,7 @@ static void local_worker_mailbox_close(s
 	    mailbox_sync(worker->selected_box, MAILBOX_SYNC_FLAG_FULL_WRITE) < 0)
 		dsync_worker_set_failure(&worker->worker);
 
-	mailbox_close(&worker->selected_box);
+	mailbox_free(&worker->selected_box);
 }
 
 static void
@@ -1251,7 +1251,7 @@ local_worker_update_mailbox(struct dsync
 			mail_storage_get_last_error(mailbox_get_storage(box),
 						    NULL));
 	}
-	mailbox_close(&box);
+	mailbox_free(&box);
 
 	if (selected)
 		dsync_worker_select_mailbox(_worker, dsync_box);
@@ -1412,7 +1412,7 @@ local_worker_msg_copy(struct dsync_worke
 
 	mail_free(&src_mail);
 	(void)mailbox_transaction_commit(&src_trans);
-	mailbox_close(&src_box);
+	mailbox_free(&src_box);
 
 	callback(ret == 0, context);
 }
@@ -1528,7 +1528,7 @@ static void local_worker_msg_box_close(s
 
 	mail_free(&worker->get_mail);
 	(void)mailbox_transaction_commit(&trans);
-	mailbox_close(&box);
+	mailbox_free(&box);
 	memset(&worker->get_mailbox, 0, sizeof(worker->get_mailbox));
 }
 
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-append.c	Sun Feb 07 17:50:08 2010 +0200
@@ -148,7 +148,7 @@ static void cmd_append_finish(struct cmd
 	if (ctx->t != NULL)
 		mailbox_transaction_rollback(&ctx->t);
 	if (ctx->box != ctx->cmd->client->mailbox && ctx->box != NULL)
-		mailbox_close(&ctx->box);
+		mailbox_free(&ctx->box);
 }
 
 static bool cmd_append_continue_cancel(struct client_command_context *cmd)
@@ -468,7 +468,7 @@ get_mailbox(struct client_command_contex
 			    MAILBOX_FLAG_KEEP_RECENT);
 	if (mailbox_open(box) < 0) {
 		client_send_storage_error(cmd, mailbox_get_storage(box));
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return NULL;
 	}
 	if (cmd->client->enabled_features != 0)
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-close.c
--- a/src/imap/cmd-close.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-close.c	Sun Feb 07 17:50:08 2010 +0200
@@ -23,7 +23,7 @@ bool cmd_close(struct client_command_con
 	if (mailbox_sync(mailbox, 0) < 0)
 		client_send_untagged_storage_error(client, storage);
 
-	mailbox_close(&mailbox);
+	mailbox_free(&mailbox);
 	client_update_mailbox_flags(client, NULL);
 
 	client_send_tagline(cmd, "OK Close completed.");
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-copy.c
--- a/src/imap/cmd-copy.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-copy.c	Sun Feb 07 17:50:08 2010 +0200
@@ -124,7 +124,7 @@ bool cmd_copy(struct client_command_cont
 		if (mailbox_open(destbox) < 0) {
 			client_send_storage_error(cmd,
 				mailbox_get_storage(destbox));
-			mailbox_close(&destbox);
+			mailbox_free(&destbox);
 			return TRUE;
 		}
 		if (client->enabled_features != 0)
@@ -163,7 +163,7 @@ bool cmd_copy(struct client_command_cont
 	if (destbox != client->mailbox) {
 		sync_flags |= MAILBOX_SYNC_FLAG_FAST;
 		imap_flags |= IMAP_SYNC_FLAG_SAFE;
-		mailbox_close(&destbox);
+		mailbox_free(&destbox);
 	}
 
 	if (ret > 0)
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-create.c
--- a/src/imap/cmd-create.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-create.c	Sun Feb 07 17:50:08 2010 +0200
@@ -49,6 +49,6 @@ bool cmd_create(struct client_command_co
 		client_send_storage_error(cmd, mailbox_get_storage(box));
 	else
 		client_send_tagline(cmd, "OK Create completed.");
-	mailbox_close(&box);
+	mailbox_free(&box);
 	return TRUE;
 }
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-delete.c
--- a/src/imap/cmd-delete.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-delete.c	Sun Feb 07 17:50:08 2010 +0200
@@ -30,9 +30,9 @@ bool cmd_delete(struct client_command_co
 	    mailbox_backends_equal(mailbox, client->mailbox)) {
 		/* deleting selected mailbox. close it first */
 		client_search_updates_free(client);
-		mailbox_close(&client->mailbox);
+		mailbox_free(&client->mailbox);
 	}
-	mailbox_close(&mailbox);
+	mailbox_free(&mailbox);
 
 	if (mailbox_list_delete_mailbox(ns->list, name) < 0)
 		client_send_list_error(cmd, ns->list);
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-logout.c
--- a/src/imap/cmd-logout.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-logout.c	Sun Feb 07 17:50:08 2010 +0200
@@ -16,7 +16,7 @@ bool cmd_logout(struct client_command_co
 		/* this could be done at client_disconnect() as well,
 		   but eg. mbox rewrite takes a while so the waiting is
 		   better to happen before "OK" message. */
-		mailbox_close(&client->mailbox);
+		mailbox_free(&client->mailbox);
 	}
 
 	client_send_tagline(cmd, "OK Logout completed.");
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-select.c
--- a/src/imap/cmd-select.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-select.c	Sun Feb 07 17:50:08 2010 +0200
@@ -187,7 +187,7 @@ static void cmd_select_finish(struct ima
 {
 	if (ret < 0) {
 		if (ctx->box != NULL)
-			mailbox_close(&ctx->box);
+			mailbox_free(&ctx->box);
 		ctx->cmd->client->mailbox = NULL;
 	} else {
 		client_send_tagline(ctx->cmd, mailbox_is_readonly(ctx->box) ?
@@ -271,7 +271,7 @@ select_open(struct imap_select_context *
 	if (mailbox_open(ctx->box) < 0) {
 		client_send_storage_error(ctx->cmd,
 					  mailbox_get_storage(ctx->box));
-		mailbox_close(&ctx->box);
+		mailbox_free(&ctx->box);
 		return -1;
 	}
 
@@ -377,7 +377,7 @@ bool cmd_select_full(struct client_comma
 		box = client->mailbox;
 		client->mailbox = NULL;
 
-		mailbox_close(&box);
+		mailbox_free(&box);
 		/* CLOSED response is required by QRESYNC */
 		client_send_line(client,
 				 "* OK [CLOSED] Previous mailbox closed.");
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/cmd-unselect.c
--- a/src/imap/cmd-unselect.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/cmd-unselect.c	Sun Feb 07 17:50:08 2010 +0200
@@ -18,7 +18,7 @@ bool cmd_unselect(struct client_command_
 	client->mailbox = NULL;
 
 	storage = mailbox_get_storage(mailbox);
-	mailbox_close(&mailbox);
+	mailbox_free(&mailbox);
 	client_update_mailbox_flags(client, NULL);
 
 	client_send_tagline(cmd, "OK Unselect completed.");
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/imap-client.c
--- a/src/imap/imap-client.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/imap-client.c	Sun Feb 07 17:50:08 2010 +0200
@@ -186,7 +186,7 @@ void client_destroy(struct client *clien
 
 	if (client->mailbox != NULL) {
 		client_search_updates_free(client);
-		mailbox_close(&client->mailbox);
+		mailbox_free(&client->mailbox);
 	}
 	if (client->anvil_sent) {
 		master_service_anvil_send(master_service, t_strconcat(
diff -r bd06d9b159fa -r 8b138b29dc01 src/imap/imap-status.c
--- a/src/imap/imap-status.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/imap/imap-status.c	Sun Feb 07 17:50:08 2010 +0200
@@ -84,7 +84,7 @@ int imap_status_get(struct client_comman
 		*error_r = mail_storage_get_last_error(storage, &error);
 		*error_r = imap_get_error_string(cmd, *error_r, error);
 	}
-	mailbox_close(&box);
+	mailbox_free(&box);
 	return ret;
 }
 
diff -r bd06d9b159fa -r 8b138b29dc01 src/lda/main.c
--- a/src/lda/main.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/lda/main.c	Sun Feb 07 17:50:08 2010 +0200
@@ -476,7 +476,7 @@ int main(int argc, char *argv[])
 
 	mail_free(&ctx.src_mail);
 	mailbox_transaction_rollback(&t);
-	mailbox_close(&box);
+	mailbox_free(&box);
 
 	mail_user_unref(&ctx.dest_user);
 	mail_user_unref(&raw_mail_user);
diff -r bd06d9b159fa -r 8b138b29dc01 src/lib-index/mail-index-alloc-cache.c
--- a/src/lib-index/mail-index-alloc-cache.c	Sun Feb 07 17:37:48 2010 +0200
+++ b/src/lib-index/mail-index-alloc-cache.c	Sun Feb 07 17:50:08 2010 +0200
@@ -161,10 +161,12 @@ static void index_removal_timeout(void *
 	destroy_unrefed(FALSE);
 }
 
-void mail_index_alloc_cache_unref(struct mail_index *index)
-{


More information about the dovecot-cvs mailing list