Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos M
提交
7259289b
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,发现更多精彩内容 >>
提交
7259289b
编写于
6月 17, 2021
作者:
L
li_zan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复littlefs编译fs.c缺少头文件件依赖配置+若干musl库的缺失问题+多分区规格宏配置问题
close:#I3VT11 Signed-off-by:
N
li_zan
<
371442490@qq.com
>
上级
6e162a93
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
16 deletion
+26
-16
components/fs/BUILD.gn
components/fs/BUILD.gn
+8
-0
components/fs/fs.c
components/fs/fs.c
+3
-2
components/fs/littlefs/BUILD.gn
components/fs/littlefs/BUILD.gn
+0
-1
components/fs/littlefs/lfs_api.c
components/fs/littlefs/lfs_api.c
+9
-8
components/fs/littlefs/lfs_api.h
components/fs/littlefs/lfs_api.h
+0
-5
kernel/include/los_config.h
kernel/include/los_config.h
+6
-0
未找到文件。
components/fs/BUILD.gn
浏览文件 @
7259289b
...
...
@@ -32,6 +32,14 @@ static_library("fs_operations") {
"./fs.c",
]
include_dirs = [
"../../../kernel/arch/include",
"../../../kernel/include",
"../../../utils",
"../../../kal/posix/include",
"./",
]
deps = [ "//kernel/liteos_m/kal/posix" ]
}
...
...
components/fs/fs.c
浏览文件 @
7259289b
...
...
@@ -29,6 +29,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fs_operations.h"
#include "los_config.h"
#ifdef LOSCFG_SUPPORT_FATFS
#include "fatfs.h"
#endif
...
...
@@ -426,11 +427,11 @@ int stat(const char *path, struct stat *buf)
errno
=
ENODEV
;
return
FS_FAILURE
;
}
if
(
g_fs
->
fsFops
==
NULL
||
g_fs
->
fsFops
->
Stat
==
NULL
)
{
if
(
g_fs
->
fsFops
==
NULL
||
g_fs
->
fsFops
->
Getattr
==
NULL
)
{
errno
=
ENOSYS
;
return
FS_FAILURE
;
}
return
g_fs
->
fsFops
->
Stat
(
path
,
buf
);
return
g_fs
->
fsFops
->
Getattr
(
path
,
buf
);
}
int
fsync
(
int
fd
)
...
...
components/fs/littlefs/BUILD.gn
浏览文件 @
7259289b
...
...
@@ -39,7 +39,6 @@ static_library("littlefs") {
"../../../kernel/include",
"../../../utils",
"../../../kal/cmsis",
"../../../kal",
"../../../kal/posix/include",
"./",
"../",
...
...
components/fs/littlefs/lfs_api.c
浏览文件 @
7259289b
...
...
@@ -31,15 +31,16 @@
#define _GNU_SOURCE 1
#include "lfs_api.h"
#include "los_config.h"
lfs_t
g_lfs
;
FileDirInfo
g_lfsDir
[
LFS_MAX_OPEN_DIRS
]
=
{
0
};
struct
FileOpInfo
g_fsOp
[
LFS_MAX_MOUNT_SIZE
]
=
{
0
};
struct
FileOpInfo
g_fsOp
[
L
OSCFG_L
FS_MAX_MOUNT_SIZE
]
=
{
0
};
static
LittleFsHandleStruct
g_handle
[
LITTLE_FS_MAX_OPEN_FILES
]
=
{
0
};
struct
dirent
g_nameValue
;
static
pthread_mutex_t
g_FslocalMutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
const
char
*
g_littlefsMntName
[
LFS_MAX_MOUNT_SIZE
]
=
{
"/a"
,
"/b"
,
"/c"
};
static
const
char
*
g_littlefsMntName
[
L
OSCFG_L
FS_MAX_MOUNT_SIZE
]
=
{
"/a"
,
"/b"
,
"/c"
};
LittleFsHandleStruct
*
LfsAllocFd
(
const
char
*
fileName
,
int
*
fd
)
{
...
...
@@ -126,7 +127,7 @@ BOOL CheckPathIsMounted(const char *pathName, struct FileOpInfo **fileOpInfo)
int
len
=
strlen
(
pathName
)
+
1
;
pthread_mutex_lock
(
&
g_FslocalMutex
);
for
(
int
i
=
0
;
i
<
LFS_MAX_MOUNT_SIZE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
L
OSCFG_L
FS_MAX_MOUNT_SIZE
;
i
++
)
{
if
(
g_fsOp
[
i
].
useFlag
==
1
)
{
mountPathNameLen
=
strlen
(
g_fsOp
[
i
].
dirName
);
if
(
len
<
mountPathNameLen
+
1
)
{
...
...
@@ -151,7 +152,7 @@ BOOL CheckPathIsMounted(const char *pathName, struct FileOpInfo **fileOpInfo)
struct
FileOpInfo
*
AllocMountRes
(
const
char
*
target
,
struct
FileOps
*
fileOps
)
{
pthread_mutex_lock
(
&
g_FslocalMutex
);
for
(
int
i
=
0
;
i
<
LFS_MAX_MOUNT_SIZE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
L
OSCFG_L
FS_MAX_MOUNT_SIZE
;
i
++
)
{
if
(
g_fsOp
[
i
].
useFlag
==
0
&&
strcmp
(
target
,
g_littlefsMntName
[
i
])
==
0
)
{
g_fsOp
[
i
].
useFlag
=
1
;
g_fsOp
[
i
].
fsVops
=
fileOps
;
...
...
@@ -167,7 +168,7 @@ struct FileOpInfo *AllocMountRes(const char* target, struct FileOps *fileOps)
int
SetDefaultMountPath
(
int
pathNameIndex
,
const
char
*
target
)
{
if
(
pathNameIndex
>=
LFS_MAX_MOUNT_SIZE
)
{
if
(
pathNameIndex
>=
L
OSCFG_L
FS_MAX_MOUNT_SIZE
)
{
return
VFS_ERROR
;
}
...
...
@@ -180,7 +181,7 @@ int SetDefaultMountPath(int pathNameIndex, const char* target)
struct
FileOpInfo
*
GetMountRes
(
const
char
*
target
,
int
*
mountIndex
)
{
pthread_mutex_lock
(
&
g_FslocalMutex
);
for
(
int
i
=
0
;
i
<
LFS_MAX_MOUNT_SIZE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
L
OSCFG_L
FS_MAX_MOUNT_SIZE
;
i
++
)
{
if
(
g_fsOp
[
i
].
useFlag
==
1
)
{
if
(
g_fsOp
[
i
].
dirName
&&
strcmp
(
target
,
g_fsOp
[
i
].
dirName
)
==
0
)
{
*
mountIndex
=
i
;
...
...
@@ -196,7 +197,7 @@ struct FileOpInfo *GetMountRes(const char *target, int *mountIndex)
int
FreeMountResByIndex
(
int
mountIndex
)
{
if
(
mountIndex
<
0
||
mountIndex
>=
LFS_MAX_MOUNT_SIZE
)
{
if
(
mountIndex
<
0
||
mountIndex
>=
L
OSCFG_L
FS_MAX_MOUNT_SIZE
)
{
return
VFS_ERROR
;
}
...
...
@@ -214,7 +215,7 @@ int FreeMountResByIndex(int mountIndex)
int
FreeMountRes
(
const
char
*
target
)
{
pthread_mutex_lock
(
&
g_FslocalMutex
);
for
(
int
i
=
0
;
i
<
LFS_MAX_MOUNT_SIZE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
L
OSCFG_L
FS_MAX_MOUNT_SIZE
;
i
++
)
{
if
(
g_fsOp
[
i
].
useFlag
==
1
)
{
if
(
g_fsOp
[
i
].
dirName
&&
strcmp
(
target
,
g_fsOp
[
i
].
dirName
)
==
0
)
{
g_fsOp
[
i
].
useFlag
=
0
;
...
...
components/fs/littlefs/lfs_api.h
浏览文件 @
7259289b
...
...
@@ -91,11 +91,6 @@ typedef struct {
#define LFS_MAX_OPEN_DIRS 10
#endif
#ifndef LFS_MAX_MOUNT_SIZE
#define LFS_MAX_MOUNT_SIZE 3
#endif
LittleFsHandleStruct
*
GetFreeFd
(
int
*
fd
);
int
InitMountInfo
(
const
char
*
fileSystemType
,
const
struct
MountOps
*
fsMops
);
...
...
kernel/include/los_config.h
浏览文件 @
7259289b
...
...
@@ -590,6 +590,12 @@ extern UINT8 *m_aucSysMem0;
#ifndef LOSCFG_SUPPORT_LITTLEFS
#define LOSCFG_SUPPORT_LITTLEFS 1
#endif
#ifndef LOSCFG_LFS_MAX_MOUNT_SIZE
#define LOSCFG_LFS_MAX_MOUNT_SIZE 3
#endif
/**
* @ingroup los_config
* Configuration trace tool
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录