fix: littlefs三方源码采用GN编译修改上库
close:I3VJ6X Signed-off-by: li_zan <371442490@qq.com>
This commit is contained in:
parent
d77828e206
commit
bdb614bc2b
|
@ -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)
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
static_library("littlefs") {
|
||||
sources = [
|
||||
"lfs_api.c",
|
||||
"//third_party/littlefs/lfs.c",
|
||||
"//third_party/littlefs/lfs_util.c",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue