fs-compress.c revision b8584946d3fc92c0fe71deb06b7c42ef1786d897
/* Copyright (c) 2015-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "ostream.h"
#include "iostream-temp.h"
#include "compression.h"
#include "fs-api-private.h"
struct compress_fs {
const struct compression_handler *handler;
unsigned int compress_level;
};
struct compress_fs_file {
struct compress_fs *fs;
struct fs_file *super_read;
enum fs_open_mode open_mode;
struct ostream *super_output;
struct ostream *temp_output;
};
extern const struct fs fs_class_compress;
static struct fs *fs_compress_alloc(void)
{
struct compress_fs *fs;
}
static int
struct fs_settings *set)
{
const char *parent_name, *parent_args;
/* get compression handler name */
if (p == NULL) {
return -1;
}
args = p;
/* get compression level */
return -1;
}
return -1;
}
args = p;
return -1;
}
if (parent_args == NULL) {
parent_name = args;
parent_args = "";
} else {
parent_args++;
}
return -1;
}
return 0;
}
{
}
static struct fs_file *
{
struct compress_fs_file *file;
/* avoid unnecessarily creating two seekable streams */
if (mode == FS_OPEN_MODE_READONLY &&
(flags & FS_OPEN_FLAG_ASYNC) == 0) {
/* use async stream for parent, so fs_read_stream() won't create
another seekable stream unneededly */
} else {
}
}
{
}
{
}
static struct istream *
{
}
}
{
file->temp_output =
}
{
int ret;
else
}
if (!success) {
return -1;
}
}
/* finishing up */
}
/* finish writing the temporary file */
return ret;
}
const struct fs fs_class_compress = {
.name = "compress",
.v = {
}
};