ZestCode
 
Loading...
Searching...
No Matches
vfs.h
Go to the documentation of this file.
1
15
16#pragma once
17
18#include <errno.h>
19#include <stdint.h>
20#include <sys/stat.h>
21#include <unistd.h>
22
23struct fs_driver {
24 ssize_t (*read_r)(struct _reent*, void* const, uint8_t*, const size_t);
25 int (*write_r)(struct _reent*, void* const, const uint8_t*, const size_t);
26 int (*close_r)(struct _reent*, void* const);
27 int (*fstat_r)(struct _reent*, void* const, struct stat*);
28 int (*isatty_r)(struct _reent*, void* const);
29 off_t (*lseek_r)(struct _reent*, void* const, off_t, int);
30 int (*ctl)(void* const, const uint32_t, void* const);
31};
32
33struct file_entry {
34 struct fs_driver const* driver;
35 void* arg;
36};
37
38// adds an entry to the file table
39int vfs_add_entry_r(struct _reent* r, struct fs_driver const* const driver, void* arg);
40
41// update an entry to the file table. Returns -1 if there was an error.
42// If driver is NULL, then the driver isn't updated. If arg is (void*)-1, then
43// the arg isn't updated.
44int vfs_update_entry(int file, struct fs_driver const* const driver, void* arg);
Definition vfs.h:33
Definition vfs.h:23