mail-index.c revision 1fd0d511885c30028aba388588151acf4ee85e75
964N/A/* Copyright (C) 2003-2004 Timo Sirainen */ 964N/A /* see if it's already there */ for (i = 0; i <
count; i++) {
/* keywords_hash keeps a name => index mapping of keywords. Keywords are never removed from it, so the index values are valid for the lifetime of the mail_index. */ *
idx_r = (
unsigned int)-
1;
/* Extension header contains: - struct mail_index_keyword_header - struct mail_index_keyword_header_rec * keywords_count - const char names[] * keywords_count /* Keywords can only be added into same mapping. Removing requires a new mapping (recreating the index file) */ /* make sure the header is valid */ "Keywords removed unexpectedly",
"keywords_count larger than header size",
"name_offset points outside allocated header",
"Keyword header doesn't end with NUL",
/* create file -> index mapping */ /* Check that existing headers are still the same. It's behind DEBUG since it's pretty useless waste of CPU normally. */ "Keywords changed unexpectedly",
/* Register the newly seen keywords */ "Empty keyword name in header",
/* Note that our caller must close index->fd by itself. */ /* it's corrupted - recreate it */ /* if dovecot.index exists, read it first so that we can get the correct indexid and log sequence */ /* Create a new indexid for us. If we're opening index into memory, index->map doesn't exist yet. */ /* doesn't exist / corrupted */ /* open/create failed, fallback to in-memory indexes */ /* corrupted, reopen files */ i_fatal(
"nfs flush requires fsync_disable=no");
i_fatal(
"nfs flush requires mmap_disable=yes");
/* doesn't exist and create flag not used */ /* new file, new locks. the old fd can keep its locks, they don't matter anymore as no-one's going to modify the file. */ /* we have index exclusively locked, nothing could return ret <= 0 ? -
1 : 0;
/* set the index as being into memory */ /* index was never even opened. just mark it as being in memory and let the caller re-open the index. */ /* move index map to memory */ /* move transaction log to memory */ /* FIXME: Unfortunately these functions were originally written to use endian-specific code and we can't avoid that without breaking backwards compatibility. When we do break it, just select one of these. */ return 0x00000080 | ((
offset &
0x0000007f)) |
0x00008000 | ((
offset &
0x00003f80) >>
7 <<
8) |
0x00800000 | ((
offset &
0x001fc000) >>
14 <<
16) |
0x80000000 | ((
offset &
0x0fe00000) >>
21 <<
24);
if ((
offset &
0x80808080) !=
0x80808080)
return (((
offset &
0x0000007f)) |
((
offset &
0x00007f00) >>
8 <<
7) |
((
offset &
0x007f0000) >>
16 <<
14) |
((
offset &
0x7f000000) >>
24 <<
21)) <<
2;
return 0x80000000 | ((
offset &
0x0000007f) <<
24) |
0x00800000 | ((
offset &
0x00003f80) >>
7 <<
16) |
0x00008000 | ((
offset &
0x001fc000) >>
14 <<
8) |
0x00000080 | ((
offset &
0x0fe00000) >>
21);
if ((
offset &
0x80808080) !=
0x80808080)
return (((
offset &
0x0000007f) <<
21) |
((
offset &
0x00007f00) >>
8 <<
14) |
((
offset &
0x007f0000) >>
16 <<
7) |
((
offset &
0x7f000000) >>
24)) <<
2;