[dovecot-cvs] dovecot/src/lib-storage/index/cydir cydir-save.c, 1.1, 1.2 cydir-storage.c, 1.1, 1.2 cydir-storage.h, 1.1, 1.2 cydir-sync.c, 1.1, 1.2

tss at dovecot.org tss at dovecot.org
Fri Mar 30 15:44:04 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/cydir
In directory talvi:/tmp/cvs-serv18163/index/cydir

Modified Files:
	cydir-save.c cydir-storage.c cydir-storage.h cydir-sync.c 
Log Message:
Removed struct index_storage abstraction. It's pointless.



Index: cydir-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/cydir/cydir-save.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cydir-save.c	30 Mar 2007 12:09:00 -0000	1.1
+++ cydir-save.c	30 Mar 2007 12:44:02 -0000	1.2
@@ -48,7 +48,7 @@
 {
 	const char *dir;
 
-	dir = mailbox_list_get_path(STORAGE(ctx->mbox->storage)->list,
+	dir = mailbox_list_get_path(ctx->mbox->storage->storage.list,
 				    ctx->mbox->ibox.box.name,
 				    MAILBOX_LIST_PATH_TYPE_MAILBOX);
 	return t_strdup_printf("%s/%s.%u", dir, ctx->tmp_basename, num);
@@ -134,10 +134,10 @@
 
 	if (o_stream_send_istream(ctx->output, ctx->input) < 0) {
 		if (ENOSPACE(ctx->output->stream_errno)) {
-			mail_storage_set_error(STORAGE(ctx->mbox->storage),
+			mail_storage_set_error(&ctx->mbox->storage->storage,
 					       "Not enough disk space");
 		} else {
-			mail_storage_set_critical(STORAGE(ctx->mbox->storage),
+			mail_storage_set_critical(&ctx->mbox->storage->storage,
 				"o_stream_send_istream(%s) failed: %m",
 				cydir_get_save_path(ctx, ctx->mail_count));
 		}
@@ -187,7 +187,7 @@
 	uid = hdr->next_uid;
 	mail_index_append_assign_uids(ctx->trans, uid, &next_uid);
 
-	dir = mailbox_list_get_path(STORAGE(ctx->mbox->storage)->list,
+	dir = mailbox_list_get_path(ctx->mbox->storage->storage.list,
 				    ctx->mbox->ibox.box.name,
 				    MAILBOX_LIST_PATH_TYPE_MAILBOX);
 
@@ -207,7 +207,7 @@
 		str_printfa(dest_path, "%u.", uid);
 
 		if (rename(str_c(src_path), str_c(dest_path)) < 0) {
-			mail_storage_set_critical(STORAGE(ctx->mbox->storage),
+			mail_storage_set_critical(&ctx->mbox->storage->storage,
 				"rename(%s, %s) failed: %m",
 				str_c(src_path), str_c(dest_path));
 			ctx->failed = TRUE;

Index: cydir-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/cydir/cydir-storage.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cydir-storage.c	30 Mar 2007 12:09:00 -0000	1.1
+++ cydir-storage.c	30 Mar 2007 12:44:02 -0000	1.2
@@ -88,7 +88,6 @@
 	     enum file_lock_method lock_method)
 {
 	struct cydir_storage *storage;
-	struct index_storage *istorage;
 	struct mailbox_list_settings list_set;
 	struct mailbox_list *list;
 	const char *error;
@@ -133,22 +132,18 @@
 	MODULE_CONTEXT_SET_FULL(list, cydir_mailbox_list_module,
 				storage, &storage->list_module_ctx);
 
-	istorage = INDEX_STORAGE(storage);
-	istorage->storage = cydir_storage;
-	istorage->storage.pool = pool;
-
-	istorage->user = p_strdup(pool, user);
-	index_storage_init(istorage, list, flags, lock_method);
+	storage->storage = cydir_storage;
+	storage->storage.pool = pool;
+	storage->storage.user = p_strdup(pool, user);
+	index_storage_init(&storage->storage, list, flags, lock_method);
 
-	return STORAGE(storage);
+	return &storage->storage;
 }
 
-static void cydir_free(struct mail_storage *_storage)
+static void cydir_free(struct mail_storage *storage)
 {
-	struct index_storage *storage = (struct index_storage *) _storage;
-
 	index_storage_deinit(storage);
-	pool_unref(storage->storage.pool);
+	pool_unref(storage->pool);
 }
 
 static bool cydir_autodetect(const char *data __attr_unused__,
@@ -204,8 +199,7 @@
 cydir_open(struct cydir_storage *storage, const char *name,
 	   enum mailbox_open_flags flags)
 {
-	struct index_storage *istorage = INDEX_STORAGE(storage);
-	struct mail_storage *_storage = STORAGE(storage);
+	struct mail_storage *_storage = &storage->storage;
 	struct cydir_mailbox *mbox;
 	struct mail_index *index;
 	const char *path, *index_dir;
@@ -227,7 +221,7 @@
 	mbox = p_new(pool, struct cydir_mailbox, 1);
 	mbox->ibox.box = cydir_mailbox;
 	mbox->ibox.box.pool = pool;
-	mbox->ibox.storage = istorage;
+	mbox->ibox.storage = &storage->storage;
 	mbox->ibox.mail_vfuncs = &cydir_mail_vfuncs;
 	mbox->ibox.is_recent = cydir_is_recent;
 	mbox->ibox.index = index;

Index: cydir-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/cydir/cydir-storage.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cydir-storage.h	30 Mar 2007 12:09:00 -0000	1.1
+++ cydir-storage.h	30 Mar 2007 12:44:02 -0000	1.2
@@ -14,7 +14,7 @@
 	(&(mbox_storage)->storage)
 
 struct cydir_storage {
-	struct index_storage storage;
+	struct mail_storage storage;
 	union mailbox_list_module_context list_module_ctx;
 };
 

Index: cydir-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/cydir/cydir-sync.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cydir-sync.c	30 Mar 2007 12:09:00 -0000	1.1
+++ cydir-sync.c	30 Mar 2007 12:44:02 -0000	1.2
@@ -30,7 +30,7 @@
 	string_t *path = t_str_new(256);
 	const char *dir;
 
-	dir = mailbox_list_get_path(STORAGE(mbox->storage)->list,
+	dir = mailbox_list_get_path(mbox->storage->storage.list,
 				    mbox->ibox.box.name,
 				    MAILBOX_LIST_PATH_TYPE_MAILBOX);
 	str_append(path, dir);
@@ -86,7 +86,7 @@
 			str_printfa(path, "%u.", uid);
 			if (unlink(str_c(path)) < 0 && errno != ENOENT) {
 				mail_storage_set_critical(
-					STORAGE(ctx->mbox->storage),
+					&ctx->mbox->storage->storage,
 					"unlink(%s) failed: %m", str_c(path));
 				/* continue anyway */
 			}



More information about the dovecot-cvs mailing list