mail-index-private.h revision fa5957ffc9b676bfd649fa9953e63e72ee4ebeb4
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger/* Make sure F_RDLCK, F_WRLCK and F_UNLCK get defined */
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger/* How many seconds to wait a lock for index file. */
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger/* Index file is grown exponentially when we're adding less than this many
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger#define MAIL_INDEX_MAX_POWER_GROW (1024*1024 / sizeof(struct mail_index_record))
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger/* How many times to retry opening index files if read/fstat returns ESTALE.
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger This happens with NFS when the file has been deleted (ie. index file was
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger rewritten by another computer than us). */
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger#define MAIL_INDEX_ESTALE_RETRY_COUNT NFS_ESTALE_RETRY_COUNT
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornberger PTR_OFFSET((map)->records, (idx) * (map)->hdr.record_size))
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornbergertypedef int mail_index_expunge_handler_t(struct mail_index_sync_map_ctx *ctx,
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornbergertypedef int mail_index_sync_handler_t(struct mail_index_sync_map_ctx *ctx,
736e78aff9e67436c35d4835c24fca667f3cadf3Julian Kornbergertypedef void mail_index_sync_lost_handler_t(struct mail_index *index);
555b7fd96768daf9592e7ddbd4217d784b08e451henning mueller uint32_t hdr_offset; /* points to mail_index_ext_header.data[] */
555b7fd96768daf9592e7ddbd4217d784b08e451henning mueller uint32_t hdr_size; /* size of mail_index_ext_header.data[] */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski /* unsigned char name[name_size] */
2635b9bca67d93aec1bed63d10d5f92fefce06e7Till Mossakowski /* unsigned char data[hdr_size] (starting 64bit aligned) */
0c07cc350bdb8afe9b01b4340b33d89500a43106Till Mossakowski /* struct mail_index_keyword_header_rec[] */
2635b9bca67d93aec1bed63d10d5f92fefce06e7Till Mossakowski /* char name[][] */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski uint32_t name_offset; /* relative to beginning of name[] */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski uint32_t hdr_size; /* size of mail_index_ext_header.data[] */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski struct mail_index_sync_handler sync_handler;
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski mail_index_expunge_handler_t *expunge_handler;
0c07cc350bdb8afe9b01b4340b33d89500a43106Till Mossakowski void *records; /* struct mail_index_record[] */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski array_t ARRAY_DEFINE(extensions, struct mail_index_ext);
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski array_t ARRAY_DEFINE(ext_id_map, uint32_t); /* index -> file */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski array_t ARRAY_DEFINE(keyword_idx_map, unsigned int); /* file -> index */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski /* If write_to_disk=TRUE and write_atomic=FALSE, these sequences
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski specify the range that needs to be written. Header should always
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski be rewritten. */
1543bf02d52779c4bc29f75de1de4d14636d0e47Till Mossakowski unsigned int write_atomic:1; /* copy to new file and rename() */
char *filepath;
int fd;
unsigned int lock_id;
char *copy_lock_path;
unsigned int last_grow_count;
char *error;
unsigned int *lock_id_r);
unsigned int *lock_id_r);
struct mail_index_map *
const char *name);
const struct mail_index_ext *
const char *function);
const char *filepath,
const char *function);