Mercurial > dovecot > original-hg > dovecot-1.2
changeset 60:4ecb78d94182 HEAD
Use 8 byte memory alignment by default. Also fixed index headers a bit to be
8 byte aligned.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 28 Aug 2002 03:59:11 +0300 |
parents | 296c6dbf50a5 |
children | 2ffff61ee5e1 |
files | configure.in src/lib-index/mail-index.c src/lib-index/mail-index.h |
diffstat | 3 files changed, 26 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Wed Aug 28 03:17:09 2002 +0300 +++ b/configure.in Wed Aug 28 03:59:11 2002 +0300 @@ -153,10 +153,11 @@ AC_ERROR([Couldn't find integer type for off_t]) fi -dnl * memory alignment, could be 1 for x86 systems but 4 should be -dnl * compatible with everyone. note that only 1, 2 and 4 work corrently. -dnl * is 8 needed anywhere? -AC_DEFINE(MEM_ALIGN_SIZE, 4) +dnl * memory alignment, needed with non-x86 systems and should speed up +dnl * x86 systems too. Use 8 with everyone to make sure 64bit lookups +dnl * work. Currently it should also be safe to set to 4 if off_t == 32bit. +dnl * With x86 it could be 1 as well if you want to save a bit space/memory. +AC_DEFINE(MEM_ALIGN_SIZE, 8) dnl * socklen_t - AC_CHECK_TYPE() would be _really_ useful if it only would dnl * accept header files where to find the typedef..
--- a/src/lib-index/mail-index.c Wed Aug 28 03:17:09 2002 +0300 +++ b/src/lib-index/mail-index.c Wed Aug 28 03:59:11 2002 +0300 @@ -368,14 +368,11 @@ return FALSE; /* check the compatibility */ - if (hdr->compat_data[0] != MAIL_INDEX_COMPAT_FLAGS || - hdr->compat_data[1] != sizeof(unsigned int) || - hdr->compat_data[2] != sizeof(time_t) || - hdr->compat_data[3] != sizeof(uoff_t)) - return FALSE; - - /* check the version */ - return hdr->version == MAIL_INDEX_VERSION; + return hdr->compat_data[0] == MAIL_INDEX_VERSION && + hdr->compat_data[1] == MAIL_INDEX_COMPAT_FLAGS && + hdr->compat_data[2] == sizeof(unsigned int) && + hdr->compat_data[3] == sizeof(time_t) && + hdr->compat_data[4] == sizeof(uoff_t); } /* Returns TRUE if we're compatible with given index file */ @@ -572,11 +569,11 @@ void mail_index_init_header(MailIndexHeader *hdr) { memset(hdr, 0, sizeof(MailIndexHeader)); - hdr->compat_data[0] = MAIL_INDEX_COMPAT_FLAGS; - hdr->compat_data[1] = sizeof(unsigned int); - hdr->compat_data[2] = sizeof(time_t); - hdr->compat_data[3] = sizeof(uoff_t); - hdr->version = MAIL_INDEX_VERSION; + hdr->compat_data[0] = MAIL_INDEX_VERSION; + hdr->compat_data[1] = MAIL_INDEX_COMPAT_FLAGS; + hdr->compat_data[2] = sizeof(unsigned int); + hdr->compat_data[3] = sizeof(time_t); + hdr->compat_data[4] = sizeof(uoff_t); hdr->indexid = ioloop_time; /* mark the index being rebuilt - rebuild() removes this flag
--- a/src/lib-index/mail-index.h Wed Aug 28 03:17:09 2002 +0300 +++ b/src/lib-index/mail-index.h Wed Aug 28 03:59:11 2002 +0300 @@ -72,21 +72,21 @@ typedef struct _MailIndexUpdate MailIndexUpdate; struct _MailIndexHeader { - unsigned char compat_data[4]; - /* 0 = flags, - 1 = sizeof(unsigned int), - 2 = sizeof(time_t), - 3 = sizeof(uoff_t) */ + unsigned char compat_data[8]; + /* 0 = version + 1 = flags, + 2 = sizeof(unsigned int), + 3 = sizeof(time_t), + 4 = sizeof(uoff_t) */ - unsigned int version; unsigned int indexid; - unsigned int flags; - unsigned int cache_fields; uoff_t first_hole_position; unsigned int first_hole_records; + unsigned int cache_fields; + unsigned int uid_validity; unsigned int next_uid; @@ -104,10 +104,13 @@ struct _MailIndexDataHeader { unsigned int indexid; + unsigned int reserved; /* for alignment mostly */ + uoff_t deleted_space; }; struct _MailIndexRecord { + /* remember to keep uoff_t's 8 byte aligned so we don't waste space */ unsigned int uid; unsigned int msg_flags; /* MailFlags */ time_t internal_date;