Mercurial > dovecot > original-hg > dovecot-1.2
view src/lib-index/mailbox-list-index-private.h @ 4848:967de900c73a HEAD
Mailbox list indexing and related changes. Currently works only with
maildir and mmap_disable=no. This allows doing STATUS to synced mailboxes
without opening their index files at all.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 26 Nov 2006 00:17:39 +0200 |
parents | |
children | 3d00a9636393 |
line wrap: on
line source
#ifndef __MAILBOX_LIST_INDEX_PRIVATE_H #define __MAILBOX_LIST_INDEX_PRIVATE_H #include "mailbox-list-index.h" #define MAILBOX_LIST_INDEX_MAJOR_VERSION 1 #define MAILBOX_LIST_INDEX_MINOR_VERSION 0 struct mailbox_list_index_header { uint8_t major_version; uint8_t minor_version; uint8_t unused[2]; uint32_t header_size; uint32_t uid_validity; /* locking required to access the fields below: */ uint32_t next_uid; uint32_t used_space; uint32_t deleted_space; }; struct mailbox_list_dir_record { /* If non-zero, contains a pointer to updated directory list. Stored using mail_index_uint32_to_offset(). */ uint32_t next_offset; uint32_t count; /* The records are sorted by their name_hash */ /* struct mailbox_list_record records[count]; */ }; struct mailbox_list_record { /* CRC32 hash of the name */ uint32_t name_hash; uint32_t uid:31; /* Set when this record has been marked as deleted. It will be removed permanently the next time a new record is added to this directory or on the next index compression. */ uint32_t deleted:1; /* Points to a NUL-terminated record name */ uint32_t name_offset; /* the dir offset is stored using mail_index_uint32_to_offset() since it may change while we're reading */ uint32_t dir_offset; }; struct mailbox_list_index { char *filepath; char separator; struct mail_index *mail_index; int fd; void *mmap_base; size_t mmap_size; const struct mailbox_list_index_header *hdr; }; #define MAILBOX_LIST_RECORDS(dir) \ ((struct mailbox_list_record *)(dir + 1)) #define MAILBOX_LIST_RECORD_IDX(dir, rec) \ ((rec) - MAILBOX_LIST_RECORDS(dir)) int mailbox_list_index_set_syscall_error(struct mailbox_list_index *index, const char *function); int mailbox_list_index_dir_lookup_rec(struct mailbox_list_index *index, const struct mailbox_list_dir_record *dir, const char *name, const struct mailbox_list_record **rec_r); int mailbox_list_index_get_dir(struct mailbox_list_index *index, uint32_t *offset, const struct mailbox_list_dir_record **dir_r); int mailbox_list_index_map(struct mailbox_list_index *index); #endif