aboutsummaryrefslogtreecommitdiff
path: root/nuttx/fs/fs_registerblockdriver.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-02-15 17:51:30 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-02-15 17:51:30 +0000
commit3625222c6c6acf678b730502f4b7e3016ae9fbf3 (patch)
tree35172ca6e0c8bc762e6ee6588589e6ef2a5d350d /nuttx/fs/fs_registerblockdriver.c
parenta1590c1424d6065ec21830a10a4d210f9fc8a299 (diff)
downloadpx4-firmware-3625222c6c6acf678b730502f4b7e3016ae9fbf3.tar.gz
px4-firmware-3625222c6c6acf678b730502f4b7e3016ae9fbf3.tar.bz2
px4-firmware-3625222c6c6acf678b730502f4b7e3016ae9fbf3.zip
Add QE support to STM32F4Discovery; add a test of the quadrature encoder driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4395 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/fs/fs_registerblockdriver.c')
-rw-r--r--nuttx/fs/fs_registerblockdriver.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/nuttx/fs/fs_registerblockdriver.c b/nuttx/fs/fs_registerblockdriver.c
index 248e3e2a7..bd5c08be4 100644
--- a/nuttx/fs/fs_registerblockdriver.c
+++ b/nuttx/fs/fs_registerblockdriver.c
@@ -1,8 +1,8 @@
/****************************************************************************
* fs/fs_registerblockdriver.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2009, 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
@@ -65,27 +65,45 @@
/****************************************************************************
* Name: register_driver
+ *
+ * Description:
+ * Register a block driver inode the pseudo file system.
+ *
+ * Input parameters:
+ * path - The path to the inode to create
+ * bops - The block driver operations structure
+ * mode - inmode priviledges (not used)
+ * priv - Private, user data that will be associated with the inode.
+ *
+ * Returned Value:
+ * Zero on success (with the inode point in 'inode'); A negated errno
+ * value is returned on a failure (all error values returned by
+ * inode_reserve):
+ *
+ * EINVAL - 'path' is invalid for this operation
+ * EEXIST - An inode already exists at 'path'
+ * ENOMEM - Failed to allocate in-memory resources for the operation
+ *
****************************************************************************/
-int register_blockdriver(const char *path,
- const struct block_operations *bops,
- mode_t mode, void *priv)
+int register_blockdriver(FAR const char *path,
+ FAR const struct block_operations *bops,
+ mode_t mode, FAR void *priv)
{
- struct inode *node;
- int ret = -ENOMEM;
+ FAR struct inode *node;
+ int ret;
- /* Insert an inode for the device driver -- we need to hold the inode semaphore
- * to prevent access to the tree while we this. This is because we will have a
- * momentarily bad true until we populate the inode with valid data.
+ /* Insert an inode for the device driver -- we need to hold the inode
+ * semaphore to prevent access to the tree while we this. This is because
+ * we will have a momentarily bad true until we populate the inode with
+ * valid data.
*/
inode_semtake();
- node = inode_reserve(path);
- if (node != NULL)
+ ret = inode_reserve(path, &node);
+ if (ret >= 0)
{
- /* We have it, now populate it with block driver specific
- * information.
- */
+ /* We have it, now populate it with block driver specific information. */
INODE_SET_BLOCK(node);