map->path = i_strconcat(root, "/"MDBOX_GLOBAL_DIR_NAME, NULL);
map->index_path =
i_strconcat(index_root, "/"MDBOX_GLOBAL_DIR_NAME, NULL);
- map->index = mail_index_alloc(storage->storage.storage.user->event,
+ map->index = mail_index_alloc(storage->storage.storage.event,
map->index_path,
MDBOX_GLOBAL_INDEX_PREFIX);
mail_index_set_fsync_mode(map->index,
/* if backup index file exists, try to use it */
index_dir = mailbox_get_index_path(box);
backup_path = t_strconcat(box->index_prefix, ".backup", NULL);
- ctx->backup_index = mail_index_alloc(box->storage->user->event,
+ ctx->backup_index = mail_index_alloc(box->storage->event,
index_dir, backup_path);
#ifndef MMAP_CONFLICTS_WRITE
mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_INDEX,
&index_dir) <= 0)
index_dir = NULL;
- *index_r = mail_index_alloc_cache_get(box->storage->user->event,
+ *index_r = mail_index_alloc_cache_get(box->storage->event,
mailbox_path, index_dir,
box->index_prefix);
return 0;
mailbox_list_get_storage_name(box->list, vname));
box->flags = flags;
box->index_prefix = p_strdup(box->pool, index_prefix);
- box->event = event_create(box->storage->user->event);
+ box->event = event_create(box->storage->event);
event_add_category(box->event, &event_category_mailbox);
event_add_str(box->event, "name", box->vname);
event_set_append_log_prefix(box->event,
char *error_string;
enum mail_error error;
ARRAY(struct mail_storage_error) error_stack;
+ struct event *event;
const struct mail_storage *storage_class;
struct mail_user *user;
storage->user = ns->user;
storage->set = ns->mail_set;
storage->flags = flags;
+ storage->event = event_create(ns->user->event);
p_array_init(&storage->module_contexts, storage->pool, 5);
if (storage->v.create != NULL &&
i_assert(array_count(&storage->error_stack) == 0);
array_free(&storage->error_stack);
}
+ event_unref(&storage->event);
*_storage = NULL;
pool_unref(&storage->pool);
storage->last_internal_error = i_strdup_vprintf(fmt, va);
va_end(va);
storage->last_error_is_internal = TRUE;
- e_error(storage->user->event, "%s", storage->last_internal_error);
+ e_error(storage->event, "%s", storage->last_internal_error);
/* free the old_error and old_internal_error only after the new error
is generated, because they may be one of the parameters. */
if (mailbox_create_missing_dir(box, MAILBOX_LIST_PATH_TYPE_INDEX_PRIVATE) < 0)
return -1;
- box->index_pvt = mail_index_alloc_cache_get(box->storage->user->event,
+ box->index_pvt = mail_index_alloc_cache_get(box->storage->event,
NULL, index_dir, t_strconcat(box->index_prefix, ".pvt", NULL));
mail_index_set_fsync_mode(box->index_pvt,
box->storage->set->parsed_fsync_mode, 0);
i_zero(storage_r);
storage_r->user = t_new(struct mail_user, 1);
storage_r->user->event = event_create(NULL);
+ storage_r->event = event_create(storage_r->user->event);
}
static void test_deinit_storage(struct mail_storage *storage)
i_assert(array_count(&storage->error_stack) == 0);
array_free(&storage->error_stack);
}
+ event_unref(&storage->event);
event_unref(&storage->user->event);
}