fs-sis.c revision c33d3f93abf8392fdc60e12bea41ffd12cc85a8d
/* Copyright (c) 2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "istream.h"
#include "ostream-cmp.h"
#include "fs-sis-common.h"
struct sis_fs {
};
struct sis_fs_file {
enum fs_open_mode open_mode;
struct istream *hash_input;
};
{
}
{
}
static struct fs *
{
const char *p;
if (*args == '\0')
i_fatal("fs-sis: Parent filesystem not given as parameter");
if (p == NULL)
else
}
{
}
static int
{
struct sis_fs_file *file;
if (mode == FS_OPEN_MODE_APPEND) {
return -1;
}
return -1;
}
switch (mode) {
case FS_OPEN_MODE_RDONLY:
return 0;
case FS_OPEN_MODE_CREATE:
case FS_OPEN_MODE_REPLACE:
break;
case FS_OPEN_MODE_APPEND:
i_unreached();
}
return -1;
/* if hashes/<hash> already exists, open it */
i_error("fs-sis: Couldn't open hash file: %s",
}
file->hash_input =
}
return 0;
}
{
}
}
{
return ret;
}
static struct istream *
{
}
{
/* we can use the existing file */
/* failed to use link(), continue as if it hadn't been equal */
return FALSE;
}
return FALSE;
}
/* the hashes/ file was already replaced with something else */
return FALSE;
}
return TRUE;
}
{
int ret;
/* hash file didn't exist previously. we should be able to
create it with link() */
/* the file was just created. it's probably
a duplicate, but it's too much trouble
trying to deduplicate it anymore */
} else {
}
}
return;
}
if (hash_fname == NULL)
else {
hash_fname++;
}
/* replace existing hash file atomically */
/* either someone's racing us or it's a stale file.
try to continue. */
}
if (ret < 0) {
return;
}
/* apparently someone else just renamed it. ignore. */
} else {
}
}
}
{
/* try to use existing file */
if (fs_sis_try_link(file))
return 0;
}
return -1;
}
T_BEGIN {
} T_END;
return 0;
}
{
else {
/* compare if files are equal */
file->hash_input);
}
}
{
if (!success) {
return -1;
}
if (fs_sis_try_link(file)) {
return 0;
}
}
return -1;
}
T_BEGIN {
} T_END;
return 0;
}
static int
{
return -1;
}
return 0;
}
{
i_unreached();
}
{
return -1;
}
return 0;
}
{
return -1;
}
return 0;
}
{
return -1;
}
return 0;
}
{
return -1;
}
return 0;
}
{
return -1;
}
return 0;
}
{
T_BEGIN {
} T_END;
return -1;
}
return 0;
}
{
return -1;
}
return 0;
}
struct fs fs_class_sis = {
.name = "sis",
.v = {
}
};