From 7861a52adf92a083bb2aed4c35f98d8035dce032 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 7 Jul 2025 13:22:53 +0200 Subject: Setup project skeleton --- src/aio/include/aio.h | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'src/aio/include') 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 +#include +#include +#include #include -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 -- cgit v1.2.3