Lines Matching defs:file
1 /* Copyright (c) 2003-2018 Dovecot authors, see the included COPYING file */
42 struct mail_transaction_log_file *file = ctx->log->head;
46 if (ftruncate(file->fd, file->sync_offset) < 0) {
48 file->filepath,
54 i_assert(MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file));
56 i_assert(file->buffer_offset + file->buffer->used == file->sync_offset);
57 buffer_append_buf(file->buffer, ctx->output, 0, (size_t)-1);
58 file->sync_offset = file->buffer_offset + file->buffer->used;
64 struct mail_transaction_log_file *file = ctx->log->head;
69 if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) {
70 if (file->buffer == NULL) {
71 file->buffer = buffer_create_dynamic(default_pool, 4096);
72 file->buffer_offset = sizeof(file->hdr);
74 buffer_append_buf(file->buffer, ctx->output, 0, (size_t)-1);
75 file->sync_offset = file->buffer_offset + file->buffer->used;
79 if (write_full(file->fd, ctx->output->data, ctx->output->used) < 0) {
82 file->filepath,
88 file->sync_offset + ctx->output->used ==
89 file->max_tail_offset);
92 file->log->index->fsync_mode != FSYNC_MODE_NEVER) ||
93 file->log->index->fsync_mode == FSYNC_MODE_ALWAYS) {
94 if (fdatasync(file->fd) < 0) {
96 file->filepath,
102 if (file->mmap_base == NULL && file->buffer != NULL) {
103 /* we're reading from a file. avoid re-reading the data that
107 i_assert(file->buffer_offset +
108 file->buffer->used == file->sync_offset);
109 buffer_append(file->buffer, ctx->output->data,
112 file->sync_offset += ctx->output->used;
119 struct mail_transaction_log_file *file = ctx->log->head;
138 } else if (file->max_tail_offset == file->sync_offset) {
151 file->max_tail_offset += ctx->output->used +
159 offset = file->max_tail_offset;
161 if (file->saved_tail_offset == offset)
163 i_assert(offset > file->saved_tail_offset);
178 struct mail_transaction_log_file *file = ctx->log->head;
181 if (file->sync_offset < file->last_size) {
185 buffer_set_used_size(file->buffer,
186 file->sync_offset - file->buffer_offset);
187 if (!MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) {
188 if (ftruncate(file->fd, file->sync_offset) < 0) {
190 file->filepath, "ftruncate()");
213 file->sync_highest_modseq = ctx->new_highest_modseq;