Mercurial > dovecot > original-hg > dovecot-1.2
view src/lib-index/mail-hash.h @ 50:d493b9cc265e HEAD
Introduced uoff_t which is the unsigned-equilevant of off_t. This was needed
to be able to handle off_t overflows properly. Also changed a few unsigned
int fields into uoff_t so we should now support >2G mails if uoff_t is
64bit. Also fixed several potential integer overflows.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 27 Aug 2002 22:16:54 +0300 |
parents | 1ab58549429d |
children | 8cef827d2d79 |
line wrap: on
line source
#ifndef __MAIL_HASH_H #define __MAIL_HASH_H typedef struct _MailHashHeader MailHashHeader; typedef struct _MailHashRecord MailHashRecord; struct _MailHashHeader { unsigned int indexid; unsigned int updateid; unsigned int used_records; }; struct _MailHashRecord { unsigned int uid; uoff_t position; }; /* Open or create a hash file for index. If the hash needs to be created, it's also immediately built from the given index. */ int mail_hash_create(MailIndex *index); int mail_hash_open_or_create(MailIndex *index); void mail_hash_free(MailHash *hash); /* Synchronize the hash file with memory map */ int mail_hash_sync_file(MailHash *hash); /* Rebuild hash from index and reset the FLAG_REBUILD_HASH in header. The index must have an exclusive lock before this function is called. */ int mail_hash_rebuild(MailHash *hash); /* Returns position in index file to given UID, or 0 if not found. */ uoff_t mail_hash_lookup_uid(MailHash *hash, unsigned int uid); /* Update hash file. If pos is 0, the record is deleted. This call may rebuild the hash if it's too full. */ void mail_hash_update(MailHash *hash, unsigned int uid, uoff_t pos); #endif