mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 19:28:52 +02:00
ircd::fs: Add an fallocate wrapper for now.
This commit is contained in:
parent
0ce45b50d6
commit
55b2b128c6
2 changed files with 11 additions and 0 deletions
|
@ -30,6 +30,9 @@ namespace ircd::fs
|
|||
// Truncate file to explicit size
|
||||
void truncate(const fd &, const size_t &, const write_opts & = write_opts_default);
|
||||
void truncate(const string_view &path, const size_t &, const write_opts & = write_opts_default);
|
||||
|
||||
// Allocate
|
||||
void allocate(const fd &, const size_t &size, const write_opts & = write_opts_default);
|
||||
}
|
||||
|
||||
/// Options for a write operation
|
||||
|
|
|
@ -383,6 +383,14 @@ ircd::fs::write_opts
|
|||
const ircd::fs::write_opts_default
|
||||
{};
|
||||
|
||||
void
|
||||
ircd::fs::allocate(const fd &fd,
|
||||
const size_t &size,
|
||||
const write_opts &opts)
|
||||
{
|
||||
syscall(::posix_fallocate, fd, opts.offset, size);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::fs::truncate(const string_view &path,
|
||||
const size_t &size,
|
||||
|
|
Loading…
Reference in a new issue