iolist.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Kaspar Schleiser <kaspar@schleiser.de>
3  * 2018 Inria
4  * 2018 Freie Universität Berlin
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
11 #pragma once
12 
26 #include <unistd.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
33 typedef struct iolist iolist_t;
34 
38 struct iolist {
40  void *iol_base;
41  size_t iol_len;
42 };
43 
51 unsigned iolist_count(const iolist_t *iolist);
52 
63 size_t iolist_size(const iolist_t *iolist);
64 
66 struct iovec;
67 
82 size_t iolist_to_iovec(const iolist_t *iolist, struct iovec *iov, unsigned *count);
83 
94 ssize_t iolist_to_buffer(const iolist_t *iolist, void *dst, size_t len);
95 
96 #ifdef __cplusplus
97 }
98 #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:38
void * iol_base
ptr to this list entries data
Definition: iolist.h:40
size_t iol_len
size of data pointet to by ptr
Definition: iolist.h:41
iolist_t * iol_next
ptr to next list entry
Definition: iolist.h:39
Structure for scatter/gather I/O.
Definition: uio.h:33