[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-file.c, 1.19, 1.20 mbox-lock.c, 1.28, 1.29 mbox-mail.c, 1.38, 1.39 mbox-save.c, 1.107, 1.108 mbox-storage.c, 1.172, 1.173 mbox-storage.h, 1.50, 1.51 mbox-sync-rewrite.c, 1.79, 1.80 mbox-sync.c, 1.206, 1.207

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


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

Modified Files:
	mbox-file.c mbox-lock.c mbox-mail.c mbox-save.c mbox-storage.c 
	mbox-storage.h mbox-sync-rewrite.c mbox-sync.c 
Log Message:
Removed struct index_storage abstraction. It's pointless.



Index: mbox-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-file.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mbox-file.c	18 Jan 2007 16:57:44 -0000	1.19
+++ mbox-file.c	30 Mar 2007 12:44:06 -0000	1.20
@@ -160,7 +160,7 @@
 	}
 
 	if (data == NULL) {
-		mail_storage_set_critical(STORAGE(mbox->storage),
+		mail_storage_set_critical(&mbox->storage->storage,
 			"Cached message offset lost for seq %u in mbox file %s",
 			seq, mbox->path);
                 mbox->mbox_sync_dirty = TRUE;
@@ -170,7 +170,7 @@
 	offset = *((const uint64_t *)data);
 	if (istream_raw_mbox_seek(mbox->mbox_stream, offset) < 0) {
 		if (offset == 0) {
-			mail_storage_set_error(STORAGE(mbox->storage),
+			mail_storage_set_error(&mbox->storage->storage,
 				"Mailbox isn't a valid mbox file");
 			return -1;
 		}
@@ -178,7 +178,7 @@
 		if (mbox->mbox_sync_dirty)
 			return 0;
 
-		mail_storage_set_critical(STORAGE(mbox->storage),
+		mail_storage_set_critical(&mbox->storage->storage,
 			"Cached message offset %s is invalid for mbox file %s",
 			dec2str(offset), mbox->path);
 		mbox->mbox_sync_dirty = TRUE;

Index: mbox-lock.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-lock.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- mbox-lock.c	18 Jan 2007 16:57:44 -0000	1.28
+++ mbox-lock.c	30 Mar 2007 12:44:06 -0000	1.29
@@ -249,7 +249,7 @@
         ctx->dotlock_last_stale = -1;
 
 	memset(&set, 0, sizeof(set));
-	set.use_excl_lock = (STORAGE(mbox->storage)->flags &
+	set.use_excl_lock = (mbox->storage->storage.flags &
 			     MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL) != 0;
 	set.timeout = lock_timeout;
 	set.stale_timeout = dotlock_change_timeout;
@@ -262,9 +262,9 @@
 		return -1;
 	}
 	if (ret == 0) {
-		mail_storage_set_error(STORAGE(mbox->storage),
+		mail_storage_set_error(&mbox->storage->storage,
 				       "Timeout while waiting for lock");
-		STORAGE(mbox->storage)->temporary_error = TRUE;
+		mbox->storage->storage.temporary_error = TRUE;
 		return 0;
 	}
 	mbox->mbox_dotlocked = TRUE;
@@ -494,9 +494,9 @@
 		if (!drop_locks)
 			(void)mbox_unlock_files(&ctx);
 		if (ret == 0) {
-			mail_storage_set_error(STORAGE(mbox->storage),
+			mail_storage_set_error(&mbox->storage->storage,
 				"Timeout while waiting for lock");
-			STORAGE(mbox->storage)->temporary_error = TRUE;
+			mbox->storage->storage.temporary_error = TRUE;
 		}
 		return ret;
 	}

Index: mbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-mail.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- mbox-mail.c	25 Jan 2007 09:39:08 -0000	1.38
+++ mbox-mail.c	30 Mar 2007 12:44:06 -0000	1.39
@@ -86,7 +86,7 @@
 		sync_flags |= MBOX_SYNC_UNDIRTY | MBOX_SYNC_FORCE_SYNC;
 	}
 	if (ret == 0) {
-		mail_storage_set_critical(STORAGE(mbox->storage),
+		mail_storage_set_critical(&mbox->storage->storage,
 			"Losing sync for mail uid=%u in mbox file %s",
 			mail->mail.mail.uid, mbox->path);
 	}

Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- mbox-save.c	11 Mar 2007 16:27:55 -0000	1.107
+++ mbox-save.c	30 Mar 2007 12:44:07 -0000	1.108
@@ -59,7 +59,7 @@
 static int write_error(struct mbox_save_context *ctx)
 {
 	if (ENOSPACE(errno)) {
-		mail_storage_set_error(STORAGE(ctx->mbox->storage),
+		mail_storage_set_error(&ctx->mbox->storage->storage,
 				       "Not enough disk space");
 	} else {
 		mbox_set_syscall_error(ctx->mbox, "write()");
@@ -134,7 +134,7 @@
 	t_push();
 	if (from_envelope == NULL) {
 		from_envelope =
-			t_strconcat(INDEX_STORAGE(ctx->mbox->storage)->user,
+			t_strconcat(ctx->mbox->storage->storage.user,
 				    "@", my_hostdomain, NULL);
 	}
 
@@ -267,7 +267,7 @@
 	int ret;
 
 	if (ctx->mbox->mbox_readonly) {
-		mail_storage_set_error(STORAGE(ctx->mbox->storage),
+		mail_storage_set_error(&ctx->mbox->storage->storage,
 				       "Read-only mbox");
 		return -1;
 	}
@@ -280,7 +280,7 @@
 				   a locking issue that should be possible to
 				   fix.. */
 				mail_storage_set_error(
-					STORAGE(ctx->mbox->storage),
+					&ctx->mbox->storage->storage,
 					"Can't copy mails inside same mailbox");
 				return -1;
 			}
@@ -415,7 +415,7 @@
 			str_printfa(ctx->headers, "X-IMAPbase: %u %010u\n",
 				    ctx->uid_validity, ctx->next_uid);
 		}
-		if ((STORAGE(mbox->storage)->flags &
+		if ((mbox->storage->storage.flags &
 		     MAIL_STORAGE_FLAG_KEEP_HEADER_MD5) != 0) {
 			/* we're using MD5 sums to generate POP3 UIDLs.
 			   clients don't like it much if there are duplicates,
@@ -473,7 +473,7 @@
 						mbox_save_drop_headers_count,
 						save_header_callback, ctx);
 		ctx->body_output =
-			(STORAGE(mbox->storage)->flags &
+			(mbox->storage->storage.flags &
 			 MAIL_STORAGE_FLAG_SAVE_CRLF) != 0 ?
 			o_stream_create_crlf(default_pool, ctx->output) :
 			o_stream_create_lf(default_pool, ctx->output);

Index: mbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- mbox-storage.c	29 Mar 2007 11:51:28 -0000	1.172
+++ mbox-storage.c	30 Mar 2007 12:44:07 -0000	1.173
@@ -83,10 +83,10 @@
 	i_assert(function != NULL);
 
 	if (ENOSPACE(errno)) {
-		mail_storage_set_error(STORAGE(mbox->storage),
+		mail_storage_set_error(&mbox->storage->storage,
 				       "Not enough disk space");
 	} else {
-		mail_storage_set_critical(STORAGE(mbox->storage),
+		mail_storage_set_critical(&mbox->storage->storage,
 					  "%s failed with mbox file %s: %m",
 					  function, mbox->path);
 	}
@@ -405,7 +405,6 @@
 	    enum file_lock_method lock_method)
 {
 	struct mbox_storage *storage;
-	struct index_storage *istorage;
 	struct mailbox_list_settings list_set;
 	struct mailbox_list *list;
 	const char *layout, *error;
@@ -437,21 +436,17 @@
 	MODULE_CONTEXT_SET_FULL(list, mbox_mailbox_list_module,
 				storage, &storage->list_module_ctx);
 
-	istorage = INDEX_STORAGE(storage);
-	istorage->storage = mbox_storage;
-	istorage->storage.pool = pool;
-
-	istorage->user = p_strdup(pool, user);
-	index_storage_init(istorage, list, flags, lock_method);
-	return &storage->storage.storage;
+	storage->storage = mbox_storage;
+	storage->storage.pool = pool;
+	storage->storage.user = p_strdup(pool, user);
+	index_storage_init(&storage->storage, list, flags, lock_method);
+	return &storage->storage;
 }
 
-static void mbox_free(struct mail_storage *_storage)
+static void mbox_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 int create_mbox_index_dirs(struct mail_storage *storage,
@@ -519,7 +514,7 @@
 		if (errno == ENOENT)
 			st.st_size = 0;
 		else {
-			mail_storage_set_critical(STORAGE(storage),
+			mail_storage_set_critical(&storage->storage,
 						  "stat(%s) failed: %m", path);
 			return FALSE;
 		}
@@ -543,7 +538,7 @@
 	mbox = p_new(pool, struct mbox_mailbox, 1);
 	mbox->ibox.box = mbox_mailbox;
 	mbox->ibox.box.pool = pool;
-	mbox->ibox.storage = INDEX_STORAGE(storage);
+	mbox->ibox.storage = &storage->storage;
 	mbox->ibox.mail_vfuncs = &mbox_mail_vfuncs;
 	mbox->ibox.is_recent = mbox_mail_is_recent;
 	mbox->ibox.index = index;
@@ -560,7 +555,7 @@
 	mbox->mbox_do_dirty_syncs = mbox->mbox_very_dirty_syncs ||
 		getenv("MBOX_DIRTY_SYNCS") != NULL;
 
-	if ((STORAGE(storage)->flags & MAIL_STORAGE_FLAG_KEEP_HEADER_MD5) != 0)
+	if ((storage->storage.flags & MAIL_STORAGE_FLAG_KEEP_HEADER_MD5) != 0)
 		mbox->mbox_save_md5 = TRUE;
 
 	if ((flags & MAILBOX_OPEN_KEEP_LOCKED) != 0) {
@@ -587,7 +582,7 @@
 mbox_open(struct mbox_storage *storage, const char *name,
 	  enum mailbox_open_flags flags)
 {
-	struct mail_storage *_storage = STORAGE(storage);
+	struct mail_storage *_storage = &storage->storage;
 	struct mbox_mailbox *mbox;
 	struct mail_index *index;
 	const char *path, *index_dir;
@@ -625,7 +620,7 @@
 mbox_mailbox_open_stream(struct mbox_storage *storage, const char *name,
 			 struct istream *input, enum mailbox_open_flags flags)
 {
-	struct mail_storage *_storage = STORAGE(storage);
+	struct mail_storage *_storage = &storage->storage;
 	struct mail_index *index;
 	struct mbox_mailbox *mbox;
 	const char *path, *index_dir;

Index: mbox-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- mbox-storage.h	29 Mar 2007 11:51:28 -0000	1.50
+++ mbox-storage.h	30 Mar 2007 12:44:07 -0000	1.51
@@ -20,7 +20,7 @@
 	(&(mbox_storage)->storage)
 
 struct mbox_storage {
-	struct index_storage storage;
+	struct mail_storage storage;
 
 	union mailbox_list_module_context list_module_ctx;
 };

Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- mbox-sync-rewrite.c	21 Mar 2007 21:57:16 -0000	1.79
+++ mbox-sync-rewrite.c	30 Mar 2007 12:44:07 -0000	1.80
@@ -44,7 +44,7 @@
         if (ret == (off_t)size)
 		ret = 0;
 	else if (ret >= 0) {
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"mbox_move(%"PRIuUOFF_T", %"PRIuUOFF_T", %"PRIuUOFF_T
 			") moved only %"PRIuUOFF_T" bytes in mbox file %s",
 			dest, source, size, (uoff_t)ret, sync_ctx->mbox->path);

Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- mbox-sync.c	23 Mar 2007 02:46:20 -0000	1.206
+++ mbox-sync.c	30 Mar 2007 12:44:07 -0000	1.207
@@ -65,7 +65,7 @@
 int mbox_sync_seek(struct mbox_sync_context *sync_ctx, uoff_t from_offset)
 {
 	if (istream_raw_mbox_seek(sync_ctx->input, from_offset) < 0) {
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"Unexpectedly lost From-line at offset %"PRIuUOFF_T
 			" from mbox file %s", from_offset,
 			sync_ctx->mbox->path);
@@ -92,7 +92,7 @@
 	      || st.st_mtim.tv_nsec != sync_ctx->last_stat.st_mtim.tv_nsec
 #endif
 	     ))) {
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"mbox file %s was modified while we were syncing, "
 			"check your locking settings", sync_ctx->mbox->path);
 		return TRUE;
@@ -337,7 +337,7 @@
 
 	if (rec == NULL && uid < sync_ctx->idx_next_uid) {
 		/* this UID was already in index and it was expunged */
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"mbox sync: Expunged message reappeared in mailbox %s "
 			"(UID %u < %u, seq=%u, idx_msgs=%u)",
 			sync_ctx->mbox->path, uid, sync_ctx->idx_next_uid,
@@ -345,7 +345,7 @@
 		ret = 0; rec = NULL;
 	} else if (rec != NULL && rec->uid != uid) {
 		/* new UID in the middle of the mailbox - shouldn't happen */
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"mbox sync: UID inserted in the middle of mailbox %s "
 			"(%u > %u, seq=%u, idx_msgs=%u)", sync_ctx->mbox->path,
 			rec->uid, uid, sync_ctx->seq, messages_count);
@@ -633,7 +633,7 @@
 		return -1;
 	}
 	if (ret == 0) {
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"X-IMAPbase uid-last unexpectedly points outside "
 			"mbox file %s", sync_ctx->mbox->path);
 		return -1;
@@ -648,7 +648,7 @@
 	}
 
 	if (uid_last != sync_ctx->base_uid_last) {
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"X-IMAPbase uid-last unexpectedly lost in mbox file %s",
 			sync_ctx->mbox->path);
 		return -1;
@@ -921,7 +921,7 @@
 
 	if (seq == 0) {
 		if (istream_raw_mbox_seek(mbox->mbox_stream, 0) < 0) {
-			mail_storage_set_error(STORAGE(mbox->storage),
+			mail_storage_set_error(&mbox->storage->storage,
 				"Mailbox isn't a valid mbox file");
 			return -1;
 		}
@@ -937,7 +937,7 @@
 			if (istream_raw_mbox_seek(mbox->mbox_stream,
 						  old_offset) < 0) {
 				mail_storage_set_critical(
-					STORAGE(mbox->storage),
+					&mbox->storage->storage,
 					"Error seeking back to original "
 					"offset %s in mbox file %s",
 					dec2str(old_offset), mbox->path);
@@ -995,7 +995,7 @@
 		if (istream_raw_mbox_seek(sync_ctx->mbox->mbox_stream,
 					  st->st_size) < 0) {
 			mail_storage_set_critical(
-				STORAGE(sync_ctx->mbox->storage),
+				&sync_ctx->mbox->storage->storage,
 				"Error seeking to end of mbox file %s",
 				sync_ctx->mbox->path);
 			return -1;
@@ -1090,7 +1090,7 @@
 		    sync_ctx->base_uid_validity !=
 		    sync_ctx->hdr->uid_validity) {
 			mail_storage_set_critical(
-				STORAGE(sync_ctx->mbox->storage),
+				&sync_ctx->mbox->storage->storage,
 				"UIDVALIDITY changed (%u -> %u) "
 				"in mbox file %s",
 				sync_ctx->hdr->uid_validity,
@@ -1108,7 +1108,7 @@
 				return 0;
 
 			mail_storage_set_critical(
-				STORAGE(sync_ctx->mbox->storage),
+				&sync_ctx->mbox->storage->storage,
 				"UIDs broken with partial sync in mbox file %s",
 				sync_ctx->mbox->path);
 
@@ -1181,7 +1181,7 @@
 				   happen normally, so just try to get it fixed
 				   without crashing. */
 				mail_storage_set_critical(
-					STORAGE(sync_ctx->mbox->storage),
+					&sync_ctx->mbox->storage->storage,
 					"Out of UIDs, renumbering them in mbox "
 					"file %s", sync_ctx->mbox->path);
 				sync_ctx->renumber_uids = TRUE;
@@ -1330,7 +1330,7 @@
 	}
 	file_size = st->st_size;
 	if (file_size < sync_ctx->file_input->v_offset) {
-		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
+		mail_storage_set_critical(&sync_ctx->mbox->storage->storage,
 			"file size unexpectedly shrinked in mbox file %s "
 			"(%"PRIuUOFF_T" vs %"PRIuUOFF_T")",
 			sync_ctx->mbox->path, file_size,



More information about the dovecot-cvs mailing list