ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
ns->set = ns_set;
- if (mail_storage_create(ns, NULL, 0, &error) < 0)
+ if (mail_storage_create(ns, 0, &error) < 0)
i_fatal("Couldn't create internal raw storage: %s", error);
if (mail_namespaces_init_finish(ns, &error) < 0)
i_fatal("Couldn't create internal raw namespace: %s", error);
new_storage_flags = _storage->flags &
ENUM_NEGATE(MAIL_STORAGE_FLAG_SHARED_DYNAMIC);
new_storage_flags |= MAIL_STORAGE_FLAG_NO_AUTOVERIFY;
- if (mail_storage_create(new_ns, NULL, new_storage_flags, &error) < 0) {
+ if (mail_storage_create(new_ns, new_storage_flags, &error) < 0) {
mailbox_list_set_critical(ns->list, "Namespace %s: %s",
new_ns->prefix, error);
/* owner gets freed by namespace deinit */
ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
}
- if (mail_storage_create(ns, NULL, flags, &error) < 0) {
+ if (mail_storage_create(ns, flags, &error) < 0) {
*error_r = t_strdup_printf("Namespace %s: %s",
ns->set->name, error);
mail_namespace_free(ns);
if ((ret = mail_namespace_alloc(user, inbox_set, &ns, error_r)) < 0)
return ret;
- if (mail_storage_create(ns, NULL, 0, error_r) < 0) {
+ if (mail_storage_create(ns, 0, error_r) < 0) {
mail_namespace_free(ns);
return -1;
}
}
static int
-mail_storage_create_full_real(struct mail_namespace *ns, const char *driver,
+mail_storage_create_full_real(struct mail_namespace *ns,
const char *data, enum mail_storage_flags flags,
struct mail_storage **storage_r,
const char **error_r)
struct mailbox_list *list;
struct mailbox_list_settings list_set;
enum mailbox_list_flags list_flags = 0;
- const char *p;
+ const char *p, *driver = NULL;
mailbox_list_settings_init_defaults(&list_set);
if ((flags & MAIL_STORAGE_FLAG_SHARED_DYNAMIC) != 0) {
list_set.root_dir = ns->user->set->base_dir;
driver = MAIL_SHARED_STORAGE_NAME;
} else {
- if (driver == NULL)
- mail_storage_set_autodetection(&data, &driver);
+ mail_storage_set_autodetection(&data, &driver);
if (mailbox_list_settings_parse(ns->user, data, &list_set,
error_r) < 0)
return -1;
return 0;
}
-int mail_storage_create(struct mail_namespace *ns, const char *driver,
+int mail_storage_create(struct mail_namespace *ns,
enum mail_storage_flags flags, const char **error_r)
{
struct mail_storage *storage;
int ret;
T_BEGIN {
- ret = mail_storage_create_full_real(ns, driver,
- ns->set->location, flags,
- &storage, error_r);
+ ret = mail_storage_create_full_real(ns, ns->set->location,
+ flags, &storage, error_r);
} T_END_PASS_STR_IF(ret < 0, error_r);
return ret;
}
/* Find mail storage class by name */
struct mail_storage *mail_storage_find_class(const char *name);
-/* Create a new instance of registered mail storage class with given
- storage-specific data. If driver is NULL, it's tried to be autodetected
- from ns location. If ns location is NULL, it uses the first storage that
- exists. The storage is put into ns->storage. */
-int mail_storage_create(struct mail_namespace *ns, const char *driver,
- enum mail_storage_flags flags, const char **error_r)
- ATTR_NULL(2);
+/* Create a storage for the namespace. */
+int mail_storage_create(struct mail_namespace *ns,
+ enum mail_storage_flags flags, const char **error_r);
void mail_storage_unref(struct mail_storage **storage);
/* Returns the mail storage settings. */