14c87aefeSPatrick Mooney /*- 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> 64c87aefeSPatrick Mooney * All rights reserved. 74c87aefeSPatrick Mooney * 84c87aefeSPatrick Mooney * Redistribution and use in source and binary forms, with or without 94c87aefeSPatrick Mooney * modification, are permitted provided that the following conditions 104c87aefeSPatrick Mooney * are met: 114c87aefeSPatrick Mooney * 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. 144c87aefeSPatrick Mooney * 2. Redistributions in binary form must reproduce the above copyright 154c87aefeSPatrick Mooney * notice, this list of conditions and the following disclaimer in the 164c87aefeSPatrick Mooney * documentation and/or other materials provided with the distribution. 174c87aefeSPatrick Mooney * 184c87aefeSPatrick Mooney * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 194c87aefeSPatrick Mooney * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 204c87aefeSPatrick Mooney * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 214c87aefeSPatrick Mooney * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 224c87aefeSPatrick Mooney * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 234c87aefeSPatrick Mooney * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 244c87aefeSPatrick Mooney * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 254c87aefeSPatrick Mooney * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 264c87aefeSPatrick Mooney * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 274c87aefeSPatrick Mooney * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 284c87aefeSPatrick Mooney * SUCH DAMAGE. 294c87aefeSPatrick Mooney */ 304c87aefeSPatrick Mooney 314c87aefeSPatrick Mooney #ifndef _IOV_H_ 324c87aefeSPatrick Mooney #define _IOV_H_ 334c87aefeSPatrick Mooney 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); 414c87aefeSPatrick Mooney 424c87aefeSPatrick Mooney #endif /* _IOV_H_ */ 43