mail-index-view.c revision 03739a8eaad2d8b34b9d87dbbe5b13c5d5dfa11a
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (C) 2003-2004 Timo Sirainen */
9511a40d933181045343110c8101b75887062aaeTimo Sirainenvoid mail_index_view_clone(struct mail_index_view *dest,
4aa7fe81503a20bc972ae625da4dd9e6996fbdbfTimo Sirainen dest->log_view = mail_transaction_log_view_open(src->index->log);
dd62b77c932d1b518f2a3e4bf80e36542becc256Timo Sirainenvoid mail_index_view_ref(struct mail_index_view *view)
3f8303bae0f70df6db9337ad1d1476d290f9b1a3Timo Sirainenstatic void _view_close(struct mail_index_view *view)
859cc94211b759825db5e15b0c88754da902ca14Timo Sirainen mail_transaction_log_view_close(&view->log_view);
8887a9bb6d2e3f664cf741b763643a0e5610fa4dTimo Sirainenint mail_index_view_lock_head(struct mail_index_view *view, bool update_index)
8887a9bb6d2e3f664cf741b763643a0e5610fa4dTimo Sirainen unsigned int lock_id;
8887a9bb6d2e3f664cf741b763643a0e5610fa4dTimo Sirainen if (MAIL_INDEX_MAP_IS_IN_MEMORY(view->index->map))
8887a9bb6d2e3f664cf741b763643a0e5610fa4dTimo Sirainen if (!mail_index_is_locked(view->index, view->lock_id)) {
8887a9bb6d2e3f664cf741b763643a0e5610fa4dTimo Sirainen if (mail_index_lock_shared(view->index, update_index,
8887a9bb6d2e3f664cf741b763643a0e5610fa4dTimo Sirainen if (mail_index_map(view->index, FALSE) <= 0) {
dd62b77c932d1b518f2a3e4bf80e36542becc256Timo Sirainen /* index was rebuilt */
dd62b77c932d1b518f2a3e4bf80e36542becc256Timo Sirainen if (mail_index_lock_shared(view->index, TRUE, &lock_id) < 0)
dd62b77c932d1b518f2a3e4bf80e36542becc256Timo Sirainen mail_index_unlock(view->index, view->lock_id);
01f4ee4a0243f3fe9af763e1a540cd5cff0d63f5Timo Sirainenint mail_index_view_lock(struct mail_index_view *view)
4b9f99761df5014c659cd87fddaf6854af428cfcTimo Sirainen /* not head mapping, no need to lock */
4b9f99761df5014c659cd87fddaf6854af428cfcTimo Sirainen return mail_index_view_lock_head(view, FALSE);
4b9f99761df5014c659cd87fddaf6854af428cfcTimo Sirainenvoid mail_index_view_unlock(struct mail_index_view *view)
4b9f99761df5014c659cd87fddaf6854af428cfcTimo Sirainen mail_index_unlock(view->index, view->lock_id);
4b9f99761df5014c659cd87fddaf6854af428cfcTimo Sirainenbool mail_index_view_is_inconsistent(struct mail_index_view *view)
dd62b77c932d1b518f2a3e4bf80e36542becc256Timo Sirainenstruct mail_index *mail_index_view_get_index(struct mail_index_view *view)
a94936bafd127680184da114c6a177b37ff656e5Timo Sirainenvoid mail_index_view_transaction_ref(struct mail_index_view *view)
411d6baa37f31d90730e90c4a28c43e1974bbe58Timo Sirainenvoid mail_index_view_transaction_unref(struct mail_index_view *view)
bdcb00145ad87765e3fd22d4ebc4d2c029a326b9Timo Sirainenstatic void mail_index_view_ref_map(struct mail_index_view *view,
bdcb00145ad87765e3fd22d4ebc4d2c029a326b9Timo Sirainen unsigned int i, count;
for (i = 0; i < count; i++) {
unsigned int i, count;
for (i = 0; i < count; i++)
static const struct mail_index_header *
if (seq == 0) {
seq--;
} while (seq > 0);
int nearest_side)
if (nearest_side > 0) {
*first_seq_r = 0;
*last_seq_r = 0;
left_idx = 0;
if (*first_seq_r == 0 ||
*first_seq_r = 0;
*last_seq_r = 0;
#define LOW_UPDATE(x) \
*seq_r = 0;
if (seq == 0)
const void **data_r)
int ret;
return ret;
return ret;
*data_size_r = 0;
const struct mail_index_header *
const void *data;
const unsigned char *keyword_data;
const unsigned int *keyword_idx_map;
int ret;
if (ret < 0)
return ret;
keyword_count = 0;
if (keyword_data[i] == 0)
map) < 0)
return ret;
return ret;
const void **data_r)
*hdr_size_r = 0;
*record_size_r = 0;
*record_align_r = 0;
return view;
const struct mail_index_ext *