[dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.39, 1.40 mail-storage.c, 1.65, 1.66 mail-storage.h, 1.120, 1.121 mailbox-list.c, 1.3, 1.4 mailbox-list.h, 1.2, 1.3

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
In directory talvi:/tmp/cvs-serv32161/lib-storage

Modified Files:
	mail-storage-private.h mail-storage.c mail-storage.h 
	mailbox-list.c mailbox-list.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: mail-storage-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage-private.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- mail-storage-private.h	1 Dec 2006 20:55:03 -0000	1.39
+++ mail-storage-private.h	6 Dec 2006 15:08:24 -0000	1.40
@@ -1,6 +1,7 @@
 #ifndef __MAIL_STORAGE_PRIVATE_H
 #define __MAIL_STORAGE_PRIVATE_H
 
+#include "file-lock.h"
 #include "mail-storage.h"
 
 /* Some error strings that should be used everywhere to avoid
@@ -20,7 +21,7 @@
 	struct mail_storage *
 		(*create)(const char *data, const char *user,
 			  enum mail_storage_flags flags,
-			  enum mail_storage_lock_method lock_method);
+			  enum file_lock_method lock_method);
 	void (*destroy)(struct mail_storage *storage);
 
 	bool (*autodetect)(const char *data, enum mail_storage_flags flags);
@@ -63,7 +64,7 @@
 	char *error;
 	struct mailbox_list *list;
 	enum mail_storage_flags flags;
-        enum mail_storage_lock_method lock_method;
+        enum file_lock_method lock_method;
 
 	/* Module-specific contexts. See mail_storage_module_id. */
 	ARRAY_DEFINE(module_contexts, void);

Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- mail-storage.c	3 Dec 2006 18:53:45 -0000	1.65
+++ mail-storage.c	6 Dec 2006 15:08:24 -0000	1.66
@@ -63,7 +63,7 @@
 }
 
 void mail_storage_parse_env(enum mail_storage_flags *flags_r,
-			    enum mail_storage_lock_method *lock_method_r)
+			    enum file_lock_method *lock_method_r)
 {
 	const char *str;
 
@@ -88,11 +88,11 @@
 
 	str = getenv("LOCK_METHOD");
 	if (str == NULL || strcmp(str, "fcntl") == 0)
-		*lock_method_r = MAIL_STORAGE_LOCK_FCNTL;
+		*lock_method_r = FILE_LOCK_METHOD_FCNTL;
 	else if (strcmp(str, "flock") == 0)
-		*lock_method_r = MAIL_STORAGE_LOCK_FLOCK;
+		*lock_method_r = FILE_LOCK_METHOD_FLOCK;
 	else if (strcmp(str, "dotlock") == 0)
-		*lock_method_r = MAIL_STORAGE_LOCK_DOTLOCK;
+		*lock_method_r = FILE_LOCK_METHOD_DOTLOCK;
 	else
 		i_fatal("Unknown lock_method: %s", str);
 }
@@ -115,7 +115,7 @@
 struct mail_storage *
 mail_storage_create(const char *driver, const char *data, const char *user,
 		    enum mail_storage_flags flags,
-		    enum mail_storage_lock_method lock_method)
+		    enum file_lock_method lock_method)
 {
 	struct mail_storage *storage;
 
@@ -131,7 +131,7 @@
 
 static struct mail_storage *
 mail_storage_create_default(const char *user, enum mail_storage_flags flags,
-			    enum mail_storage_lock_method lock_method)
+			    enum file_lock_method lock_method)
 {
 	struct mail_storage *const *classes;
 	struct mail_storage *storage;
@@ -166,7 +166,7 @@
 struct mail_storage *
 mail_storage_create_with_data(const char *data, const char *user,
 			      enum mail_storage_flags flags,
-			      enum mail_storage_lock_method lock_method)
+			      enum file_lock_method lock_method)
 {
 	struct mail_storage *storage;
 	const char *p, *name;

Index: mail-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- mail-storage.h	3 Dec 2006 13:29:56 -0000	1.120
+++ mail-storage.h	6 Dec 2006 15:08:24 -0000	1.121
@@ -35,12 +35,6 @@
 	MAIL_STORAGE_FLAG_HAS_INBOX		= 0x400
 };
 
-enum mail_storage_lock_method {
-	MAIL_STORAGE_LOCK_FCNTL,
-	MAIL_STORAGE_LOCK_FLOCK,
-	MAIL_STORAGE_LOCK_DOTLOCK
-};
-
 enum mailbox_open_flags {
 	/* Mailbox must not be modified even if asked */
 	MAILBOX_OPEN_READONLY		= 0x01,
@@ -202,7 +196,7 @@
 
 /* Returns flags and lock_method based on environment settings. */
 void mail_storage_parse_env(enum mail_storage_flags *flags_r,
-			    enum mail_storage_lock_method *lock_method_r);
+			    enum file_lock_method *lock_method_r);
 
 /* Create a new instance of registered mail storage class with given
    storage-specific data. If data is NULL, it tries to autodetect defaults.
@@ -210,11 +204,11 @@
 struct mail_storage *
 mail_storage_create(const char *driver, const char *data, const char *user,
 		    enum mail_storage_flags flags,
-		    enum mail_storage_lock_method lock_method);
+		    enum file_lock_method lock_method);
 struct mail_storage *
 mail_storage_create_with_data(const char *data, const char *user,
 			      enum mail_storage_flags flags,
-			      enum mail_storage_lock_method lock_method);
+			      enum file_lock_method lock_method);
 void mail_storage_destroy(struct mail_storage **storage);
 
 char mail_storage_get_hierarchy_sep(struct mail_storage *storage);

Index: mailbox-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mailbox-list.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mailbox-list.c	25 Nov 2006 22:17:41 -0000	1.3
+++ mailbox-list.c	6 Dec 2006 15:08:24 -0000	1.4
@@ -112,7 +112,7 @@
 	list->set.maildir_name = p_strdup(list->pool, set->maildir_name);
 
 	list->set.mail_storage_flags = set->mail_storage_flags;
-	list->set.mail_storage_lock_method = set->mail_storage_lock_method;
+	list->set.lock_method = set->lock_method;
 
 	if ((flags & MAILBOX_LIST_FLAG_DEBUG) != 0) {
 		i_info("%s: root=%s, index=%s, control=%s, inbox=%s",
@@ -130,7 +130,7 @@
 		hook_mailbox_list_created(list);
 
 	list->set.mail_storage_flags = NULL;
-	list->set.mail_storage_lock_method = NULL;
+	list->set.lock_method = NULL;
 
 	*list_r = list;
 	return 0;

Index: mailbox-list.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mailbox-list.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mailbox-list.h	25 Nov 2006 22:17:41 -0000	1.2
+++ mailbox-list.h	6 Dec 2006 15:08:24 -0000	1.3
@@ -82,7 +82,7 @@
 	/* If mailbox index is used, use these settings for it
 	   (pointers, so they're set to NULL after init is finished): */
 	const enum mail_storage_flags *mail_storage_flags;
-	const enum mail_storage_lock_method *mail_storage_lock_method;
+	const enum file_lock_method *lock_method;
 };
 
 struct mailbox_info {



More information about the dovecot-cvs mailing list