[dovecot-cvs] dovecot/src/lib-storage/index index-storage.c, 1.92, 1.93 index-storage.h, 1.107, 1.108

tss at dovecot.org tss at dovecot.org
Wed Dec 6 15:08:28 UTC 2006


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

Modified Files:
	index-storage.c index-storage.h 
Log Message:
Lock handling changes. Everything goes through file-lock API now and there's
only a single enum listing the different lock methods. This change exposed
some unneeded (or possibly even wrong?) unlock calls in index file handling
which were fixed.



Index: index-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- index-storage.c	25 Nov 2006 22:17:41 -0000	1.92
+++ index-storage.c	6 Dec 2006 15:08:25 -0000	1.93
@@ -43,7 +43,7 @@
 void index_storage_init(struct index_storage *storage,
 			struct mailbox_list *list,
 			enum mail_storage_flags flags,
-			enum mail_storage_lock_method lock_method)
+			enum file_lock_method lock_method)
 {
 	storage->storage.list = list;
 	storage->storage.flags = flags;
@@ -318,7 +318,6 @@
 {
 	struct mail_storage *storage = &ibox->storage->storage;
 	enum mail_index_open_flags index_flags;
-	enum mail_index_lock_method lock_method = 0;
 	int ret;
 
 	i_assert(!ibox->box.opened);
@@ -331,25 +330,13 @@
 #endif
 		index_flags |= MAIL_INDEX_OPEN_FLAG_MMAP_NO_WRITE;
 
-	switch (storage->lock_method) {
-	case MAIL_STORAGE_LOCK_FCNTL:
-		lock_method = MAIL_INDEX_LOCK_FCNTL;
-		break;
-	case MAIL_STORAGE_LOCK_FLOCK:
-		lock_method = MAIL_INDEX_LOCK_FLOCK;
-		break;
-	case MAIL_STORAGE_LOCK_DOTLOCK:
-		lock_method = MAIL_INDEX_LOCK_DOTLOCK;
-		break;
-	}
-
-	ret = mail_index_open(ibox->index, index_flags, lock_method);
+	ret = mail_index_open(ibox->index, index_flags, storage->lock_method);
 	if (ret <= 0 || ibox->move_to_memory) {
 		if (mail_index_move_to_memory(ibox->index) < 0) {
 			/* try opening once more. it should be created
 			   directly into memory now. */
 			ret = mail_index_open(ibox->index, index_flags,
-					      lock_method);
+					      storage->lock_method);
 			if (ret <= 0) {
 				mail_storage_set_index_error(ibox);
 				index_storage_mailbox_free(&ibox->box);

Index: index-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- index-storage.h	25 Nov 2006 22:17:41 -0000	1.107
+++ index-storage.h	6 Dec 2006 15:08:25 -0000	1.108
@@ -111,7 +111,7 @@
 void index_storage_init(struct index_storage *storage,
 			struct mailbox_list *list,
 			enum mail_storage_flags flags,
-			enum mail_storage_lock_method lock_method);
+			enum file_lock_method lock_method);
 void index_storage_deinit(struct index_storage *storage);
 
 int index_storage_mailbox_init(struct index_mailbox *ibox,



More information about the dovecot-cvs mailing list