static void fs_sis_deinit(struct fs *_fs) { struct sis_fs *fs = (struct sis_fs *)_fs; fs_deinit(&fs->super); i_free(fs); }
static void fs_sis_deinit(struct fs *_fs) { struct sis_fs *fs = (struct sis_fs *)_fs; if (_fs->parent != NULL) fs_deinit(&_fs->parent); i_free(fs); }
static void fs_sis_queue_deinit(struct fs *_fs) { struct sis_queue_fs *fs = (struct sis_queue_fs *)_fs; if (fs->super != NULL) fs_deinit(&fs->super); i_free(fs->queue_dir); i_free(fs); }
static void fs_crypt_deinit(struct fs *_fs) { struct crypt_fs *fs = (struct crypt_fs *)_fs; mail_crypt_global_keys_free(&fs->keys); if (_fs->parent != NULL) fs_deinit(&_fs->parent); i_free(fs->enc_algo); i_free(fs->set_prefix); i_free(fs->public_key_path); i_free(fs->private_key_path); i_free(fs->password); i_free(fs); random_deinit(); }
static void test_fs_metawrap_write_empty(void) { struct fs *fs; const char *error; test_begin("fs metawrap write empty file"); if (fs_init("metawrap", "test", &fs_set, &fs, &error) < 0) i_fatal("fs_init() failed: %s", error); struct fs_file *file = fs_file_init(fs, "foo", FS_OPEN_MODE_REPLACE); struct ostream *output = fs_write_stream(file); test_assert(fs_write_stream_finish(file, &output) > 0); fs_file_deinit(&file); fs_deinit(&fs); test_end(); }
void test_fs_async(const char *test_name, enum fs_properties properties, const char *driver, const char *args) { struct fs_settings fs_set; struct fs *fs; struct test_fs *test_fs; const char *error; i_zero(&fs_set); if (fs_init(driver, args, &fs_set, &fs, &error) < 0) i_fatal("fs_init() failed: %s", error); test_fs = test_fs_get(fs); test_fs->properties = properties; test_fs_async_write(test_name, fs); test_fs_async_copy(test_name, fs); fs_deinit(&fs); }
static void test_fs_metawrap_stat(void) { struct fs *fs; struct fs_file *file; struct test_fs_file *test_file; struct istream *input; struct stat st; const char *error; unsigned int i; test_begin("fs metawrap stat"); if (fs_init("metawrap", "test", &fs_set, &fs, &error) < 0) i_fatal("fs_init() failed: %s", error); for (i = 0; i < 2; i++) { file = fs_file_init(fs, "foo", FS_OPEN_MODE_READONLY); test_file = test_fs_file_get(fs, "foo"); str_append(test_file->contents, "key:value\n\n12345678901234567890"); if (i == 0) { input = fs_read_stream(file, 2); test_istream_set_max_buffer_size(test_file->input, 2); } else { input = NULL; } test_assert_idx(fs_stat(file, &st) == 0 && st.st_size == 20, i); if (input != NULL) i_stream_unref(&input); fs_file_deinit(&file); } fs_deinit(&fs); test_end(); }