unsigned int seq,
unsigned int *trans_next_idx);
+/* Return data from the specified position in the cache file. Returns 1 if
+ successful, 0 if offset/size points outside the cache file, -1 if error. */
int mail_cache_map(struct mail_cache *cache, size_t offset, size_t size,
const void **data_r);
+/* Map the whole cache file into memory. Returns 0 if ok, -1 if error. */
+int mail_cache_map_all(struct mail_cache *cache);
void mail_cache_file_close(struct mail_cache *cache);
int mail_cache_reopen(struct mail_cache *cache);
cache->mmap_base, FALSE);
}
+int mail_cache_map_all(struct mail_cache *cache)
+{
+ const void *data;
+
+ int ret = mail_cache_map(cache, 0, 0, &data);
+ i_assert(ret != 0);
+ return ret < 0 ? -1 : 0;
+}
+
int mail_cache_open_and_verify(struct mail_cache *cache)
{
int ret;