Mstdlib-1.24.0
m_io_buffer.h
1
/* The MIT License (MIT)
2
*
3
* Copyright (c) 2023 Monetra Technologies, LLC.
4
*
5
* Permission is hereby granted, free of charge, to any person obtaining a copy
6
* of this software and associated documentation files (the "Software"), to deal
7
* in the Software without restriction, including without limitation the rights
8
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
* copies of the Software, and to permit persons to whom the Software is
10
* furnished to do so, subject to the following conditions:
11
*
12
* The above copyright notice and this permission notice shall be included in
13
* all copies or substantial portions of the Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
* THE SOFTWARE.
22
*/
23
24
#ifndef __M_IO_BUFFER_H__
25
#define __M_IO_BUFFER_H__
26
27
#include <mstdlib/base/m_defs.h>
28
#include <mstdlib/base/m_types.h>
29
#include <mstdlib/io/m_io.h>
30
#include <mstdlib/io/m_event.h>
31
32
__BEGIN_DECLS
33
34
/*! \addtogroup m_io_buffer Addon for I/O buffering
35
* \ingroup m_eventio_base_addon
36
*
37
* Intermediate layer for buffering reads/writes from the OS.
38
*
39
* Allows data to be buffered, this can reduce the number of syscalls required
40
* to the OS and increase performance at the cost of memory.
41
*
42
* @{
43
*/
44
45
46
/*! Add a buffer layer. Cannot be combined with base IO objects which utilize
47
* M_io_meta_t.
48
*
49
* \param[in] io io object.
50
* \param[out] layer_id Layer id this is added at.
51
* \param[in] max_read_buffer Maximum read buffer size in bytes. If not a power of 2 will be rounded up to the
52
* next power of 2. Use 0 to disable read buffering.
53
* \param[in] max_write_buffer Maximum write buffer size in bytes. If not a power of 2 will be rounded up to the
54
* next power of 2. Use 0 to disable write buffering.
55
* \return Result.
56
*/
57
M_API
M_io_error_t
M_io_add_buffer
(
M_io_t
*io,
size_t
*layer_id,
size_t
max_read_buffer,
size_t
max_write_buffer);
58
59
60
/*! @} */
61
62
__END_DECLS
63
64
#endif
65
M_io_add_buffer
M_io_error_t M_io_add_buffer(M_io_t *io, size_t *layer_id, size_t max_read_buffer, size_t max_write_buffer)
M_io_error_t
enum M_io_error M_io_error_t
Definition:
m_io.h:93
M_io_t
struct M_io M_io_t
Definition:
m_io.h:59
include
mstdlib
io
m_io_buffer.h
Generated on Tue Aug 15 2023 12:53:09 for Mstdlib-1.24.0 by
1.9.4