aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/devfs.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/fs/devfs.c b/sys/fs/devfs.c
index d7944aa..7fcdbad 100644
--- a/sys/fs/devfs.c
+++ b/sys/fs/devfs.c
@@ -178,6 +178,26 @@ vop_open(struct vnode *vp)
}
static int
+vop_close(struct vnode *vp)
+{
+ struct device_node *node;
+ struct device *dev;
+
+ if (vp == NULL) {
+ return -EIO;
+ }
+
+ node = vp->data;
+ dev = device_fetch(node->major, node->minor);
+
+ if (dev->close == NULL) {
+ return -EIO;
+ }
+
+ return dev->close(dev);
+}
+
+static int
devfs_init(struct fs_info *info, struct vnode *source)
{
if (source != NULL)
@@ -270,5 +290,6 @@ struct vfsops g_devfs_ops = {
struct vops g_devfs_vops = {
.vget = vop_vget,
.read = vop_read,
- .open = vop_open
+ .open = vop_open,
+ .close = vop_close
};