Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos M
提交
7d9976cd
K
Kernel Liteos M
项目概览
OpenHarmony
/
Kernel Liteos M
大约 1 年 前同步成功
通知
20
Star
28
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos M
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d9976cd
编写于
5月 11, 2021
作者:
L
li_zan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add already opened file logic
上级
602c9f6d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
6 deletion
+6
-6
components/fs/littlefs/lfs_api.c
components/fs/littlefs/lfs_api.c
+5
-6
components/fs/littlefs/lfs_api.h
components/fs/littlefs/lfs_api.h
+1
-0
未找到文件。
components/fs/littlefs/lfs_api.c
浏览文件 @
7d9976cd
...
...
@@ -30,7 +30,6 @@
*/
#include "lfs_api.h"
#include "iCunit.h"
lfs_t
g_lfs
;
FileDirInfo
g_lfsDir
[
LFS_MAX_OPEN_DIRS
]
=
{
0
};
...
...
@@ -57,7 +56,7 @@ LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
g_handle
[
i
].
useFlag
=
1
;
g_handle
[
i
].
pathName
=
(
char
*
)
malloc
(
len
);
if
(
g_handle
[
i
].
pathName
)
{
memcpy_s
(
g_handle
[
i
].
pathName
,
len
,
fileName
,
len
);
memcpy_s
(
g_handle
[
i
].
pathName
,
LITTLE_FS_MAX_NAME_LEN
,
fileName
,
len
);
}
pthread_mutex_unlock
(
&
g_FslocalMutex
);
return
&
(
g_handle
[
i
]);
...
...
@@ -68,17 +67,17 @@ LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
return
NULL
;
}
bool
CheckFileIsOpen
(
const
char
*
fileName
)
BOOL
CheckFileIsOpen
(
const
char
*
fileName
)
{
for
(
int
i
=
0
;
i
<
LITTLE_FS_MAX_OPEN_FILES
;
i
++
)
{
if
(
g_handle
[
i
].
useFlag
==
1
)
{
if
(
strcmp
(
g_handle
[
i
].
pathName
,
fileName
)
==
0
)
{
return
true
;
return
TRUE
;
}
}
}
return
false
;
return
FALSE
;
}
lfs_dir_t
*
GetFreeDir
()
...
...
@@ -101,7 +100,7 @@ int InitMountInfo(const char *fileSystemType, const struct MountOps *fsMops)
for
(
int
i
=
0
;
i
<
MAX_FILE_SYSTEM_LEN
;
i
++
)
{
if
(
g_fsmap
[
i
].
fileSystemtype
==
NULL
)
{
g_fsmap
[
i
].
fileSystemtype
=
(
char
*
)
malloc
(
len
);
memcpy_s
(
g_fsmap
[
i
].
fileSystemtype
,
len
,
fileSystemType
,
len
);
memcpy_s
(
g_fsmap
[
i
].
fileSystemtype
,
LITTLE_FS_MAX_NAME_LEN
,
fileSystemType
,
len
);
g_fsmap
[
i
].
fsMops
=
fsMops
;
return
VFS_OK
;
}
...
...
components/fs/littlefs/lfs_api.h
浏览文件 @
7d9976cd
...
...
@@ -98,6 +98,7 @@ typedef struct {
#define LITTLE_FS_MAX_OPEN_FILES 100
#define LITTLE_FS_STANDARD_NAME_LENGTH 50
#define LITTLE_FS_MAX_NAME_LEN 255
#define MAX_DEF_BUF_NUM 21
#define MAX_BUFFER_LEN 100
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录