fs/inode: replace some global variables to macro

replace to macro will help to extend the scheduling implementation

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-03-20 16:47:06 +08:00 committed by Xiang Xiao
parent feb6ede434
commit 0f0c370520
4 changed files with 6 additions and 4 deletions

View File

@ -187,7 +187,7 @@ int foreach_inode(foreach_inode_t handler, FAR void *arg)
ret = inode_lock();
if (ret >= 0)
{
ret = foreach_inodelevel(g_root_inode->i_child, info);
ret = foreach_inodelevel(inode_root()->i_child, info);
inode_unlock();
}
@ -211,7 +211,7 @@ int foreach_inode(foreach_inode_t handler, FAR void *arg)
ret = inode_lock();
if (ret >= 0)
{
ret = foreach_inodelevel(g_root_inode->i_child, &info);
ret = foreach_inodelevel(inode_root()->i_child, &info);
inode_unlock();
}

View File

@ -141,7 +141,7 @@ static void inode_insert(FAR struct inode *node,
void inode_root_reserve(void)
{
g_root_inode = inode_alloc("", 0777);
inode_root() = inode_alloc("", 0777);
}
/****************************************************************************

View File

@ -214,7 +214,7 @@ static int _inode_linktarget(FAR struct inode *node,
static int _inode_search(FAR struct inode_search_s *desc)
{
FAR const char *name;
FAR struct inode *node = g_root_inode;
FAR struct inode *node = inode_root();
FAR struct inode *left = NULL;
FAR struct inode *above = NULL;
FAR const char *relpath = NULL;

View File

@ -65,6 +65,8 @@
} \
while (0)
#define inode_root() g_root_inode
/****************************************************************************
* Public Types
****************************************************************************/