mail-index-map.c revision 8e57335924f5ff57cbd1929ec99764dc267c3312
2875N/A/* Copyright (C) 2003-2007 Timo Sirainen */ 3025N/A /* try to use the existing pool's size for initial_count so 2875N/A we don't grow it unneededly */ 2875N/A /* Update index ext_id -> map ext_id mapping. Fill non-used 2875N/A ext_ids with (uint32_t)-1 */ 2875N/A /* extension headers always start from 64bit offsets, so if base header 2875N/A doesn't happen to be 64bit aligned we'll skip some bytes */ 2875N/A /* nothing to do, skip allocatations and all */ 2875N/A /* Extension header contains: 2875N/A - struct mail_index_ext_header 2875N/A - extension header contents 2875N/A "Header extension goes outside header",
2875N/A "Duplicate header extension %s",
2875N/A "Broken header extension %s",
2875N/A "Record field %s points outside record size " 2875N/A "Record field %s alignmentation %u not used",
2875N/A /* major version change - handle silently(?) */ 2875N/A /* we've already complained about it */ 2875N/A "CPU architecture changed",
2875N/A "Corrupted header sizes (base %u, full %u)",
2875N/A /* following some extra checks that only take a bit of CPU */ 2875N/A "uid_validity = 0, next_uid = %u",
2875N/A /* last message's UID must be smaller than next_uid. 2875N/A also make sure it's not zero. */ 3025N/A /* header smaller than ours, make a copy so our newer headers 3025N/A won't have garbage in them */ 3025N/A /* we had temporarily used a buffer, eg. for updating index */ 3025N/A /* too large file to map into memory */ 2875N/A /* major version change - handle silently */ 2875N/A "messages_count too large (%u > %u)",
2875N/A /* try to read the whole header, but it's not necessarily an error to 2875N/A read less since the older versions of the index format could be 2875N/A smaller. Request reading up to buf_size, but accept if we only got 2875N/A /* major version change - handle silently */ 2875N/A /* place the base header into memory. */ 2875N/A /* @UNSAFE: read the rest of the header into memory */ 2875N/A /* header read, read the records now. */ 2875N/A "messages_count too large (%u > %u)",
2875N/A /* a new index file was renamed over this one. */ 2875N/A "Corrupted index file %s: File too small",
3014N/A /* notify all "sync lost" handlers */ 2875N/A /* ESTALE - reopen index file */ 2875N/A /* a bit kludgy way to do this, but it initializes everything 2875N/A build it from the transaction log. */ 2875N/A /* the index file is still open, lock it */ 2875N/A /* mmaping seems to be slower than just reading the file, so even if 2875N/A mmap isn't disabled don't use it unless the file is large enough */ 2875N/A /* make sure the header is ok before using this mapping */ 2875N/A /* first try updating the existing mapping from transaction log. */ 2875N/A /* we're not creating the index, or opening transaction log. 2875N/A sync this as a view from transaction log. */ 3025N/A /* try to open and read the latest index. if it fails for 3014N/A any reason, we'll fallback to updating the existing mapping 3014N/A from transaction logs (which we'll also do even if the 3014N/A /* and update the map with the latest changes from 3014N/A /* we need the lock only if we didn't move the map to memory */ 2875N/A /* fix base header size if needed */ 2875N/A /* if the map is ever written back to disk, we need to keep track of 2875N/A /* fix the name pointers to use our own pool */