24 lines
1.1 KiB
Markdown
24 lines
1.1 KiB
Markdown
|
---
|
||
|
title: "ramfs.h"
|
||
|
summary: "specific driver for RAMFS"
|
||
|
---
|
||
|
|
||
|
**Warning:** This is a filesystem specific driver, by this it should only be accessed by the [vfs](https://nerdcult.net/projects/noxos/docs/codebase/drivers/fs/vfs.h/).
|
||
|
|
||
|
The ramfs (ram-filesystem) is not a filesystem in the common sense.
|
||
|
All data that is stored in ramfs is stored in the virtual file systems cache.
|
||
|
This means that all data in ramfs is temporary and erased after a reboot.
|
||
|
|
||
|
# `ramfs_file_delete(node)` - function (void)
|
||
|
Frees the files cache space. This won't delete the node in the vfs.
|
||
|
|
||
|
# `ramfs_file_write(node, size, buffer_in)` - function (void)
|
||
|
If this file has some cache space allocated, it will be freed.
|
||
|
Then there will be some cache space (**_size_** bytes) allocated and **_size_** bytes from **_buffer_in_** copied into the cache.
|
||
|
|
||
|
This use of the vfs cache isn't a great solution and should be reworked.
|
||
|
|
||
|
# `ramfs_file_read(node, size, buffer_out)` - function (void)
|
||
|
Copies **_size_** bytes from the files' cache to **_buffer_out_**.
|
||
|
This won't copy more bytes than the allocated cache space is big.
|