sdbox-storage.c revision 4c51dc7df5256942f023947489fe085bc1b73951
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen/* Copyright (c) 2007-2010 Dovecot authors, see the included COPYING file */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenextern struct mail_storage dbox_storage, sdbox_storage;
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenextern struct dbox_storage_vfuncs sdbox_dbox_storage_vfuncs;
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenstatic struct mail_storage *sdbox_storage_alloc(void)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen pool = pool_alloconly_create("sdbox storage", 512+256);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen storage = p_new(pool, struct sdbox_storage, 1);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen storage->storage.v = sdbox_dbox_storage_vfuncs;
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainensdbox_storage_create(struct mail_storage *storage ATTR_UNUSED,
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainenstatic struct mailbox *
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainensdbox_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen /* dbox can't work without index files */
e70d5895795732b8247ab9abb045b438e954bc46Timo Sirainen pool = pool_alloconly_create("sdbox mailbox", 1024*3);
e70d5895795732b8247ab9abb045b438e954bc46Timo Sirainen index_storage_mailbox_alloc(&mbox->box, name, flags, DBOX_INDEX_PREFIX);
e70d5895795732b8247ab9abb045b438e954bc46Timo Sirainen ibox->save_commit_pre = sdbox_transaction_save_commit_pre;
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen ibox->save_commit_post = sdbox_transaction_save_commit_post;
33c6d5807b449463e9b81db5ec99fe027cc1b984Timo Sirainen ibox->save_rollback = sdbox_transaction_save_rollback;
8eea67470c1bd8562a62e7445d930bb2079b1a43Timo Sirainen ibox->index_flags |= MAIL_INDEX_OPEN_FLAG_KEEP_BACKUPS |
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen mbox->storage = (struct sdbox_storage *)storage;
b7c2065b3f10f9ae27787a9db5aaefbfc70d4502Timo Sirainen mail_index_ext_register(mbox->box.index, "dbox-hdr",
0469ed17dafcc56589ce00960a23f4f06817dfb5Timo Sirainen sizeof(struct sdbox_index_header), 0, 0);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenint sdbox_read_header(struct sdbox_mailbox *mbox,
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen struct sdbox_index_header *hdr, bool log_error)
97c339398f1aba6f315b55a9b6ee6b020e33bea4Timo Sirainen mail_index_get_header_ext(view, mbox->hdr_ext_id,
0469ed17dafcc56589ce00960a23f4f06817dfb5Timo Sirainen if (data_size < SDBOX_INDEX_HEADER_MIN_SIZE &&
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen "sdbox %s: Invalid dbox header size",
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen memcpy(hdr, data, I_MIN(data_size, sizeof(*hdr)));
int ret;
return ret;
.class_flags = 0,
NULL,
NULL,
NULL,
NULL,
.class_flags = 0,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,