add littlefs code
This commit is contained in:
parent
580ef55f7e
commit
928827f62e
|
@ -91,7 +91,7 @@ int InitMountInfo(const char *fileSystemType, const struct MountOps *fsMops)
|
||||||
return VFS_ERROR;
|
return VFS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct fsmap_t *MountFindfs(const char*fileSystemtype)
|
const struct fsmap_t *MountFindfs(const char *fileSystemtype)
|
||||||
{
|
{
|
||||||
struct fsmap_t *m = NULL;
|
struct fsmap_t *m = NULL;
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ const struct FileOps lfs_vops = {
|
||||||
.Fsync = LfsFsync,
|
.Fsync = LfsFsync,
|
||||||
};
|
};
|
||||||
|
|
||||||
int LfsMount(const char * source, const char * target, const char * fileSystemType, unsigned long mountflags,
|
int LfsMount(const char *source, const char *target, const char *fileSystemType, unsigned long mountflags,
|
||||||
const void * data)
|
const void *data)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -138,27 +138,27 @@ int LfsMount(const char * source, const char * target, const char * fileSystemTy
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsUmount(const char * target)
|
int LfsUmount(const char *target)
|
||||||
{
|
{
|
||||||
return lfs_unmount(&g_lfs);
|
return lfs_unmount(&g_lfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsUnlink(const char * fileName)
|
int LfsUnlink(const char *fileName)
|
||||||
{
|
{
|
||||||
return lfs_remove(&g_lfs, fileName);
|
return lfs_remove(&g_lfs, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsMkdir(const char * dirName, mode_t mode)
|
int LfsMkdir(const char *dirName, mode_t mode)
|
||||||
{
|
{
|
||||||
return lfs_mkdir(&g_lfs, dirName);
|
return lfs_mkdir(&g_lfs, dirName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsRmdir(const char * dirName)
|
int LfsRmdir(const char *dirName)
|
||||||
{
|
{
|
||||||
return lfs_remove(&g_lfs, dirName);
|
return lfs_remove(&g_lfs, dirName);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIR *LfsOpendir(const char * dirName)
|
DIR *LfsOpendir(const char *dirName)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ DIR *LfsOpendir(const char * dirName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dirent *LfsReaddir(DIR * dir)
|
struct dirent *LfsReaddir(DIR *dir)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct lfs_info lfsInfo;
|
struct lfs_info lfsInfo;
|
||||||
|
@ -200,12 +200,12 @@ struct dirent *LfsReaddir(DIR * dir)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsClosedir(DIR * dir)
|
int LfsClosedir(DIR *dir)
|
||||||
{
|
{
|
||||||
return lfs_dir_close(&g_lfs, (lfs_dir_t *)dir);
|
return lfs_dir_close(&g_lfs, (lfs_dir_t *)dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsOpen(const char * path, int openFlag, int mode)
|
int LfsOpen(const char *path, int openFlag, int mode)
|
||||||
{
|
{
|
||||||
int fd = INVALID_FD;
|
int fd = INVALID_FD;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ errout:
|
||||||
return INVALID_FD;
|
return INVALID_FD;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsRead(int fd, void * buf, unsigned int len)
|
int LfsRead(int fd, void *buf, unsigned int len)
|
||||||
{
|
{
|
||||||
if (fd >= LITTLE_FS_MAX_OPEN_FILES && fd < 0) {
|
if (fd >= LITTLE_FS_MAX_OPEN_FILES && fd < 0) {
|
||||||
return VFS_ERROR;
|
return VFS_ERROR;
|
||||||
|
@ -233,7 +233,7 @@ int LfsRead(int fd, void * buf, unsigned int len)
|
||||||
return lfs_file_read(&g_lfs, &(g_handle[fd].file), buf, len);
|
return lfs_file_read(&g_lfs, &(g_handle[fd].file), buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsWrite(int fd, const void * buf, unsigned int len)
|
int LfsWrite(int fd, const void *buf, unsigned int len)
|
||||||
{
|
{
|
||||||
if (fd >= LITTLE_FS_MAX_OPEN_FILES && fd < 0) {
|
if (fd >= LITTLE_FS_MAX_OPEN_FILES && fd < 0) {
|
||||||
return VFS_ERROR;
|
return VFS_ERROR;
|
||||||
|
@ -267,12 +267,12 @@ int LfsClose(int fd)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsRename(const char * oldName, const char * newName)
|
int LfsRename(const char *oldName, const char *newName)
|
||||||
{
|
{
|
||||||
return lfs_rename(&g_lfs, oldName, newName);
|
return lfs_rename(&g_lfs, oldName, newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LfsStat(const char * path, struct stat * buf)
|
int LfsStat(const char *path, struct stat *buf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct lfs_info info;
|
struct lfs_info info;
|
||||||
|
|
Loading…
Reference in New Issue