mail-transaction-log-file.c revision 95a1a5195d56f3cf5d1e529aad668f87ad3b979b
45312f52ff3a3d4c137447be4c7556500c2f8bf2Timo Sirainen/* Copyright (c) 2003-2008 Dovecot authors, see the included COPYING file */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen#define MEMORY_LOG_NAME "(in-memory transaction log file)"
bbce20cb4e5739e9a06058cf8ee1f38a7f6884f6Timo Sirainenmail_transaction_log_file_set_corrupted(struct mail_transaction_log_file *file,
213b139965e8bde6c8aff02ffd9fd39a74c887a9Timo Sirainen const char *fmt, ...)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if (!MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* indexid=0 marks the log file as corrupted */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen "Corrupted transaction log file %s: %s",
bbce20cb4e5739e9a06058cf8ee1f38a7f6884f6Timo Sirainenmail_transaction_log_file_alloc(struct mail_transaction_log *log,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen file = i_new(struct mail_transaction_log_file, 1);
bbce20cb4e5739e9a06058cf8ee1f38a7f6884f6Timo Sirainenvoid mail_transaction_log_file_free(struct mail_transaction_log_file **_file)
bbce20cb4e5739e9a06058cf8ee1f38a7f6884f6Timo Sirainen struct mail_transaction_log_file *file = *_file;
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen for (p = &file->log->files; *p != NULL; p = &(*p)->next) {
bbce20cb4e5739e9a06058cf8ee1f38a7f6884f6Timo Sirainen if (munmap(file->mmap_base, file->mmap_size) < 0) {
bbce20cb4e5739e9a06058cf8ee1f38a7f6884f6Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
93b29720c5141f787bd1861796867e4595c9d084Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenmail_transaction_log_file_add_to_list(struct mail_transaction_log_file *file)
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen const struct mail_index_modseq_header *modseq_hdr;
a050ca9def13949dbaa67bd6574a41c4f397ae26Timo Sirainen if (map != NULL && file->hdr.file_seq == map->hdr.log_file_seq &&
a050ca9def13949dbaa67bd6574a41c4f397ae26Timo Sirainen /* we can get a valid log offset from index file. initialize
93b29720c5141f787bd1861796867e4595c9d084Timo Sirainen sync_offset from it so we don't have to read the whole log
a050ca9def13949dbaa67bd6574a41c4f397ae26Timo Sirainen file from beginning. */
93b29720c5141f787bd1861796867e4595c9d084Timo Sirainen uoff_t head_offset = map->hdr.log_file_head_offset;
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen modseq_hdr = mail_index_map_get_modseq_header(map);
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen "%s: log_file_head_offset too small",
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen file->sync_highest_modseq = file->hdr.initial_modseq;
0d658231054332c3f4c04aab0422af649de89a8cTimo Sirainen /* highest_modseq not synced, start from beginning */
0d658231054332c3f4c04aab0422af649de89a8cTimo Sirainen file->sync_highest_modseq = file->hdr.initial_modseq;
0d658231054332c3f4c04aab0422af649de89a8cTimo Sirainen file->sync_highest_modseq = modseq_hdr->highest_modseq;
45e62043058738e294f89504c319d852e25943ccTimo Sirainen file->saved_tail_offset = map->hdr.log_file_tail_offset;
f2786c07cbd4a7a0a6a46c3e06dc4545aaf2f278Timo Sirainen file->sync_highest_modseq = file->hdr.initial_modseq;
9df8c9225140d9d1df5ddf4c6c9da61662ae6c44Timo Sirainen /* insert it to correct position */
9df8c9225140d9d1df5ddf4c6c9da61662ae6c44Timo Sirainen for (p = &log->files; *p != NULL; p = &(*p)->next) {
9df8c9225140d9d1df5ddf4c6c9da61662ae6c44Timo Sirainen i_assert((*p)->hdr.file_seq < file->hdr.file_seq);
95a284736b8b11319a3f575ba249ba2eb7dbac1bTimo Sirainenmail_transaction_log_init_hdr(struct mail_transaction_log *log,
a4d209d480d453566d331e870b8d0c99af7716c8Timo Sirainen hdr->major_version = MAIL_TRANSACTION_LOG_MAJOR_VERSION;
a4d209d480d453566d331e870b8d0c99af7716c8Timo Sirainen hdr->minor_version = MAIL_TRANSACTION_LOG_MINOR_VERSION;
a4d209d480d453566d331e870b8d0c99af7716c8Timo Sirainen hdr->hdr_size = sizeof(struct mail_transaction_log_header);
a4d209d480d453566d331e870b8d0c99af7716c8Timo Sirainen /* not creating index - make sure we have latest header */
f537e7efaec891d6b3320ca94331d09ca8c4a4dbTimo Sirainen /* if we got here from mapping, the .log file is
f537e7efaec891d6b3320ca94331d09ca8c4a4dbTimo Sirainen corrupted. use whatever values we got from index
fc7b17677ac1a5fa3f7fe13d5ef7dcfea8d9b4a1Timo Sirainen hdr->prev_file_seq = index->map->hdr.log_file_seq;
fc7b17677ac1a5fa3f7fe13d5ef7dcfea8d9b4a1Timo Sirainen hdr->prev_file_offset = index->map->hdr.log_file_head_offset;
fc7b17677ac1a5fa3f7fe13d5ef7dcfea8d9b4a1Timo Sirainen hdr->file_seq = index->map->hdr.log_file_seq + 1;
fc7b17677ac1a5fa3f7fe13d5ef7dcfea8d9b4a1Timo Sirainen mail_index_map_modseq_get_highest(index->map);
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen if (log->head != NULL && hdr->file_seq <= log->head->hdr.file_seq) {
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen /* make sure the sequence grows */
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainenmail_transaction_log_file_alloc_in_memory(struct mail_transaction_log *log)
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen file = mail_transaction_log_file_alloc(log, MEMORY_LOG_NAME);
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen if (mail_transaction_log_init_hdr(log, &file->hdr) < 0) {
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen file->buffer = buffer_create_dynamic(default_pool, 4096);
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainenmail_transaction_log_file_dotlock(struct mail_transaction_log_file *file)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ret = file_dotlock_create(&file->log->dotlock_settings,
c21c33a8c98972c45349066fc76ac9e2c05013c1Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
1cf72a848805fcf014b01c9d3665b6a157846a21Timo Sirainen "file_dotlock_create()");
1cf72a848805fcf014b01c9d3665b6a157846a21Timo Sirainen "Timeout while waiting for "
1cf72a848805fcf014b01c9d3665b6a157846a21Timo Sirainen "dotlock for transaction log file %s",
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainenmail_transaction_log_file_undotlock(struct mail_transaction_log_file *file)
1cf72a848805fcf014b01c9d3665b6a157846a21Timo Sirainen ret = file_dotlock_delete(&file->log->dotlock);
1cf72a848805fcf014b01c9d3665b6a157846a21Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen "Dotlock was lost for transaction log file %s",
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainenint mail_transaction_log_file_lock(struct mail_transaction_log_file *file)
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if (file->log->index->lock_method == FILE_LOCK_METHOD_DOTLOCK)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen return mail_transaction_log_file_dotlock(file);
527ed64bc924b4a13b570a8450f8be3efdf71879Timo Sirainen ret = mail_index_lock_fd(file->log->index, file->filepath, file->fd,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen "mail_index_wait_lock_fd()");
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen "Timeout while waiting for lock for transaction log file %s",
c680a6b35b459045e92814778908da5a93922107Timo Sirainenvoid mail_transaction_log_file_unlock(struct mail_transaction_log_file *file)
c680a6b35b459045e92814778908da5a93922107Timo Sirainen if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file))
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen if (file->log->index->lock_method == FILE_LOCK_METHOD_DOTLOCK) {
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainenmail_transaction_log_file_read_hdr(struct mail_transaction_log_file *file,
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen i_assert(!MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file));
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ret = pread_full(file->fd, &file->hdr, sizeof(file->hdr), 0);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen "pread_full()");
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen "unexpected end of file while reading header");
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen if (file->hdr.major_version != MAIL_TRANSACTION_LOG_MAJOR_VERSION) {
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* incompatible version - fix silently */
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen if (file->hdr.hdr_size < MAIL_TRANSACTION_LOG_HEADER_MIN_SIZE) {
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen "Header size too small");
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* @UNSAFE: smaller than we expected - zero out the fields we
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen shouldn't have filled */
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen memset(PTR_OFFSET(&file->hdr, file->hdr.hdr_size), 0,
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* corrupted */
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen "Transaction log file %s: marked corrupted",
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen if (file->hdr.indexid != file->log->index->indexid) {
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* index file was probably just rebuilt and we don't
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen know about it yet */
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen "indexid changed %u -> %u",
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen file->log->index->indexid, file->hdr.indexid);
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* creating index file. since transaction log is created
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen first, use the indexid in it to create the main index
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen to avoid races. */
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen file->log->index->indexid = file->hdr.indexid;
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* make sure we already don't have a file with the same sequence
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen opened. it shouldn't happen unless the old log file was
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen corrupted. */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen for (f = file->log->files; f != NULL; f = f->next) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* mark the old file corrupted. we can't safely remove
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen it from the list however, so return failure. */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen "duplicate transaction log sequence (%u)",
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen file->sync_highest_modseq = file->hdr.initial_modseq;
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainenmail_transaction_log_file_stat(struct mail_transaction_log_file *file,
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen mail_index_file_set_syscall_error(file->log->index,
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainenmail_transaction_log_file_is_dupe(struct mail_transaction_log_file *file)
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen for (tmp = file->log->files; tmp != NULL; tmp = tmp->next) {
a5b331e18b220fac557480b569b85215a1b3bd8eTimo Sirainenmail_transaction_log_file_create2(struct mail_transaction_log_file *file,
a5b331e18b220fac557480b569b85215a1b3bd8eTimo Sirainen /* although we check also mtime and file size below, it's done
a5b331e18b220fac557480b569b85215a1b3bd8eTimo Sirainen only to fix broken log files. we don't bother flushing
a5b331e18b220fac557480b569b85215a1b3bd8eTimo Sirainen attribute cache just for that. */
075912b4566a79c7bc59bf229c9f629ef7be0ea2Timo Sirainen /* log creation is locked now - see if someone already created it.
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen note that if we're rotating, we need to keep the log locked until
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen the file has been rewritten. and because fcntl() locks are stupid,
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen if we go and open()+close() the file and we had it already opened,
b5ac20e30146562322ceb7939f044d52d1e51184Timo Sirainen its locks are lost. so we use stat() to check if the file has been
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen recreated, although it almost never is. */
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen else if (nfs_safe_stat(file->filepath, &st) < 0) {
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen mail_index_file_set_syscall_error(index, file->filepath,
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen /* inode/dev checks are enough when we're rotating the file,
a5b331e18b220fac557480b569b85215a1b3bd8eTimo Sirainen but not when we're replacing a broken log file */
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen /* no-one else recreated the file */
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen /* recreated. use the file if its header is ok */
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen mail_transaction_log_file_stat(file, FALSE) == 0) {
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen /* yes, it was ok */
a5b331e18b220fac557480b569b85215a1b3bd8eTimo Sirainen if (mail_transaction_log_init_hdr(file->log, &file->hdr) < 0)
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen if (write_full(new_fd, &file->hdr, sizeof(file->hdr)) < 0) {
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen mail_index_file_set_syscall_error(index, file->filepath,
b5ac20e30146562322ceb7939f044d52d1e51184Timo Sirainen "write_full()");
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen /* the header isn't important, so don't bother calling
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen fdatasync() unless NFS is used */
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen mail_index_file_set_syscall_error(index, file->filepath,
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen "fdatasync()");
c91de2744f8c1e61e91082ff5e214450f28a0e7cTimo Sirainen ret = mail_transaction_log_file_stat(file, FALSE);
a8012fea2a7315033bc467acbf46be8e7323318cTimo Sirainen if (file->log->head != NULL && file->log->head->locked) {
a8012fea2a7315033bc467acbf46be8e7323318cTimo Sirainen /* we'll need to preserve the lock */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* if we return -1 the dotlock deletion code closes the fd */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* keep two log files */
f2786c07cbd4a7a0a6a46c3e06dc4545aaf2f278Timo Sirainen /* rename() would be nice and easy way to do this, except then
f2786c07cbd4a7a0a6a46c3e06dc4545aaf2f278Timo Sirainen there's a race condition between the rename and
fadd878cd6098f5b873c21c121209a922679dae4Timo Sirainen file_dotlock_replace(). during that time the log file
fadd878cd6098f5b873c21c121209a922679dae4Timo Sirainen doesn't exist, which could cause problems. */
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen path2 = t_strconcat(file->filepath, ".2", NULL);
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen mail_index_set_error(index, "unlink(%s) failed: %m",
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* try to link() anyway */
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen if (nfs_safe_link(file->filepath, path2, FALSE) < 0 &&
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen mail_index_set_error(index, "link(%s, %s) failed: %m",
c9c24293550541307f1bb41bba4a0fdfe2fa59e0Timo Sirainen /* ignore the error. we don't care that much about the
f2786c07cbd4a7a0a6a46c3e06dc4545aaf2f278Timo Sirainen second log file and we're going to overwrite this
f2786c07cbd4a7a0a6a46c3e06dc4545aaf2f278Timo Sirainen first one. */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* success */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenint mail_transaction_log_file_create(struct mail_transaction_log_file *file,
1225a5a7ce39f1d5545d5ed3b84ecd4f72438d36Timo Sirainen /* With dotlocking we might already have path.lock created, so this
b5ac20e30146562322ceb7939f044d52d1e51184Timo Sirainen filename has to be different. */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen fd = file_dotlock_open(&file->log->new_dotlock_settings,
1225a5a7ce39f1d5545d5ed3b84ecd4f72438d36Timo Sirainen mail_index_file_set_syscall_error(index, file->filepath,
b5ac20e30146562322ceb7939f044d52d1e51184Timo Sirainen "file_dotlock_open()");
19e8adccba16ff419f5675b1575358c2956dce83Timo Sirainen mail_index_file_set_syscall_error(index, file->filepath,
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen /* either fd gets used or the dotlock gets deleted and returned fd
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen is for the existing file */
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen if (mail_transaction_log_file_create2(file, fd, reset, &dotlock) < 0) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenint mail_transaction_log_file_open(struct mail_transaction_log_file *file,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen unsigned int i;
5f78b33aa505b17e23cdf27b071a24e127b3db54Timo Sirainen for (i = 0;; i++) {
5f78b33aa505b17e23cdf27b071a24e127b3db54Timo Sirainen file->fd = nfs_safe_open(file->filepath, O_RDWR);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen mail_index_file_set_syscall_error(file->log->index,
5f78b33aa505b17e23cdf27b071a24e127b3db54Timo Sirainen ignore_estale = i < MAIL_INDEX_ESTALE_RETRY_COUNT;
5f78b33aa505b17e23cdf27b071a24e127b3db54Timo Sirainen if (mail_transaction_log_file_stat(file, ignore_estale) < 0)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ret = mail_transaction_log_file_read_hdr(file,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* success */
ccffbed92cb02c24fd717808a84138240bf1885bTimo Sirainen /* corrupted */
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen if (unlink(file->filepath) < 0 && errno != ENOENT) {
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen "unlink(%s) failed: %m",
ccffbed92cb02c24fd717808a84138240bf1885bTimo Sirainen /* syscall error */
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen /* ESTALE - try again */
const unsigned int offset_pos =
sizeof(sync_offset));
case MAIL_TRANSACTION_APPEND:
return TRUE;
return FALSE;
static struct modseq_cache *
if (idx > 0) {
static struct modseq_cache *
return NULL;
best = i;
return NULL;
static struct modseq_cache *
return NULL;
best = i;
return NULL;
int ret;
if (ret <= 0) {
if (ret < 0)
cur_modseq++;
int ret;
if (ret <= 0) {
if (ret < 0)
unsigned int trans_size)
int ret;
sizeof(*hdr));
if (ret != 0)
const void *data;
if (trans_size == 0) {
trans_size = 0;
if (trans_size != 0) {
void *data;
if (ret > 0) {
if (ret == 0) {
void *data;
if (ret > 0)
if (ret < 0) {
return TRUE;
return TRUE;
return FALSE;
int ret;
if (ret <= 0)
return ret;
return ret;
MADV_SEQUENTIAL) < 0) {
int ret;
if (ret > 0)
FALSE);
} while (ret == 0);
int ret;
end_offset) == 0)
*file)