diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-07-07 13:22:53 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-11-11 00:08:15 +0100 |
| commit | 7861a52adf92a083bb2aed4c35f98d8035dce032 (patch) | |
| tree | 28cd3c40e4c878f730f5df3c1d93bdf91af490c3 /src/fs/ramfs | |
| parent | 7fc48e9216ff809da5f8055a50b0be17628ef1df (diff) | |
| download | wnix-7861a52adf92a083bb2aed4c35f98d8035dce032.tar.gz | |
Setup project skeleton
Diffstat (limited to 'src/fs/ramfs')
| -rw-r--r-- | src/fs/ramfs/CMakeLists.txt | 20 | ||||
| -rw-r--r-- | src/fs/ramfs/include/ramfs.h | 43 | ||||
| -rw-r--r-- | src/fs/ramfs/private_include/ramfs/types.h | 31 | ||||
| -rw-r--r-- | src/fs/ramfs/src/CMakeLists.txt | 29 | ||||
| -rw-r--r-- | src/fs/ramfs/src/close.c | 25 | ||||
| -rw-r--r-- | src/fs/ramfs/src/flags.c | 25 | ||||
| -rw-r--r-- | src/fs/ramfs/src/free.c | 31 | ||||
| -rw-r--r-- | src/fs/ramfs/src/mkdir.c | 79 | ||||
| -rw-r--r-- | src/fs/ramfs/src/mknod.c | 87 | ||||
| -rw-r--r-- | src/fs/ramfs/src/mount.c | 69 | ||||
| -rw-r--r-- | src/fs/ramfs/src/open.c | 26 | ||||
| -rw-r--r-- | src/fs/ramfs/src/read.c | 26 | ||||
| -rw-r--r-- | src/fs/ramfs/src/search.c | 143 | ||||
| -rw-r--r-- | src/fs/ramfs/src/stat.c | 53 | ||||
| -rw-r--r-- | src/fs/ramfs/src/write.c | 26 |
15 files changed, 713 insertions, 0 deletions
diff --git a/src/fs/ramfs/CMakeLists.txt b/src/fs/ramfs/CMakeLists.txt new file mode 100644 index 0000000..477e8a7 --- /dev/null +++ b/src/fs/ramfs/CMakeLists.txt @@ -0,0 +1,20 @@ +# 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 <https://www.gnu.org/licenses/>. + +add_library(ramfs) +add_subdirectory(src) +target_include_directories(ramfs PUBLIC include PRIVATE private_include) +target_link_libraries(ramfs PUBLIC state c PRIVATE fs drv) diff --git a/src/fs/ramfs/include/ramfs.h b/src/fs/ramfs/include/ramfs.h new file mode 100644 index 0000000..74160e1 --- /dev/null +++ b/src/fs/ramfs/include/ramfs.h @@ -0,0 +1,43 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#ifndef RAMFS_H +#define RAMFS_H + +#include <fs/fs.h> +#include <fs/inode.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <stddef.h> + +struct ramfs *ramfs_mount(const struct fs_mount *m, struct fs_ret *r); +int ramfs_mkdir(const struct fs_mkdir *m, struct ramfs *rfs, + const union inode_result *i, struct fs_ret *r); +int ramfs_open(const struct fs_open *o, struct inode *i, struct fs_ret *r); +int ramfs_read(const struct fs_read *r, struct fs_ret *ret); +int ramfs_write(const struct fs_write *w, struct fs_ret *r); +int ramfs_stat(const struct fs_stat *s, const struct ramfs *rfs, + const union inode_result *inode, struct fs_ret *r); +int ramfs_close(struct fs_fd *fd); +int ramfs_search(const char *path, const struct ramfs *rfs, + union inode_result *inode, struct fs_ret *r); +int ramfs_flags(const union inode_result *i); +int ramfs_mknod(const char *node, mode_t mode, dev_t dev, struct ramfs *rfs); +void ramfs_free(struct ramfs *rfs); + +#endif diff --git a/src/fs/ramfs/private_include/ramfs/types.h b/src/fs/ramfs/private_include/ramfs/types.h new file mode 100644 index 0000000..9be5899 --- /dev/null +++ b/src/fs/ramfs/private_include/ramfs/types.h @@ -0,0 +1,31 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#ifndef RAMFS_TYPES_H +#define RAMFS_TYPES_H + +#include <fs/fs.h> +#include <fs/inode.h> + +struct ramfs +{ + struct inode *root; + ino_t ino; +}; + +#endif diff --git a/src/fs/ramfs/src/CMakeLists.txt b/src/fs/ramfs/src/CMakeLists.txt new file mode 100644 index 0000000..a35e23e --- /dev/null +++ b/src/fs/ramfs/src/CMakeLists.txt @@ -0,0 +1,29 @@ +# 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 <https://www.gnu.org/licenses/>. + +target_sources(ramfs PRIVATE + close.c + free.c + flags.c + mount.c + mkdir.c + mknod.c + open.c + stat.c + read.c + search.c + write.c +) diff --git a/src/fs/ramfs/src/close.c b/src/fs/ramfs/src/close.c new file mode 100644 index 0000000..5243a77 --- /dev/null +++ b/src/fs/ramfs/src/close.c @@ -0,0 +1,25 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <fs/fs.h> + +int ramfs_close(struct fs_fd *const fd) +{ + return -1; +} diff --git a/src/fs/ramfs/src/flags.c b/src/fs/ramfs/src/flags.c new file mode 100644 index 0000000..7f51b81 --- /dev/null +++ b/src/fs/ramfs/src/flags.c @@ -0,0 +1,25 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <fs/inode.h> + +int ramfs_flags(const union inode_result *const i) +{ + return i->memi->flags; +} diff --git a/src/fs/ramfs/src/free.c b/src/fs/ramfs/src/free.c new file mode 100644 index 0000000..10fcbd6 --- /dev/null +++ b/src/fs/ramfs/src/free.c @@ -0,0 +1,31 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <ramfs/types.h> +#include <stddef.h> +#include <stdlib.h> + +void ramfs_free(struct ramfs *const r) +{ + if (!r) + return; + + inode_free(r->root); + free(r); +} diff --git a/src/fs/ramfs/src/mkdir.c b/src/fs/ramfs/src/mkdir.c new file mode 100644 index 0000000..f62984d --- /dev/null +++ b/src/fs/ramfs/src/mkdir.c @@ -0,0 +1,79 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <ramfs/types.h> +#include <fs/fs.h> +#include <fs/inode.h> +#include <state.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +static enum state done(void *const args) +{ + return STATE_OK; +} + +int ramfs_mkdir(const struct fs_mkdir *const m, struct ramfs *const rfs, + const union inode_result *const inode, struct fs_ret *const r) +{ + struct timespec ts; + struct inode *ni = NULL; + struct inode *const parent = inode->memi; + char *const name = strdup(m->path); + + if (!name + || clock_gettime(CLOCK_REALTIME, &ts) + || !(ni = malloc(sizeof *ni))) + goto failure; + + *ni = (const struct inode) + { + .name = name, + .mode = m->mode, + .uid = m->uid, + .gid = m->gid, + .flags = INODE_DIR, + .atim = ts, + .ctim = ts, + .mtim = ts, + .ino = rfs->ino++, + .parent = parent + }; + + if (!parent->child) + parent->child = ni; + else + for (struct inode *i = parent->child; i; i = i->right) + if (!i->right) + { + i->right = ni; + ni->left = i; + break; + } + + parent->atim = parent->mtim = ts; + *r = (const struct fs_ret){.f = done}; + return 0; + +failure: + free(ni); + free(name); + return -1; +} diff --git a/src/fs/ramfs/src/mknod.c b/src/fs/ramfs/src/mknod.c new file mode 100644 index 0000000..d142ab1 --- /dev/null +++ b/src/fs/ramfs/src/mknod.c @@ -0,0 +1,87 @@ + +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <ramfs/types.h> +#include <fs/inode.h> +#include <sys/types.h> +#include <errno.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +static struct inode *find(const char *const node, struct inode *const root) +{ + for (struct inode *c = root->child; c; c = c->right) + if (!strcmp(c->name, node)) + return c; + + return NULL; +} + +int ramfs_mknod(const char *const node, const mode_t mode, const dev_t dev, + struct ramfs *const rfs) +{ + struct inode *const r = rfs->root, + *const inode = find(node, r), + *newinode = NULL; + char *nodedup = NULL; + struct timespec ts; + + if (inode) + { + errno = EEXIST; + goto failure; + } + else if (clock_gettime(CLOCK_REALTIME, &ts) + || !(nodedup = strdup(node)) + || !(newinode = malloc(sizeof *newinode))) + goto failure; + + *newinode = (const struct inode) + { + .atim = ts, + .ctim = ts, + .mtim = ts, + .flags = INODE_BLOCKDEV, + .mode = mode, + .parent = rfs->root, + .name = nodedup + }; + + if (!r->child) + r->child = newinode; + else + for (struct inode *c = r->child; c; c = c->right) + if (!c->right) + { + c->right = newinode; + newinode->left = c; + break; + } + + r->atim = r->mtim = ts; + return 0; + +failure: + free(nodedup); + free(newinode); + return -1; +} diff --git a/src/fs/ramfs/src/mount.c b/src/fs/ramfs/src/mount.c new file mode 100644 index 0000000..567c2da --- /dev/null +++ b/src/fs/ramfs/src/mount.c @@ -0,0 +1,69 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <ramfs/types.h> +#include <fs/fs.h> +#include <state.h> +#include <sys/types.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +static enum state mount(void *const args) +{ + return STATE_OK; +} + +struct ramfs *ramfs_mount(const struct fs_mount *const m, + struct fs_ret *const r) +{ + struct ramfs *ret = NULL; + struct timespec ts; + char *const name = strdup("/"); + struct inode *root = NULL; + + if (!name + || clock_gettime(CLOCK_REALTIME, &ts) + || !(root = malloc(sizeof *root)) + || !(ret = malloc(sizeof *ret))) + goto failure; + + *root = (const struct inode) + { + .name = name, + .mode = m->mode, + .uid = m->uid, + .gid = m->gid, + .atim = ts, + .mtim = ts, + .ctim = ts + }; + + *ret = (const struct ramfs){.root = root}; + *r = (const struct fs_ret){.f = mount}; + ret->ino++; + return ret; + +failure: + free(root); + free(ret); + free(name); + return NULL; +} diff --git a/src/fs/ramfs/src/open.c b/src/fs/ramfs/src/open.c new file mode 100644 index 0000000..894b160 --- /dev/null +++ b/src/fs/ramfs/src/open.c @@ -0,0 +1,26 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <fs/fs.h> + +int ramfs_open(const struct fs_open *const o,struct inode *const i, + struct fs_ret *const r) +{ + return -1; +} diff --git a/src/fs/ramfs/src/read.c b/src/fs/ramfs/src/read.c new file mode 100644 index 0000000..cc96744 --- /dev/null +++ b/src/fs/ramfs/src/read.c @@ -0,0 +1,26 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <fs/fs.h> +#include <stddef.h> + +int ramfs_read(const struct fs_read *const r, struct fs_ret *const ret) +{ + return -1; +} diff --git a/src/fs/ramfs/src/search.c b/src/fs/ramfs/src/search.c new file mode 100644 index 0000000..24e2a98 --- /dev/null +++ b/src/fs/ramfs/src/search.c @@ -0,0 +1,143 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <ramfs/types.h> +#include <fs/fs.h> +#include <state.h> +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +struct search +{ + union inode_result *inode; + const struct ramfs *rfs; + struct fs_ret r, *pr; + const char *path; +}; + +static void free_search(struct search *const s) +{ + free(s); +} + +static int find_node(const char *const path, struct inode **const out, + size_t *const i) +{ + int ret = -1; + char *node; + struct inode *volatile const inode = *out; + + if (fs_next(path, &node, i)) + return -1; + else if (!strcmp(inode->name, node)) + { + if (*i >= strlen(path)) + { + free(node); + return 1; + } + + *out = inode->child; + } + else + { + bool found = false; + + for (struct inode *in = inode->right; in; in = in->right) + if (!strcmp(in->name, node)) + { + if (*i >= strlen(path)) + { + *out = in; + free(node); + return 1; + } + + *out = in->child; + found = true; + break; + } + + if (!found) + goto end; + } + + ret = 0; + +end: + free(node); + return ret; +} + +static enum state search(void *const args) +{ + enum state ret = STATE_FATAL; + struct search *const s = args; + struct inode *inode = s->rfs->root; + size_t i = 0; + + for (;;) + { + const int n = find_node(s->path, &inode, &i); + + if (n < 0) + goto end; + else if (n > 0) + break; + } + + s->inode->memi = inode; + *s->pr = s->r; + ret = STATE_AGAIN; + +end: + free_search(s); + return ret; +} + +int ramfs_search(const char *const path, const struct ramfs *const rfs, + union inode_result *const inode, struct fs_ret *const r) +{ + struct search *const s = malloc(sizeof *s); + + if (!s) + goto failure; + + *s = (const struct search) + { + .inode = inode, + .path = path, + .rfs = rfs, + .r = *r, + .pr = r + }; + + *r = (const struct fs_ret) + { + .f = search, + .args = s + }; + + return 0; + +failure: + free(s); + return -1; +} diff --git a/src/fs/ramfs/src/stat.c b/src/fs/ramfs/src/stat.c new file mode 100644 index 0000000..6bb1b23 --- /dev/null +++ b/src/fs/ramfs/src/stat.c @@ -0,0 +1,53 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <fs/fs.h> +#include <state.h> +#include <sys/stat.h> + +static enum state done(void *const args) +{ + return STATE_OK; +} + +int ramfs_stat(const struct fs_stat *const s, const struct ramfs *const rfs, + const union inode_result *const inode, struct fs_ret *const r) +{ + const struct inode *const i = inode->memi; + + *s->sb = (const struct stat) + { + .st_atim = i->atim, + .st_ctim = i->ctim, + .st_mtim = i->mtim, + .st_size = i->size, + .st_blksize = 1, + .st_ino = i->ino, + .st_uid = i->uid, + .st_gid = i->gid, + .st_mode = i->mode + }; + + *r = (const struct fs_ret) + { + .f = done + }; + + return 0; +} diff --git a/src/fs/ramfs/src/write.c b/src/fs/ramfs/src/write.c new file mode 100644 index 0000000..ca49c22 --- /dev/null +++ b/src/fs/ramfs/src/write.c @@ -0,0 +1,26 @@ +/* + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <ramfs.h> +#include <fs/fs.h> +#include <stddef.h> + +int ramfs_write(const struct fs_write *const w, struct fs_ret *const r) +{ + return -1; +} |
