void fs_file_timing_end(struct fs_file *file, enum fs_op op);
struct fs_file *
-fs_file_init_parent(struct fs_file *parent, const char *path, int mode_flags);
+fs_file_init_parent(struct fs_file *parent, const char *path,
+ enum fs_open_mode mode, enum fs_open_flags flags);
struct fs_iter *
fs_iter_init_parent(struct fs_iter *parent,
const char *path, enum fs_iter_flags flags);
}
struct fs_file *
-fs_file_init_parent(struct fs_file *parent, const char *path, int mode_flags)
+fs_file_init_parent(struct fs_file *parent, const char *path,
+ enum fs_open_mode mode, enum fs_open_flags flags)
{
return fs_file_init_with_event(parent->fs->parent, parent->event,
- path, mode_flags);
+ path, (int)mode | (int)flags);
}
struct fs_iter *
/* avoid unnecessarily creating two seekable streams */
flags &= ENUM_NEGATE(FS_OPEN_FLAG_SEEKABLE);
- file->file.parent = fs_file_init_parent(_file, path, mode | flags);
+ file->file.parent = fs_file_init_parent(_file, path, mode, flags);
if (file->fs->wrap_metadata && 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 needlessly */
file->super_read = fs_file_init_parent(_file, path,
- mode | flags | FS_OPEN_FLAG_ASYNC |
+ mode, flags | FS_OPEN_FLAG_ASYNC |
FS_OPEN_FLAG_ASYNC_NOQUEUE);
} else {
file->super_read = file->file.parent;
struct randomfail_fs_file *file = RANDOMFAIL_FILE(_file);
file->file.path = i_strdup(path);
- file->file.parent = fs_file_init_parent(_file, path, mode | flags);
+ file->file.parent = fs_file_init_parent(_file, path, mode, flags);
}
static void fs_randomfail_file_deinit(struct fs_file *_file)
if (mode == FS_OPEN_MODE_APPEND)
fs_set_error(_file->event, ENOTSUP, "APPEND mode not supported");
else
- file->file.parent = fs_file_init_parent(_file, path, mode | flags);
+ file->file.parent = fs_file_init_parent(_file, path, mode, flags);
}
static void fs_sis_queue_file_deinit(struct fs_file *_file)
fname = path;
queue_path = t_strdup_printf("%s/%s", fs->queue_dir, fname);
- queue_file = fs_file_init_parent(&file->file, queue_path, FS_OPEN_MODE_CREATE);
+ queue_file = fs_file_init_parent(&file->file, queue_path, FS_OPEN_MODE_CREATE, 0);
if (fs_write(queue_file, "", 0) < 0 && errno != EEXIST)
e_error(file->file.event, "%s", fs_file_last_error(queue_file));
fs_file_deinit(&queue_file);
/* if hashes/<hash> already exists, open it */
file->hash_path = i_strdup_printf("%s/"HASH_DIR_NAME"/%s", dir, hash);
file->hash_file = fs_file_init_parent(_file, file->hash_path,
- FS_OPEN_MODE_READONLY);
+ FS_OPEN_MODE_READONLY, 0);
file->hash_input = fs_read_stream(file->hash_file, IO_BLOCK_SIZE);
if (i_stream_read(file->hash_input) == -1) {
i_stream_destroy(&file->hash_input);
}
- file->file.parent = fs_file_init_parent(_file, path, mode | flags);
+ file->file.parent = fs_file_init_parent(_file, path, mode, flags);
}
static void fs_sis_file_deinit(struct fs_file *_file)
/* replace existing hash file atomically */
temp_file = fs_file_init_parent(&file->file, str_c(temp_path),
- FS_OPEN_MODE_READONLY);
+ FS_OPEN_MODE_READONLY, 0);
ret = fs_copy(file->file.parent, temp_file);
if (ret < 0 && errno == EEXIST) {
/* either someone's racing us or it's a stale file.
/* avoid unnecessarily creating two seekable streams */
flags &= ENUM_NEGATE(FS_OPEN_FLAG_SEEKABLE);
- file->file.parent = fs_file_init_parent(_file, path, mode | flags);
+ file->file.parent = fs_file_init_parent(_file, path, mode, flags);
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 needlessly */
file->super_read = fs_file_init_parent(_file, path,
- mode | flags | FS_OPEN_FLAG_ASYNC |
+ mode, flags | FS_OPEN_FLAG_ASYNC |
FS_OPEN_FLAG_ASYNC_NOQUEUE);
} else {
file->super_read = file->file.parent;
/* avoid unnecessarily creating two seekable streams */
flags &= ENUM_NEGATE(FS_OPEN_FLAG_SEEKABLE);
- file->file.parent = fs_file_init_parent(_file, path, mode | flags);
+ file->file.parent = fs_file_init_parent(_file, path, mode, flags);
if (mode == FS_OPEN_MODE_READONLY &&
(flags & FS_OPEN_FLAG_ASYNC) == 0) {
/* use async stream for super, so fs_read_stream() won't create
another seekable stream needlessly */
file->super_read = fs_file_init_parent(_file, path,
- mode | flags | FS_OPEN_FLAG_ASYNC |
+ mode, flags | FS_OPEN_FLAG_ASYNC |
FS_OPEN_FLAG_ASYNC_NOQUEUE);
} else {
file->super_read = file->file.parent;