1bf21cd93STycho Nightingale /*- 2*32640292SAndy Fiddaman * SPDX-License-Identifier: BSD-2-Clause 34c87aefeSPatrick Mooney * 44c87aefeSPatrick Mooney * Copyright (c) 2016 Jakub Klama <jceel@FreeBSD.org>. 54c87aefeSPatrick Mooney * Copyright (c) 2018 Alexander Motin <mav@FreeBSD.org> 6bf21cd93STycho Nightingale * All rights reserved. 7bf21cd93STycho Nightingale * 8bf21cd93STycho Nightingale * Redistribution and use in source and binary forms, with or without 9bf21cd93STycho Nightingale * modification, are permitted provided that the following conditions 10bf21cd93STycho Nightingale * are met: 11bf21cd93STycho Nightingale * 1. Redistributions of source code must retain the above copyright 124c87aefeSPatrick Mooney * notice, this list of conditions and the following disclaimer 134c87aefeSPatrick Mooney * in this position and unchanged. 14bf21cd93STycho Nightingale * 2. Redistributions in binary form must reproduce the above copyright 15bf21cd93STycho Nightingale * notice, this list of conditions and the following disclaimer in the 16bf21cd93STycho Nightingale * documentation and/or other materials provided with the distribution. 17bf21cd93STycho Nightingale * 184c87aefeSPatrick Mooney * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19bf21cd93STycho Nightingale * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20bf21cd93STycho Nightingale * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 214c87aefeSPatrick Mooney * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22bf21cd93STycho Nightingale * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23bf21cd93STycho Nightingale * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24bf21cd93STycho Nightingale * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25bf21cd93STycho Nightingale * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26bf21cd93STycho Nightingale * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27bf21cd93STycho Nightingale * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28bf21cd93STycho Nightingale * SUCH DAMAGE. 29bf21cd93STycho Nightingale */ 30bf21cd93STycho Nightingale 314c87aefeSPatrick Mooney #ifndef _IOV_H_ 324c87aefeSPatrick Mooney #define _IOV_H_ 33bf21cd93STycho Nightingale 344c87aefeSPatrick Mooney void seek_iov(const struct iovec *iov1, int niov1, struct iovec *iov2, 354c87aefeSPatrick Mooney int *niov2, size_t seek); 364c87aefeSPatrick Mooney void truncate_iov(struct iovec *iov, int *niov, size_t length); 374c87aefeSPatrick Mooney size_t count_iov(const struct iovec *iov, int niov); 384c87aefeSPatrick Mooney ssize_t iov_to_buf(const struct iovec *iov, int niov, void **buf); 39154972afSPatrick Mooney ssize_t buf_to_iov(const void *buf, size_t buflen, const struct iovec *iov, 40154972afSPatrick Mooney int niov, size_t seek); 41bf21cd93STycho Nightingale 424c87aefeSPatrick Mooney #endif /* _IOV_H_ */ 43