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:
parent
55b2b128c6
commit
79d4c15ff5
2 changed files with 16 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
|
17
ircd/fs.cc
17
ircd/fs.cc
|
@ -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_);
|
||||
if(!opts.offset)
|
||||
opts.offset = syscall(::lseek, fd, 0, SEEK_END);
|
||||
|
||||
return write(fd, buf, opts);
|
||||
}
|
||||
catch(const error &e)
|
||||
|
|
Loading…
Reference in a new issue