!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
commit 8f1dc3a1ff
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 145 additions and 12 deletions

View File

@ -42,11 +42,13 @@ kernel_module(module_name) {
"src/cmds/mempt_shellcmd.c",
"src/cmds/shell_shellcmd.c",
"src/cmds/task_shellcmd.c",
"src/cmds/vfs_shellcmd.c",
]
if (defined(LOSCFG_NET_LWIP_SACK)) {
defines = [ "LWIP_SHELLCMD_ENABLE" ]
}
if (defined(LOSCFG_FS_VFS)) {
sources += [ "src/cmds/vfs_shellcmd.c" ]
}
}
config("public") {

View File

@ -51,6 +51,7 @@ CmdItem g_shellcmdAll[] = {
{CMD_TYPE_EX, "ifconfig", XARGS, (CmdCallBackFunc)lwip_ifconfig},
{CMD_TYPE_EX, "ping", XARGS, (CmdCallBackFunc)OsShellPing},
#endif
#if LOSCFG_FS_VFS
{CMD_TYPE_EX, "touch", XARGS, (CmdCallBackFunc)OsShellCmdTouch},
{CMD_TYPE_EX, "ls", XARGS, (CmdCallBackFunc)OsShellCmdLs},
{CMD_TYPE_EX, "pwd", XARGS, (CmdCallBackFunc)OsShellCmdPwd},
@ -60,6 +61,8 @@ CmdItem g_shellcmdAll[] = {
{CMD_TYPE_EX, "rmdir", XARGS, (CmdCallBackFunc)OsShellCmdRmdir},
{CMD_TYPE_EX, "mkdir", XARGS, (CmdCallBackFunc)OsShellCmdMkdir},
{CMD_TYPE_EX, "cp", XARGS, (CmdCallBackFunc)OsShellCmdCp},
#endif
{CMD_TYPE_EX, "help", 0, (CmdCallBackFunc)OsShellCmdHelp},
};

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"

View File

@ -30,7 +30,6 @@
*/
#include "stdarg.h"
#include "vfs_operations.h"
#include "los_arch.h"
#include "los_config.h"
#include "los_debug.h"
@ -88,6 +87,10 @@
#include "los_box.h"
#endif
#if (LOSCFG_FS_VFS == 1)
#include "vfs_operations.h"
#endif
/*****************************************************************************
Function : LOS_Reboot
Description : system exception, die in here, wait for watchdog.