fs-sis.c revision 8b3f557cda9023b87b183e364cb7f7c7b0906950
/* Copyright (c) 2010-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "istream.h"
#include "ostream.h"
#include "ostream-cmp.h"
#include "fs-sis-common.h"
#define FS_SIS_REQUIRED_PROPS \
struct sis_fs {
};
struct sis_fs_file {
enum fs_open_mode open_mode;
struct istream *hash_input;
bool opened;
};
static struct fs *fs_sis_alloc(void)
{
}
static int
{
enum fs_properties props;
if (*args == '\0') {
return -1;
}
if (parent_args == NULL) {
parent_name = args;
parent_args = "";
} else {
parent_args++;
}
return -1;
}
return -1;
}
return 0;
}
{
}
static struct fs_file *
{
struct sis_fs_file *file;
if (mode == FS_OPEN_MODE_APPEND) {
}
}
/* if hashes/<hash> already exists, open it */
/* doesn't exist */
i_error("fs-sis: Couldn't read hash file %s: %m",
}
}
}
{
}
{
}
{
return FALSE;
/* 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;
}
{
const char *hash_fname;
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 {
}
}
}
{
return -1;
/* try to use existing file */
if (fs_sis_try_link(file))
return 0;
}
return -1;
T_BEGIN {
} T_END;
return 0;
}
{
} else {
} else {
/* compare if files are equal */
file->hash_input);
}
}
}
{
if (!success) {
return -1;
}
if (fs_sis_try_link(file)) {
return 1;
}
}
return -1;
T_BEGIN {
} T_END;
return 1;
}
{
T_BEGIN {
} T_END;
}
const struct fs fs_class_sis = {
.name = "sis",
.v = {
NULL,
NULL,
}
};