0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd::fs: Deinline and improve append() related.

This commit is contained in:
Jason Volk 2018-08-23 21:24:56 -07:00
parent 55b2b128c6
commit 79d4c15ff5
2 changed files with 16 additions and 15 deletions

View file

@ -52,15 +52,3 @@ inline
ircd::fs::write_opts::write_opts(const off_t &offset)
:offset{offset}
{}
inline ircd::const_buffer
ircd::fs::append(const string_view &path,
const const_buffer &buf,
const write_opts &opts)
{
const fd fd
{
path, std::ios::out | std::ios::app
};
return write(fd, buf, opts);
}

View file

@ -433,16 +433,29 @@ ircd::fs::overwrite(const fd &fd,
return write(fd, buf, opts);
}
ircd::const_buffer
ircd::fs::append(const string_view &path,
const const_buffer &buf,
const write_opts &opts)
{
const fd fd
{
path, std::ios::out | std::ios::app
};
return write(fd, buf, opts);
}
ircd::const_buffer
ircd::fs::append(const fd &fd,
const const_buffer &buf,
const write_opts &opts_)
try
{
assert(opts_.offset == 0);
auto opts(opts_);
opts.offset = syscall(::lseek, fd, 0, SEEK_END);
if(!opts.offset)
opts.offset = syscall(::lseek, fd, 0, SEEK_END);
return write(fd, buf, opts);
}
catch(const error &e)