[dovecot-cvs] dovecot/src/lib-storage mail-storage.c, 1.46, 1.47 mail-storage.h, 1.102, 1.103

cras at dovecot.org cras at dovecot.org
Thu Feb 2 22:20:39 EET 2006


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

Modified Files:
	mail-storage.c mail-storage.h 
Log Message:
Moved mailbox flag and lock method parsing to lib-storage.



Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- mail-storage.c	14 Jan 2006 18:47:41 -0000	1.46
+++ mail-storage.c	2 Feb 2006 20:20:34 -0000	1.47
@@ -49,6 +49,36 @@
 	}
 }
 
+void mail_storage_parse_env(enum mail_storage_flags *flags_r,
+			    enum mail_storage_lock_method *lock_method_r)
+{
+	const char *str;
+
+	*flags_r = 0;
+	if (getenv("FULL_FILESYSTEM_ACCESS") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_FULL_FS_ACCESS;
+	if (getenv("DEBUG") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_DEBUG;
+	if (getenv("MMAP_DISABLE") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_MMAP_DISABLE;
+	if (getenv("MMAP_NO_WRITE") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_MMAP_NO_WRITE;
+	if (getenv("MAIL_READ_MMAPED") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_MMAP_MAILS;
+	if (getenv("MAIL_SAVE_CRLF") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_SAVE_CRLF;
+
+	str = getenv("LOCK_METHOD");
+	if (str == NULL || strcmp(str, "flock") == 0)
+		*lock_method_r = MAIL_STORAGE_LOCK_FLOCK;
+	else if (strcmp(str, "fcntl") == 0)
+		*lock_method_r = MAIL_STORAGE_LOCK_FCNTL;
+	else if (strcmp(str, "dotlock") == 0)
+		*lock_method_r = MAIL_STORAGE_LOCK_DOTLOCK;
+	else
+		i_fatal("Unknown lock_method: %s", str);
+}
+
 static struct mail_storage *mail_storage_find(const char *name)
 {
 	struct mail_storage *const *classes;

Index: mail-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- mail-storage.h	14 Jan 2006 18:47:41 -0000	1.102
+++ mail-storage.h	2 Feb 2006 20:20:35 -0000	1.103
@@ -213,6 +213,10 @@
 void mail_storage_class_register(struct mail_storage *storage_class);
 void mail_storage_class_unregister(struct mail_storage *storage_class);
 
+/* 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);
+
 /* Create a new instance of registered mail storage class with given
    storage-specific data. If data is NULL, it tries to use defaults.
    May return NULL if anything fails.



More information about the dovecot-cvs mailing list