aboutsummaryrefslogtreecommitdiff
path: root/include/libtio/io/generic.h
diff options
context:
space:
mode:
authorThomas Touhey <thomas@touhey.fr>2019-04-29 09:09:13 +0200
committerThomas Touhey <thomas@touhey.fr>2019-04-29 09:09:13 +0200
commit6ec77a7b972ef033ba3cd46561c4233aa9c82422 (patch)
treed2df81db356c1a387d336fd9ac5dc4c0d1a95388 /include/libtio/io/generic.h
parent731a5ab888292615660880abf809a43e613b330a (diff)
Reorganized the headers for I/O operations
Diffstat (limited to 'include/libtio/io/generic.h')
-rw-r--r--include/libtio/io/generic.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/libtio/io/generic.h b/include/libtio/io/generic.h
new file mode 100644
index 0000000..1887856
--- /dev/null
+++ b/include/libtio/io/generic.h
@@ -0,0 +1,32 @@
+#ifndef LIBTIO_IO_GENERIC_H
+# define LIBTIO_IO_GENERIC_H 20190429
+# include "../cdefs.h"
+
+TIO_BEGIN_NAMESPACE
+
+/* A generic stream is inspired from the libc streams, which mainly serve
+ * for interacting with local files. Using such a stream, you can read,
+ * write and seek (move the cursor to a specific offset in the stream).
+ *
+ * Offset types, for seeking, are the following:
+ *
+ * `SET`: set the current position to the offset.
+ * `CUR`: add the offset to the current position.
+ * `END`: set the current position to the end minus the offset.
+ * `DATA`: seek to the next data.
+ * `HOLE`: seek to the next hole. */
+
+typedef long tio_off_t;
+
+typedef int tio_whence_t;
+
+# define TIO_SEEK_SET 1
+# define TIO_SEEK_CUR 2
+# define TIO_SEEK_END 4
+
+# define TIO_SEEK_DATA 8
+# define TIO_SEEK_HOLE 16
+
+TIO_END_NAMESPACE
+
+#endif /* LIBTIO_IO_GENERIC_H */