mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
fs_lock/pathbuffer:Optimize code structure
Summary: Adjust code logic Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
+5
-5
@@ -610,7 +610,7 @@ out:
|
|||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
lib_put_pathbuffer(path);
|
lib_put_pathbuffer(path);
|
||||||
return OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -756,7 +756,7 @@ void file_closelk(FAR struct file *filep)
|
|||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (filep->locked == false)
|
if (!filep->locked)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -774,7 +774,7 @@ void file_closelk(FAR struct file *filep)
|
|||||||
* it.
|
* it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
goto out;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
nxmutex_lock(&g_protect_lock);
|
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. */
|
/* There is no bucket here, so we don't need to free it. */
|
||||||
|
|
||||||
nxmutex_unlock(&g_protect_lock);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,8 +806,9 @@ void file_closelk(FAR struct file *filep)
|
|||||||
file_lock_delete_bucket(bucket, path);
|
file_lock_delete_bucket(bucket, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
nxmutex_unlock(&g_protect_lock);
|
|
||||||
out:
|
out:
|
||||||
|
nxmutex_unlock(&g_protect_lock);
|
||||||
|
out_free:
|
||||||
lib_put_pathbuffer(path);
|
lib_put_pathbuffer(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
struct pathbuffer_s
|
struct pathbuffer_s
|
||||||
{
|
{
|
||||||
mutex_t lock; /* Lock for the buffer */
|
mutex_t lock; /* Lock for the buffer */
|
||||||
int free_bitmap; /* Bitmap of free buffer */
|
unsigned int free_bitmap; /* Bitmap of free buffer */
|
||||||
char buffer[CONFIG_LIBC_MAX_PATHBUFFER][PATH_MAX];
|
char buffer[CONFIG_LIBC_MAX_PATHBUFFER][PATH_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user