fs: Initialize g_inode_sem at the definition place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-03-12 03:56:57 +08:00 committed by Gustavo Henrique Nihei
parent 8b7d08f59a
commit dfb9a763a7

View File

@ -62,7 +62,10 @@ struct inode_sem_s
* Private Data
****************************************************************************/
static struct inode_sem_s g_inode_sem;
static struct inode_sem_s g_inode_sem =
{
SEM_INITIALIZER(1), NO_HOLDER, 0
};
/****************************************************************************
* Public Functions
@ -79,14 +82,6 @@ static struct inode_sem_s g_inode_sem;
void inode_initialize(void)
{
/* Initialize the semaphore to one (to support one-at-a-time access to the
* inode tree).
*/
nxsem_init(&g_inode_sem.sem, 0, 1);
g_inode_sem.holder = NO_HOLDER;
g_inode_sem.count = 0;
/* Reserve the root node */
inode_root_reserve();