dovecot-2.2: sdbox: Verify that mail_attachment_fs backend suppo...

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 26 23:16:12 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/80a8bed29ad9
changeset: 15408:80a8bed29ad9
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 26 23:16:00 2012 +0200
description:
sdbox: Verify that mail_attachment_fs backend supports RENAME property.
This isn't needed by mdbox.

diffstat:

 src/lib-storage/index/dbox-single/sdbox-storage.c |  26 +++++++++++++++++++++-
 1 files changed, 24 insertions(+), 2 deletions(-)

diffs (57 lines):

diff -r 7fb33baa8201 -r 80a8bed29ad9 src/lib-storage/index/dbox-single/sdbox-storage.c
--- a/src/lib-storage/index/dbox-single/sdbox-storage.c	Mon Nov 26 23:15:01 2012 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.c	Mon Nov 26 23:16:00 2012 +0200
@@ -1,6 +1,7 @@
 /* Copyright (c) 2007-2012 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
+#include "fs-api.h"
 #include "master-service.h"
 #include "mail-index-modseq.h"
 #include "mail-search-build.h"
@@ -28,6 +29,27 @@
 	return &storage->storage.storage;
 }
 
+static int sdbox_storage_create(struct mail_storage *_storage,
+				struct mail_namespace *ns,
+				const char **error_r)
+{
+	struct dbox_storage *storage = (struct dbox_storage *)_storage;
+	enum fs_properties props;
+
+	if (dbox_storage_create(_storage, ns, error_r) < 0)
+		return -1;
+
+	if (storage->attachment_fs != NULL) {
+		props = fs_get_properties(storage->attachment_fs);
+		if ((props & FS_PROPERTY_RENAME) == 0) {
+			*error_r = "mail_attachment_fs: "
+				"Backend doesn't support renaming";
+			return -1;
+		}
+	}
+	return 0;
+}
+
 static const char *
 sdbox_storage_find_root_dir(const struct mail_namespace *ns)
 {
@@ -372,7 +394,7 @@
 	.v = {
                 NULL,
 		sdbox_storage_alloc,
-		dbox_storage_create,
+		sdbox_storage_create,
 		dbox_storage_destroy,
 		NULL,
 		dbox_storage_get_list_settings,
@@ -389,7 +411,7 @@
 	.v = {
 		NULL,
 		sdbox_storage_alloc,
-		dbox_storage_create,
+		sdbox_storage_create,
 		dbox_storage_destroy,
 		NULL,
 		dbox_storage_get_list_settings,


More information about the dovecot-cvs mailing list