/src/dovecot/src/lib-storage/fail-mail-storage.c
Line | Count | Source |
1 | | /* Copyright (c) Dovecot authors, see top-level COPYING file */ |
2 | | |
3 | | #include "lib.h" |
4 | | #include "array.h" |
5 | | #include "mail-storage-private.h" |
6 | | #include "fail-mail-storage.h" |
7 | | |
8 | | static struct mail_storage *fail_storage_alloc(void) |
9 | 0 | { |
10 | 0 | struct mail_storage *storage; |
11 | 0 | pool_t pool; |
12 | |
|
13 | 0 | pool = pool_alloconly_create("fail mail storage", 1024); |
14 | 0 | storage = p_new(pool, struct mail_storage, 1); |
15 | 0 | *storage = fail_storage; |
16 | 0 | storage->pool = pool; |
17 | 0 | return storage; |
18 | 0 | } |
19 | | |
20 | | static void fail_storage_destroy(struct mail_storage *storage ATTR_UNUSED) |
21 | 0 | { |
22 | 0 | } |
23 | | |
24 | | struct mail_storage fail_storage = { |
25 | | .name = "fail", |
26 | | .class_flags = MAIL_STORAGE_CLASS_FLAG_NO_ROOT, |
27 | | |
28 | | .v = { |
29 | | .alloc = fail_storage_alloc, |
30 | | .destroy = fail_storage_destroy, |
31 | | .mailbox_alloc = fail_mailbox_alloc, |
32 | | } |
33 | | }; |
34 | | |
35 | | struct mail_storage *fail_mail_storage_create(void) |
36 | 0 | { |
37 | 0 | struct mail_storage *storage; |
38 | |
|
39 | 0 | storage = fail_storage_alloc(); |
40 | 0 | storage->refcount = 1; |
41 | 0 | storage->storage_class = &fail_storage; |
42 | 0 | p_array_init(&storage->module_contexts, storage->pool, 5); |
43 | 0 | return storage; |
44 | 0 | } |