lib: fs: implement mounting filesystems; reading, writing from files

This commit is contained in:
2026-03-10 19:15:26 +00:00
parent aef0163017
commit 6d88cf4bf3
14 changed files with 393 additions and 41 deletions

View File

@@ -5,11 +5,31 @@
#include <stddef.h>
struct fs_file;
struct xpc_buffer;
struct fs_file_ops {
ssize_t (*f_read)(struct fs_file *, void *, size_t);
ssize_t (*f_write)(struct fs_file *, const void *, size_t);
off_t (*f_seek)(struct fs_file *, off_t, int);
enum fs_status (*f_read)(
struct fs_file *,
struct xpc_buffer *,
size_t,
off_t *);
enum fs_status (*f_write)(
struct fs_file *,
const struct xpc_buffer *,
size_t,
off_t *);
enum fs_status (*f_seek)(struct fs_file *, off_t, int);
};
extern struct fs_inode *fs_file_get_inode(const struct fs_file *f);
extern size_t fs_file_get_cursor(const struct fs_file *f);
extern enum fs_status fs_file_read(
struct fs_file *f,
struct xpc_buffer *buf,
size_t count);
extern enum fs_status fs_file_write(
struct fs_file *f,
struct xpc_buffer *buf,
size_t count);
#endif