mdbox-storage.c revision a956137aa86d16e5a90b9d4a9e69d3854d824380
/* Copyright (c) 2007-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "mkdir-parents.h"
#include "master-service.h"
#include "mail-index-modseq.h"
#include "mail-index-alloc-cache.h"
#include "mailbox-log.h"
#include "mailbox-list-private.h"
#include "index-pop3-uidl.h"
#include "dbox-mail.h"
#include "dbox-save.h"
#include "mdbox-map.h"
#include "mdbox-file.h"
#include "mdbox-sync.h"
#include "mdbox-storage-rebuild.h"
#include "mdbox-storage.h"
extern struct mail_storage mdbox_storage;
extern struct mailbox mdbox_mailbox;
static struct mail_storage *mdbox_storage_alloc(void)
{
struct mdbox_storage *storage;
}
{
const char *dir;
*error_r = "mdbox: MAILBOXDIR must not be empty";
return -1;
}
}
}
{
}
static const char *
{
if (debug)
return path;
}
if (debug)
}
return NULL;
}
struct mailbox_list_settings *set)
{
else {
if (debug)
i_debug("mdbox: couldn't find root dir");
return FALSE;
}
}
if (debug)
return FALSE;
}
if (debug)
return FALSE;
}
return TRUE;
}
static struct mailbox *
{
struct mdbox_mailbox *mbox;
struct index_mailbox_context *ibox;
/* dbox can't work without index files */
}
{
if (dbox_mailbox_open(box) < 0)
return -1;
sizeof(struct mdbox_mail_index_record),
sizeof(uint32_t));
mbox->hdr_ext_id =
sizeof(struct mdbox_index_header), 0, 0);
mbox->guid_ext_id =
0, GUID_128_SIZE, 1);
return 0;
}
{
(void)mdbox_storage_rebuild(mstorage);
}
{
const void *data;
if (data_size < MDBOX_INDEX_HEADER_MIN_SIZE &&
"mdbox %s: Invalid dbox header size: %"PRIuSIZE_T,
return -1;
}
return 0;
}
struct mail_index_transaction *trans,
const struct mailbox_update *update)
{
bool need_resize;
need_resize = TRUE;
}
sizeof(new_hdr.mailbox_guid));
}
if (need_resize) {
sizeof(new_hdr));
}
}
}
const struct mailbox_update *update,
struct mail_index_transaction *trans)
{
struct mail_index_view *view;
const struct mail_index_header *hdr;
return -1;
}
else if (uid_validity == 0) {
/* set uidvalidity */
}
}
}
}
}
if (box->inbox_user)
if (mail_index_transaction_commit(&new_trans) < 0) {
return -1;
}
}
return 0;
}
const struct mailbox_update *update,
struct mail_index_transaction *trans)
{
int ret;
return ret;
}
{
/* already set it corrupted (possibly recursing back here) */
return;
}
}
}
static const char *
{
return "";
}
{
}
{
}
static int
{
const struct mail_index_header *idx_hdr;
struct mdbox_index_header hdr;
bool need_resize;
int ret = 0;
/* there's a race condition between mkdir and getting the mailbox GUID.
normally this is handled by mdbox syncing, but GUID can be looked up
without syncing. when we detect this situation we'll try to finish
creating the indexes first, which usually means just waiting for
the sync lock to get unlocked by the other process creating them. */
return -1;
}
/* regenerate it */
ret = -1;
}
if (ret == 0)
return ret;
}
static int
enum mailbox_metadata_items items,
struct mailbox_metadata *metadata_r)
{
return -1;
if ((items & MAILBOX_METADATA_GUID) != 0) {
return -1;
}
return 0;
}
static int
{
if (mailbox_open(box) < 0)
return -1;
}
return -1;
}
struct mail_storage mdbox_storage = {
.v = {
NULL,
}
};
struct mailbox mdbox_mailbox = {
.v = {
NULL,
NULL,
}
};
struct dbox_storage_vfuncs mdbox_dbox_storage_vfuncs = {
};