From 2b9e49e4e65e3e2dca38f56971029a3051ccdb99 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 14 Jul 2010 17:10:30 +0100 Subject: [PATCH] Renamed "dbox" to "sdbox". Keep also dbox as an alias for it. --- configure.in | 15 ++++++++-- .../index/dbox-single/sdbox-storage.c | 29 +++++++++++++++---- .../index/dbox-single/sdbox-storage.h | 2 +- .../index/dbox-single/sdbox-sync-rebuild.c | 4 +-- .../index/dbox-single/sdbox-sync.c | 4 +-- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/configure.in b/configure.in index e8df2cb817..83935e390c 100644 --- a/configure.in +++ b/configure.in @@ -234,7 +234,7 @@ AC_ARG_WITH(storages, AC_MSG_ERROR([--with-storages needs storage list as parameter]) fi mail_storages="shared `echo "$withval"|sed 's/,/ /g'`" ], - mail_storages="shared maildir mbox dbox mdbox cydir") + mail_storages="shared maildir mbox sdbox mdbox cydir") AC_SUBST(mail_storages) AC_ARG_WITH(moduledir, @@ -2409,7 +2409,7 @@ dnl ** maildir_libs='$(top_builddir)/src/lib-storage/index/maildir/libstorage_maildir.la' mbox_libs='$(top_builddir)/src/lib-storage/index/mbox/libstorage_mbox.la' dbox_common_libs='$(top_builddir)/src/lib-storage/index/dbox-common/libstorage_dbox_common.la' -dbox_libs='$(top_builddir)/src/lib-storage/index/dbox-single/libstorage_dbox_single.la' +sdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-single/libstorage_dbox_single.la' mdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-multi/libstorage_dbox_multi.la' cydir_libs='$(top_builddir)/src/lib-storage/index/cydir/libstorage_cydir.la' raw_libs='$(top_builddir)/src/lib-storage/index/raw/libstorage_raw.la' @@ -2422,9 +2422,13 @@ LINKED_STORAGE_LIBS= mail_storages="$mail_storages raw" # drop duplicates mail_storages=`(for i in $mail_storages; do echo $i; done)|sort|uniq|xargs echo` +have_sdbox=no for storage in $mail_storages; do LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS `eval echo \\$${storage}_libs`" - if test $storage = dbox || test $storage = mdbox; then + if test $storage = sdbox; then + have_sdbox=yes + fi + if test $storage = sdbox || test $storage = mdbox; then LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS $dbox_common_libs" dbox_common_libs="" fi @@ -2432,6 +2436,11 @@ done AC_SUBST(LINKED_STORAGE_LIBS) AC_DEFINE_UNQUOTED(MAIL_STORAGES, "$mail_storages", List of compiled in mail storages) +if test $have_sdbox = yes; then + # create alias for sdbox + mail_storages="$mail_storages dbox" +fi + dnl ** dnl ** Shared libraries usage dnl ** diff --git a/src/lib-storage/index/dbox-single/sdbox-storage.c b/src/lib-storage/index/dbox-single/sdbox-storage.c index b283004e69..08c73bde14 100644 --- a/src/lib-storage/index/dbox-single/sdbox-storage.c +++ b/src/lib-storage/index/dbox-single/sdbox-storage.c @@ -10,7 +10,7 @@ #include "sdbox-sync.h" #include "sdbox-storage.h" -extern struct mail_storage dbox_storage; +extern struct mail_storage dbox_storage, sdbox_storage; extern struct mailbox sdbox_mailbox; extern struct dbox_storage_vfuncs sdbox_dbox_storage_vfuncs; @@ -19,7 +19,7 @@ static struct mail_storage *sdbox_storage_alloc(void) struct sdbox_storage *storage; pool_t pool; - pool = pool_alloconly_create("dbox storage", 512+256); + pool = pool_alloconly_create("sdbox storage", 512+256); storage = p_new(pool, struct sdbox_storage, 1); storage->storage.v = sdbox_dbox_storage_vfuncs; storage->storage.storage = dbox_storage; @@ -34,7 +34,7 @@ sdbox_storage_create(struct mail_storage *storage ATTR_UNUSED, { #ifndef HAVE_FLOCK if (master_service_get_client_limit(master_service) > 1) { - *error_r = "dbox requires client_limit=1 for service " + *error_r = "sdbox requires client_limit=1 for service " "since your OS doesn't support flock()"; return -1; } @@ -53,7 +53,7 @@ sdbox_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list, /* dbox can't work without index files */ flags &= ~MAILBOX_FLAG_NO_INDEX_FILES; - pool = pool_alloconly_create("dbox mailbox", 1024*3); + pool = pool_alloconly_create("sdbox mailbox", 1024*3); mbox = p_new(pool, struct sdbox_mailbox, 1); mbox->box = sdbox_mailbox; mbox->box.pool = pool; @@ -97,7 +97,7 @@ int sdbox_read_header(struct sdbox_mailbox *mbox, if (log_error) { mail_storage_set_critical( &mbox->storage->storage.storage, - "dbox %s: Invalid dbox header size", + "sdbox %s: Invalid dbox header size", mbox->box.path); } ret = -1; @@ -263,7 +263,7 @@ dbox_mailbox_update(struct mailbox *box, const struct mailbox_update *update) return sdbox_write_index_header(box, update, NULL); } -struct mail_storage dbox_storage = { +struct mail_storage sdbox_storage = { .name = SDBOX_STORAGE_NAME, .class_flags = 0, @@ -280,6 +280,23 @@ struct mail_storage dbox_storage = { } }; +struct mail_storage dbox_storage = { + .name = "dbox", /* alias */ + .class_flags = 0, + + .v = { + NULL, + sdbox_storage_alloc, + sdbox_storage_create, + NULL, + NULL, + dbox_storage_get_list_settings, + NULL, + sdbox_mailbox_alloc, + NULL + } +}; + struct mailbox sdbox_mailbox = { .v = { index_storage_is_readonly, diff --git a/src/lib-storage/index/dbox-single/sdbox-storage.h b/src/lib-storage/index/dbox-single/sdbox-storage.h index 02438c25db..42fcbc282c 100644 --- a/src/lib-storage/index/dbox-single/sdbox-storage.h +++ b/src/lib-storage/index/dbox-single/sdbox-storage.h @@ -4,7 +4,7 @@ #include "index-storage.h" #include "dbox-storage.h" -#define SDBOX_STORAGE_NAME "dbox" +#define SDBOX_STORAGE_NAME "sdbox" #define SDBOX_MAIL_FILE_PREFIX "u." #define SDBOX_MAIL_FILE_FORMAT SDBOX_MAIL_FILE_PREFIX"%u" diff --git a/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c b/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c index 34ca509f24..ba94e812bb 100644 --- a/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c +++ b/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c @@ -45,7 +45,7 @@ static int sdbox_sync_add_file_index(struct dbox_sync_rebuild_context *ctx, if (ret < 0) return -1; - i_warning("dbox: Skipping unfixable file: %s", file->cur_path); + i_warning("sdbox: Skipping unfixable file: %s", file->cur_path); return 0; } @@ -71,7 +71,7 @@ sdbox_sync_add_file(struct dbox_sync_rebuild_context *ctx, fname += strlen(SDBOX_MAIL_FILE_PREFIX); if (str_to_uint32(fname, &uid) < 0 || uid == 0) { - i_warning("dbox %s: Ignoring invalid filename %s", + i_warning("sdbox %s: Ignoring invalid filename %s", ctx->box->path, fname); return 0; } diff --git a/src/lib-storage/index/dbox-single/sdbox-sync.c b/src/lib-storage/index/dbox-single/sdbox-sync.c index f191d394cf..7b9e3c67ad 100644 --- a/src/lib-storage/index/dbox-single/sdbox-sync.c +++ b/src/lib-storage/index/dbox-single/sdbox-sync.c @@ -194,12 +194,12 @@ int sdbox_sync_begin(struct sdbox_mailbox *mbox, enum sdbox_sync_flags flags, if (ret == 0) { if (i >= SDBOX_REBUILD_COUNT) { mail_storage_set_critical(storage, - "dbox %s: Index keeps breaking", + "sdbox %s: Index keeps breaking", ctx->mbox->box.path); ret = -1; } else { /* do a full resync and try again. */ - i_warning("dbox %s: Rebuilding index", + i_warning("sdbox %s: Rebuilding index", ctx->mbox->box.path); rebuild = FALSE; ret = sdbox_sync_index_rebuild(mbox, -- 2.47.3