Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos M
提交
bdb614bc
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,发现更多精彩内容 >>
提交
bdb614bc
编写于
6月 15, 2021
作者:
L
li_zan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: littlefs三方源码采用GN编译修改上库
close:I3VJ6X Signed-off-by:
N
li_zan
<
371442490@qq.com
>
上级
d77828e2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
1 deletion
+25
-1
components/fs/fs.c
components/fs/fs.c
+6
-0
components/fs/littlefs/BUILD.gn
components/fs/littlefs/BUILD.gn
+2
-0
components/fs/littlefs/lfs_api.c
components/fs/littlefs/lfs_api.c
+13
-1
components/fs/littlefs/lfs_api.h
components/fs/littlefs/lfs_api.h
+1
-0
kernel/include/los_config.h
kernel/include/los_config.h
+3
-0
未找到文件。
components/fs/fs.c
浏览文件 @
bdb614bc
...
...
@@ -29,7 +29,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fs_operations.h"
#ifdef LOSCFG_SUPPORT_FATFS
#include "fatfs.h"
#endif
#include "dirent.h"
#include "errno.h"
#include "fcntl.h"
...
...
@@ -158,16 +160,20 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
static
void
InitMountInfo
(
void
)
{
#if (LOSCFG_SUPPORT_FATFS == 1)
extern
struct
MountOps
g_fatfsMnt
;
extern
struct
FileOps
g_fatfsFops
;
g_fsmap
[
0
].
fileSystemtype
=
strdup
(
"fat"
);
g_fsmap
[
0
].
fsMops
=
&
g_fatfsMnt
;
g_fsmap
[
0
].
fsFops
=
&
g_fatfsFops
;
#endif
#if (LOSCFG_SUPPORT_LITTLEFS == 1)
extern
struct
MountOps
g_lfsMnt
;
extern
struct
FileOps
g_lfsFops
;
g_fsmap
[
1
].
fileSystemtype
=
strdup
(
"littlefs"
);
g_fsmap
[
1
].
fsMops
=
&
g_lfsMnt
;
g_fsmap
[
1
].
fsFops
=
&
g_lfsFops
;
#endif
}
static
struct
FsMap
*
MountFindfs
(
const
char
*
fileSystemtype
)
...
...
components/fs/littlefs/BUILD.gn
浏览文件 @
bdb614bc
...
...
@@ -30,6 +30,8 @@
static_library("littlefs") {
sources = [
"lfs_api.c",
"//third_party/littlefs/lfs.c",
"//third_party/littlefs/lfs_util.c",
]
include_dirs = [
...
...
components/fs/littlefs/lfs_api.c
浏览文件 @
bdb614bc
...
...
@@ -39,7 +39,7 @@ struct FileOpInfo g_fsOp[LFS_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
*
const
g_littlefsMntName
[
LFS_MAX_MOUNT_SIZE
]
=
{
"/a"
,
"/b"
,
"/c"
};
static
const
char
*
g_littlefsMntName
[
LFS_MAX_MOUNT_SIZE
]
=
{
"/a"
,
"/b"
,
"/c"
};
LittleFsHandleStruct
*
LfsAllocFd
(
const
char
*
fileName
,
int
*
fd
)
{
...
...
@@ -165,6 +165,18 @@ struct FileOpInfo *AllocMountRes(const char* target, struct FileOps *fileOps)
return
NULL
;
}
int
SetDefaultMountPath
(
int
pathNameIndex
,
const
char
*
target
)
{
if
(
pathNameIndex
>=
LFS_MAX_MOUNT_SIZE
)
{
return
VFS_ERROR
;
}
pthread_mutex_lock
(
&
g_FslocalMutex
);
g_littlefsMntName
[
pathNameIndex
]
=
strdup
(
target
);
pthread_mutex_unlock
(
&
g_FslocalMutex
);
return
VFS_OK
;
}
struct
FileOpInfo
*
GetMountRes
(
const
char
*
target
,
int
*
mountIndex
)
{
pthread_mutex_lock
(
&
g_FslocalMutex
);
...
...
components/fs/littlefs/lfs_api.h
浏览文件 @
bdb614bc
...
...
@@ -117,6 +117,7 @@ int LfsClose(int fd);
int
LfsRename
(
const
char
*
oldName
,
const
char
*
newName
);
int
LfsStat
(
const
char
*
path
,
struct
stat
*
buf
);
int
LfsFsync
(
int
fd
);
int
SetDefaultMountPath
(
int
pathNameIndex
,
const
char
*
target
);
const
struct
FsMap
*
MountFindfs
(
const
char
*
filesystemtype
);
...
...
kernel/include/los_config.h
浏览文件 @
bdb614bc
...
...
@@ -583,6 +583,9 @@ extern UINT8 *m_aucSysMem0;
#define LOSCFG_KERNEL_TRACE 0
#endif
#ifndef LOSCFG_SUPPORT_LITTLEFS
#define LOSCFG_SUPPORT_LITTLEFS 1
#endif
/**
* @ingroup los_config
* Configuration trace tool
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录