iolist.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Kaspar Schleiser <kaspar@schleiser.de>
3  * SPDX-FileCopyrightText: 2018 Inria
4  * SPDX-FileCopyrightText: 2018 Freie Universität Berlin
5  * SPDX-License-Identifier: LGPL-2.1-only
6  */
7 
8 #pragma once
9 
23 #include <unistd.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
30 typedef struct iolist iolist_t;
31 
35 struct iolist {
37  void *iol_base;
38  size_t iol_len;
39 };
40 
48 unsigned iolist_count(const iolist_t *iolist);
49 
60 size_t iolist_size(const iolist_t *iolist);
61 
63 struct iovec;
64 
79 size_t iolist_to_iovec(const iolist_t *iolist, struct iovec *iov, unsigned *count);
80 
91 ssize_t iolist_to_buffer(const iolist_t *iolist, void *dst, size_t len);
92 
93 #ifdef __cplusplus
94 }
95 #endif
unsigned iolist_count(const iolist_t *iolist)
Count number of entries in an iolist_t.
size_t iolist_size(const iolist_t *iolist)
Sum up number of bytes in iolist.
size_t iolist_to_iovec(const iolist_t *iolist, struct iovec *iov, unsigned *count)
Create struct iovec from iolist.
ssize_t iolist_to_buffer(const iolist_t *iolist, void *dst, size_t len)
Copies the bytes of the iolist to a buffer.
iolist structure definition
Definition: iolist.h:35
void * iol_base
ptr to this list entries data
Definition: iolist.h:37
size_t iol_len
size of data pointet to by ptr
Definition: iolist.h:38
iolist_t * iol_next
ptr to next list entry
Definition: iolist.h:36
Structure for scatter/gather I/O.
Definition: uio.h:33