#ifndef MAIL_INDEX_PRIVATE_H
#define MAIL_INDEX_PRIVATE_H
#include "file-lock.h"
#include "mail-index.h"
#include "mail-index-util.h"
#include "mail-index-view-private.h"
#include "mail-index-transaction-private.h"
struct mail_transaction_header;
struct mail_transaction_log_view;
struct mail_index_sync_map_ctx;
/* How large index files to mmap() instead of reading to memory. */
This happens with NFS when the file has been deleted (ie. index file was
rewritten by another computer than us). */
/* Large extension header sizes are probably caused by file corruption, so
try to catch them by limiting the header size. */
((struct mail_index_record *) \
((struct mail_index_record *) \
#define MAIL_TRANSACTION_FLAG_UPDATE_IS_INTERNAL(u) \
(u)->modseq_inc_flag == 0)
void **sync_context, void *context);
struct mail_index_ext {
const char *name;
};
struct mail_index_ext_header {
/* unsigned char name[name_size] */
/* unsigned char data[hdr_size] (starting 64bit aligned) */
};
struct mail_index_keyword_header {
/* struct mail_index_keyword_header_rec[] */
/* char name[][] */
};
struct mail_index_keyword_header_rec {
};
enum mail_index_sync_handler_type {
};
struct mail_index_sync_handler {
};
struct mail_index_registered_ext {
const char *name;
void *expunge_context;
};
struct mail_index_record_map {
void *mmap_base;
unsigned int records_count;
};
struct mail_index_map {
int refcount;
const void *hdr_base;
};
struct mail_index_module_register {
unsigned int id;
};
union mail_index_module_context {
};
struct mail_index {
char *cache_dir;
unsigned int open_count;
char *gid_origin;
void *ext_hdr_init_data;
char *filepath;
int fd;
unsigned int inconsistency_id;
the main index file's headers. these are used to figure out when
the main index file should be updated. */
/* syncing will update this if non-NULL */
unsigned int max_lock_timeout_secs;
/* Module-specific contexts. */
char *error;
};
extern struct mail_index_module_register mail_index_module_register;
extern struct event_category event_category_index;
void *context);
enum mail_index_sync_handler_type type);
const char *path_prefix, const char **path_r);
const char **reason_r);
int lock_type, unsigned int timeout_secs,
/* Allocate a new empty map. */
/* Replace index->map with the latest index changes. This may reopen the index
read up to EOF, but non-synced expunges are skipped.
If we mmap()ed the index file, the map is returned locked.
Returns 1 = ok, 0 = corrupted, -1 = error. */
enum mail_index_sync_handler_type type);
/* Unreference given mapping and unmap it if it's dropped to zero. */
/* Clone a map. The returned map is always in memory. */
/* Move a mmaped map to memory. */
const struct mail_index_ext_header *ext_hdr);
const struct mail_index_ext *
/* Returns 1 on success, 0 on non-critical errors we want to silently fix,
-1 if map isn't usable. The caller is responsible for logging the errors
if -1 is returned. */
const char **error_r);
/* Returns 1 if header is usable, 0 or -1 if not. The caller should log an
error if -1 is returned, but not if 0 is returned. */
const struct mail_index_header *hdr,
unsigned int initial_count);
unsigned int *offset,
const struct mail_index_ext_header **ext_hdr_r,
const char **name_r);
const struct mail_index_ext_header *ext_hdr,
unsigned int mail_index_map_ext_hdr_offset(unsigned int name_len);
/* Log an error and set it as the index's current error that is available
with mail_index_get_error_message(). */
/* Same as mail_index_set_error(), but don't log the error. */
/* "%s failed with index file %s: %m" */
const char *function);
/* "%s failed with file %s: %m" */
const char *filepath,
const char *function);
#endif