aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user/vfs.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-20 15:00:51 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-20 15:00:51 +0100
commit2d4d64189501c253ed6a5b5ff5e27da1cb34407a (patch)
tree488ed008de322f0ffbfd1efdaec2041811b41a1c /src/kernel/user/vfs.c
parent13db03fcc4a476c8881ccafe0852e72410c67b3a (diff)
downloadkogata-2d4d64189501c253ed6a5b5ff5e27da1cb34407a.tar.gz
kogata-2d4d64189501c253ed6a5b5ff5e27da1cb34407a.zip
Think a bit ; ioctls only on open file descriptors.
Diffstat (limited to 'src/kernel/user/vfs.c')
-rw-r--r--src/kernel/user/vfs.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/kernel/user/vfs.c b/src/kernel/user/vfs.c
index 31f162a..a5f03ca 100644
--- a/src/kernel/user/vfs.c
+++ b/src/kernel/user/vfs.c
@@ -354,18 +354,6 @@ bool fs_stat(fs_t *fs, const char* file, stat_t *st) {
return ret;
}
-int fs_ioctl(fs_t *fs, const char* file, int command, void* data) {
- fs_node_t* n = fs_walk_path(&fs->root, file);
- if (n == 0) return -1;
-
- mutex_lock(&n->lock);
- int ret = (n->ops->ioctl ? n->ops->ioctl(n->data, command, data) : -1);
- mutex_unlock(&n->lock);
-
- unref_fs_node(n);
- return ret;
-}
-
// =================== //
// OPERATIONS ON FILES //
// =================== //
@@ -446,10 +434,9 @@ bool file_stat(fs_handle_t *f, stat_t *st) {
int file_ioctl(fs_handle_t *f, int command, void* data) {
if (!(f->mode & FM_IOCTL)) return -1;
- int ret = -1;
- if (f->node->ops->ioctl) ret = f->node->ops->ioctl(f->node->data, command, data);
+ if (f->ops->ioctl == 0) return -1;
- return ret;
+ return f->ops->ioctl(f->data, command, data);
}
bool file_readdir(fs_handle_t *f, dirent_t *d) {