Minor file system clean-up

This commit is contained in:
Gregory Nutt
2015-06-18 10:16:49 -06:00
parent ed9c45bcef
commit 8293a5e773
10 changed files with 39 additions and 24 deletions
+2 -2
View File
@@ -203,7 +203,7 @@ int foreach_inode(foreach_inode_t handler, FAR void *arg)
/* Start the recursion at the root inode */
inode_semtake();
ret = foreach_inodelevel(root_inode, info);
ret = foreach_inodelevel(g_root_inode, info);
inode_semgive();
/* Free the info structure and return the result */
@@ -224,7 +224,7 @@ int foreach_inode(foreach_inode_t handler, FAR void *arg)
/* Start the recursion at the root inode */
inode_semtake();
ret = foreach_inodelevel(root_inode, &info);
ret = foreach_inodelevel(g_root_inode, &info);
inode_semgive();
return ret;
+5 -3
View File
@@ -82,7 +82,7 @@ static struct inode_sem_s g_inode_sem;
* Public Variables
****************************************************************************/
FAR struct inode *root_inode = NULL;
FAR struct inode *g_root_inode = NULL;
/****************************************************************************
* Private Functions
@@ -290,7 +290,7 @@ FAR struct inode *inode_search(FAR const char **path,
FAR const char **relpath)
{
FAR const char *name = *path + 1; /* Skip over leading '/' */
FAR struct inode *node = root_inode;
FAR struct inode *node = g_root_inode;
FAR struct inode *left = NULL;
FAR struct inode *above = NULL;
@@ -396,7 +396,9 @@ FAR struct inode *inode_search(FAR const char **path,
void inode_free(FAR struct inode *node)
{
if (node)
/* Verify that we were passed valid pointer to an inode */
if (node != NULL)
{
inode_free(node->i_peer);
inode_free(node->i_child);
+7 -2
View File
@@ -93,9 +93,14 @@ void inode_release(FAR struct inode *node)
if (node->i_crefs <= 0 && (node->i_flags & FSNODEFLAG_DELETED) != 0)
{
/* If the inode has been properly unlinked, then the peer pointer
* should be NULL.
*/
inode_semgive();
inode_free(node->i_child);
kmm_free(node);
DEBUGASSERT(node->i_peer == NULL);
inode_free(node);
}
else
{
+6 -4
View File
@@ -120,7 +120,7 @@ FAR struct inode *inode_unlink(FAR const char *path)
else
{
root_inode = node->i_peer;
g_root_inode = node->i_peer;
}
node->i_peer = NULL;
@@ -167,10 +167,12 @@ int inode_remove(FAR const char *path)
}
else
{
/* And delete it now -- recursively to delete all of its children */
/* And delete it now -- recursively to delete all of its children.
* Since it has been unlinked, then the peer pointer should be NULL.
*/
inode_free(node->i_child);
kmm_free(node);
DEBUGASSERT(node->i_peer == NULL);
inode_free(node);
return OK;
}
}
+2 -2
View File
@@ -132,8 +132,8 @@ static void inode_insert(FAR struct inode *node,
else
{
node->i_peer = root_inode;
root_inode = node;
node->i_peer = g_root_inode;
g_root_inode = node;
}
}
+1 -1
View File
@@ -123,7 +123,7 @@ extern "C"
#define EXTERN extern
#endif
EXTERN FAR struct inode *root_inode;
EXTERN FAR struct inode *g_root_inode;
/****************************************************************************
* Public Function Prototypes