mail-index-compress.c revision ec9d382ea6adbf2c8a0e5dd304acb629ebed3203
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "write-full.h"
#include "mail-index.h"
#include "mail-index-data.h"
#include "mail-index-util.h"
#include <stdio.h>
#include <unistd.h>
{
return FALSE;
/* we don't need to compress after all. shouldn't happen.. */
return TRUE;
}
"first_hole_position points outside file",
return FALSE;
}
/* if we get interrupted, the whole index is probably corrupted.
so keep rebuild-flag on while doing this */
return FALSE;
/* first actually compress the data */
index->mmap_length);
hole_rec++;
}
rec++;
}
/* truncate the file to get rid of the extra records */
return FALSE;
}
/* update headers */
/* make sure the whole file is synced before removing rebuild-flag */
return FALSE;
return TRUE;
}
{
unsigned char *mmap_data;
return FALSE;
/* write data header */
"%s: %m", path);
return FALSE;
}
/* no we'll begin the actual moving. keep rebuild-flag on
while doing it. */
return FALSE;
"data_position+data_size points "
return FALSE;
}
"data %s: %m", path);
return FALSE;
}
}
return TRUE;
}
{
int fd;
/* write the data into temporary file updating the offsets in index
we'll simply fail and index is rebuilt later */
return FALSE;
if (fd == -1)
return FALSE;
return FALSE;
}
/* now, close the old data file and rename the temp file into
new data file */
return FALSE;
}
/* make sure the whole file is synced before removing rebuild-flag */
return FALSE;
return mail_index_data_open(index);
}