mail-index-view.c revision e49e973f363a56ad186fce372310d5ec6d83d8fa
/* Copyright (c) 2003-2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "buffer.h"
#include "mail-index-view-private.h"
#include "mail-transaction-log.h"
struct mail_index_view *
{
struct mail_index_view *view;
struct mail_index_map *map;
return view;
}
const struct mail_index_view *src)
{
}
}
{
}
{
}
}
{
return view->inconsistent;
}
{
}
unsigned int
{
return view->transactions;
}
{
view->transactions++;
}
{
view->transactions--;
}
struct mail_index_map *map)
{
struct mail_index_map *const *maps;
unsigned int i, count;
/* if map is already referenced, do nothing */
for (i = 0; i < count; i++) {
return;
}
} else {
}
/* reference the given mapping. the reference is dropped when the view
is synchronized or closed. */
}
{
struct mail_index_map **maps;
unsigned int i, count;
return;
for (i = 0; i < count; i++)
mail_index_unmap(&maps[i]);
}
{
}
static const struct mail_index_header *
{
}
static const struct mail_index_record *
{
static struct mail_index_record broken_rec;
struct mail_index_map *map;
/* look up the record */
if (!view->inconsistent) {
"Corrupted Index file %s: Record [%u].uid=0",
}
/* we'll need to return something so the caller doesn't crash */
if (expunged_r != NULL)
*expunged_r = TRUE;
return &broken_rec;
}
/* view's mapping is latest. we can use it directly. */
if (expunged_r != NULL)
*expunged_r = FALSE;
return rec;
}
/* look up the record from head mapping. it may contain some changes.
start looking up from the same sequence as in the old view.
if there are no expunges, it's there. otherwise it's somewhere
before (since records can't be inserted).
usually there are only a few expunges, so just going downwards from
our initial sequence position is probably faster than binary
search. */
if (seq == 0) {
/* everything is expunged from head. use the old record. */
if (expunged_r != NULL)
*expunged_r = TRUE;
return rec;
}
do {
seq--;
break;
} while (seq > 0);
/* found it. use it. reference the index mapping so that the
returned record doesn't get invalidated after next sync. */
if (expunged_r != NULL)
*expunged_r = FALSE;
return head_rec;
} else {
/* expuned from head. use the old record. */
if (expunged_r != NULL)
*expunged_r = TRUE;
return rec;
}
}
{
}
{
}
{
#define LOW_UPDATE(x) \
const struct mail_index_record *rec;
*seq_r = 0;
if (low_uid == 1)
seq = 1;
else {
return;
}
break;
}
}
}
static void
const unsigned char *data,
{
const unsigned int *keyword_idx_map;
unsigned int i, j, keyword_count, index_idx;
/* no keywords at all in index */
return;
}
&hdr_size, &record_size,
&record_align);
/* keyword_idx_map[] contains file => index keyword mapping */
return;
for (i = 0; i < record_size; i++) {
/* first do the quick check to see if there's keywords at all */
if (data[i] == 0)
continue;
if ((data[i] & (1 << j)) == 0)
continue;
if (idx >= keyword_count) {
/* extra bits set in keyword bytes.
shouldn't happen, but just ignore. */
break;
}
}
}
}
{
struct mail_index_map *map;
const void *data;
}
static const void *
{
const struct mail_index_ext *ext;
return NULL;
}
static void
const void **data_r, bool *expunged_r)
{
const struct mail_index_record *rec;
}
{
const struct mail_index_ext *ext;
/* no mapping given, use head mapping */
}
/* extension doesn't exist in this index file */
*data_size_r = 0;
return;
}
}
struct mail_index_map *map,
{
const struct mail_index_ext *ext;
return FALSE;
return TRUE;
}
{
return;
}
{
}
const struct mail_index_header *
{
}
const struct mail_index_record *
{
struct mail_index_map *map;
}
const struct mail_index_record *
struct mail_index_map **map_r)
{
}
{
struct mail_index_map *map;
bool expunged;
return expunged;
}
{
const struct mail_index_ext *ext;
const struct mail_index_record *rec;
const void *data;
else {
}
}
{
}
enum mail_flags *flags_r,
{
const struct mail_index_record *rec;
const unsigned char *keyword_data;
}
{
}
{
return *first_seq_r != 0;
}
{
return *seq_r != 0;
}
{
}
bool *expunged_r)
{
struct mail_index_map *map;
}
const void **data_r, bool *expunged_r)
{
}
{
}
{
}
struct mail_index_map *map,
{
}
{
const struct mail_index_ext *ext;
/* extension doesn't exist in this index file */
*hdr_size_r = 0;
*record_size_r = 0;
*record_align_r = 0;
return;
}
}
static struct mail_index_view_vfuncs view_vfuncs = {
};
struct mail_index_view *
struct mail_index_map *map)
{
struct mail_index_view *view;
view->v = view_vfuncs;
index->view_count++;
return view;
}
{
}
const struct mail_index_ext *
{
return NULL;
}