summaryrefslogtreecommitdiff
path: root/nuttx/fs/vfs/fs_unlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/fs/vfs/fs_unlink.c')
-rw-r--r--nuttx/fs/vfs/fs_unlink.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/nuttx/fs/vfs/fs_unlink.c b/nuttx/fs/vfs/fs_unlink.c
index 6a294196b..fae0b59b0 100644
--- a/nuttx/fs/vfs/fs_unlink.c
+++ b/nuttx/fs/vfs/fs_unlink.c
@@ -161,6 +161,26 @@ int unlink(FAR const char *pathname)
goto errout_with_inode;
}
+ /* Notify the character driver that it has been unlinked. If
+ * there are no open references to the driver instance, then the
+ * driver should clean release all resources because it is no
+ * longer accessible.
+ */
+
+ if (INODE_IS_DRIVER(inode) && inode->u.i_ops->unlink)
+ {
+ /* The value passed to the driver is the same value that was
+ * provided to register_driver();
+ */
+
+ ret = inode->u.i_ops->unlink(inode->i_private);
+ if (ret < 0)
+ {
+ errcode = -ret;
+ goto errout_with_inode;
+ }
+ }
+
/* Remove the old inode. Because we hold a reference count on the
* inode, it will not be deleted now. It will be deleted when all
* of the references to to the inode have been released (perhaps