aboutsummaryrefslogtreecommitdiff
path: root/include/iobuf.h
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-11-06 02:52:23 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-06 07:09:54 +0000
commit03a8f91651ed26c3db97ec5e94834ba6eba54cc2 (patch)
treeab5c5b1ec4eabda582f037ebc8b4071eb991556f /include/iobuf.h
parentfeat(buf): add buffer (diff)
downloadcodebase-03a8f91651ed26c3db97ec5e94834ba6eba54cc2.tar.gz
feat(iobuf): add I/O buffer
Diffstat (limited to 'include/iobuf.h')
-rw-r--r--include/iobuf.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/iobuf.h b/include/iobuf.h
new file mode 100644
index 0000000..79f5195
--- /dev/null
+++ b/include/iobuf.h
@@ -0,0 +1,40 @@
1// iobuf.h --- Input/Output buffer -*- C -*-
2//
3// Copyright (c) 2026 Martin Michalec <martin@michalec.dev>
4//
5// SPDX-License-Identifier: MIT
6//
7// This file is part of COSMOS Codebase.
8//
9// Commentary:
10//
11// Code:
12
13#ifndef INCLUDED_COSMOS_IOBUF_H
14#define INCLUDED_COSMOS_IOBUF_H
15
16#include "ms.h"
17
18struct iobuf {
19 u8 *beg;
20 u8 *rhead;
21 u8 *whead;
22 u8 *end;
23};
24
25struct iobuf iobuf_from (struct ms ms);
26usz iobuf_sz (struct iobuf);
27struct mv *iobuf_rmv (struct iobuf *);
28struct ms *iobuf_wms (struct iobuf *);
29
30void iobuf_compact (struct iobuf *);
31
32#ifndef IOBUF_NO_UNISTD
33
34int iobuf_read (struct iobuf *, int fd);
35
36#endif // IOBUF_NO_UNISTD
37
38#endif // INCLUDED_COSMOS_IOBUF_H
39
40// iobuf.h ends here