0
0
Fork 0
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:
Jason Volk 2018-08-23 21:24:35 -07:00
parent 0ce45b50d6
commit 55b2b128c6
2 changed files with 11 additions and 0 deletions

View file

@ -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

View file

@ -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,