static void fs_compress_write_stream(struct fs_file *_file) { struct compress_fs_file *file = (struct compress_fs_file *)_file; i_assert(_file->output == NULL); file->temp_output = iostream_temp_create_named(_file->fs->temp_path_prefix, IOSTREAM_TEMP_FLAG_TRY_FD_DUP, fs_file_path(_file)); _file->output = file->fs->handler-> create_ostream(file->temp_output, file->fs->compress_level); }
static void fs_crypt_write_stream(struct fs_file *_file) { struct crypt_fs_file *file = (struct crypt_fs_file *)_file; const char *error; i_assert(_file->output == NULL); if (fs_crypt_load_keys(file->fs, &error) < 0) { _file->output = o_stream_create_error_str(EIO, "Couldn't read settings: %s", error); return; } if (file->fs->keys.public_key == NULL) { if (_file->fs->set.debug) i_debug("No public key provided, " "NOT encrypting stream %s", fs_file_path(_file)); file->super_output = fs_write_stream(_file->parent); _file->output = file->super_output; return; } enum io_stream_encrypt_flags flags; if (strstr(file->fs->enc_algo, "gcm") != NULL || strstr(file->fs->enc_algo, "ccm") != NULL) { flags = IO_STREAM_ENC_INTEGRITY_AEAD; } else { flags = IO_STREAM_ENC_INTEGRITY_HMAC; } file->temp_output = iostream_temp_create_named(_file->fs->temp_path_prefix, IOSTREAM_TEMP_FLAG_TRY_FD_DUP, fs_file_path(_file)); _file->output = o_stream_create_encrypt(file->temp_output, file->fs->enc_algo, file->fs->keys.public_key, flags); }
struct ostream *iostream_temp_create(const char *temp_path_prefix, enum iostream_temp_flags flags) { return iostream_temp_create_named(temp_path_prefix, flags, ""); }