Compare commits
22 Commits
master
...
OpenHarmon
Author | SHA1 | Date |
---|---|---|
|
af5fcc0e6c | |
|
e004ca9783 | |
|
257364f873 | |
|
86ee9aff2e | |
|
e709718fdc | |
|
34fcef1bf1 | |
|
f5833a19ce | |
|
5b65d5d0f3 | |
|
1a525b1f0f | |
|
780227205d | |
|
171ffc4f4b | |
|
87e957c6a6 | |
|
03a72de3ed | |
|
ed3ad6e65f | |
|
48b116bebb | |
|
d4cbd3b563 | |
|
787eaac712 | |
|
de6e3829b2 | |
|
9c0ea618df | |
|
6fdbdf18cb | |
|
9454dd8bda | |
|
291cb06744 |
8
Kconfig
8
Kconfig
|
@ -335,6 +335,14 @@ config KERNEL_PM
|
||||||
Configuration item for low power frame tailoring.
|
Configuration item for low power frame tailoring.
|
||||||
If you wish to build LiteOS with support for power management.
|
If you wish to build LiteOS with support for power management.
|
||||||
|
|
||||||
|
config KERNEL_PM_IDLE
|
||||||
|
bool "Enable Power Management Idle"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_PM
|
||||||
|
help
|
||||||
|
Configuration item for low power frame tailoring.
|
||||||
|
If you wish to build LiteOS with support for power management idle.
|
||||||
|
|
||||||
config KERNEL_PM_TASK_PTIORITY
|
config KERNEL_PM_TASK_PTIORITY
|
||||||
int "Power Management Task Priority"
|
int "Power Management Task Priority"
|
||||||
default 1
|
default 1
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
|
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||||
|
# to endorse or promote products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
import("//kernel/liteos_m/liteos.gni")
|
||||||
|
|
||||||
|
module_name = "arch"
|
||||||
|
kernel_module(module_name) {
|
||||||
|
sources = [
|
||||||
|
"los_context.c",
|
||||||
|
"los_dispatch.S",
|
||||||
|
"los_exc.S",
|
||||||
|
"los_interrupt.c",
|
||||||
|
"los_mpu.c",
|
||||||
|
"los_timer.c",
|
||||||
|
]
|
||||||
|
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
config("public") {
|
||||||
|
include_dirs = [ "." ]
|
||||||
|
}
|
|
@ -40,12 +40,13 @@
|
||||||
#include "securec.h"
|
#include "securec.h"
|
||||||
#include "los_compiler.h"
|
#include "los_compiler.h"
|
||||||
#include "los_debug.h"
|
#include "los_debug.h"
|
||||||
#include "cmsis_os2.h"
|
#include "los_sched.h"
|
||||||
#include "vfs_files.h"
|
#include "vfs_files.h"
|
||||||
#include "vfs_operations.h"
|
#include "vfs_operations.h"
|
||||||
#include "vfs_partition.h"
|
#include "vfs_partition.h"
|
||||||
#include "vfs_maps.h"
|
#include "vfs_maps.h"
|
||||||
#include "vfs_mount.h"
|
#include "vfs_mount.h"
|
||||||
|
#include "los_fs.h"
|
||||||
|
|
||||||
/* the max name length of different parts should not bigger than 32 */
|
/* the max name length of different parts should not bigger than 32 */
|
||||||
#define FS_DRIVE_NAME_MAX_LEN 32
|
#define FS_DRIVE_NAME_MAX_LEN 32
|
||||||
|
@ -73,7 +74,7 @@ static int FsLock(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct timespec absTimeout = {0};
|
struct timespec absTimeout = {0};
|
||||||
if (osKernelGetState() != osKernelRunning) {
|
if (!OsCheckKernelRunning()) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = clock_gettime(CLOCK_REALTIME, &absTimeout);
|
ret = clock_gettime(CLOCK_REALTIME, &absTimeout);
|
||||||
|
@ -88,7 +89,7 @@ static int FsLock(void)
|
||||||
|
|
||||||
static void FsUnlock(void)
|
static void FsUnlock(void)
|
||||||
{
|
{
|
||||||
if (osKernelGetState() != osKernelRunning) {
|
if (!OsCheckKernelRunning()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void)pthread_mutex_unlock(&g_fatfsMutex);
|
(void)pthread_mutex_unlock(&g_fatfsMutex);
|
||||||
|
@ -244,7 +245,7 @@ char * GetLdPath(const char *source)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *volPath = g_volPath[partId];
|
char *volPath = g_volPath[partId];
|
||||||
char *ldPath = (char *)malloc(strlen(volPath) + LDPATH_PAD);
|
char *ldPath = (char *)LOSCFG_FS_MALLOC_HOOK(strlen(volPath) + LDPATH_PAD);
|
||||||
if (ldPath == NULL) {
|
if (ldPath == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -255,7 +256,7 @@ char * GetLdPath(const char *source)
|
||||||
*ldPath = '/';
|
*ldPath = '/';
|
||||||
ret = strcpy_s(ldPath + 1, strlen(volPath)+1, volPath);
|
ret = strcpy_s(ldPath + 1, strlen(volPath)+1, volPath);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
free(ldPath);
|
LOSCFG_FS_FREE_HOOK(ldPath);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +266,7 @@ char * GetLdPath(const char *source)
|
||||||
void PutLdPath(const char *ldPath)
|
void PutLdPath(const char *ldPath)
|
||||||
{
|
{
|
||||||
if (ldPath != NULL) {
|
if (ldPath != NULL) {
|
||||||
free((void *)ldPath);
|
LOSCFG_FS_FREE_HOOK((void *)ldPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,6 +283,12 @@ int FatfsMount(struct MountPoint *mp, unsigned long mountflags,
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mountflags & MS_REMOUNT) {
|
||||||
|
ret = Remount(mp, mountflags);
|
||||||
|
FsUnlock();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
char *ldPath = GetLdPath(mp->mDev);
|
char *ldPath = GetLdPath(mp->mDev);
|
||||||
if (ldPath == NULL) {
|
if (ldPath == NULL) {
|
||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
|
@ -289,12 +296,7 @@ int FatfsMount(struct MountPoint *mp, unsigned long mountflags,
|
||||||
goto ERROUT;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mountflags & MS_REMOUNT) {
|
fs = (FATFS *)LOSCFG_FS_MALLOC_HOOK(sizeof(FATFS));
|
||||||
ret = Remount(mp, mountflags);
|
|
||||||
goto ERROUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs = (FATFS *)malloc(sizeof(FATFS));
|
|
||||||
if (fs == NULL) {
|
if (fs == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
|
@ -315,7 +317,7 @@ int FatfsMount(struct MountPoint *mp, unsigned long mountflags,
|
||||||
return (int)LOS_OK;
|
return (int)LOS_OK;
|
||||||
|
|
||||||
ERROUT:
|
ERROUT:
|
||||||
free(fs);
|
LOSCFG_FS_FREE_HOOK(fs);
|
||||||
mp->mData = NULL;
|
mp->mData = NULL;
|
||||||
PutLdPath(ldPath);
|
PutLdPath(ldPath);
|
||||||
FsUnlock();
|
FsUnlock();
|
||||||
|
@ -368,7 +370,7 @@ int FatfsUmount(struct MountPoint *mp)
|
||||||
ff_memfree(fatfs->win);
|
ff_memfree(fatfs->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(mp->mData);
|
LOSCFG_FS_FREE_HOOK(mp->mData);
|
||||||
mp->mData = NULL;
|
mp->mData = NULL;
|
||||||
|
|
||||||
ret = (int)LOS_OK;
|
ret = (int)LOS_OK;
|
||||||
|
@ -423,7 +425,7 @@ int FatfsUmount2(struct MountPoint *mp, int flag)
|
||||||
ff_memfree(fatfs->win);
|
ff_memfree(fatfs->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(mp->mData);
|
LOSCFG_FS_FREE_HOOK(mp->mData);
|
||||||
mp->mData = NULL;
|
mp->mData = NULL;
|
||||||
|
|
||||||
ret = (int)LOS_OK;
|
ret = (int)LOS_OK;
|
||||||
|
@ -448,7 +450,7 @@ int FatfsOpen(struct File *file, const char *path, int oflag)
|
||||||
|
|
||||||
fmode = FatFsGetMode(oflag);
|
fmode = FatFsGetMode(oflag);
|
||||||
|
|
||||||
fp = (FIL *)malloc(sizeof(FIL));
|
fp = (FIL *)LOSCFG_FS_MALLOC_HOOK(sizeof(FIL));
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
|
@ -457,7 +459,7 @@ int FatfsOpen(struct File *file, const char *path, int oflag)
|
||||||
ret = FsLock();
|
ret = FsLock();
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
errno = ret;
|
errno = ret;
|
||||||
free(fp);
|
LOSCFG_FS_FREE_HOOK(fp);
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,14 +468,14 @@ int FatfsOpen(struct File *file, const char *path, int oflag)
|
||||||
PRINT_ERR("FAT open ChangeDrive err 0x%x!\r\n", ret);
|
PRINT_ERR("FAT open ChangeDrive err 0x%x!\r\n", ret);
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
free(fp);
|
LOSCFG_FS_FREE_HOOK(fp);
|
||||||
goto OUT;
|
goto OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = f_open(fp, path, fmode);
|
res = f_open(fp, path, fmode);
|
||||||
if (res != FR_OK) {
|
if (res != FR_OK) {
|
||||||
PRINT_ERR("FAT open err 0x%x!\r\n", res);
|
PRINT_ERR("FAT open err 0x%x!\r\n", res);
|
||||||
free(fp);
|
LOSCFG_FS_FREE_HOOK(fp);
|
||||||
errno = FatfsErrno(res);
|
errno = FatfsErrno(res);
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
goto OUT;
|
goto OUT;
|
||||||
|
@ -517,7 +519,7 @@ int FatfsClose(struct File *file)
|
||||||
(void)ff_memfree(fp->buf);
|
(void)ff_memfree(fp->buf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
free(file->fData);
|
LOSCFG_FS_FREE_HOOK(file->fData);
|
||||||
file->fData = NULL;
|
file->fData = NULL;
|
||||||
FsUnlock();
|
FsUnlock();
|
||||||
|
|
||||||
|
@ -832,7 +834,7 @@ int FatfsOpendir(struct Dir *dir, const char *dirName)
|
||||||
goto ERROUT;
|
goto ERROUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
dp = (DIR *)malloc(sizeof(DIR));
|
dp = (DIR *)LOSCFG_FS_MALLOC_HOOK(sizeof(DIR));
|
||||||
if (dp == NULL) {
|
if (dp == NULL) {
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
goto ERROUT;
|
goto ERROUT;
|
||||||
|
@ -866,7 +868,7 @@ int FatfsOpendir(struct Dir *dir, const char *dirName)
|
||||||
|
|
||||||
ERROUT:
|
ERROUT:
|
||||||
if (dp != NULL) {
|
if (dp != NULL) {
|
||||||
free(dp);
|
LOSCFG_FS_FREE_HOOK(dp);
|
||||||
}
|
}
|
||||||
FsUnlock();
|
FsUnlock();
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
|
@ -938,7 +940,7 @@ int FatfsClosedir(struct Dir *dir)
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(dir->dData);
|
LOSCFG_FS_FREE_HOOK(dir->dData);
|
||||||
dir->dData = NULL;
|
dir->dData = NULL;
|
||||||
FsUnlock();
|
FsUnlock();
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "vfs_maps.h"
|
#include "vfs_maps.h"
|
||||||
#include "vfs_mount.h"
|
#include "vfs_mount.h"
|
||||||
#include "securec.h"
|
#include "securec.h"
|
||||||
|
#include "los_fs.h"
|
||||||
|
|
||||||
static pthread_mutex_t g_fsLocalMutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t g_fsLocalMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
|
@ -184,7 +185,13 @@ int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
mountHdl = (lfs_t *)malloc(sizeof(lfs_t) + sizeof(struct lfs_config));
|
if (mountflags & MS_REMOUNT) {
|
||||||
|
errno = ENOSYS;
|
||||||
|
ret = (int)LOS_NOK;
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
|
||||||
|
mountHdl = (lfs_t *)LOSCFG_FS_MALLOC_HOOK(sizeof(lfs_t) + sizeof(struct lfs_config));
|
||||||
if (mountHdl == NULL) {
|
if (mountHdl == NULL) {
|
||||||
errno = ENODEV;
|
errno = ENODEV;
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
|
@ -204,7 +211,7 @@ int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
free(mountHdl);
|
LOSCFG_FS_FREE_HOOK(mountHdl);
|
||||||
errno = LittlefsErrno(ret);
|
errno = LittlefsErrno(ret);
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +240,7 @@ int LfsUmount(struct MountPoint *mp)
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(mp->mData);
|
LOSCFG_FS_FREE_HOOK(mp->mData);
|
||||||
mp->mData = NULL;
|
mp->mData = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -327,7 +334,7 @@ int LfsOpendir(struct Dir *dir, const char *dirName)
|
||||||
}
|
}
|
||||||
|
|
||||||
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
|
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
|
||||||
lfs_dir_t *dirInfo = (lfs_dir_t *)malloc(sizeof(lfs_dir_t));
|
lfs_dir_t *dirInfo = (lfs_dir_t *)LOSCFG_FS_MALLOC_HOOK(sizeof(lfs_dir_t));
|
||||||
if (dirInfo == NULL) {
|
if (dirInfo == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
|
@ -336,7 +343,7 @@ int LfsOpendir(struct Dir *dir, const char *dirName)
|
||||||
(void)memset_s(dirInfo, sizeof(lfs_dir_t), 0, sizeof(lfs_dir_t));
|
(void)memset_s(dirInfo, sizeof(lfs_dir_t), 0, sizeof(lfs_dir_t));
|
||||||
ret = lfs_dir_open(lfs, dirInfo, dirName);
|
ret = lfs_dir_open(lfs, dirInfo, dirName);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
free(dirInfo);
|
LOSCFG_FS_FREE_HOOK(dirInfo);
|
||||||
errno = LittlefsErrno(ret);
|
errno = LittlefsErrno(ret);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
@ -415,7 +422,7 @@ int LfsClosedir(struct Dir *dir)
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(dirInfo);
|
LOSCFG_FS_FREE_HOOK(dirInfo);
|
||||||
dir->dData = NULL;
|
dir->dData = NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -432,7 +439,7 @@ int LfsOpen(struct File *file, const char *pathName, int openFlag)
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
lfsHandle = (lfs_file_t *)malloc(sizeof(lfs_file_t));
|
lfsHandle = (lfs_file_t *)LOSCFG_FS_MALLOC_HOOK(sizeof(lfs_file_t));
|
||||||
if (lfsHandle == NULL) {
|
if (lfsHandle == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
|
@ -441,7 +448,7 @@ int LfsOpen(struct File *file, const char *pathName, int openFlag)
|
||||||
int lfsOpenFlag = ConvertFlagToLfsOpenFlag(openFlag);
|
int lfsOpenFlag = ConvertFlagToLfsOpenFlag(openFlag);
|
||||||
ret = lfs_file_open((lfs_t *)file->fMp->mData, lfsHandle, pathName, lfsOpenFlag);
|
ret = lfs_file_open((lfs_t *)file->fMp->mData, lfsHandle, pathName, lfsOpenFlag);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
free(lfsHandle);
|
LOSCFG_FS_FREE_HOOK(lfsHandle);
|
||||||
errno = LittlefsErrno(ret);
|
errno = LittlefsErrno(ret);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +576,7 @@ int LfsClose(struct File *file)
|
||||||
ret = (int)LOS_NOK;
|
ret = (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(file->fData);
|
LOSCFG_FS_FREE_HOOK(file->fData);
|
||||||
file->fData = NULL;
|
file->fData = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#define _LOS_FS_H_
|
#define _LOS_FS_H_
|
||||||
|
|
||||||
#include "los_config.h"
|
#include "los_config.h"
|
||||||
|
#include "los_memory.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
#include "sys/mount.h"
|
#include "sys/mount.h"
|
||||||
#include "sys/statfs.h"
|
#include "sys/statfs.h"
|
||||||
|
@ -52,6 +53,14 @@ extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#ifndef LOSCFG_FS_MALLOC_HOOK
|
||||||
|
#define LOSCFG_FS_MALLOC_HOOK(size) LOS_MemAlloc((VOID *)OS_SYS_MEM_ADDR, size)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LOSCFG_FS_FREE_HOOK
|
||||||
|
#define LOSCFG_FS_FREE_HOOK(ptr) LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, ptr)
|
||||||
|
#endif
|
||||||
|
|
||||||
int LOS_Open(const char *path, int flags, ...);
|
int LOS_Open(const char *path, int flags, ...);
|
||||||
int LOS_Close(int fd);
|
int LOS_Close(int fd);
|
||||||
ssize_t LOS_Read(int fd, void *buff, size_t bytes);
|
ssize_t LOS_Read(int fd, void *buff, size_t bytes);
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "fcntl.h"
|
#include "fcntl.h"
|
||||||
#include "los_mux.h"
|
#include "los_mux.h"
|
||||||
#include "los_debug.h"
|
#include "los_debug.h"
|
||||||
|
#include "los_sched.h"
|
||||||
#include "limits.h"
|
#include "limits.h"
|
||||||
#include "securec.h"
|
#include "securec.h"
|
||||||
#include "vfs_config.h"
|
#include "vfs_config.h"
|
||||||
|
@ -85,7 +86,7 @@ int PollQueryFd(int fd, struct PollTable *table)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FREE_AND_SET_NULL(ptr) do { \
|
#define FREE_AND_SET_NULL(ptr) do { \
|
||||||
free(ptr); \
|
LOSCFG_FS_FREE_HOOK(ptr); \
|
||||||
ptr = NULL; \
|
ptr = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -96,6 +97,9 @@ UINT32 g_fsMutex;
|
||||||
|
|
||||||
int VfsLock(void)
|
int VfsLock(void)
|
||||||
{
|
{
|
||||||
|
if (!OsCheckKernelRunning()) {
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
if (LOS_MuxPend(g_fsMutex, LOS_WAIT_FOREVER) != LOS_OK) {
|
if (LOS_MuxPend(g_fsMutex, LOS_WAIT_FOREVER) != LOS_OK) {
|
||||||
PRINT_ERR("VfsLock failed!");
|
PRINT_ERR("VfsLock failed!");
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
|
@ -106,6 +110,9 @@ int VfsLock(void)
|
||||||
|
|
||||||
void VfsUnlock(void)
|
void VfsUnlock(void)
|
||||||
{
|
{
|
||||||
|
if (!OsCheckKernelRunning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
(void)LOS_MuxPost(g_fsMutex);
|
(void)LOS_MuxPost(g_fsMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,13 +143,13 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
|
||||||
|
|
||||||
offset = strlen("///") + 1; // three '/' and one '\0'
|
offset = strlen("///") + 1; // three '/' and one '\0'
|
||||||
size_t tmpLen = strlen(cwd) + strlen(path) + offset;
|
size_t tmpLen = strlen(cwd) + strlen(path) + offset;
|
||||||
char *tmpBuf = (char *)malloc(tmpLen);
|
char *tmpBuf = (char *)LOSCFG_FS_MALLOC_HOOK(tmpLen);
|
||||||
if (tmpBuf == NULL) {
|
if (tmpBuf == NULL) {
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-1 == sprintf_s(tmpBuf, tmpLen, "/%s/%s/", cwd, path)) {
|
if (-1 == sprintf_s(tmpBuf, tmpLen, "/%s/%s/", cwd, path)) {
|
||||||
free(tmpBuf);
|
LOSCFG_FS_FREE_HOOK(tmpBuf);
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +158,7 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
|
||||||
offset = strlen("/./") - 1;
|
offset = strlen("/./") - 1;
|
||||||
while ((p = strstr(tmpBuf, "/./")) != NULL) {
|
while ((p = strstr(tmpBuf, "/./")) != NULL) {
|
||||||
if (EOK != memmove_s(p, tmpLen - (p - tmpBuf), p + offset, tmpLen - (p - tmpBuf) - offset)) {
|
if (EOK != memmove_s(p, tmpLen - (p - tmpBuf), p + offset, tmpLen - (p - tmpBuf) - offset)) {
|
||||||
free(tmpBuf);
|
LOSCFG_FS_FREE_HOOK(tmpBuf);
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +166,7 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
|
||||||
/* replace // to / */
|
/* replace // to / */
|
||||||
while ((p = strstr(tmpBuf, "//")) != NULL) {
|
while ((p = strstr(tmpBuf, "//")) != NULL) {
|
||||||
if (EOK != memmove_s(p, tmpLen - (p - tmpBuf), p + 1, tmpLen - (p - tmpBuf) - 1)) {
|
if (EOK != memmove_s(p, tmpLen - (p - tmpBuf), p + 1, tmpLen - (p - tmpBuf) - 1)) {
|
||||||
free(tmpBuf);
|
LOSCFG_FS_FREE_HOOK(tmpBuf);
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +179,7 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
|
||||||
--start;
|
--start;
|
||||||
}
|
}
|
||||||
if (EOK != memmove_s(start, tmpLen - (start - tmpBuf), p + offset, tmpLen - (p - tmpBuf) - offset)) {
|
if (EOK != memmove_s(start, tmpLen - (start - tmpBuf), p + offset, tmpLen - (p - tmpBuf) - offset)) {
|
||||||
free(tmpBuf);
|
LOSCFG_FS_FREE_HOOK(tmpBuf);
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,23 +191,24 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!buf) || (bufSize == 0)) {
|
if ((!buf) || (bufSize == 0)) {
|
||||||
free(tmpBuf);
|
LOSCFG_FS_FREE_HOOK(tmpBuf);
|
||||||
return totalLen;
|
return totalLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EOK != memcpy_s(buf, bufSize, tmpBuf, (((totalLen + 1) > bufSize) ? bufSize : (totalLen + 1)))) {
|
if (EOK != memcpy_s(buf, bufSize, tmpBuf, (((totalLen + 1) > bufSize) ? bufSize : (totalLen + 1)))) {
|
||||||
free(tmpBuf);
|
LOSCFG_FS_FREE_HOOK(tmpBuf);
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[bufSize - 1] = 0;
|
buf[bufSize - 1] = 0;
|
||||||
free(tmpBuf);
|
LOSCFG_FS_FREE_HOOK(tmpBuf);
|
||||||
return totalLen;
|
return totalLen;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int VfsOpen(const char *path, int flags)
|
static int VfsOpen(const char *path, int flags)
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
struct File *file = NULL;
|
struct File *file = NULL;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
const char *pathInMp = NULL;
|
const char *pathInMp = NULL;
|
||||||
|
@ -240,13 +248,15 @@ static int VfsOpen(const char *path, int flags)
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
file->fullPath = strdup(path);
|
len = strlen(path) + 1;
|
||||||
|
file->fullPath = LOSCFG_FS_MALLOC_HOOK(len);
|
||||||
if (file->fullPath == NULL) {
|
if (file->fullPath == NULL) {
|
||||||
VFS_ERRNO_SET(ENOMEM);
|
VFS_ERRNO_SET(ENOMEM);
|
||||||
VfsFilePut(file);
|
VfsFilePut(file);
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
(void)strcpy_s((char *)file->fullPath, len, path);
|
||||||
|
|
||||||
file->fFlags = (UINT32)flags;
|
file->fFlags = (UINT32)flags;
|
||||||
file->fOffset = 0;
|
file->fOffset = 0;
|
||||||
|
@ -337,7 +347,7 @@ static int VfsClose(int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->fullPath != NULL) {
|
if (file->fullPath != NULL) {
|
||||||
free((void *)file->fullPath);
|
LOSCFG_FS_FREE_HOOK((void *)file->fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
VfsDetachFile(file);
|
VfsDetachFile(file);
|
||||||
|
@ -644,7 +654,7 @@ static DIR *VfsOpendir(const char *path)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = (struct Dir *)malloc(sizeof(struct Dir));
|
dir = (struct Dir *)LOSCFG_FS_MALLOC_HOOK(sizeof(struct Dir));
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
VFS_ERRNO_SET(ENOMEM);
|
VFS_ERRNO_SET(ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -652,7 +662,7 @@ static DIR *VfsOpendir(const char *path)
|
||||||
|
|
||||||
if (VfsLock() != LOS_OK) {
|
if (VfsLock() != LOS_OK) {
|
||||||
VFS_ERRNO_SET(EAGAIN);
|
VFS_ERRNO_SET(EAGAIN);
|
||||||
free(dir);
|
LOSCFG_FS_FREE_HOOK(dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,14 +670,14 @@ static DIR *VfsOpendir(const char *path)
|
||||||
if ((mp == NULL) || (pathInMp == NULL)) {
|
if ((mp == NULL) || (pathInMp == NULL)) {
|
||||||
VFS_ERRNO_SET(ENOENT);
|
VFS_ERRNO_SET(ENOENT);
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
free(dir);
|
LOSCFG_FS_FREE_HOOK(dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp->mFs->fsFops->opendir == NULL) {
|
if (mp->mFs->fsFops->opendir == NULL) {
|
||||||
VFS_ERRNO_SET(ENOTSUP);
|
VFS_ERRNO_SET(ENOTSUP);
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
free(dir);
|
LOSCFG_FS_FREE_HOOK(dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,7 +688,7 @@ static DIR *VfsOpendir(const char *path)
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
mp->mRefs++;
|
mp->mRefs++;
|
||||||
} else {
|
} else {
|
||||||
free(dir);
|
LOSCFG_FS_FREE_HOOK(dir);
|
||||||
dir = NULL;
|
dir = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +757,7 @@ static int VfsClosedir(DIR *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
free(dir);
|
LOSCFG_FS_FREE_HOOK(dir);
|
||||||
dir = NULL;
|
dir = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -920,7 +930,7 @@ int LOS_Open(const char *path, int flags, ...)
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *canonicalPath = (char *)malloc(pathLen);
|
char *canonicalPath = (char *)LOSCFG_FS_MALLOC_HOOK(pathLen);
|
||||||
if (!canonicalPath) {
|
if (!canonicalPath) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
|
@ -1235,7 +1245,7 @@ ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt)
|
||||||
return (ssize_t)LOS_NOK;
|
return (ssize_t)LOS_NOK;
|
||||||
}
|
}
|
||||||
totalLen = bufLen * sizeof(char);
|
totalLen = bufLen * sizeof(char);
|
||||||
buf = (char *)malloc(totalLen);
|
buf = (char *)LOSCFG_FS_MALLOC_HOOK(totalLen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return (ssize_t)LOS_NOK;
|
return (ssize_t)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
@ -1252,7 +1262,7 @@ ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt)
|
||||||
size_t lenToRead = totalLen < bytesToRead ? totalLen : bytesToRead;
|
size_t lenToRead = totalLen < bytesToRead ? totalLen : bytesToRead;
|
||||||
ret = memcpy_s(readBuf, bytesToRead, curBuf, lenToRead);
|
ret = memcpy_s(readBuf, bytesToRead, curBuf, lenToRead);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
free(buf);
|
LOSCFG_FS_FREE_HOOK(buf);
|
||||||
return (ssize_t)LOS_NOK;
|
return (ssize_t)LOS_NOK;
|
||||||
}
|
}
|
||||||
if (totalLen < (size_t)bytesToRead) {
|
if (totalLen < (size_t)bytesToRead) {
|
||||||
|
@ -1261,7 +1271,7 @@ ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt)
|
||||||
curBuf += bytesToRead;
|
curBuf += bytesToRead;
|
||||||
totalLen -= bytesToRead;
|
totalLen -= bytesToRead;
|
||||||
}
|
}
|
||||||
free(buf);
|
LOSCFG_FS_FREE_HOOK(buf);
|
||||||
return totalBytesRead;
|
return totalBytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1293,7 +1303,7 @@ ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt)
|
||||||
return (ssize_t)LOS_NOK;
|
return (ssize_t)LOS_NOK;
|
||||||
}
|
}
|
||||||
totalLen = bufLen * sizeof(char);
|
totalLen = bufLen * sizeof(char);
|
||||||
buf = (char *)malloc(totalLen);
|
buf = (char *)LOSCFG_FS_MALLOC_HOOK(totalLen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return (ssize_t)LOS_NOK;
|
return (ssize_t)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
@ -1306,7 +1316,7 @@ ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt)
|
||||||
}
|
}
|
||||||
ret = memcpy_s(curBuf, totalLen, writeBuf, bytesToWrite);
|
ret = memcpy_s(curBuf, totalLen, writeBuf, bytesToWrite);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
free(buf);
|
LOSCFG_FS_FREE_HOOK(buf);
|
||||||
return (ssize_t)LOS_NOK;
|
return (ssize_t)LOS_NOK;
|
||||||
}
|
}
|
||||||
curBuf += bytesToWrite;
|
curBuf += bytesToWrite;
|
||||||
|
@ -1314,7 +1324,7 @@ ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
totalBytesWritten = write(fd, buf, bufLen);
|
totalBytesWritten = write(fd, buf, bufLen);
|
||||||
free(buf);
|
LOSCFG_FS_FREE_HOOK(buf);
|
||||||
|
|
||||||
return totalBytesWritten;
|
return totalBytesWritten;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "securec.h"
|
#include "securec.h"
|
||||||
#include "los_debug.h"
|
#include "los_debug.h"
|
||||||
#include "los_compiler.h"
|
#include "los_compiler.h"
|
||||||
|
#include "los_fs.h"
|
||||||
|
|
||||||
struct FsMap *g_fsMap = NULL;
|
struct FsMap *g_fsMap = NULL;
|
||||||
|
|
||||||
|
@ -57,22 +58,25 @@ struct FsMap *VfsFsMapGet(const char *fsType)
|
||||||
int OsFsRegister(const char *fsType, struct MountOps *fsMops,
|
int OsFsRegister(const char *fsType, struct MountOps *fsMops,
|
||||||
struct FileOps *fsFops, struct FsManagement *fsMgt)
|
struct FileOps *fsFops, struct FsManagement *fsMgt)
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
if ((fsMops == NULL) || (fsFops == NULL)) {
|
if ((fsMops == NULL) || (fsFops == NULL)) {
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FsMap *newfs = (struct FsMap *)malloc(sizeof(struct FsMap));
|
struct FsMap *newfs = (struct FsMap *)LOSCFG_FS_MALLOC_HOOK(sizeof(struct FsMap));
|
||||||
if (newfs == NULL) {
|
if (newfs == NULL) {
|
||||||
PRINT_ERR("Fs register malloc failed, fsType %s.\n", fsType);
|
PRINT_ERR("Fs register malloc failed, fsType %s.\n", fsType);
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
(void)memset_s(newfs, sizeof(struct FsMap), 0, sizeof(struct FsMap));
|
(void)memset_s(newfs, sizeof(struct FsMap), 0, sizeof(struct FsMap));
|
||||||
|
|
||||||
newfs->fsType = strdup(fsType);
|
len = strlen(fsType) + 1;
|
||||||
|
newfs->fsType = LOSCFG_FS_MALLOC_HOOK(len);
|
||||||
if (newfs->fsType == NULL) {
|
if (newfs->fsType == NULL) {
|
||||||
free(newfs);
|
LOSCFG_FS_FREE_HOOK(newfs);
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
(void)strcpy_s((char *)newfs->fsType, len, fsType);
|
||||||
|
|
||||||
newfs->fsMops = fsMops;
|
newfs->fsMops = fsMops;
|
||||||
newfs->fsFops = fsFops;
|
newfs->fsFops = fsFops;
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "vfs_config.h"
|
#include "vfs_config.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#include "errno.h"
|
||||||
|
#include "securec.h"
|
||||||
#include "vfs_operations.h"
|
#include "vfs_operations.h"
|
||||||
#include "los_compiler.h"
|
#include "los_compiler.h"
|
||||||
#include "los_debug.h"
|
#include "los_debug.h"
|
||||||
|
@ -122,7 +124,7 @@ struct MountPoint *VfsMpFind(const char *path, const char **pathInMp)
|
||||||
return bestMp;
|
return bestMp;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC struct MountPoint *MountPointInit(const char *target, const char *fsType, unsigned long mountflags)
|
STATIC struct MountPoint *VfsMountPointInit(const char *target, const char *fsType, unsigned long mountflags)
|
||||||
{
|
{
|
||||||
struct MountPoint *mp = NULL;
|
struct MountPoint *mp = NULL;
|
||||||
const char *pathInMp = NULL;
|
const char *pathInMp = NULL;
|
||||||
|
@ -140,7 +142,7 @@ STATIC struct MountPoint *MountPointInit(const char *target, const char *fsType,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp = (struct MountPoint *)malloc(sizeof(struct MountPoint));
|
mp = (struct MountPoint *)LOSCFG_FS_MALLOC_HOOK(sizeof(struct MountPoint));
|
||||||
if (mp == NULL) {
|
if (mp == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -155,10 +157,32 @@ STATIC struct MountPoint *MountPointInit(const char *target, const char *fsType,
|
||||||
return mp;
|
return mp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC int VfsRemount(const char *source, const char *target,
|
||||||
|
const char *fsType, unsigned long mountflags,
|
||||||
|
const void *data)
|
||||||
|
{
|
||||||
|
(VOID)source;
|
||||||
|
(VOID)fsType;
|
||||||
|
struct MountPoint *mp;
|
||||||
|
|
||||||
|
mp = VfsMpFind(target, NULL);
|
||||||
|
if (mp == NULL) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return (int)LOS_NOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOS_ASSERT(mp->mFs != NULL);
|
||||||
|
LOS_ASSERT(mp->mFs->fsMops != NULL);
|
||||||
|
LOS_ASSERT(mp->mFs->fsMops->mount != NULL);
|
||||||
|
|
||||||
|
return mp->mFs->fsMops->mount(mp, mountflags, data);
|
||||||
|
}
|
||||||
|
|
||||||
int LOS_FsMount(const char *source, const char *target,
|
int LOS_FsMount(const char *source, const char *target,
|
||||||
const char *fsType, unsigned long mountflags,
|
const char *fsType, unsigned long mountflags,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
int ret;
|
int ret;
|
||||||
struct MountPoint *mp = NULL;
|
struct MountPoint *mp = NULL;
|
||||||
|
|
||||||
|
@ -169,25 +193,35 @@ int LOS_FsMount(const char *source, const char *target,
|
||||||
|
|
||||||
(void)VfsLock();
|
(void)VfsLock();
|
||||||
|
|
||||||
mp = MountPointInit(target, fsType, mountflags);
|
if (mountflags & MS_REMOUNT) {
|
||||||
|
ret = VfsRemount(source, target, fsType, mountflags, data);
|
||||||
|
VfsUnlock();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp = VfsMountPointInit(target, fsType, mountflags);
|
||||||
if (mp == NULL) {
|
if (mp == NULL) {
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source != NULL) {
|
if (source != NULL) {
|
||||||
mp->mDev = strdup(source);
|
len = strlen(source) + 1;
|
||||||
|
mp->mDev = LOSCFG_FS_MALLOC_HOOK(len);
|
||||||
if (mp->mDev == NULL) {
|
if (mp->mDev == NULL) {
|
||||||
free(mp);
|
LOSCFG_FS_FREE_HOOK(mp);
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
(void)strcpy_s((char *)mp->mDev, len, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
mp->mPath = strdup(target);
|
len = strlen(target) + 1;
|
||||||
|
mp->mPath = LOSCFG_FS_MALLOC_HOOK(len);
|
||||||
if (mp->mPath == NULL) {
|
if (mp->mPath == NULL) {
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
(void)strcpy_s((char *)mp->mPath, len, target);
|
||||||
|
|
||||||
ret = mp->mFs->fsMops->mount(mp, mountflags, data);
|
ret = mp->mFs->fsMops->mount(mp, mountflags, data);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
@ -201,9 +235,9 @@ int LOS_FsMount(const char *source, const char *target,
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
free((void *)mp->mPath);
|
LOSCFG_FS_FREE_HOOK((void *)mp->mPath);
|
||||||
free((void *)mp->mDev);
|
LOSCFG_FS_FREE_HOOK((void *)mp->mDev);
|
||||||
free(mp);
|
LOSCFG_FS_FREE_HOOK(mp);
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
@ -238,9 +272,9 @@ int LOS_FsUmount(const char *target)
|
||||||
/* delete mp from mount list */
|
/* delete mp from mount list */
|
||||||
MpDeleteFromList(mp);
|
MpDeleteFromList(mp);
|
||||||
mp->mFs->fsRefs--;
|
mp->mFs->fsRefs--;
|
||||||
free((void *)mp->mPath);
|
LOSCFG_FS_FREE_HOOK((void *)mp->mPath);
|
||||||
free((void *)mp->mDev);
|
LOSCFG_FS_FREE_HOOK((void *)mp->mDev);
|
||||||
free(mp);
|
LOSCFG_FS_FREE_HOOK(mp);
|
||||||
|
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
@ -298,9 +332,9 @@ int LOS_FsUmount2(const char *target, int flag)
|
||||||
/* delete mp from mount list */
|
/* delete mp from mount list */
|
||||||
MpDeleteFromList(mp);
|
MpDeleteFromList(mp);
|
||||||
mp->mFs->fsRefs--;
|
mp->mFs->fsRefs--;
|
||||||
free((void *)mp->mPath);
|
LOSCFG_FS_FREE_HOOK((void *)mp->mPath);
|
||||||
free((void *)mp->mDev);
|
LOSCFG_FS_FREE_HOOK((void *)mp->mDev);
|
||||||
free(mp);
|
LOSCFG_FS_FREE_HOOK(mp);
|
||||||
|
|
||||||
VfsUnlock();
|
VfsUnlock();
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
|
|
@ -77,6 +77,7 @@ struct DeviceDesc *getDeviceList(VOID)
|
||||||
static int AddDevice(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
|
static int AddDevice(const char *dev, const char *fsType, int *lengthArray, int *addrArray,
|
||||||
int partNum)
|
int partNum)
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
struct DeviceDesc *prev = NULL;
|
struct DeviceDesc *prev = NULL;
|
||||||
for (prev = g_deviceList; prev != NULL; prev = prev->dNext) {
|
for (prev = g_deviceList; prev != NULL; prev = prev->dNext) {
|
||||||
if (strcmp(prev->dDev, dev) == 0) {
|
if (strcmp(prev->dDev, dev) == 0) {
|
||||||
|
@ -90,21 +91,25 @@ static int AddDevice(const char *dev, const char *fsType, int *lengthArray, int
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev = (struct DeviceDesc *)malloc(sizeof(struct DeviceDesc));
|
prev = (struct DeviceDesc *)LOSCFG_FS_MALLOC_HOOK(sizeof(struct DeviceDesc));
|
||||||
if (prev == NULL) {
|
if (prev == NULL) {
|
||||||
errno = -ENOMEM;
|
errno = -ENOMEM;
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
prev->dDev = strdup(dev);
|
len = strlen(dev) + 1;
|
||||||
prev->dFsType = strdup(fsType);
|
prev->dDev = LOSCFG_FS_MALLOC_HOOK(len);
|
||||||
prev->dAddrArray = (int *)malloc(partNum * sizeof(int));
|
len = strlen(fsType) + 1;
|
||||||
|
prev->dFsType = LOSCFG_FS_MALLOC_HOOK(len);
|
||||||
|
prev->dAddrArray = (int *)LOSCFG_FS_MALLOC_HOOK(partNum * sizeof(int));
|
||||||
if (prev->dDev == NULL || prev->dFsType == NULL || prev->dAddrArray == NULL) {
|
if (prev->dDev == NULL || prev->dFsType == NULL || prev->dAddrArray == NULL) {
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
(void)strcpy_s((char *)prev->dDev, len, dev);
|
||||||
|
(void)strcpy_s((char *)prev->dFsType, len, fsType);
|
||||||
(void)memcpy_s(prev->dAddrArray, partNum * sizeof(int), addrArray, partNum * sizeof(int));
|
(void)memcpy_s(prev->dAddrArray, partNum * sizeof(int), addrArray, partNum * sizeof(int));
|
||||||
|
|
||||||
if (lengthArray != NULL) {
|
if (lengthArray != NULL) {
|
||||||
prev->dLengthArray = (int *)malloc(partNum * sizeof(int));
|
prev->dLengthArray = (int *)LOSCFG_FS_MALLOC_HOOK(partNum * sizeof(int));
|
||||||
if (prev->dLengthArray == NULL) {
|
if (prev->dLengthArray == NULL) {
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
@ -117,19 +122,19 @@ static int AddDevice(const char *dev, const char *fsType, int *lengthArray, int
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
errout:
|
errout:
|
||||||
if (prev->dDev != NULL) {
|
if (prev->dDev != NULL) {
|
||||||
free((void *)prev->dDev);
|
LOSCFG_FS_FREE_HOOK((void *)prev->dDev);
|
||||||
}
|
}
|
||||||
if (prev->dFsType != NULL) {
|
if (prev->dFsType != NULL) {
|
||||||
free((void *)prev->dFsType);
|
LOSCFG_FS_FREE_HOOK((void *)prev->dFsType);
|
||||||
}
|
}
|
||||||
if (prev->dAddrArray != NULL) {
|
if (prev->dAddrArray != NULL) {
|
||||||
free((void *)prev->dAddrArray);
|
LOSCFG_FS_FREE_HOOK((void *)prev->dAddrArray);
|
||||||
}
|
}
|
||||||
if (prev->dLengthArray != NULL) {
|
if (prev->dLengthArray != NULL) {
|
||||||
free((void *)prev->dLengthArray);
|
LOSCFG_FS_FREE_HOOK((void *)prev->dLengthArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(prev);
|
LOSCFG_FS_FREE_HOOK(prev);
|
||||||
errno = -ENOMEM;
|
errno = -ENOMEM;
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
@ -160,8 +165,7 @@ int LOS_PartitionFormat(const char *partName, char *fsType, void *data)
|
||||||
format is not allowed when the device has been mounted. */
|
format is not allowed when the device has been mounted. */
|
||||||
struct MountPoint *iter = NULL;
|
struct MountPoint *iter = NULL;
|
||||||
LOS_MP_FOR_EACH_ENTRY(iter) {
|
LOS_MP_FOR_EACH_ENTRY(iter) {
|
||||||
if ((iter->mFs != NULL) && (iter->mFs->fsType != NULL) &&
|
if ((iter->mPath != NULL) && (strcmp(iter->mPath, partName) == 0)) {
|
||||||
strcmp(iter->mFs->fsType, fsType) == 0) {
|
|
||||||
errno = EBUSY;
|
errno = EBUSY;
|
||||||
return (int)LOS_NOK;
|
return (int)LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,8 +373,9 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
|
||||||
while (!ping_kill && (forever || (i < cnt))) {
|
while (!ping_kill && (forever || (i < cnt))) {
|
||||||
iecho->seqno = htons((u16_t)i);
|
iecho->seqno = htons((u16_t)i);
|
||||||
iecho->chksum = 0;
|
iecho->chksum = 0;
|
||||||
|
#if (CHECKSUM_GEN_ICMP > 0)
|
||||||
iecho->chksum = inet_chksum((void *)iecho, iecho_len);
|
iecho->chksum = inet_chksum((void *)iecho, iecho_len);
|
||||||
|
#endif
|
||||||
ret = sendto(sfd, iecho, iecho_len, 0, (struct sockaddr *)&to, (socklen_t)sizeof(to));
|
ret = sendto(sfd, iecho, iecho_len, 0, (struct sockaddr *)&to, (socklen_t)sizeof(to));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
perror("Ping: sending ICMP echo request failed\n");
|
perror("Ping: sending ICMP echo request failed\n");
|
||||||
|
|
|
@ -96,6 +96,11 @@ STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
|
||||||
return LOS_SysCycleGet();
|
return LOS_SysCycleGet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC INLINE BOOL OsCheckKernelRunning(VOID)
|
||||||
|
{
|
||||||
|
return (g_taskScheduled && LOS_CHECK_SCHEDULE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup los_sched
|
* @ingroup los_sched
|
||||||
* @brief Get the time, in nanoseconds, remaining before the next tick interrupt response.
|
* @brief Get the time, in nanoseconds, remaining before the next tick interrupt response.
|
||||||
|
|
|
@ -120,21 +120,6 @@ LITE_OS_SEC_TEXT_INIT VOID LOS_Panic(const CHAR *fmt, ...)
|
||||||
ArchSysExit();
|
ArchSysExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
Function : OsRegister
|
|
||||||
Description : Configuring the maximum number of tasks
|
|
||||||
Input : None
|
|
||||||
Output : None
|
|
||||||
Return : None
|
|
||||||
*****************************************************************************/
|
|
||||||
LITE_OS_SEC_TEXT_INIT static VOID OsRegister(VOID)
|
|
||||||
{
|
|
||||||
g_taskMaxNum = LOSCFG_BASE_CORE_TSK_LIMIT + 1; /* Reserved 1 for IDLE */
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_Start(VOID)
|
LITE_OS_SEC_TEXT_INIT UINT32 LOS_Start(VOID)
|
||||||
{
|
{
|
||||||
return ArchStartSchedule();
|
return ArchStartSchedule();
|
||||||
|
@ -156,8 +141,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||||
OsBackTraceInit();
|
OsBackTraceInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OsRegister();
|
|
||||||
|
|
||||||
#ifdef LOSCFG_KERNEL_LMS
|
#ifdef LOSCFG_KERNEL_LMS
|
||||||
OsLmsInit();
|
OsLmsInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -618,7 +618,7 @@ VOID LOS_SchedTickHandler(VOID)
|
||||||
|
|
||||||
VOID LOS_Schedule(VOID)
|
VOID LOS_Schedule(VOID)
|
||||||
{
|
{
|
||||||
if (g_taskScheduled && LOS_CHECK_SCHEDULE) {
|
if (OsCheckKernelRunning()) {
|
||||||
ArchTaskSchedule();
|
ArchTaskSchedule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
* @ingroup los_task
|
* @ingroup los_task
|
||||||
* @brief check task id's validation
|
* @brief check task id's validation
|
||||||
*/
|
*/
|
||||||
#define OS_TASK_ID_CHECK(taskID) LOS_ASSERT_COND(OS_TSK_GET_INDEX(taskID) < g_taskMaxNum)
|
#define OS_TASK_ID_CHECK(taskID) (OS_TSK_GET_INDEX(taskID) < g_taskMaxNum)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup los_task
|
* @ingroup los_task
|
||||||
|
@ -409,6 +409,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTaskInit(VOID)
|
||||||
UINT32 size;
|
UINT32 size;
|
||||||
UINT32 index;
|
UINT32 index;
|
||||||
|
|
||||||
|
g_taskMaxNum = LOSCFG_BASE_CORE_TSK_LIMIT + 1; /* Reserved 1 for IDLE */
|
||||||
size = (g_taskMaxNum + 1) * sizeof(LosTaskCB);
|
size = (g_taskMaxNum + 1) * sizeof(LosTaskCB);
|
||||||
g_taskCBArray = (LosTaskCB *)LOS_MemAlloc(m_aucSysMem0, size);
|
g_taskCBArray = (LosTaskCB *)LOS_MemAlloc(m_aucSysMem0, size);
|
||||||
if (g_taskCBArray == NULL) {
|
if (g_taskCBArray == NULL) {
|
||||||
|
@ -856,7 +857,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskResume(UINT32 taskID)
|
||||||
UINT32 retErr = OS_ERROR;
|
UINT32 retErr = OS_ERROR;
|
||||||
BOOL needSched = FALSE;
|
BOOL needSched = FALSE;
|
||||||
|
|
||||||
if (taskID > LOSCFG_BASE_CORE_TSK_LIMIT) {
|
if (!OS_TASK_ID_CHECK(taskID)) {
|
||||||
return LOS_ERRNO_TSK_ID_INVALID;
|
return LOS_ERRNO_TSK_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ static UINT32 Testcase(VOID)
|
||||||
LOS_EventInit(&g_pevent);
|
LOS_EventInit(&g_pevent);
|
||||||
|
|
||||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
|
@ -111,7 +111,6 @@ static UINT32 Testcase(VOID)
|
||||||
EXIT1:
|
EXIT1:
|
||||||
LOS_TaskDelete(g_testTaskID02);
|
LOS_TaskDelete(g_testTaskID02);
|
||||||
|
|
||||||
EXIT:
|
|
||||||
LOS_TaskDelete(g_testTaskID01);
|
LOS_TaskDelete(g_testTaskID01);
|
||||||
|
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
|
|
@ -88,7 +88,7 @@ static UINT32 Testcase(VOID)
|
||||||
LOS_EventInit(&g_pevent);
|
LOS_EventInit(&g_pevent);
|
||||||
|
|
||||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
|
@ -106,7 +106,6 @@ static UINT32 Testcase(VOID)
|
||||||
EXIT1:
|
EXIT1:
|
||||||
LOS_TaskDelete(g_testTaskID02);
|
LOS_TaskDelete(g_testTaskID02);
|
||||||
|
|
||||||
EXIT:
|
|
||||||
LOS_TaskDelete(g_testTaskID01);
|
LOS_TaskDelete(g_testTaskID01);
|
||||||
|
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
|
|
@ -37,7 +37,7 @@ static VOID TaskF01(VOID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ItHwiM3B001F001()
|
static VOID ItHwiM3B001F001(VOID)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ static UINT32 g_uwsTick2;
|
||||||
static UINT32 g_uwsTick3;
|
static UINT32 g_uwsTick3;
|
||||||
|
|
||||||
extern VOID LOS_GetCpuTick(UINT32 *puwCntHi, UINT32 *puwCntLo);
|
extern VOID LOS_GetCpuTick(UINT32 *puwCntHi, UINT32 *puwCntLo);
|
||||||
extern VOID ItSuiteLosSwtmr();
|
extern VOID ItSuiteLosSwtmr(VOID);
|
||||||
extern VOID ItLosSwtmr001(VOID);
|
extern VOID ItLosSwtmr001(VOID);
|
||||||
extern VOID ItLosSwtmr002(VOID);
|
extern VOID ItLosSwtmr002(VOID);
|
||||||
extern VOID ItLosSwtmr003(VOID);
|
extern VOID ItLosSwtmr003(VOID);
|
||||||
|
|
|
@ -39,7 +39,7 @@ static VOID Case1(UINT32 arg)
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID Case2()
|
static VOID Case2(VOID)
|
||||||
{
|
{
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,12 +44,12 @@ static VOID Case1(UINT32 arg)
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID Case2()
|
static VOID Case2(VOID)
|
||||||
{
|
{
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID Case3()
|
static VOID Case3(VOID)
|
||||||
{
|
{
|
||||||
g_testCount++;
|
g_testCount++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
|
|
||||||
static UINT32 g_testCount1 = 0;
|
static UINT32 g_testCount1 = 0;
|
||||||
static VOID Case1()
|
static VOID Case1(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
static UINT32 g_testCount1 = 0;
|
static UINT32 g_testCount1 = 0;
|
||||||
|
|
||||||
static VOID Case1()
|
static VOID Case1(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ static VOID Case1(UINT32 arg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID Case2()
|
static VOID Case2(VOID)
|
||||||
{
|
{
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
UINT32 tick;
|
UINT32 tick;
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
#include "osTest.h"
|
#include "osTest.h"
|
||||||
#include "It_los_task.h"
|
#include "It_los_task.h"
|
||||||
|
|
||||||
static UINT32 g_freeMem1 = 0;
|
|
||||||
static UINT32 g_freeMem2 = 0;
|
|
||||||
|
|
||||||
static UINT32 GetfreeMemSize(void *pool)
|
static UINT32 GetfreeMemSize(void *pool)
|
||||||
{
|
{
|
||||||
return LOS_MemPoolSizeGet(pool) - LOS_MemTotalUsedGet(pool);
|
return LOS_MemPoolSizeGet(pool) - LOS_MemTotalUsedGet(pool);
|
||||||
|
|
|
@ -43,7 +43,7 @@ pthread_t TestPthreadSelf(void)
|
||||||
return tid;
|
return tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ItSuitePosixPthread()
|
void ItSuitePosixPthread(void)
|
||||||
{
|
{
|
||||||
printf("************** begin SAMPLE POSIX pthread test *************\n");
|
printf("************** begin SAMPLE POSIX pthread test *************\n");
|
||||||
ItPosixPthread001();
|
ItPosixPthread001();
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "osTest.h"
|
#include "osTest.h"
|
||||||
#include "pthread.h"
|
#include "pthread.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#undef TASK_PRIO_TEST
|
#undef TASK_PRIO_TEST
|
||||||
#define TASK_PRIO_TEST LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO
|
#define TASK_PRIO_TEST LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO
|
||||||
|
@ -690,7 +691,6 @@ static VOID PthreadOnceFunc01(void)
|
||||||
LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread010, Function | MediumTest | Level1)
|
LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread010, Function | MediumTest | Level1)
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_t thread[TEST_THREAD_COUNT];
|
|
||||||
struct sched_param schedParam = { 0 };
|
struct sched_param schedParam = { 0 };
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
UINT32 i = 0;
|
UINT32 i = 0;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "posix_test.h"
|
#include "posix_test.h"
|
||||||
#include "kernel_test.h"
|
#include "kernel_test.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#define RET_TRUE 1
|
#define RET_TRUE 1
|
||||||
#define RET_FALSE 0
|
#define RET_FALSE 0
|
||||||
|
|
|
@ -77,6 +77,8 @@
|
||||||
|
|
||||||
void ItSuitePosix(void);
|
void ItSuitePosix(void);
|
||||||
|
|
||||||
|
extern void ItSuitePosixPthread(void);
|
||||||
|
extern void ItSuitePosixMutex(void);
|
||||||
extern void PosixCtypeFuncTest(void);
|
extern void PosixCtypeFuncTest(void);
|
||||||
extern void PosixIsdigitFuncTest(void);
|
extern void PosixIsdigitFuncTest(void);
|
||||||
extern void PosixIslowerFuncTest(void);
|
extern void PosixIslowerFuncTest(void);
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "los_config.h"
|
#include "los_config.h"
|
||||||
#include "kernel_test.h"
|
#include "kernel_test.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define RET_OK 0
|
#define RET_OK 0
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "los_config.h"
|
#include "los_config.h"
|
||||||
#include "kernel_test.h"
|
#include "kernel_test.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
#define EQUAL 0
|
#define EQUAL 0
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "kernel_test.h"
|
#include "kernel_test.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "los_tick.h"
|
#include "los_tick.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define RET_OK 0
|
#define RET_OK 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue