summaryrefslogtreecommitdiff
path: root/nuttx/fs/fs_registerblockdriver.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_registerblockdriver.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_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);