summaryrefslogtreecommitdiff
path: root/nuttx/fs/fs_mount.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-15 17:51:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-15 17:51:30 +0000
commit8b265a45d9b5d840b563321941c632bd3b2c3963 (patch)
tree35172ca6e0c8bc762e6ee6588589e6ef2a5d350d /nuttx/fs/fs_mount.c
parent9f4ec53da93776bfcf221a699317c59a13782d7e (diff)
downloadpx4-nuttx-8b265a45d9b5d840b563321941c632bd3b2c3963.tar.gz
px4-nuttx-8b265a45d9b5d840b563321941c632bd3b2c3963.tar.bz2
px4-nuttx-8b265a45d9b5d840b563321941c632bd3b2c3963.zip
Add QE support to STM32F4Discovery; add a test of the quadrature encoder driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4395 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/fs_mount.c')
-rw-r--r--nuttx/fs/fs_mount.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/nuttx/fs/fs_mount.c b/nuttx/fs/fs_mount.c
index 803f4e797..d2e0dc961 100644
--- a/nuttx/fs/fs_mount.c
+++ b/nuttx/fs/fs_mount.c
@@ -1,8 +1,8 @@
/****************************************************************************
* fs/fs_mount.c
*
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -193,9 +193,9 @@ mount_findfs(FAR const struct fsmap_t *fstab, FAR const char *filesystemtype)
*
****************************************************************************/
-int mount(const char *source, const char *target,
- const char *filesystemtype, unsigned long mountflags,
- const void *data)
+int mount(FAR const char *source, FAR const char *target,
+ FAR const char *filesystemtype, unsigned long mountflags,
+ FAR const void *data)
{
#if defined(BDFS_SUPPORT) || defined(NONBDFS_SUPPORT)
#ifdef BDFS_SUPPORT
@@ -205,7 +205,7 @@ int mount(const char *source, const char *target,
FAR const struct mountpt_operations *mops;
void *fshandle;
int errcode;
- int status;
+ int ret;
/* Verify required pointer arguments */
@@ -222,11 +222,11 @@ int mount(const char *source, const char *target,
/* Find the block driver */
- status = find_blockdriver(source, mountflags, &blkdrvr_inode);
- if (status < 0)
+ ret = find_blockdriver(source, mountflags, &blkdrvr_inode);
+ if (ret < 0)
{
fdbg("Failed to find block driver %s\n", source);
- errcode = -status;
+ errcode = -ret;
goto errout;
}
}
@@ -244,20 +244,24 @@ int mount(const char *source, const char *target,
goto errout;
}
- /* Insert a dummy node -- we need to hold the inode semaphore
+ /* Insert a dummy node -- we need to hold the inode semaphore
* to do this because we will have a momentarily bad structure.
*/
inode_semtake();
- mountpt_inode = inode_reserve(target);
- if (!mountpt_inode)
+ ret = inode_reserve(target, &mountpt_inode);
+ if (ret < 0)
{
/* inode_reserve can fail for a couple of reasons, but the most likely
- * one is that the inode already exists.
+ * one is that the inode already exists. inode_reserve may return:
+ *
+ * -EINVAL - 'path' is invalid for this operation
+ * -EEXIST - An inode already exists at 'path'
+ * -ENOMEM - Failed to allocate in-memory resources for the operation
*/
fdbg("Failed to reserve inode\n");
- errcode = EBUSY;
+ errcode = -ret;
goto errout_with_semaphore;
}
@@ -289,18 +293,18 @@ int mount(const char *source, const char *target,
/* On failure, the bind method returns -errorcode */
#ifdef BDFS_SUPPORT
- status = mops->bind(blkdrvr_inode, data, &fshandle);
+ ret = mops->bind(blkdrvr_inode, data, &fshandle);
#else
- status = mops->bind(NULL, data, &fshandle);
+ ret = mops->bind(NULL, data, &fshandle);
#endif
- if (status != 0)
+ if (ret != 0)
{
/* The inode is unhappy with the blkdrvr for some reason. Back out
* the count for the reference we failed to pass and exit with an
* error.
*/
- fdbg("Bind method failed: %d\n", status);
+ fdbg("Bind method failed: %d\n", ret);
#ifdef BDFS_SUPPORT
#ifdef NONBDFS_SUPPORT
if (blkdrvr_inode)
@@ -309,7 +313,7 @@ int mount(const char *source, const char *target,
blkdrvr_inode->i_crefs--;
}
#endif
- errcode = -status;
+ errcode = -ret;
goto errout_with_mountpt;
}