[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-expunge.c,1.19,1.20 mbox-storage.c,1.15,1.16 mbox-storage.h,1.7,1.8

cras at procontrol.fi cras at procontrol.fi
Sat Nov 2 22:10:23 EET 2002


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory danu:/tmp/cvs-serv8907/lib-storage/index/mbox

Modified Files:
	mbox-expunge.c mbox-storage.c mbox-storage.h 
Log Message:
Mostly mbox locking/syncing fixes. Still some problems though.



Index: mbox-expunge.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-expunge.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mbox-expunge.c	28 Oct 2002 04:18:26 -0000	1.19
+++ mbox-expunge.c	2 Nov 2002 20:10:21 -0000	1.20
@@ -150,15 +150,3 @@
 
 	return !failed;
 }
-
-int mbox_storage_expunge(Mailbox *box, int notify)
-{
-	IndexMailbox *ibox = (IndexMailbox *) box;
-	int ret;
-
-	ibox->index->mbox_lock_next_sync = MAIL_LOCK_EXCLUSIVE;
-	ret = index_storage_expunge(box, notify);
-	(void)mbox_unlock(ibox->index);
-
-	return ret;
-}

Index: mbox-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mbox-storage.c	26 Oct 2002 19:38:37 -0000	1.15
+++ mbox-storage.c	2 Nov 2002 20:10:21 -0000	1.16
@@ -371,46 +371,18 @@
 	}
 }
 
-static void mbox_storage_close(Mailbox *box)
+static int mbox_storage_close(Mailbox *box)
 {
 	IndexMailbox *ibox = (IndexMailbox *) box;
+	int failed = FALSE;
 
-	if (!ibox->index->set_lock(ibox->index, MAIL_LOCK_EXCLUSIVE))
+	/* update flags by rewrite mbox file */
+	if (!mbox_index_rewrite(ibox->index)) {
 		mail_storage_set_index_error(ibox);
-	else {
-		/* update flags by rewrite mbox file */
-		mbox_index_rewrite(ibox->index);
-
-		(void)ibox->index->set_lock(ibox->index, MAIL_LOCK_UNLOCK);
+		failed = TRUE;
 	}
 
-	index_storage_close(box);
-}
-
-static int mbox_storage_fetch(Mailbox *box, MailFetchData *fetch_data,
-			      OBuffer *outbuf, int *all_found)
-{
-	IndexMailbox *ibox = (IndexMailbox *) box;
-	int ret;
-
-	ibox->index->mbox_lock_next_sync = MAIL_LOCK_SHARED;
-	ret = index_storage_fetch(box, fetch_data, outbuf, all_found);
-	(void)mbox_unlock(ibox->index);
-
- 	return ret;
-}
-
-static int mbox_storage_search(Mailbox *box, MailSearchArg *args,
-			       OBuffer *outbuf, int uid_result)
-{
-	IndexMailbox *ibox = (IndexMailbox *) box;
-	int ret;
-
-	ibox->index->mbox_lock_next_sync = MAIL_LOCK_SHARED;
-	ret = index_storage_search(box, args, outbuf, uid_result);
-	(void)mbox_unlock(ibox->index);
-
- 	return ret;
+	return index_storage_close(box) && !failed;
 }
 
 MailStorage mbox_storage = {
@@ -444,11 +416,11 @@
 	index_storage_set_sync_callbacks,
 	index_storage_get_status,
 	index_storage_sync,
-	mbox_storage_expunge,
+	index_storage_expunge,
 	index_storage_update_flags,
 	index_storage_copy,
-	mbox_storage_fetch,
-	mbox_storage_search,
+	index_storage_fetch,
+	index_storage_search,
 	mbox_storage_save,
 	mail_storage_is_inconsistency_error,
 

Index: mbox-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mbox-storage.h	26 Oct 2002 19:38:37 -0000	1.7
+++ mbox-storage.h	2 Nov 2002 20:10:21 -0000	1.8
@@ -14,7 +14,6 @@
 int mbox_find_subscribed(MailStorage *storage, const char *mask,
 			 MailboxFunc func, void *context);
 
-int mbox_storage_expunge(Mailbox *box, int notify);
 int mbox_expunge_locked(IndexMailbox *ibox, int notify);
 
 #endif




More information about the dovecot-cvs mailing list