!636 修改menuconfig关闭VFS选项后编译无法通过

Merge pull request !636 from wangchen/0317_m
This commit is contained in:
openharmony_ci
2022-03-19 08:24:14 +00:00
committed by Gitee
7 changed files with 145 additions and 12 deletions

View File

@@ -33,13 +33,12 @@ import("//third_party/musl/porting/liteos_m/kernel/musl.gni")
module_switch = defined(LOSCFG_LIBC_MUSL)
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
sources = [ "malloc.c" ]
sources = [
"fs.c",
"malloc.c",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]
if (defined(LOSCFG_LIBC_MUSL_FS)) {
sources += [ "fs.c" ]
}
deps = [ "//third_party/musl/porting/liteos_m/kernel" ]
}

View File

@@ -30,7 +30,6 @@
*/
#include "los_config.h"
#include "los_fs.h"
#include "stdarg.h"
#include "dirent.h"
#include "sys/mount.h"
@@ -38,9 +37,16 @@
#include "sys/stat.h"
#include "unistd.h"
#ifdef LOSCFG_LIBC_MUSL_FS
#include "los_fs.h"
#else
#include "sys/stat.h"
#endif
#ifdef LOSCFG_LIBC_MUSL_FS
int mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,
const void *data)
const char *filesystemtype, unsigned long mountflags,
const void *data)
{
return LOS_FsMount(source, target, filesystemtype, mountflags, data);
}
@@ -154,3 +160,119 @@ ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
return LOS_Pwrite(fd, buf, nbyte, offset);
}
#else /* #ifdef LOSCFG_FS_VFS */
int mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,
const void *data)
{
return -1;
}
int umount(const char *target)
{
return -1;
}
int umount2(const char *target, int flag)
{
return -1;
}
int open(const char *path, int oflag, ...)
{
return -1;
}
int close(int fd)
{
return -1;
}
ssize_t read(int fd, void *buf, size_t nbyte)
{
return -1;
}
ssize_t write(int fd, const void *buf, size_t nbyte)
{
return -1;
}
off_t lseek(int fd, off_t offset, int whence)
{
return -1;
}
int unlink(const char *path)
{
return -1;
}
int fstat(int fd, struct stat *buf)
{
return -1;
}
int stat(const char *path, struct stat *buf)
{
return -1;
}
int fsync(int fd)
{
return -1;
}
int mkdir(const char *path, mode_t mode)
{
return -1;
}
DIR *opendir(const char *dirName)
{
return NULL;
}
struct dirent *readdir(DIR *dir)
{
return NULL;
}
int closedir(DIR *dir)
{
return -1;
}
int rmdir(const char *path)
{
return -1;
}
int rename(const char *oldName, const char *newName)
{
return -1;
}
int statfs(const char *path, struct statfs *buf)
{
return -1;
}
int ftruncate(int fd, off_t length)
{
return -1;
}
ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset)
{
return -1;
}
ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
return -1;
}
#endif

View File

@@ -29,11 +29,16 @@
*/
#include "los_config.h"
#include "los_fs.h"
#include "stdio.h"
#include "stdarg.h"
#include <sys/ioctl.h>
#ifdef LOSCFG_LIBC_NEWLIB_FS
#include "los_fs.h"
#else
#include "sys/stat.h"
#endif
#ifdef LOSCFG_LIBC_NEWLIB_FS
int mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,

View File

@@ -31,7 +31,6 @@
#include <fcntl.h>
#include <poll.h>
#include "securec.h"
#include "los_fs.h"
#include "los_list.h"
#include "los_mux.h"
#include "los_sem.h"