Example #1
0
int mdbox_storage_create(struct mail_storage *_storage,
                         struct mail_namespace *ns, const char **error_r)
{
    struct mdbox_storage *storage = (struct mdbox_storage *)_storage;
    const char *dir;

    storage->set = mail_storage_get_driver_settings(_storage);
    storage->preallocate_space = storage->set->mdbox_preallocate_space;

    if (*ns->list->set.mailbox_dir_name == '\0') {
        *error_r = "mdbox: MAILBOXDIR must not be empty";
        return -1;
    }

    _storage->unique_root_dir =
        p_strdup(_storage->pool, ns->list->set.root_dir);

    dir = mailbox_list_get_root_forced(ns->list, MAILBOX_LIST_PATH_TYPE_DIR);
    storage->storage_dir = p_strconcat(_storage->pool, dir,
                                       "/"MDBOX_GLOBAL_DIR_NAME, NULL);
    storage->alt_storage_dir = p_strconcat(_storage->pool,
                                           ns->list->set.alt_dir,
                                           "/"MDBOX_GLOBAL_DIR_NAME, NULL);
    i_array_init(&storage->open_files, 64);

    storage->map = mdbox_map_init(storage, ns->list);
    return dbox_storage_create(_storage, ns, error_r);
}
Example #2
0
static int sdbox_storage_create(struct mail_storage *_storage,
				struct mail_namespace *ns,
				const char **error_r)
{
	struct dbox_storage *storage = 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;
}