2018-11-29 01:53:04 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_FS_IOV_H
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
struct iovec;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace ircd::fs
|
|
|
|
{
|
2018-12-02 00:33:30 +01:00
|
|
|
using const_iovec_view = vector_view<const struct ::iovec>;
|
|
|
|
using iovec_view = vector_view<struct ::iovec>;
|
2018-11-29 02:10:17 +01:00
|
|
|
using const_buffers = vector_view<const const_buffer>;
|
|
|
|
using mutable_buffers = vector_view<const mutable_buffer>;
|
|
|
|
|
2018-11-29 01:53:04 +01:00
|
|
|
// utility; count the total bytes of an iov.
|
2018-12-02 00:33:30 +01:00
|
|
|
size_t bytes(const const_iovec_view &);
|
|
|
|
|
2018-12-18 21:28:28 +01:00
|
|
|
// Transforms our buffers to struct iovec ones. The offset value allows
|
|
|
|
// a front-truncation of the input buffers when transforming. This is
|
|
|
|
// useful for progressive readv()'s filling the buffers.
|
|
|
|
const_iovec_view make_iov(const iovec_view &, const const_buffers &, const size_t &off = 0);
|
|
|
|
const_iovec_view make_iov(const iovec_view &, const mutable_buffers &, const size_t &off = 0);
|
2018-11-29 01:53:04 +01:00
|
|
|
}
|