devfs: enable writing to device files
This commit is contained in:
parent
2009a9adb7
commit
4e2d2d0f4e
2 changed files with 3 additions and 11 deletions
|
|
@ -94,6 +94,7 @@ struct fs *devfs_init()
|
|||
devfs->ops->open_dir = devfs_open_dir;
|
||||
|
||||
devfs->root->flags = VFS_VNO_DIR;
|
||||
devfs->root->fs = devfs;
|
||||
|
||||
int res = vfs_mount(devfs, "dev");
|
||||
|
||||
|
|
|
|||
13
fs/vfs.c
13
fs/vfs.c
|
|
@ -184,11 +184,7 @@ int vfs_close(struct file *file)
|
|||
|
||||
ssize_t vfs_write(struct file *file, void *buf, off_t off, size_t count)
|
||||
{
|
||||
/* TODO: implement */
|
||||
if (file->type == FTYPE_CHARDEV)
|
||||
return -EBADF;
|
||||
|
||||
if ((file->vnode->flags & VFS_VTYPE_MASK) != VFS_VNO_REG)
|
||||
if ((file->vnode->flags & VFS_VTYPE_MASK) == VFS_VNO_DIR)
|
||||
return -EISDIR;
|
||||
|
||||
return file->vnode->fs->ops->write(file->vnode, buf, off, count);
|
||||
|
|
@ -196,12 +192,7 @@ ssize_t vfs_write(struct file *file, void *buf, off_t off, size_t count)
|
|||
|
||||
ssize_t vfs_read(struct file *file, void *buf, off_t off, size_t count)
|
||||
{
|
||||
/* TODO: implement */
|
||||
if (file->type == FTYPE_CHARDEV)
|
||||
return -EBADF;
|
||||
|
||||
/* TODO: implement */
|
||||
if ((file->vnode->flags & VFS_VTYPE_MASK) != VFS_VNO_REG)
|
||||
if ((file->vnode->flags & VFS_VTYPE_MASK) == VFS_VNO_DIR)
|
||||
return -EISDIR;
|
||||
|
||||
if (off >= file->vnode->size)
|
||||
|
|
|
|||
Loading…
Reference in a new issue