[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.116,1.117
cras at procontrol.fi
cras at procontrol.fi
Sat May 1 21:30:37 EEST 2004
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index.c, 1.115,
1.116 mail-index.h, 1.101, 1.102
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index index-mail.c, 1.26,
1.27 index-search.c, 1.84, 1.85 index-status.c, 1.28,
1.29 index-storage.h, 1.54, 1.55 index-sync.c, 1.29, 1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv20958/lib-index
Modified Files:
mail-index.c
Log Message:
syncing fix
Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- mail-index.c 1 May 2004 16:42:10 -0000 1.116
+++ mail-index.c 1 May 2004 18:30:35 -0000 1.117
@@ -261,19 +261,25 @@
int mail_index_map(struct mail_index *index, int force)
{
+ const struct mail_index_header *hdr;
struct mail_index_map *map;
+ size_t used_size;
int ret;
- if (index->map != NULL) {
- map = index->map;
- if (map != NULL && !force)
+ map = index->map;
+ if (map != NULL && MAIL_INDEX_MAP_IS_IN_MEMORY(map)) {
+ /* FIXME: we need to re-read header */
+ } else if (map != NULL) {
+ /* see if re-mmaping is needed (file has grown) */
+ hdr = map->mmap_base;
+ used_size = hdr->header_size +
+ hdr->messages_count * sizeof(struct mail_index_record);
+ if (map->mmap_size >= used_size && !force)
return 1;
- if (map->mmap_base != NULL) {
- if (munmap(map->mmap_base, map->mmap_size) < 0)
- mail_index_set_syscall_error(index, "munmap()");
- map->mmap_base = NULL;
- }
+ if (munmap(map->mmap_base, map->mmap_size) < 0)
+ mail_index_set_syscall_error(index, "munmap()");
+ map->mmap_base = NULL;
} else {
map = i_new(struct mail_index_map, 1);
map->refcount = 1;
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index.c, 1.115,
1.116 mail-index.h, 1.101, 1.102
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index index-mail.c, 1.26,
1.27 index-search.c, 1.84, 1.85 index-status.c, 1.28,
1.29 index-storage.h, 1.54, 1.55 index-sync.c, 1.29, 1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list