2018-08-19 07:58:43 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
2018-12-14 01:54:09 +01:00
|
|
|
#define HAVE_IRCD_FS_SYNC_H
|
2018-08-19 07:58:43 +02:00
|
|
|
|
|
|
|
namespace ircd::fs
|
|
|
|
{
|
2018-12-14 01:54:09 +01:00
|
|
|
struct sync_opts extern const sync_opts_default;
|
2018-08-19 07:58:43 +02:00
|
|
|
|
2018-12-14 02:46:08 +01:00
|
|
|
void flush(const fd &, const sync_opts & = sync_opts_default);
|
2018-12-14 01:54:09 +01:00
|
|
|
void sync(const fd &, const sync_opts & = sync_opts_default);
|
2018-08-19 07:58:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Options for a write operation
|
2018-12-14 01:54:09 +01:00
|
|
|
struct ircd::fs::sync_opts
|
2018-08-19 07:58:43 +02:00
|
|
|
{
|
2018-12-14 01:54:09 +01:00
|
|
|
sync_opts() = default;
|
2018-08-19 07:58:43 +02:00
|
|
|
|
2018-12-14 02:46:08 +01:00
|
|
|
/// Set to true to flush metadata; otherwise only data is flushed.
|
|
|
|
/// This ends up forcing the use of fsync() rather than fdatasync() or
|
|
|
|
/// sync_file_range() et al.
|
|
|
|
bool metadata {true};
|
|
|
|
|
2018-11-29 19:18:43 +01:00
|
|
|
/// Determines whether this operation is conducted via AIO. If not, a
|
|
|
|
/// direct syscall is made. Using AIO will only block one ircd::ctx while
|
|
|
|
/// a direct syscall will block the thread (all contexts). If AIO is not
|
2018-12-14 02:46:08 +01:00
|
|
|
/// available or not enabled, or doesn't support this operation, setting
|
|
|
|
/// this has no effect.
|
|
|
|
bool yielding {true};
|
2018-11-29 19:18:43 +01:00
|
|
|
|
2018-11-02 04:15:12 +01:00
|
|
|
/// Request priority. This value is ignored by the kernel for the
|
|
|
|
/// operations provided by this interface. It is still provided for
|
|
|
|
/// consistency and may be used internally by IRCd in the future.
|
|
|
|
int8_t priority {-1};
|
2018-08-19 07:58:43 +02:00
|
|
|
};
|