mail-index.c revision e9128d6cb8a6ffef71e8cbb049a97c0e986f4279
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (C) 2003-2004 Timo Sirainen */
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenstatic int mail_index_try_open_only(struct mail_index *index);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenstatic void mail_index_create_in_memory(struct mail_index *index,
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainenstruct mail_index *mail_index_alloc(const char *dir, const char *prefix)
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen pool_alloconly_create(MEMPOOL_GROWING"index extension", 1024);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen p_array_init(&index->extensions, index->extension_pool, 5);
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainen array_create(&index->mail_index_module_contexts, default_pool,
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen sizeof(void *), I_MIN(5, mail_index_module_id));
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen mail_index_ext_register(index, "keywords", 128, 2, 1);
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen index->keywords_pool = pool_alloconly_create("keywords", 512);
563273bdac80393af63b9520cbf4d24cc0efd028Timo Sirainen hash_create(default_pool, index->keywords_pool, 0,
563273bdac80393af63b9520cbf4d24cc0efd028Timo Sirainen strcase_hash, (hash_cmp_callback_t *)strcasecmp);
e5fd6dfd0a492e4708d4dbb7971d7fc5d7b8fd85Timo Sirainenvoid mail_index_free(struct mail_index **_index)
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen array_free(&index->mail_index_module_contexts);
563273bdac80393af63b9520cbf4d24cc0efd028Timo Sirainenvoid mail_index_set_permissions(struct mail_index *index,
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainenuint32_t mail_index_ext_register(struct mail_index *index, const char *name,
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen const struct mail_index_registered_ext *extensions;
8d630c15a8ed6f85553467c3a231a273defca5f6Timo Sirainen unsigned int i, ext_count;
ee116df08d0fdab703483e18fe8076b2ef9fd9d7Timo Sirainen extensions = array_get(&index->extensions, &ext_count);
c5ab90cfad9cc3e33bcb1baeb30ffc82a7b7053aTimo Sirainen /* see if it's already there */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen for (i = 0; i < ext_count; i++) {
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen rext.name = p_strdup(index->extension_pool, name);
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainenvoid mail_index_register_expunge_handler(struct mail_index *index,
2649b237dd4690575e75a30b2bf3b39ebd37b835Timo Sirainen rext = array_idx_modifiable(&index->extensions, ext_id);
2649b237dd4690575e75a30b2bf3b39ebd37b835Timo Sirainen i_assert(rext->expunge_handler == NULL || rext->expunge_handler == cb);
51327f2489a4e0e615eb9f7d921473cf8512bb79Timo Sirainen rext->expunge_handler_call_always = call_always;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_index_unregister_expunge_handler(struct mail_index *index,
d3442384ca53d4b18a493db7dd0b000f470419cfTimo Sirainen rext = array_idx_modifiable(&index->extensions, ext_id);
d756ebcfa96bd7cff02097c8f26df9df368b81b1Timo Sirainenvoid mail_index_register_sync_handler(struct mail_index *index, uint32_t ext_id,
2584e86cc2d8c31ba30a4109cf4ba09d1e37e28aTimo Sirainen rext = array_idx_modifiable(&index->extensions, ext_id);
d756ebcfa96bd7cff02097c8f26df9df368b81b1Timo Sirainen i_assert(rext->sync_handler.callback == NULL);
5137d2d80255938a0f5fb8f3c1a21b34cf11ada3Timo Sirainenvoid mail_index_unregister_sync_handler(struct mail_index *index,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen rext = array_idx_modifiable(&index->extensions, ext_id);
b2c1349cf07410aefab0f5b17153af9e5cfcf48fTimo Sirainen i_assert(rext->sync_handler.callback != NULL);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenvoid mail_index_register_sync_lost_handler(struct mail_index *index,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen array_append(&index->sync_lost_handlers, &cb, 1);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenvoid mail_index_unregister_sync_lost_handler(struct mail_index *index,
eef4ba0cc3e78f8c26804c1c9251a76580a41f0cTimo Sirainen mail_index_sync_lost_handler_t *const *handlers;
eef4ba0cc3e78f8c26804c1c9251a76580a41f0cTimo Sirainen unsigned int i, count;
f3bb2fbe87425dc89a839908985af496f7f65702Timo Sirainen handlers = array_get(&index->sync_lost_handlers, &count);
eef4ba0cc3e78f8c26804c1c9251a76580a41f0cTimo Sirainen for (i = 0; i < count; i++) {
bd1b2615928a1e8be190cb0405754f0aec8cac2fTimo Sirainen array_delete(&index->sync_lost_handlers, i, 1);
2ebeb22b9a8a8bb7fbe2f2e2908478a220792b87Timo Sirainenstatic void mail_index_map_init_extbufs(struct mail_index_map *map,
1460ef7a18c53216ddb4a94bb62fba96076aae8eTimo Sirainen ((sizeof(map->extensions) + BUFFER_APPROX_SIZE) * 2)
1460ef7a18c53216ddb4a94bb62fba96076aae8eTimo Sirainen sizeof(struct mail_index_ext) + sizeof(uint32_t))
1d2b188f0eedc3cab6e27ceac5425a037f38042eTimo Sirainen /* try to use the existing pool's size for initial_count so
df00412606a00714a6e85383fa87fbdc7cc1fb5bTimo Sirainen we don't grow it unneededly */
df00412606a00714a6e85383fa87fbdc7cc1fb5bTimo Sirainen size = p_get_max_easy_alloc_size(map->extension_pool);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen if (size > EXT_GLOBAL_ALLOC_SIZE + EXT_PER_ALLOC_SIZE) {
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen initial_count = (size - EXT_GLOBAL_ALLOC_SIZE) /
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen p_array_init(&map->extensions, map->extension_pool, initial_count);
ca98892a6b8a30ffc1fe26fcf02c7d59e3204e7eTimo Sirainen p_array_init(&map->ext_id_map, map->extension_pool, initial_count);
ca98d6a1bbe73499da758a36bfab2963375c8d06Timo Sirainenuint32_t mail_index_map_lookup_ext(struct mail_index_map *map, const char *name)
ca98892a6b8a30ffc1fe26fcf02c7d59e3204e7eTimo Sirainen unsigned int i, size;
ca98d6a1bbe73499da758a36bfab2963375c8d06Timo Sirainen extensions = array_get(&map->extensions, &size);
bd4e36a8cd7257cca7d1434c49a1e343ed7c5100Timo Sirainen for (i = 0; i < size; i++) {
a2f250a332dfc1e6cd4ffd196c621eb9dbf7b8a1Timo Sirainenmail_index_map_register_ext(struct mail_index *index,
5fb3bff645380804c9db2510940c41db6b8fdb01Timo Sirainen i_assert(mail_index_map_lookup_ext(map, name) == (uint32_t)-1);
5fb3bff645380804c9db2510940c41db6b8fdb01Timo Sirainen ext->name = p_strdup(map->extension_pool, name);
6b0d8106ae51ffc6ce45636b34d2e21cbefca7fdTimo Sirainen ext->index_idx = mail_index_ext_register(index, name, hdr_size,
eb64c3586d854cddd693f0b811d897399076a441Timo Sirainen /* Update index ext_id -> map ext_id mapping. Fill non-used
eb64c3586d854cddd693f0b811d897399076a441Timo Sirainen ext_ids with (uint32_t)-1 */
7f735cb86b2d8abd8f230089065eacfc24e9e5d6Timo Sirainen while (array_count(&map->ext_id_map) < ext->index_idx)
7f735cb86b2d8abd8f230089065eacfc24e9e5d6Timo Sirainen array_append(&map->ext_id_map, &empty_idx, 1);
7f735cb86b2d8abd8f230089065eacfc24e9e5d6Timo Sirainen array_idx_set(&map->ext_id_map, ext->index_idx, &idx);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenstatic bool size_check(size_t *size_left, size_t size)
ecd69c4e8371853667e01b0c16d436ef7f7393e2Timo Sirainen size_t size = sizeof(struct mail_index_ext_header) + name_len;
ecd69c4e8371853667e01b0c16d436ef7f7393e2Timo Sirainen return MAIL_INDEX_HEADER_SIZE_ALIGN(size) - size;
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenstatic int mail_index_parse_extensions(struct mail_index *index,
a2f250a332dfc1e6cd4ffd196c621eb9dbf7b8a1Timo Sirainen unsigned int i, old_count;
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen /* extension headers always start from 64bit offsets, so if base header
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen doesn't happen to be 64bit aligned we'll skip some bytes */
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen offset = MAIL_INDEX_HEADER_SIZE_ALIGN(map->hdr.base_header_size);
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen if (offset >= map->hdr.header_size && map->extension_pool == NULL) {
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen /* nothing to do, skip allocatations and all */
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen mail_index_map_init_extbufs(map, old_count + 5);
6df0ab0c1ab91f06b6418cb30eff44405a1b8f02Timo Sirainen for (i = 0; i < old_count; i++)
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen ext_hdr = CONST_PTR_OFFSET(map->hdr_base, offset);
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen /* Extension header contains:
9af6cc9ebc9986c1275ebdfa29c39e152af1557eTimo Sirainen - struct mail_index_ext_header
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen - name (not 0-terminated)
73b50eecfc31750a312e2f940023f522eb07178cTimo Sirainen - 64bit alignment padding
73b50eecfc31750a312e2f940023f522eb07178cTimo Sirainen - extension header contents
73b50eecfc31750a312e2f940023f522eb07178cTimo Sirainen - 64bit alignment padding
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen if (!size_check(&size_left, sizeof(*ext_hdr)) ||
73b50eecfc31750a312e2f940023f522eb07178cTimo Sirainen !size_check(&size_left, ext_hdr->name_size) ||
838e367716bbd5e44b4a1691db9cbf72af53e9f0Timo Sirainen !size_check(&size_left, get_align(ext_hdr->name_size)) ||
6564208826b0f46a00f010d1b5711d85944c3c88Timo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen "Header extension goes outside header",
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen offset += ext_hdr->name_size + get_align(ext_hdr->name_size);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen name = t_strndup(CONST_PTR_OFFSET(map->hdr_base, name_offset),
310767ca33e7636d40ec45dee68a2c319a5fa3c0Timo Sirainen if (mail_index_map_lookup_ext(map, name) != (uint32_t)-1) {
310767ca33e7636d40ec45dee68a2c319a5fa3c0Timo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen "Duplicate header extension %s",
defb12ecd360df672ffb2f4dbf4d1218a0a9549cTimo Sirainen ext_hdr->record_offset + ext_hdr->record_size) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen "Record field %s points outside record size "
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen ext_hdr->record_offset, ext_hdr->record_size);
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen if ((ext_hdr->record_offset % ext_hdr->record_align) != 0 ||
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen (map->hdr.record_size % ext_hdr->record_align) != 0) {
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen "Record field %s alignmentation %u not used",
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen index->filepath, name, ext_hdr->record_align);
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainen offset += MAIL_INDEX_HEADER_SIZE_ALIGN(ext_hdr->hdr_size);
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainenbool mail_index_keyword_lookup(struct mail_index *index,
c04f9a724a7b3cc649485a61b0a540868d25d71bTimo Sirainen unsigned int *idx_r)
eb0816090cf5a549280ad783b9aa6fec199d36baTimo Sirainen /* keywords_hash keeps a name => index mapping of keywords.
1eaaa2c9003cf3fbf672d597473e3f84e70d2ee6Timo Sirainen Keywords are never removed from it, so the index values are valid
1eaaa2c9003cf3fbf672d597473e3f84e70d2ee6Timo Sirainen for the lifetime of the mail_index. */
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen if (hash_lookup_full(index->keywords_hash, keyword, NULL, &value)) {
1eaaa2c9003cf3fbf672d597473e3f84e70d2ee6Timo Sirainen *idx_r = POINTER_CAST_TO(value, unsigned int);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen keyword = keyword_dup = p_strdup(index->keywords_pool, keyword);
e63bdfedcf61e1a9ee21990140cbd0d0638da7e1Timo Sirainen hash_insert(index->keywords_hash, keyword_dup, POINTER_CAST(*idx_r));
3dd0679b6f24be0287cc42d7a60bbf59cdf8b637Timo Sirainenint mail_index_map_parse_keywords(struct mail_index *index,
3dd0679b6f24be0287cc42d7a60bbf59cdf8b637Timo Sirainen const struct mail_index_keyword_header *kw_hdr;
3dd0679b6f24be0287cc42d7a60bbf59cdf8b637Timo Sirainen const struct mail_index_keyword_header_rec *kw_rec;
a3ee5ce6ecc8e228ee69300fdd562d7ac8be89a7Timo Sirainen unsigned int i, name_area_end_offset, old_count;
4321f6c969e7b8f6b243ff5bb6b8d297921676f6Timo Sirainen ext_id = mail_index_map_lookup_ext(map, "keywords");
e3aeeb634245e80d4f643f8d2eea11d6b72336d8Timo Sirainen /* Extension header contains:
ad48319996942463675b53877092ab7e13a7a75aTimo Sirainen - struct mail_index_keyword_header
e3aeeb634245e80d4f643f8d2eea11d6b72336d8Timo Sirainen - struct mail_index_keyword_header_rec * keywords_count
0cce885512b836ce021260a58e7b4f099b36d0f1Timo Sirainen - const char names[] * keywords_count
e3aeeb634245e80d4f643f8d2eea11d6b72336d8Timo Sirainen i_assert(ext->hdr_offset < map->hdr.header_size);
0cce885512b836ce021260a58e7b4f099b36d0f1Timo Sirainen kw_hdr = CONST_PTR_OFFSET(map->hdr_base, ext->hdr_offset);
e050e5c9b1688765f1fdfce9b7141f7b614383fdTimo Sirainen name = (const char *)(kw_rec + kw_hdr->keywords_count);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen old_count = !array_is_created(&map->keyword_idx_map) ? 0 :
b62140c5849297a800fee942026d9c3cb8c60206Timo Sirainen /* Keywords can only be added into same mapping. Removing requires a
b62140c5849297a800fee942026d9c3cb8c60206Timo Sirainen new mapping (recreating the index file) */
4d527c363482be2b65dd0573d878ecda86cbb0bbTimo Sirainen /* nothing changed */
d756ebcfa96bd7cff02097c8f26df9df368b81b1Timo Sirainen /* make sure the header is valid */
64b61cd24d630223478ccbe1934b9f60f0881f59Timo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
d756ebcfa96bd7cff02097c8f26df9df368b81b1Timo Sirainen "Keywords removed unexpectedly",
de58be41126e5d68008d2ea706d62ccdc1f29337Timo Sirainen if ((size_t)(name - (const char *)kw_hdr) > ext->hdr_size) {
a4f09749814b93e8ad3ec8a0dc18885b874d6f8cTimo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
a4f09749814b93e8ad3ec8a0dc18885b874d6f8cTimo Sirainen "keywords_count larger than header size",
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen name_area_end_offset = (const char *)kw_hdr + ext->hdr_size - name;
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen for (i = 0; i < kw_hdr->keywords_count; i++) {
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen if (kw_rec[i].name_offset > name_area_end_offset) {
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen "name_offset points outside allocated header",
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen "Keyword header doesn't end with NUL",
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* create file -> index mapping */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen i_array_init(&map->keyword_idx_map, kw_hdr->keywords_count);
43d32cbe60fdaef2699d99f1ca259053e9350411Timo Sirainen /* Check that existing headers are still the same. It's behind DEBUG
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen since it's pretty useless waste of CPU normally. */
ca98d6a1bbe73499da758a36bfab2963375c8d06Timo Sirainen for (i = 0; i < array_count(&map->keyword_idx_map); i++) {
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen const char *keyword = name + kw_rec[i].name_offset;
61b0637759146621cbb7edcbd0b03a71cfd66dfeTimo Sirainen const unsigned int *old_idx;
61b0637759146621cbb7edcbd0b03a71cfd66dfeTimo Sirainen unsigned int idx;
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainen old_idx = array_idx(&map->keyword_idx_map, i);
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainen if (!mail_index_keyword_lookup(index, keyword, FALSE, &idx) ||
910fa4e4204a73d3d24c03f3059dd24e727ca057Timo Sirainen mail_index_set_error(index, "Corrupted index file %s: "
7631f16156aca373004953fe6b01a7f343fb47e0Timo Sirainen "Keywords changed unexpectedly",
ca98892a6b8a30ffc1fe26fcf02c7d59e3204e7eTimo Sirainen /* Register the newly seen keywords */
3c493c276f599d9b9cd10764876d648003046954Timo Sirainen const char *keyword = name + kw_rec[i].name_offset;
3c493c276f599d9b9cd10764876d648003046954Timo Sirainen unsigned int idx;
3c493c276f599d9b9cd10764876d648003046954Timo Sirainen (void)mail_index_keyword_lookup(index, keyword, TRUE, &idx);
#ifndef WORDS_BIGENDIAN
sizeof(struct mail_index_record));
unsigned int records_count;
int ret;
pos = 0;
if (ret > 0)
return ret;
unsigned int records_count;
pos);
if (ret > 0) {
if (ret < 0) {
if (ret == 0) {
&prev_offset);
bool sync_to_index)
const void *tdata;
int ret;
if (sync_to_index) {
MAIL_TRANSACTION_TYPE_MASK) <= 0) {
&skipped)) > 0) {
ret = 0;
&prev_offset);
return ret;
bool sync_to_index)
unsigned int i, count;
int ret;
bool retry;
if (ret != 0)
return ret;
for (i = 0; i < count; i++)
return ret;
if (ret <= 0) {
if (ret == 0) {
int ret;
if (ret > 0)
int ret;
if (ret != 0) {
return ret;
if (ret > 0) {
if (ret < 0)
ret = 0;
else if (ret == 0) {
if (ret <= 0) {
return ret;
int ret;
if (ret > 0)
return ret;
&pos);
if (ret <= 0) {
if (ret == 0) {
if (ret < 0)
return ret;
struct mail_index_map *
unsigned int i, count;
for (i = 0; i < count; i++) {
return mem_map;
unsigned int lock_id;
int ret;
*lock_id_r = 0;
if (ret <= 0)
return ret;
if (ret == 0) {
*lock_id_r = 0;
return ret;
const char *path;
int fd;
return fd;
const char *path;
int ret;
if (ret != 0) {
/* create it fully in index.tmp first */
if (ret == 0) {
if (ret < 0) {
return ret;
#ifndef WORDS_BIGENDIAN
unsigned int lock_id = 0;
int ret;
if (ret > 0)
else if (ret == 0) {
} else if (ret < 0)
if (ret == 0)
if (lock_id != 0) {
lock_id = 0;
if (lock_id == 0) {
int i = 0, ret;
if (ret <= 0)
if (ret == 0) {
if (ret <= 0)
return ret;
ret = 0;
if (ret > 0)
else if (ret == 0) {
if (ret == 0) {
if (lock_id != 0)
if (ret == 0) {
return ret;
unsigned int lock_id;
int ret;
int ret = 0;
return ret;
const char *function)
const char *filepath,
const char *function)
return MAIL_INDEX_ERROR_DISKSPACE;
return MAIL_INDEX_ERROR_INTERNAL;
return MAIL_INDEX_ERROR_NONE;