mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 06:18:40 +08:00
fs_lock/pathbuffer:Optimize code structure
Summary: Adjust code logic Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
parent
36a8ff0540
commit
271f76590f
2 changed files with 7 additions and 7 deletions
|
@ -610,7 +610,7 @@ out:
|
|||
|
||||
out_free:
|
||||
lib_put_pathbuffer(path);
|
||||
return OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -756,7 +756,7 @@ void file_closelk(FAR struct file *filep)
|
|||
bool deleted = false;
|
||||
int ret;
|
||||
|
||||
if (filep->locked == false)
|
||||
if (!filep->locked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ void file_closelk(FAR struct file *filep)
|
|||
* it.
|
||||
*/
|
||||
|
||||
goto out;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
nxmutex_lock(&g_protect_lock);
|
||||
|
@ -783,7 +783,6 @@ void file_closelk(FAR struct file *filep)
|
|||
{
|
||||
/* There is no bucket here, so we don't need to free it. */
|
||||
|
||||
nxmutex_unlock(&g_protect_lock);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -807,8 +806,9 @@ void file_closelk(FAR struct file *filep)
|
|||
file_lock_delete_bucket(bucket, path);
|
||||
}
|
||||
|
||||
nxmutex_unlock(&g_protect_lock);
|
||||
out:
|
||||
nxmutex_unlock(&g_protect_lock);
|
||||
out_free:
|
||||
lib_put_pathbuffer(path);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
|
||||
struct pathbuffer_s
|
||||
{
|
||||
mutex_t lock; /* Lock for the buffer */
|
||||
int free_bitmap; /* Bitmap of free buffer */
|
||||
mutex_t lock; /* Lock for the buffer */
|
||||
unsigned int free_bitmap; /* Bitmap of free buffer */
|
||||
char buffer[CONFIG_LIBC_MAX_PATHBUFFER][PATH_MAX];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue