mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 05:38:21 +00:00
vfs and tmpfs read
This commit is contained in:
+29
-5
@@ -60,11 +60,15 @@ int vfs_write(int* error, vnode_t* node, void* buff, size_t count, size_t offset
|
||||
|
||||
int type = GETTYPE(node->st.st_mode);
|
||||
|
||||
if(type == TYPE_DIR || type == TYPE_LINK)
|
||||
return EINVAL;
|
||||
|
||||
if(type == TYPE_BLOCKDEV || type == TYPE_CHARDEV)
|
||||
return ENOSYS; // TODO change this when the device manager is implemented :)
|
||||
if(type == TYPE_DIR || type == TYPE_LINK){
|
||||
*error = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(type == TYPE_BLOCKDEV || type == TYPE_CHARDEV){
|
||||
*error = ENOSYS;
|
||||
return -1; // TODO change this when the device manager is implemented :)
|
||||
}
|
||||
|
||||
int writecount = node->fs->calls->write(error, node, buff, count, offset);
|
||||
|
||||
@@ -72,6 +76,26 @@ int vfs_write(int* error, vnode_t* node, void* buff, size_t count, size_t offset
|
||||
|
||||
}
|
||||
|
||||
int vfs_read(int* error, vnode_t* node, void* buff, size_t count, size_t offset){
|
||||
|
||||
int type = GETTYPE(node->st.st_mode);
|
||||
|
||||
if(type == TYPE_DIR || type == TYPE_LINK){
|
||||
*error = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(type == TYPE_BLOCKDEV || type == TYPE_CHARDEV){
|
||||
*error = ENOSYS;
|
||||
return -1; // TODO change this when the device manager is implemented :)
|
||||
}
|
||||
|
||||
int readcount = node->fs->calls->read(error, node, buff, count, offset);
|
||||
|
||||
return readcount;
|
||||
|
||||
}
|
||||
|
||||
int vfs_close(vnode_t* node){
|
||||
|
||||
vfs_releasenode(node);
|
||||
|
||||
Reference in New Issue
Block a user