summaryrefslogtreecommitdiff
path: root/os/include
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-28 23:41:41 +0100
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-28 23:41:49 +0100
commit8fbd519e538ddedcbafe5f6732b16d5d8a1b7bf4 (patch)
treecc23ec943ec80266ec6e73e136facbbd897c8ee6 /os/include
parentf595d9e7896e2a38b19522a34a6829c2fec011fb (diff)
File IO embryo.
Diffstat (limited to 'os/include')
-rw-r--r--os/include/fio.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/os/include/fio.h b/os/include/fio.h
new file mode 100644
index 0000000..a1a1c1f
--- /dev/null
+++ b/os/include/fio.h
@@ -0,0 +1,28 @@
+#ifndef __FIO_H__
+#define __FIO_H__
+
+#include <stdio.h>
+
+#define MAX_FDS 32
+
+typedef ssize_t (*fdread_t)(void * opaque, void * buf, size_t count);
+typedef ssize_t (*fdwrite_t)(void * opaque, const void * buf, size_t count);
+typedef off_t (*fdseek_t)(void * opaque, off_t offset, int whence);
+typedef int (*fdclose_t)(void * opaque);
+
+struct fddef_t {
+ fdread_t fdread;
+ fdwrite_t fdwrite;
+ fdseek_t fdseek;
+ fdclose_t fdclose;
+ void * opaque;
+};
+
+int fio_is_open(int fd);
+int fio_open(fdread_t, fdwrite_t, fdseek_t, fdclose_t, void * opaque);
+ssize_t fio_read(int fd, void * buf, size_t count);
+ssize_t fio_write(int fd, const void * buf, size_t count);
+off_t fio_seek(int fd, off_t offset, int whence);
+int fio_close(int fd);
+
+#endif