diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-01-31 13:19:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-01-31 13:19:23 -0600 |
commit | a06ac7bb2b2c7efcd7ac3c367b668f7579797f97 (patch) | |
tree | 165668b4885e3511876c619fd9a7c8c686c74324 /nuttx/fs | |
parent | 61ee96ebe4e94111fd8ed2c49fd38b0b9b5b859e (diff) | |
download | nuttx-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.c | 24 |
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; |