aboutsummaryrefslogtreecommitdiff
path: root/src/aio/include/aio.h
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-07-07 13:22:53 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-11-11 00:08:15 +0100
commit7861a52adf92a083bb2aed4c35f98d8035dce032 (patch)
tree28cd3c40e4c878f730f5df3c1d93bdf91af490c3 /src/aio/include/aio.h
parent7fc48e9216ff809da5f8055a50b0be17628ef1df (diff)
Setup project skeleton
Diffstat (limited to 'src/aio/include/aio.h')
-rw-r--r--src/aio/include/aio.h40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/aio/include/aio.h b/src/aio/include/aio.h
index f9f76cb..9486f3f 100644
--- a/src/aio/include/aio.h
+++ b/src/aio/include/aio.h
@@ -1,5 +1,5 @@
/*
- * wanix, a Unix-like operating system for WebAssembly
+ * wnix, a Unix-like operating system for WebAssembly applications.
* Copyright (C) 2025 Xavier Del Campo Romero
*
* This program is free software: you can redistribute it and/or modify
@@ -19,17 +19,41 @@
#ifndef AIO_H
#define AIO_H
+#include <fs/fs.h>
+#include <sys/types.h>
+#include <state.h>
+#include <stdbool.h>
#include <stddef.h>
-enum
+struct aio_poll
{
- AIO_POLLIN = 1,
- AIO_POLLOUT = 1 << 1
+ const struct aio *aio;
+ bool done;
+ int error;
+ struct aio_poll *prev, *next;
};
-struct aio *aio_open(const char *path, const char *mode);
-int aio_poll(struct aio **io, size_t n);
-int aio_event(const struct aio *io, int ev);
-int aio_close(struct aio *io);
+struct aio_done
+{
+ int (*f)(enum state state, void *args);
+ void *args;
+};
+
+struct aio_mount
+{
+ struct fs_mount mount;
+ const char *type;
+};
+
+struct aio *aio_mount(const struct aio_mount *m, const struct aio_done *d);
+struct aio *aio_mkdir(const struct fs_mkdir *m, const struct aio_done *d);
+struct aio *aio_open(const struct fs_open *o, const struct aio_done *d);
+struct aio *aio_read(const struct fs_read *r, const struct aio_done *d);
+struct aio *aio_write(const struct fs_write *w, const struct aio_done *d);
+struct aio *aio_stat(const struct fs_stat *s, const struct aio_done *d);
+int aio_read_nb(const struct fs_read *r);
+int aio_poll(struct aio_poll *p, int ms);
+int aio_close(struct fs_fd *fd);
+void aio_free(struct aio *io);
#endif