aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/include/vfs.h
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-03-02 23:02:59 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-03-02 23:02:59 +0100
commite356371f09df87ebab2d7e3d816de1147768dfa9 (patch)
tree4932209fc8799bb63006c3ebb11b9a438ae34342 /src/kernel/include/vfs.h
parent969c8cacc50e8c39ddbc19e05f3f5b98c34bde01 (diff)
downloadkogata-e356371f09df87ebab2d7e3d816de1147768dfa9.tar.gz
kogata-e356371f09df87ebab2d7e3d816de1147768dfa9.zip
Change VFS interface : handles no longer visible to underlying FS.
Diffstat (limited to 'src/kernel/include/vfs.h')
-rw-r--r--src/kernel/include/vfs.h33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/kernel/include/vfs.h b/src/kernel/include/vfs.h
index 066211b..6372850 100644
--- a/src/kernel/include/vfs.h
+++ b/src/kernel/include/vfs.h
@@ -32,42 +32,25 @@
// - The VFS does not implement any locking mechanism on filesystems themselves (e.g. the add_source
// implementation must have its own locking system)
-typedef void* fs_handle_ptr;
typedef void* fs_node_ptr;
typedef void* fs_ptr;
// usefull forward declarations
struct fs;
struct fs_node;
-struct fs_handle;
typedef struct user_region user_region_t;
// -------------------------------------------
// Structure defining a handle to an open file
-
-typedef struct {
- // Standard read-write architecture
- size_t (*read)(fs_handle_ptr f, size_t offset, size_t len, char* buf);
- size_t (*write)(fs_handle_ptr f, size_t offset, size_t len, const char* buf);
- bool (*readdir)(fs_handle_ptr f, dirent_t *d);
- int (*ioctl)(fs_handle_ptr f, int command, void* data);
- void (*close)(fs_handle_ptr f);
- // Page cache architecture, must be implemented by all files opened with FM_MMAP
- uint32_t (*get_page)(fs_handle_ptr f, size_t offset);
- void (*commit_page)(fs_handle_ptr f, size_t offset, uint64_t time); // notifies change
-} fs_handle_ops_t;
+// This structure is entirely managed by the VFS, the underlying filesystem does not see it
typedef struct fs_handle {
- // These field are filled by the VFS's generic open() code
struct fs *fs;
struct fs_node *node;
int refs;
- // These fields are filled by the FS's specific open() code
- fs_handle_ops_t *ops;
- fs_handle_ptr data;
int mode;
} fs_handle_t;
@@ -89,8 +72,15 @@ typedef struct fs_handle {
// - delete() is not expected to delete recursively : it should fail on a non-empty directory
typedef struct {
- bool (*open)(fs_node_ptr n, int mode, fs_handle_t *s); // open current node
+ bool (*open)(fs_node_ptr n, int mode);
+ size_t (*read)(fs_node_ptr f, size_t offset, size_t len, char* buf);
+ size_t (*write)(fs_node_ptr f, size_t offset, size_t len, const char* buf);
+ bool (*readdir)(fs_node_ptr f, size_t ent_no, dirent_t *d);
+ void (*close)(fs_node_ptr f);
+
bool (*stat)(fs_node_ptr n, stat_t *st);
+ int (*ioctl)(fs_node_ptr f, int command, void* data);
+
bool (*walk)(fs_node_ptr n, const char* file, struct fs_node *node_d);
bool (*delete)(fs_node_ptr n, const char* file);
bool (*move)(fs_node_ptr dir, const char* old_name, struct fs_node *new_parent, const char *new_name);
@@ -180,9 +170,6 @@ bool file_stat(fs_handle_t *f, stat_t *st);
size_t file_read(fs_handle_t *f, size_t offset, size_t len, char* buf);
size_t file_write(fs_handle_t *f, size_t offset, size_t len, const char* buf);
int file_ioctl(fs_handle_t *f, int command, void* data);
-bool file_readdir(fs_handle_t *f, dirent_t *d);
-
-uint32_t file_get_page(fs_handle_t *f, size_t offset);
-void file_commit_page(fs_handle_t *f, size_t offset, uint64_t time);
+bool file_readdir(fs_handle_t *f, size_t ent_no, dirent_t *d);
/* vim: set ts=4 sw=4 tw=0 noet :*/