0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-17 01:18:39 +02:00

ircd::fs: Simplify read suite overloads.

This commit is contained in:
Jason Volk 2020-05-20 18:32:44 -07:00
parent a1de7e8e08
commit 4d5c006003
2 changed files with 3 additions and 45 deletions

View file

@ -16,18 +16,17 @@ namespace ircd::fs
struct read_op;
struct read_opts extern const read_opts_default;
// Yields ircd::ctx for parallel reads into buffers; total bytes read
size_t read(const vector_view<read_op> &);
// Yields ircd::ctx for read into buffers; returns bytes read
size_t read(const fd &, const mutable_buffers &, const read_opts & = read_opts_default);
size_t read(const string_view &path, const mutable_buffers &, const read_opts & = read_opts_default);
size_t read(const vector_view<read_op> &); // parallel read
// Yields ircd::ctx for read into buffer; returns view of read portion.
const_buffer read(const fd &, const mutable_buffer &, const read_opts & = read_opts_default);
const_buffer read(const string_view &path, const mutable_buffer &, const read_opts & = read_opts_default);
// Yields ircd::ctx for read into allocated string; returns that string
std::string read(const fd &, const read_opts & = read_opts_default);
std::string read(const string_view &path, const read_opts & = read_opts_default);
// Test whether bytes in the specified range are cached and should not block
bool fincore(const fd &, const size_t &, const read_opts & = read_opts_default);

View file

@ -847,18 +847,6 @@ ircd::fs::fincore(void *const &map,
return std::find(vec, vec + vec_size, 0UL) == vec + vec_size;
}
std::string
ircd::fs::read(const string_view &path,
const read_opts &opts)
{
const fd fd
{
path
};
return read(fd, opts);
}
std::string
ircd::fs::read(const fd &fd,
const read_opts &opts)
@ -870,22 +858,6 @@ ircd::fs::read(const fd &fd,
});
}
ircd::const_buffer
ircd::fs::read(const string_view &path,
const mutable_buffer &buf,
const read_opts &opts)
{
const mutable_buffers bufs
{
&buf, 1
};
return mutable_buffer
{
data(buf), read(path, bufs, opts)
};
}
ircd::const_buffer
ircd::fs::read(const fd &fd,
const mutable_buffer &buf,
@ -902,19 +874,6 @@ ircd::fs::read(const fd &fd,
};
}
size_t
ircd::fs::read(const string_view &path,
const mutable_buffers &bufs,
const read_opts &opts)
{
const fd fd
{
path
};
return read(fd, bufs, opts);
}
size_t
ircd::fs::read(const vector_view<read_op> &op)
{