mail-index-private.h revision 51b979b6414b940f04677a7e2d064be119345954
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen/* How large index files to mmap() instead of reading to memory. */
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen/* How many seconds to wait a lock for index file. */
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen/* How many times to retry opening index files if read/fstat returns ESTALE.
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen This happens with NFS when the file has been deleted (ie. index file was
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen rewritten by another computer than us). */
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen#define MAIL_INDEX_ESTALE_RETRY_COUNT NFS_ESTALE_RETRY_COUNT
64e244defe74f513ce94f33d000a048ddbe2ea23Timo Sirainen PTR_OFFSET((map)->records, (idx) * (map)->hdr.record_size))
939451389b8e0ad529277b84fe51dab38a8cf77cTimo Sirainentypedef int mail_index_expunge_handler_t(struct mail_index_sync_map_ctx *ctx,
64e244defe74f513ce94f33d000a048ddbe2ea23Timo Sirainentypedef int mail_index_sync_handler_t(struct mail_index_sync_map_ctx *ctx,
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainentypedef void mail_index_sync_lost_handler_t(struct mail_index *index);
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen uint32_t hdr_offset; /* points to mail_index_ext_header.data[] */
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen uint32_t hdr_size; /* size of mail_index_ext_header.data[] */
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen /* unsigned char name[name_size] */
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen /* unsigned char data[hdr_size] (starting 64bit aligned) */
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen /* struct mail_index_keyword_header_rec[] */
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen /* char name[][] */
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen uint32_t unused; /* for backwards compatibility */
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen uint32_t name_offset; /* relative to beginning of name[] */
acf3b7bf3a8891b118a71c45e6c48d17bc90b259Timo Sirainen uint32_t hdr_size; /* size of mail_index_ext_header.data[] */
void *expunge_context;
struct mail_index_map {
int refcount;
const void *hdr_base;
unsigned int records_count;
void *mmap_base;
unsigned int lock_id;
struct mail_index_module_register {
unsigned int id;
union mail_index_module_context {
struct mail_index {
char *filepath;
int fd;
unsigned int lock_id_counter;
char *error;
void *context);
unsigned int *lock_id_r);
const char *name);
const struct mail_index_ext *
const char *function);
const char *filepath,
const char *function);