/*
* 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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
#ifndef AIO_H
#define AIO_H
#include
#include
#include
#include
#include
struct aio_poll
{
const struct aio *aio;
bool done;
int error;
struct aio_poll *prev, *next;
};
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