summaryrefslogtreecommitdiff
path: root/nuttx/fs/fs_close.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-05-20 16:54:09 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-05-20 16:54:09 +0000
commit80c8fab4acd3dcdd301d39db7d16d2e5993c76af (patch)
tree354938cc1e1fe6a272a1832c8167cbe93947f656 /nuttx/fs/fs_close.c
parent030a08da229d9c7a409c48fa7be3ff7f0177ece6 (diff)
downloadpx4-nuttx-80c8fab4acd3dcdd301d39db7d16d2e5993c76af.tar.gz
px4-nuttx-80c8fab4acd3dcdd301d39db7d16d2e5993c76af.tar.bz2
px4-nuttx-80c8fab4acd3dcdd301d39db7d16d2e5993c76af.zip
fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@236 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/fs_close.c')
-rw-r--r--nuttx/fs/fs_close.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/nuttx/fs/fs_close.c b/nuttx/fs/fs_close.c
index 74f5e831b..97444c2f2 100644
--- a/nuttx/fs/fs_close.c
+++ b/nuttx/fs/fs_close.c
@@ -1,4 +1,4 @@
-/************************************************************
+/****************************************************************************
* fs_close.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
@@ -45,9 +45,9 @@
#include <nuttx/fs.h>
#include "fs_internal.h"
-/************************************************************
+/****************************************************************************
* Global Functions
- ************************************************************/
+ ****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
@@ -71,18 +71,21 @@ int close(int fd)
{
int ret = OK;
- /* Close the driver. NOTES: (1) there is no semaphore protection
- * here, the driver must be able to handle concurrent close and
- * open operations. (2) The driver may have been opened numerous
- * times (for different file descriptors) and must also handle
- * being closed numerous times.
+ /* Close the driver or mountpoint. NOTES: (1) there is no
+ * exclusion mechanism here , the driver or mountpoint must be
+ * able to handle concurrent operations internally, (2) The driver
+ * may have been opened numerous times (for different file
+ * descriptors) and must also handle being closed numerous times.
+ * (3) for the case of the mountpoint, we depend on the close
+ * methods bing identical in signal and position in the operations
+ * vtable.
*/
if (inode->u.i_ops && inode->u.i_ops->close)
{
/* Perform the close operation (by the driver) */
- int status = inode->u.i_ops->close(fd);
+ int status = inode->u.i_ops->close(&list->fl_files[fd]);
if (status < 0)
{
/* An error occurred while closing the driver */
@@ -96,7 +99,9 @@ int close(int fd)
files_release(fd);
- /* Then remove the inode, eliminating the name from the namespace */
+ /* Decrement the reference count on the inode. This may remove the inode and
+ * eliminate the name from the namespace
+ */
inode_release(inode);
return ret;