summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-01-31 13:19:23 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-01-31 13:19:23 -0600
commita06ac7bb2b2c7efcd7ac3c367b668f7579797f97 (patch)
tree165668b4885e3511876c619fd9a7c8c686c74324 /nuttx/fs
parent61ee96ebe4e94111fd8ed2c49fd38b0b9b5b859e (diff)
downloadnuttx-a06ac7bb2b2c7efcd7ac3c367b668f7579797f97.tar.gz
nuttx-a06ac7bb2b2c7efcd7ac3c367b668f7579797f97.tar.bz2
nuttx-a06ac7bb2b2c7efcd7ac3c367b668f7579797f97.zip
Add an unlink method to block driver interface. Same motivataion as for the same modification to the character driver interface
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/vfs/fs_unlink.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/nuttx/fs/vfs/fs_unlink.c b/nuttx/fs/vfs/fs_unlink.c
index fae0b59b0..abd774d98 100644
--- a/nuttx/fs/vfs/fs_unlink.c
+++ b/nuttx/fs/vfs/fs_unlink.c
@@ -161,19 +161,27 @@ 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.
+ /* Notify the driver that it has been unlinked. If there are no
+ * open references to the driver instance, then the driver should
+ * 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();
- */
+ /* Notify the character driver that it has been unlinked */
- ret = inode->u.i_ops->unlink(inode->i_private);
+ ret = inode->u.i_ops->unlink(inode);
+ if (ret < 0)
+ {
+ errcode = -ret;
+ goto errout_with_inode;
+ }
+ }
+ else if (INODE_IS_BLOCK(inode) && inode->u.i_bops->unlink)
+ {
+ /* Notify the block driver that it has been unlinked */
+
+ ret = inode->u.i_bops->unlink(inode);
if (ret < 0)
{
errcode = -ret;