aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/include
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-03-08 12:16:48 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-03-08 12:16:48 +0100
commit5e3d036d3a10d919e54035b1365005f26886ed75 (patch)
treeca6b2057457603abd4339f918a8879fb4dc4957b /src/kernel/include
parent3995fb8aee32783d3386d82a5a6910a86c7bf38c (diff)
downloadkogata-5e3d036d3a10d919e54035b1365005f26886ed75.tar.gz
kogata-5e3d036d3a10d919e54035b1365005f26886ed75.zip
Change VFS a bit in preparation for IPC code : ...
Handles now have a copy of data and ops, and may reference a null node in the case of an IPC channel.
Diffstat (limited to 'src/kernel/include')
-rw-r--r--src/kernel/include/prng.h2
-rw-r--r--src/kernel/include/vfs.h9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/kernel/include/prng.h b/src/kernel/include/prng.h
index 0a9e036..4321ada 100644
--- a/src/kernel/include/prng.h
+++ b/src/kernel/include/prng.h
@@ -1,3 +1,5 @@
+#pragma once
+
#include <stdint.h>
#include <stddef.h>
diff --git a/src/kernel/include/vfs.h b/src/kernel/include/vfs.h
index a34681b..90944b2 100644
--- a/src/kernel/include/vfs.h
+++ b/src/kernel/include/vfs.h
@@ -40,15 +40,22 @@ struct fs;
struct fs_node;
typedef struct user_region user_region_t;
+typedef struct fs_node_ops fs_node_ops_t;
// -------------------------------------------
// Structure defining a handle to an open file
// This structure is entirely managed by the VFS, the underlying filesystem does not see it
+// For IPC structures (sockets, channels), fs and node are null because the handle does not reference
+// an underlying object. The ops and data fields are filled in by the IPC code with corresponding
+// data structures. All VFS calls are done on ops and data as specified in the handle and not the node.
typedef struct fs_handle {
struct fs *fs;
struct fs_node *node;
+ fs_node_ops_t *ops;
+ fs_node_ptr data;
+
int refs;
int mode;
@@ -74,7 +81,7 @@ typedef struct fs_handle {
// - dispose() is not called on the root node when a filesystem is shutdown
// - delete() is not expected to delete recursively : it should fail on a non-empty directory
-typedef struct {
+typedef struct fs_node_ops {
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);