diff --git a/.gitignore b/.gitignore index fc87f6d3..23b64f81 100644 --- a/.gitignore +++ b/.gitignore @@ -16,9 +16,9 @@ cscope* tags # Menuconfig temp files -/include/config -/include/generated -.config* +/config.h +.config +.config.old # Build temp files /platform/board.ld diff --git a/BUILD.gn b/BUILD.gn index 696f2219..f0ab922f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -28,57 +28,330 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//build/lite/config/component/lite_component.gni") -import("//build/lite/config/subsystem/lite_subsystem.gni") + +declare_args() { + tee_enable = false +} + +LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h") + +tee = "" +if (tee_enable) { + tee = "_tee" +} + +productName = get_path_info(product_path, "file") +config_file = "${productName}_release.config" +if (ohos_build_compiler == "clang") { + if (ohos_build_type == "debug") { + config_file = "debug/${productName}_${ohos_build_compiler}${tee}.config" + } else { + config_file = "${productName}_${ohos_build_compiler}_release${tee}.config" + } +} else if (ohos_build_compiler == "gcc") { + if (ohos_build_type == "debug") { + config_file = "${productName}_debug_shell${tee}.config" + } else { + config_file = "${productName}_release${tee}.config" + } +} + +liteos_config_file = rebase_path("tools/build/config/$config_file") + +# we prefer use product specified config file +f = "$product_path/config/${ohos_build_type}${tee}.config" +if (exec_script("//build/lite/run_shell_cmd.py", [ "if [ -f $f ]; then echo true; else echo false; fi" ], "value")) { + liteos_config_file = f +} + +print("liteos_config_file:", liteos_config_file) + +exec_script("//build/lite/run_shell_cmd.py", [ "which genconfig || pip install --user kconfiglib" ]) + +exec_script("//build/lite/run_shell_cmd.py", + [ + "env" + + " CONFIG_=LOSCFG_" + + " KCONFIG_CONFIG_HEADER='y=true'" + + " KCONFIG_CONFIG=$liteos_config_file" + + " DEVICE_PATH=$device_path" + + " srctree=" + rebase_path(".") + + " genconfig" + + " --header-path $LITEOS_MENUCONFIG_H" + + " --file-list kconfig_files.txt" + + " --env-list kconfig_env.txt" + + " --config-out config.gni", + ]) + +import("liteos.gni") generate_notice_file("kernel_notice_file") { module_name = "kernel" module_source_dir_list = [ - "//third_party/FreeBSD", - "//third_party/musl", - "//third_party/zlib", - "//third_party/FatFs", - "//third_party/Linux_Kernel", - "//third_party/lwip", - "//third_party/NuttX", - "//third_party/mtd-utils", + "$LITEOSTHIRDPARTY/FreeBSD", + "$LITEOSTHIRDPARTY/musl", + "$LITEOSTHIRDPARTY/zlib", + "$LITEOSTHIRDPARTY/FatFs", + "$LITEOSTHIRDPARTY/Linux_Kernel", + "$LITEOSTHIRDPARTY/lwip", + "$LITEOSTHIRDPARTY/NuttX", + "$LITEOSTHIRDPARTY/mtd-utils", ] } -declare_args() { - enable_ohos_kernel_liteos_a_ext_build = true - LOSCFG_TEST_APPS = false - tee_enable = "" +liteos_arch_cflags = [] +if (defined(LOSCFG_ARCH_ARM)) { + mcpu = LOSCFG_ARCH_CPU + if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) { + mcpu += "+nofp" + } + liteos_arch_cflags += [ "-mcpu=$mcpu" ] + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + liteos_arch_cflags += [ + "-mfloat-abi=softfp", + "-mfpu=$LOSCFG_ARCH_FPU", + ] + } } -lite_subsystem("kernel") { - subsystem_components = [] +cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_cflags) +if (ohos_build_compiler == "clang") { + cc += " --target=$target_triple" +} - if (enable_ohos_kernel_liteos_a_ext_build == false) { - subsystem_components += [ - "//kernel/liteos_a/kernel", - "//kernel/liteos_a/net", - "//kernel/liteos_a/lib", - "//kernel/liteos_a/compat", - "//kernel/liteos_a/fs", - "//kernel/liteos_a/arch:platform_cpu", - ] - if (LOSCFG_SHELL) { - subsystem_components += [ "//kernel/liteos_a/shell" ] - } - } else { - deps = [ ":make" ] - deps += [ "//kernel/liteos_a/testsuites/unittest:unittest" ] +config("arch_config") { + cflags = liteos_arch_cflags + asmflags = cflags + ldflags = cflags +} + +config("as_objs_libc_flags") { + defines = [ "__ASSEMBLY__" ] + + # linux style macros + if (defined(LOSCFG_ARCH_ARM_V7A) || defined(LOSCFG_ARCH_ARM_V7R) || + defined(LOSCFG_ARCH_ARM_V7M)) { + defines += [ "__LINUX_ARM_ARCH__=7" ] + } else if (defined(LOSCFG_ARCH_ARM_V8A) || defined(LOSCFG_ARCH_ARM_V8R) || + defined(LOSCFG_ARCH_ARM_V8M)) { + defines += [ "__LINUX_ARM_ARCH__=8" ] } } +config("std_include") { + std_include = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-file-name=include" ], "trim string") + include_dirs = [ std_include ] +} + +config("public") { + configs = [ + "arch:public", + "platform:public", + "kernel:public", + "compat:public", + "bsd:public", + "fs:public", + "drivers:public", + "security:public", + "net:public", + "shell:public", + "lib:public", + ":std_include", + ] +} + +config("los_nostdinc") { + cflags = [ "-nostdinc" ] +} + +config("los_nostdlib") { + ldflags = [ "-nostdlib" ] +} + +config("los_common") { + cflags = [ + "-imacros", + "$LITEOS_MENUCONFIG_H", + ] + + defines = [ "__LITEOS__" ] + + cflags_c = [ "-std=c99" ] + + cflags += [ + "-fno-pic", + "-fno-builtin", + "-Wall", + "-Werror", + "-fms-extensions", + "-Wno-address-of-packed-member", + "-fno-strict-aliasing", + "-fno-common", + "-fsigned-char", + "-Wpointer-arith", + "-Wstrict-prototypes", + "-Winvalid-pch", + "-ffunction-sections", + "-fdata-sections", + "-fno-exceptions", + "-fno-omit-frame-pointer", + "-fno-short-enums", + ] + + if (defined(LOSCFG_QUICK_START)) { + cflags -= [ "-Werror" ] + } + + if (defined(LOSCFG_COMPILE_DEBUG)) { + cflags += [ + "-O0", + "-g", + "-gdwarf-2", + ] + } else { + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Oz", + "-flto", + ] + } else { + cflags += [ "-O2" ] + } + } + + if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) { + cflags += [ "-fstack-protector-all" ] + } else if (defined(LOSCFG_CC_STACKPROTECTOR_STRONG)) { + cflags += [ "-fstack-protector-strong" ] + } else if (defined(LOSCFG_CC_STACKPROTECTOR)) { + cflags += [ + "-fstack-protector", + "--param", + "ssp-buffer-size=4", + ] + } else { + cflags += [ "-fno-stack-protector" ] + } + + if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ "-fno-aggressive-loop-optimizations" ] + if (!defined(LOSCFG_ARCH_ARM_AARCH64)) { + cflags += [ + "-mno-unaligned-access", + "-mthumb-interwork", + ] + } + } + + if (defined(LOSCFG_THUMB)) { + cflags += [ + "-mthumb", + "-Wa,-mimplicit-it=thumb", + ] + } + + asmflags = cflags +} + +config("los_config") { + configs = [ + ":los_common", + ":arch_config", + ":los_nostdinc", + ":los_nostdlib", + ] +} + +liteos_name = "liteos2" +liteos_out = rebase_path("$target_out_dir/$liteos_name") +executable(liteos_name) { + configs = [] # clear default configs + configs += [ ":los_config" ] + + ldflags = [ + "-static", + "-Wl,--gc-sections", + "-Wl,-Map=" + rebase_path("$liteos_out.map"), + "-Wl,--no-eh-frame-hdr", + "-Wl,--whole-archive", + ] + + libgcc = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-libgcc-file-name" ], "trim string") + libs = [ libgcc ] + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ] + } else { + ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ] + ldflags += [ "-nostartfiles" ] + } + + output_dir = target_out_dir + + deps = [ + ":modules", + ] +} + +build_ext_component("build_liteos_bin") { + deps = [ ":$liteos_name" ] + exec_path = rebase_path(target_out_dir) + + objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix" + objdump = "${compile_prefix}objdump$toolchain_cmd_suffix" + + liteos = rebase_path("$target_out_dir/unstripped/bin/$liteos_name") + + command = "$objcopy -O binary $liteos $liteos_out.bin" + command += " && sh -c '$objdump -t $liteos | sort >$liteos_out.sym.sorted'" + command += " && sh -c '$objdump -d $liteos >$liteos_out.asm'" +} + +group("modules") { + deps = [ + "arch", + "bsd", + "compat", + "drivers", + "fs", + "kernel", + "lib", + "net", + "platform", + "security", + "shell", + "syscall", + ] +} + +group("apps") { + deps = [ "apps" ] +} + +group("tests") { + deps = [ "testsuites" ] +} + +group("kernel") { + deps = [ + ":make", + ":tests", + ] +} + +group("liteos_a") { + deps = [ + ":apps", + ":kernel", + ":tests", + ] +} + build_ext_component("make") { exec_path = rebase_path(".", root_build_dir) - tee_enable = "false" - if (board_name == "hi3516dv300" && enable_tee_ree) { - tee_enable = "tee" - } outdir = rebase_path(get_path_info(".", "out_dir")) sysroot_path = rebase_path(ohos_current_sysroot) arch_cflags = string_join(" ", target_arch_cflags) - command = "./build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable} \"${device_company}\" \"${product_path}\" $outdir \"${ohos_version}\" ${sysroot_path} \"${arch_cflags}\"" + command = "./build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} \"${tee_enable}\"" + command += " \"${device_company}\" \"${product_path}\" $outdir \"${ohos_version}\" ${sysroot_path} \"${arch_cflags}\"" + command += " \"${device_path}\"" } diff --git a/Kconfig b/Kconfig index 8bce9860..8b8704e8 100644 --- a/Kconfig +++ b/Kconfig @@ -52,15 +52,19 @@ endmenu menu "Platform" ######################### config options of bsp ##################### -source "../../kernel/liteos_a/platform/Kconfig" +source "platform/Kconfig" ######################### config options of cpu arch ################ -source "../../kernel/liteos_a/arch/Kconfig" +source "arch/Kconfig" ######################### config options of rootfs ##################### -source "../../kernel/liteos_a/kernel/common/Kconfig" +source "kernel/common/rootfs/Kconfig" ######################### config options of patchfs ##################### -source "../../kernel/liteos_a/kernel/common/patchfs/Kconfig" +source "kernel/common/patchfs/Kconfig" +######################### config options of blackbox ##################### +source "kernel/common/blackbox/Kconfig" +######################### config options of hidumper ##################### +source "kernel/common/hidumper/Kconfig" config QUICK_START bool "Enable QUICK_START" @@ -71,27 +75,25 @@ config QUICK_START endmenu ######################### config options of kernel ##################### -source "../../kernel/liteos_a/kernel/Kconfig" +source "kernel/Kconfig" ######################### config options of lib ######################## -source "../../kernel/liteos_a/lib/Kconfig" +source "lib/Kconfig" ######################### config options of compatibility ############## menu "Compat" -source "../../kernel/liteos_a/compat/posix/Kconfig" -source "../../kernel/liteos_a/bsd/Kconfig" +source "compat/posix/Kconfig" +source "bsd/Kconfig" endmenu -######################### config options of framework ################## -#source "../../frameworks/m2mcomm/Kconfig" - ######################## config options of filesystem ################## menu "FileSystem" -source "../../kernel/liteos_a/fs/vfs/Kconfig" -source "../../kernel/liteos_a/fs/fat/Kconfig" -source "../../kernel/liteos_a/fs/ramfs/Kconfig" -source "../../kernel/liteos_a/fs/romfs/Kconfig" -source "../../kernel/liteos_a/fs/nfs/Kconfig" -source "../../kernel/liteos_a/fs/proc/Kconfig" -source "../../kernel/liteos_a/fs/jffs2/Kconfig" +source "fs/vfs/Kconfig" +source "fs/fat/Kconfig" +source "fs/ramfs/Kconfig" +source "fs/romfs/Kconfig" +source "fs/nfs/Kconfig" +source "fs/proc/Kconfig" +source "fs/jffs2/Kconfig" +source "fs/zpfs/Kconfig" config ENABLE_READ_BUFFER bool "Enable read buffer Option" default n @@ -117,7 +119,7 @@ config MAX_PATH_CACHE_SIZE endmenu ######################## config options of net ############################ -source "../../kernel/liteos_a/net/Kconfig" +source "net/Kconfig" ######################## config options of debug ######################## menu "Debug" @@ -162,9 +164,16 @@ config ENABLE_MAGICKEY config THUMB bool "Enable Thumb" default n + select INTERWORK_THUMB help Answer Y to build thumb version. This will make LiteOS smaller. +config INTERWORK_THUMB + bool "Enable interwork Thumb" if THUMB + default n + help + Answer Y to enable interwork thumb. + config PLATFORM_DVFS bool "Enable Dvfs" default n @@ -219,14 +228,14 @@ config DEBUG_SEMAPHORE help Answer Y to enable debug semaphore. -source "../../kernel/liteos_a/shell/Kconfig" +source "shell/Kconfig" config NET_LWIP_SACK_TFTP bool "Enable Tftp" default y depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION help Answer Y to enable LiteOS support tftp cmd and tftp tool. -source "../../kernel/liteos_a/net/telnet/Kconfig" +source "net/telnet/Kconfig" config SCHED_DEBUG bool "Enable sched debug Feature" default n @@ -265,7 +274,7 @@ config MEM_LEAKCHECK help Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the infomations of mem node. config BASE_MEM_NODE_INTEGRITY_CHECK - bool "Enable integrity check or not " + bool "Enable integrity check or not" default n depends on DEBUG_VERSION && MEM_DEBUG config MEM_WATERLINE @@ -290,20 +299,24 @@ config DRIVERS help Answer Y to enable LiteOS support driver. -source "../../kernel/liteos_a/bsd/dev/usb/Kconfig" +source "bsd/dev/usb/Kconfig" source "../../drivers/adapter/khdf/liteos/Kconfig" +# Device driver Kconfig import +osource "$(DEVICE_PATH)/drivers/Kconfig" + source "drivers/char/mem/Kconfig" source "drivers/char/quickstart/Kconfig" source "drivers/char/random/Kconfig" -source "../../drivers/liteos/tzdriver/Kconfig" source "drivers/char/video/Kconfig" + +source "../../drivers/liteos/tzdriver/Kconfig" source "../../drivers/liteos/hievent/Kconfig" endmenu menu "Security" -source "../../kernel/liteos_a/security/Kconfig" +source "security/Kconfig" endmenu menu "Test" diff --git a/Makefile b/Makefile index 9323917e..5c0c1bea 100644 --- a/Makefile +++ b/Makefile @@ -47,22 +47,29 @@ ROOTFS = rootfs LITEOS_TARGET = liteos LITEOS_LIBS_TARGET = libs_target -LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform export CONFIG_=LOSCFG_ -MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig -KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig - -ifeq ($(OS), Linux) -MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/mconf -MENUCONFIG_CONF := $(MENUCONFIG_PATH)/conf -else -MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/kconfig-mconf.exe -MENUCONFIG_CONF := $(MENUCONFIG_PATH)/kconfig-conf.exe +ifeq ($(PRODUCT_PATH),) +export PRODUCT_PATH=$(shell hb env|grep "product path:"|sed 's/.*: //g') +endif +ifeq ($(DEVICE_PATH),) +export DEVICE_PATH=$(shell hb env|grep "device path:"|sed 's/.*: //g') endif -$(shell env CONFIG_=$(CONFIG_) $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH)) +ifeq ($(TEE:1=y),y) +tee = _tee +endif +ifeq ($(RELEASE:1=y),y) +CONFIG ?= $(PRODUCT_PATH)/config/release$(tee).config +else +CONFIG ?= $(PRODUCT_PATH)/config/debug$(tee).config +endif + +ifeq ($(shell which menuconfig),) +$(shell pip install --user kconfiglib >/dev/null) +endif +$(shell env CONFIG_=$(CONFIG_) DEVICE_PATH=$(DEVICE_PATH) olddefconfig >/dev/null) -include $(LITEOSTOPDIR)/tools/build/config.mk @@ -116,6 +123,15 @@ else $(HIDE)$(SCRIPTS_PATH)/mklibversion.sh endif +##### make sysroot ##### +sysroot: +ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) +ifeq ($(wildcard $(SYSROOT_PATH)/usr/include/$(LLVM_TARGET)/),) + $(HIDE)$(MAKE) -C $(SYSROOT_PATH)/build TARGETS=liteos_a_user +endif + $(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH)) +endif + ##### make dynload ##### -include $(LITEOS_MK_PATH)/dynload.mk @@ -132,26 +148,21 @@ $(OUT): $(LITEOS_MENUCONFIG_H) $(BUILD): $(HIDE)mkdir -p $(BUILD) -$(LITEOS_LIBS_TARGET): $(__LIBS) +$(LITEOS_LIBS_TARGET): $(__LIBS) sysroot $(HIDE)for dir in $(LIB_SUBDIRS); \ do $(MAKE) -C $$dir all || exit 1; \ done $(HIDE)echo "=============== make lib done ===============" ##### make menuconfig ##### -menuconfig:$(MENUCONFIG_MCONF) - $< $(KCONFIG_FILE_PATH) - -genconfig:$(MENUCONFIG_CONF) - $(HIDE)mkdir -p include/config include/generated - $< --olddefconfig $(KCONFIG_FILE_PATH) - $< --silentoldconfig $(KCONFIG_FILE_PATH) +menuconfig: + $(HIDE)menuconfig ##### menuconfig end ####### $(LITEOS_MENUCONFIG_H): .config - $(HIDE)$(MAKE) genconfig + $(HIDE)genconfig -$(LITEOS_TARGET): $(__LIBS) +$(LITEOS_TARGET): $(__LIBS) sysroot $(HIDE)touch $(LOSCFG_ENTRY_SRC) $(HIDE)for dir in $(LITEOS_SUBDIRS); \ @@ -165,18 +176,14 @@ $(LITEOS_TARGET): $(__LIBS) $(OBJDUMP) -d $(OUT)/$@ >$(OUT)/$@.asm # $(NM) -S --size-sort $(OUT)/$@ >$(OUT)/$@.size -$(APPS): $(LITEOS_TARGET) +$(APPS): $(LITEOS_TARGET) sysroot $(HIDE)$(MAKE) -C apps all -ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -MULTILIB := $(patsubst $(shell $(CC) --target=$(LLVM_TARGET) $(ARCH_CFLAGS) -print-file-name=lib/$(LLVM_TARGET)/)%,%,$(dir $(shell $(CC) --target=$(LLVM_TARGET) $(ARCH_CFLAGS) -print-libgcc-file-name))) -endif - prepare: $(HIDE)mkdir -p $(OUT)/musl ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) - $(HIDE)cp -f $(SYSROOT_PATH)/usr/lib/$(LLVM_TARGET)/$(MULTILIB)/libc.so $(OUT)/musl - $(HIDE)cp -f $(LITEOS_COMPILER_PATH)/lib/$(LLVM_TARGET)/c++/$(MULTILIB)/libc++.so $(OUT)/musl + $(HIDE)cp -f $$($(CC) --target=$(LLVM_TARGET) --sysroot=$(SYSROOT_PATH) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl + $(HIDE)cp -f $$($(GPP) --target=$(LLVM_TARGET) --sysroot=$(SYSROOT_PATH) $(LITEOS_CXXFLAGS) -print-file-name=libc++.so) $(OUT)/musl else $(HIDE)cp -f $(LITEOS_COMPILER_PATH)/target/usr/lib/libc.so $(OUT)/musl $(HIDE)cp -f $(LITEOS_COMPILER_PATH)/arm-linux-musleabi/lib/libstdc++.so.6 $(OUT)/musl @@ -186,7 +193,7 @@ endif $(ROOTFSDIR): prepare $(APPS) $(HIDE)$(MAKE) clean -C apps - $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT)/bin $(OUT)/musl $(ROOTFS_DIR) $(LITEOS_TARGET_DIR) + $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT) $(ROOTFS_DIR) $(LITEOS_TARGET_DIR) ifneq ($(VERSION),) $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR) $(LITEOS_TARGET_DIR) endif @@ -218,10 +225,11 @@ update_all_config: $(HIDE)shopt -s globstar && for f in tools/build/config/**/*.config ; \ do \ echo updating $$f; \ - test -f $$f && cp $$f .config && $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig $$f $(KCONFIG_FILE_PATH); \ + test -f $$f && cp $$f .config && olddefconfig && savedefconfig --out $$f; \ done -%.config: - $(HIDE)test -f tools/build/config/$@ && cp tools/build/config/$@ .config && $(MENUCONFIG_MCONF) $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig tools/build/config/$@ $(KCONFIG_FILE_PATH) +update_config: + $(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig && savedefconfig --out "$(CONFIG)" -.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config +.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config update_config +.PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT) diff --git a/apps/BUILD.gn b/apps/BUILD.gn new file mode 100644 index 00000000..3e197007 --- /dev/null +++ b/apps/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("apps") { + deps = [] + + if (defined(LOSCFG_SHELL)) { + deps += [ + "shell", + #"mksh", + #"toybox", + ] + } + + if (defined(LOSCFG_USER_INIT_DEBUG)) { + #deps += [ "init" ] + } + + if (defined(LOSCFG_NET_LWIP_SACK_TFTP)) { + deps += [ "tftp" ] + } +} diff --git a/apps/init/BUILD.gn b/apps/init/BUILD.gn new file mode 100644 index 00000000..3b8b4f5a --- /dev/null +++ b/apps/init/BUILD.gn @@ -0,0 +1,53 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +executable("init") { + sources = [ "src/init.c" ] + + cflags = [ "-fPIE" ] + + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Wno-shift-op-parentheses", + "-Wno-bitwise-op-parentheses", + "-Wnonnull", + ] + } + + ldflags = [ + "-pie", + "-s", + ] + + if (defined(LOSCFG_QUICK_START)) { + ldflags += [ "--static" ] + } +} diff --git a/apps/mksh/BUILD.gn b/apps/mksh/BUILD.gn new file mode 100644 index 00000000..a09888e5 --- /dev/null +++ b/apps/mksh/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") + +group("mksh") { + deps = [ ":build_mksh" ] +} + +build_ext_component("build_mksh") { + exec_path = rebase_path(target_out_dir) + command = "make -C $LITEOSTHIRDPARTY/mksh" +} diff --git a/apps/mksh/Makefile b/apps/mksh/Makefile index 8aa8bcdc..43f215f1 100755 --- a/apps/mksh/Makefile +++ b/apps/mksh/Makefile @@ -34,15 +34,16 @@ LITEOSTOPDIR = $(MKSH_DIR)/../../ include $(MKSH_DIR)/../config.mk APPS_OUT := $(OUT)/bin +ETC_OUT := $(OUT)/etc BUILD_DIR := $(MKSH_DIR)/build BUILD_LOG := $(MKSH_DIR)/build.log TARGET_OS := OpenHarmony LOCAL_CFLAGS := -flto -fdata-sections -ffunction-sections -Oz -fstack-protector-strong -D_FORTIFY_SOURCE=2 -LOCAL_CFLAGS += --target=arm-liteos $(LLVM_SYSROOT) +LOCAL_CFLAGS += --target=$(LLVM_TARGET) $(LLVM_SYSROOT) LOCAL_CFLAGS += -DMKSH_DISABLE_TTY_WARNING -DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=1 -DMKSH_SMALL_BUT_FAST=0 -DMKSH_S_NOVI=1 -DHAVE_CAN_FSTACKPROTECTORSTRONG=1 LOCAL_CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A -LOCAL_LDFLAGS := -Wl,--gc-sections -flto -O2 --target=arm-liteos $(LLVM_SYSROOT) +LOCAL_LDFLAGS := -Wl,--gc-sections -flto -O2 --target=$(LLVM_TARGET) $(LLVM_SYSROOT) all:$(MKSH) @@ -61,6 +62,8 @@ endif $(HIDE)$(STRIP) $(MKSH) $(HIDE)mkdir -p $(APPS_OUT) $(HIDE)$(CP) $(MKSH) $(APPS_OUT) + $(HIDE)mkdir -p $(ETC_OUT) + $(HIDE)$(CP) -rf $(BUILD_DIR)/.mkshrc $(ETC_OUT)/ clean: $(HIDE)$(RM) $(MKSH) $(BUILD_DIR) $(BUILD_LOG) diff --git a/apps/module.mk b/apps/module.mk index e2d014d6..5b246a45 100644 --- a/apps/module.mk +++ b/apps/module.mk @@ -33,6 +33,8 @@ APP_SUBDIRS := ifeq ($(LOSCFG_SHELL), y) APP_SUBDIRS += shell +APP_SUBDIRS += mksh +APP_SUBDIRS += toybox endif ifeq ($(LOSCFG_USER_INIT_DEBUG), y) @@ -42,9 +44,3 @@ endif ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y) APP_SUBDIRS += tftp endif - -#only enable for qemu now -ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y) -APP_SUBDIRS += mksh -APP_SUBDIRS += toybox -endif diff --git a/apps/shell/BUILD.gn b/apps/shell/BUILD.gn new file mode 100644 index 00000000..7afbbf6f --- /dev/null +++ b/apps/shell/BUILD.gn @@ -0,0 +1,58 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +executable("shell") { + sources = [ + "builtin/cd.c", + "src/main.c", + "src/shcmd.c", + "src/shcmdparse.c", + "src/shmsg.c", + ] + + deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ] + + include_dirs = [ "include" ] + + cflags = [ "-fPIE" ] + + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Wno-shift-op-parentheses", + "-Wno-bitwise-op-parentheses", + ] + } + + ldflags = [ + "-pie", + "-s", + ] +} diff --git a/apps/tftp/BUILD.gn b/apps/tftp/BUILD.gn new file mode 100644 index 00000000..eef0d82a --- /dev/null +++ b/apps/tftp/BUILD.gn @@ -0,0 +1,55 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +executable("tftp") { + sources = [ + "src/main.c", + "src/tftpc.c", + ] + + deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ] + + include_dirs = [ "include" ] + + cflags = [ "-fPIE" ] + + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Wno-shift-op-parentheses", + "-Wno-bitwise-op-parentheses", + ] + } + + ldflags = [ + "-pie", + "-s", + ] +} diff --git a/apps/toybox/BUILD.gn b/apps/toybox/BUILD.gn new file mode 100644 index 00000000..8438e89e --- /dev/null +++ b/apps/toybox/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") + +group("toybox") { + deps = [ ":build_toybox" ] +} + +build_ext_component("build_toybox") { + exec_path = rebase_path(target_out_dir) + command = "make -C $LITEOSTHIRDPARTY/toybox" +} diff --git a/apps/toybox/Makefile b/apps/toybox/Makefile index 0af3c951..d4345bae 100644 --- a/apps/toybox/Makefile +++ b/apps/toybox/Makefile @@ -46,8 +46,8 @@ else $(HIDE)$(CP) $(LITEOSTHIRDPARTY)/$(TOYBOX)/. $(BUILD_DIR) $(HIDE)$(CP) -p $(LITEOSTHIRDPARTY)/$(TOYBOX)/porting/liteos_a/. $(BUILD_DIR) endif - $(HIDE)CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong --target=arm-liteos $(LLVM_SYSROOT)" CC="$(CC)" OUTNAME=$(OUTNAME) \ - LDFLAGS="--target=arm-liteos $(LLVM_SYSROOT)" \ + $(HIDE)CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong --target=$(LLVM_TARGET) $(LLVM_SYSROOT)" CC="$(CC)" OUTNAME=$(OUTNAME) \ + LDFLAGS="--target=$(LLVM_TARGET) $(LLVM_SYSROOT)" \ make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1 $(HIDE)$(CP) $(BUILD_DIR)/$(TOYBOX) . $(HIDE)$(STRIP) $(TOYBOX) diff --git a/apps/toybox/liteos_a_custom.config b/apps/toybox/liteos_a_custom.config index 2de92c6d..7628c2fa 100644 --- a/apps/toybox/liteos_a_custom.config +++ b/apps/toybox/liteos_a_custom.config @@ -1,7 +1,6 @@ -CONFIG_GETTY=y -CONFIG_MDEV=y -CONFIG_MDEV_CONF=y +# CONFIG_BASENAME is not set # CONFIG_CAL is not set +# CONFIG_CAT is not set # CONFIG_CATV is not set # CONFIG_CKSUM is not set # CONFIG_CRC32 is not set @@ -13,6 +12,7 @@ CONFIG_MDEV_CONF=y # CONFIG_CUT is not set # CONFIG_DF is not set # CONFIG_DIRNAME is not set +# CONFIG_ECHO is not set # CONFIG_ENV is not set # CONFIG_EXPAND is not set # CONFIG_FALSE is not set @@ -128,7 +128,6 @@ CONFIG_MDEV_CONF=y # CONFIG_READAHEAD is not set # CONFIG_READLINK is not set # CONFIG_REALPATH is not set -# CONFIG_REBOOT is not set # CONFIG_RESET is not set # CONFIG_REV is not set # CONFIG_RMMOD is not set @@ -179,3 +178,9 @@ CONFIG_MDEV_CONF=y # CONFIG_SEQ is not set # CONFIG_SU is not set # CONFIG_SYNC is not set +# +# pending (see toys/pending/README) +# +# CONFIG_GETTY is not set +# CONFIG_MDEV is not set +# CONFIG_MDEV_CONF is not set diff --git a/arch/BUILD.gn b/arch/BUILD.gn new file mode 100644 index 00000000..75517815 --- /dev/null +++ b/arch/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("arch") { + deps = [] + if (defined(LOSCFG_ARCH_ARM)) { + deps += [ "arm" ] + } +} + +config("public") { + configs = [] + if (defined(LOSCFG_ARCH_ARM)) { + configs += [ "arm:public" ] + } +} diff --git a/arch/arm/BUILD.gn b/arch/arm/BUILD.gn new file mode 100644 index 00000000..6a797c10 --- /dev/null +++ b/arch/arm/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("arm") { + deps = [ "gic" ] + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + deps += [ "arm" ] + } +} + +config("public") { + include_dirs = [ "include" ] + configs = [] + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + configs += [ "arm:public" ] + } else if (defined(LOSCFG_ARCH_ARM_AARCH64)) { + configs += [ "aarch64:public" ] + } +} diff --git a/arch/arm/arm/BUILD.gn b/arch/arm/arm/BUILD.gn new file mode 100644 index 00000000..f2ef7610 --- /dev/null +++ b/arch/arm/arm/BUILD.gn @@ -0,0 +1,82 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_name = LOSCFG_ARCH_CPU +kernel_module(module_name) { + sources = [ + "src/arm_generic_timer.c", + "src/clear_user.S", + "src/hw_user_get.S", + "src/hw_user_put.S", + "src/jmp.S", + "src/los_arch_mmu.c", + "src/los_asid.c", + "src/los_dispatch.S", + "src/los_exc.c", + "src/los_hw.c", + "src/los_hw_exc.S", + "src/los_hw_runstop.S", + "src/los_hw_tick.c", + "src/los_hwi.c", + "src/strncpy_from_user.c", + "src/strnlen_user.c", + "src/user_copy.c", + ] + + if (LOSCFG_ARCH_ARM_VER == "armv7-a") { + sources += [ "src/armv7a/cache.S" ] + } + + if (defined(LOSCFG_KERNEL_SMP)) { + sources += [ "src/startup/reset_vector_mp.S" ] + } else { + sources += [ "src/startup/reset_vector_up.S" ] + } + + include_dirs = [ "src/include" ] + + if (defined(LOSCFG_GDB)) { + configs += [ "$LITEOSTOPDIR:as_objs_libc_flags" ] + } + + public_configs = [ ":public" ] +} + +group("arm") { + public_deps = [ ":$module_name" ] +} + +config("public") { + include_dirs = [ + "include", + "src/include", + ] +} diff --git a/arch/arm/arm/include/los_hw_cpu.h b/arch/arm/arm/include/los_hw_cpu.h index f6fc4460..425ca449 100644 --- a/arch/arm/arm/include/los_hw_cpu.h +++ b/arch/arm/arm/include/los_hw_cpu.h @@ -145,7 +145,7 @@ STATIC INLINE VOID ArchCurrUserTaskSet(UINTPTR val) STATIC INLINE UINT32 ArchCurrCpuid(VOID) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP return ARM_SYSREG_READ(MPIDR) & MPIDR_CPUID_MASK; #else return 0; diff --git a/arch/arm/arm/src/los_arch_mmu.c b/arch/arm/arm/src/los_arch_mmu.c index 435dcfaf..b3991ce2 100644 --- a/arch/arm/arm/src/los_arch_mmu.c +++ b/arch/arm/arm/src/los_arch_mmu.c @@ -51,7 +51,7 @@ __attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \ __attribute__((section(".bss.prebss.translation_table"))) UINT8 \ g_firstPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS]; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP __attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \ __attribute__((section(".bss.prebss.translation_table"))) UINT8 \ g_tempPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS]; @@ -218,7 +218,7 @@ STATIC UINT32 OsCvtSecCacheFlagsToMMUFlags(UINT32 flags) switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) { case VM_MAP_REGION_FLAG_CACHED: mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_NORMAL_WRITE_BACK_ALLOCATE; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP mmuFlags |= MMU_DESCRIPTOR_L1_SECTION_SHAREABLE; #endif break; @@ -544,7 +544,7 @@ STATIC UINT32 OsCvtPte2CacheFlagsToMMUFlags(UINT32 flags) switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) { case VM_MAP_REGION_FLAG_CACHED: -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP mmuFlags |= MMU_DESCRIPTOR_L2_SHAREABLE; #endif mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_NORMAL_WRITE_BACK_ALLOCATE; @@ -871,7 +871,7 @@ STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached) kSpace->archMmu.virtTtb = (PTE_T *)g_firstPageTable; kSpace->archMmu.physTtb = LOS_PaddrQuery(kSpace->archMmu.virtTtb); status = LOS_ArchMmuUnmap(&kSpace->archMmu, virtAddr, - (bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT); + (bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT); if (status != ((bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) { VM_ERR("unmap failed, status: %d", status); return; @@ -882,8 +882,8 @@ STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached) flags |= VM_MAP_REGION_FLAG_UNCACHED; } status = LOS_ArchMmuMap(&kSpace->archMmu, virtAddr, SYS_MEM_BASE, - (textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, - flags); + (textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, + flags); if (status != ((textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) { VM_ERR("mmap failed, status: %d", status); return; @@ -910,9 +910,9 @@ STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached) flags |= VM_MAP_REGION_FLAG_UNCACHED; } status = LOS_ArchMmuMap(&kSpace->archMmu, bssEndBoundary, - SYS_MEM_BASE + bssEndBoundary - virtAddr, - kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, - flags); + SYS_MEM_BASE + bssEndBoundary - virtAddr, + kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, + flags); if (status != (kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) { VM_ERR("mmap failed, status: %d", status); return; diff --git a/arch/arm/arm/src/los_exc.c b/arch/arm/arm/src/los_exc.c index 1c0c89cd..297a061b 100644 --- a/arch/arm/arm/src/los_exc.c +++ b/arch/arm/arm/src/los_exc.c @@ -38,7 +38,6 @@ #include "los_excinfo_pri.h" #endif #include "los_sys_stack_pri.h" -#include "los_stackinfo_pri.h" #ifdef LOSCFG_COREDUMP #include "los_coredump.h" #endif @@ -62,6 +61,9 @@ #ifdef LOSCFG_FS_VFS #include "console.h" #endif +#ifdef LOSCFG_BLACKBOX +#include "los_blackbox.h" +#endif #define INVALID_CPUID 0xFFFF @@ -75,7 +77,7 @@ VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr); UINT32 g_curNestCount[LOSCFG_KERNEL_CORE_NUM] = { 0 }; BOOL g_excFromUserMode[LOSCFG_KERNEL_CORE_NUM]; STATIC EXC_PROC_FUNC g_excHook = (EXC_PROC_FUNC)OsExcHook; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP STATIC SPIN_LOCK_INIT(g_excSerializerSpin); STATIC UINT32 g_currHandleExcPID = OS_INVALID_VALUE; STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID; @@ -531,7 +533,7 @@ STATIC VOID OsExcRestore(VOID) g_excFromUserMode[currCpuID] = FALSE; g_intCount[currCpuID] = 0; g_curNestCount[currCpuID] = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP OsPercpuGet()->excFlag = CPU_RUNNING; #endif OsPercpuGet()->taskLockCnt = 0; @@ -548,7 +550,7 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr) return; } -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP LOS_SpinLock(&g_excSerializerSpin); if (g_nextExcWaitCpu != INVALID_CPUID) { g_currHandleExcCpuID = g_nextExcWaitCpu; @@ -563,12 +565,15 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr) #endif runProcess->processStatus &= ~OS_PROCESS_FLAG_EXIT; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #ifdef LOSCFG_FS_VFS OsWakeConsoleSendTask(); #endif #endif +#ifdef LOSCFG_BLACKBOX + BBoxNotifyError("USER_CRASH", MODULE_SYSTEM, "Crash in user", 0); +#endif SCHEDULER_LOCK(intSave); #ifdef LOSCFG_SAVE_EXCINFO OsProcessExitCodeCoreDumpSet(runProcess); @@ -716,14 +721,14 @@ VOID BackTraceSub(UINTPTR regFP) while (IsValidFP(backFP, stackStart, stackEnd, &kvaddr) == TRUE) { tmpFP = backFP; #ifdef LOSCFG_COMPILER_CLANG_LLVM - backFP = *(UINTPTR *)(UINTPTR)kvaddr; + backFP = *(UINTPTR *)(UINTPTR)kvaddr; if (IsValidFP(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) { PrintExcInfo("traceback backLR check failed, backLP: 0x%x\n", tmpFP + POINTER_SIZE); return; } backLR = *(UINTPTR *)(UINTPTR)kvaddr; #else - backLR = *(UINTPTR *)(UINTPTR)kvaddr; + backLR = *(UINTPTR *)(UINTPTR)kvaddr; if (IsValidFP(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) { PrintExcInfo("traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE); return; @@ -909,7 +914,7 @@ VOID OsDataAbortExcHandleEntry(ExcContext *excBufAddr) #endif /* __LINUX_ARM_ARCH__ */ #endif /* LOSCFG_GDB */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #define EXC_WAIT_INTER 50U #define EXC_WAIT_TIME 2000U @@ -1007,7 +1012,7 @@ STATIC VOID OsCheckAllCpuStatus(VOID) OsWaitOtherCoresHandleExcEnd(currCpuID); } else { - if (g_excFromUserMode[g_currHandleExcCpuID] == TRUE) { + if ((g_currHandleExcCpuID < LOSCFG_KERNEL_CORE_NUM) && (g_excFromUserMode[g_currHandleExcCpuID] == TRUE)) { g_currHandleExcCpuID = currCpuID; LOS_SpinUnlock(&g_excSerializerSpin); target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID)); @@ -1027,7 +1032,7 @@ STATIC VOID OsCheckAllCpuStatus(VOID) STATIC VOID OsCheckCpuStatus(VOID) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP OsCheckAllCpuStatus(); #else g_currHandleExcCpuID = ArchCurrCpuid(); @@ -1048,7 +1053,7 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr) OsCheckCpuStatus(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #ifdef LOSCFG_FS_VFS /* Wait for the end of the Console task to avoid multicore printing code */ OsWaitConsoleSendTaskPend(OsCurrTaskGet()->taskID); @@ -1058,6 +1063,11 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr) LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far) { +#ifdef LOSCFG_BLACKBOX +#ifdef LOSCFG_SAVE_EXCINFO + SetExcInfoIndex(0); +#endif +#endif #ifdef LOSCFG_KERNEL_VM /* You are not allowed to add any other print information before this exception information */ if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) { @@ -1113,7 +1123,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd OsPrintExcHead(far); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP OsAllCpuStatusOutput(); #endif @@ -1125,7 +1135,9 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd if (g_curNestCount[ArchCurrCpuid()] == 1) { #ifdef LOSCFG_SAVE_EXCINFO if (func != NULL) { +#ifndef LOSCFG_BLACKBOX SetExcInfoIndex(0); +#endif OsSysStateSave(&intCount, &lockCount); OsRecordExcInfoTime(); OsSysStateRestore(intCount, lockCount); @@ -1154,6 +1166,9 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd } #endif +#ifdef LOSCFG_BLACKBOX + BBoxNotifyError(EVENT_PANIC, MODULE_SYSTEM, "Crash in kernel", 1); +#endif while (1) {} } @@ -1168,7 +1183,7 @@ __attribute__((noinline)) VOID LOS_Panic(const CHAR *fmt, ...) } /* stack protector */ -UINT32 __stack_chk_guard = 0xd00a0dff; +USED UINT32 __stack_chk_guard = 0xd00a0dff; VOID __stack_chk_fail(VOID) { @@ -1200,7 +1215,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou framePtr = Get_Fp(); while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr, sizeof(CHAR *))) { tmpFramePtr = framePtr; +#ifdef LOSCFG_COMPILER_CLANG_LLVM + linkReg = *(UINTPTR *)(tmpFramePtr + sizeof(UINTPTR)); +#else linkReg = *(UINTPTR *)framePtr; +#endif if (index >= jumpCount) { LR[count++] = linkReg; if (count == recordCount) { @@ -1208,7 +1227,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou } } index++; +#ifdef LOSCFG_COMPILER_CLANG_LLVM + framePtr = *(UINTPTR *)framePtr; +#else framePtr = *(UINTPTR *)(tmpFramePtr - sizeof(UINTPTR)); +#endif } /* if linkReg is not enough,clean up the last of the effective LR as the end. */ diff --git a/arch/arm/arm/src/los_hw.c b/arch/arm/arm/src/los_hw.c index 2db15a42..2c9584b9 100644 --- a/arch/arm/arm/src/los_hw.c +++ b/arch/arm/arm/src/los_hw.c @@ -105,7 +105,15 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStack, UINT32 parentStackSize) { - VOID *cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext)); + LosTaskCB *task = OsCurrTaskGet(); + sig_cb *sigcb = &task->sig; + VOID *cloneStack = NULL; + + if (sigcb->sigContext != NULL) { + cloneStack = (VOID *)((UINTPTR)sigcb->sigContext - sizeof(TaskContext)); + } else { + cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext)); + } (VOID)memcpy_s(childStack, sizeof(TaskContext), cloneStack, sizeof(TaskContext)); ((TaskContext *)childStack)->R0 = 0; diff --git a/arch/arm/gic/BUILD.gn b/arch/arm/gic/BUILD.gn new file mode 100644 index 00000000..127100f5 --- /dev/null +++ b/arch/arm/gic/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [] + + if (defined(LOSCFG_ARCH_GIC_V2)) { + sources += [ "gic_v2.c" ] + } else if (defined(LOSCFG_ARCH_GIC_V3)) { + sources += [ "gic_v3.c" ] + } +} diff --git a/arch/arm/gic/gic_v2.c b/arch/arm/gic/gic_v2.c index 75c23219..9479c0d4 100644 --- a/arch/arm/gic/gic_v2.c +++ b/arch/arm/gic/gic_v2.c @@ -40,7 +40,7 @@ STATIC_ASSERT(OS_USER_HWI_MAX <= 1020, "hwi max is too large!"); STATIC UINT32 g_curIrqNum = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* * filter description * 0b00: forward to the cpu interfaces specified in cpu_mask @@ -144,7 +144,7 @@ VOID HalIrqInit(VOID) /* enable gic distributor control */ GIC_REG_32(GICD_CTLR) = 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* register inter-processor interrupt */ (VOID)LOS_HwiCreate(LOS_MP_IPI_WAKEUP, 0xa0, 0, OsMpWakeHandler, 0); (VOID)LOS_HwiCreate(LOS_MP_IPI_SCHEDULE, 0xa0, 0, OsMpScheduleHandler, 0); diff --git a/arch/arm/gic/gic_v3.c b/arch/arm/gic/gic_v3.c index 03b8cfd8..f6e943f9 100644 --- a/arch/arm/gic/gic_v3.c +++ b/arch/arm/gic/gic_v3.c @@ -48,7 +48,7 @@ STATIC INLINE UINT64 MpidrToAffinity(UINT64 mpidr) (MPIDR_AFF_LEVEL(mpidr, 0))); } -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP STATIC UINT32 NextCpu(UINT32 cpu, UINT32 cpuMask) { @@ -399,7 +399,7 @@ VOID HalIrqInit(VOID) HalIrqInitPercpu(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* register inter-processor interrupt */ LOS_HwiCreate(LOS_MP_IPI_WAKEUP, 0xa0, 0, OsMpWakeHandler, 0); LOS_HwiCreate(LOS_MP_IPI_SCHEDULE, 0xa0, 0, OsMpScheduleHandler, 0); diff --git a/arch/arm/include/hal_hwi.h b/arch/arm/include/hal_hwi.h index 9d08589a..4b068e41 100644 --- a/arch/arm/include/hal_hwi.h +++ b/arch/arm/include/hal_hwi.h @@ -49,7 +49,7 @@ extern VOID HalIrqClear(UINT32 vector); extern CHAR *HalIrqVersion(VOID); extern UINT32 HalCurIrqGet(VOID); extern UINT32 HalIrqSetPrio(UINT32 vector, UINT8 priority); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP extern VOID HalIrqSendIpi(UINT32 target, UINT32 ipi); extern VOID HalIrqSetAffinity(UINT32 vector, UINT32 cpuMask); #endif diff --git a/bsd/BUILD.gn b/bsd/BUILD.gn new file mode 100644 index 00000000..fac70d00 --- /dev/null +++ b/bsd/BUILD.gn @@ -0,0 +1,86 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_COMPAT_BSD) +module_name = "libbsd" +kernel_module(module_name) { + sources = [ + "kern/bus_if.c", + "kern/device_if.c", + "kern/kern_condvar.c", + "kern/kern_timeout.c", + "kern/subr_bus.c", + "kern/subr_kobj.c", + ] + + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + sources += [ + "arm/autoconf.c", + "arm/hw_user_copy.S", + "arm/in_cksum.c", + "arm/in_cksum_arm.S", + "arm/nexus.c", + ] + } + + if (defined(LOSCFG_DRIVERS_RANDOM)) { + sources += [ + "crypto/rijndael/rijndael-alg-fst.c", + "crypto/rijndael/rijndael-api-fst.c", + "crypto/sha2/sha256c.c", + "dev/random/hash.c", + "dev/random/yarrow.c", + "libkern/explicit_bzero.c", + ] + } + + public_configs = [ ":public" ] +} + +group("bsd") { + public_deps = [ ":$module_name" ] + + deps = [ + "compat/linuxkpi", + "dev/usb", + ] +} + +config("public") { + include_dirs = [ + ".", + "kern", + ] + configs = [ + "compat/linuxkpi:public", + "dev/usb:public", + ] +} diff --git a/bsd/Kconfig b/bsd/Kconfig index 53c2816a..c19d8cd8 100644 --- a/bsd/Kconfig +++ b/bsd/Kconfig @@ -1,6 +1,14 @@ config COMPAT_BSD bool "Enable FreeBSD" default y + select COMPAT_LINUXKPI help Answer Y to enable LiteOS support FreeBSD. + +config COMPAT_LINUXKPI + bool "Enable linuxkpi" if COMPAT_BSD + default y + + help + Answer Y to enable LiteOS support compatible layer for linuxkpi. diff --git a/bsd/compat/linuxkpi/BUILD.gn b/bsd/compat/linuxkpi/BUILD.gn new file mode 100644 index 00000000..01c73efb --- /dev/null +++ b/bsd/compat/linuxkpi/BUILD.gn @@ -0,0 +1,57 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_COMPAT_BSD) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/adp.c", + "src/linux_completion.c", + "src/linux_interrupt.c", + "src/linux_sched.c", + "src/linux_semaphore.c", + "src/linux_timer.c", + "src/linux_wakelock.c", + "src/linux_workqueue.c", + "src/prctl.c", + "src/tzdst.c", + ] + + if (defined(LOSCFG_HRTIMER_ENABLE)) { + sources += [ "src/linux_hrtimer.c" ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/bsd/compat/linuxkpi/include/linux/mtd/mtd.h b/bsd/compat/linuxkpi/include/linux/mtd/mtd.h deleted file mode 120000 index 89878fc8..00000000 --- a/bsd/compat/linuxkpi/include/linux/mtd/mtd.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../third_party/Linux_Kernel/fs/jffs2/mtd.h \ No newline at end of file diff --git a/bsd/compat/linuxkpi/include/linux/mtd/mtd_list.h b/bsd/compat/linuxkpi/include/linux/mtd/mtd_list.h deleted file mode 120000 index d7004259..00000000 --- a/bsd/compat/linuxkpi/include/linux/mtd/mtd_list.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../third_party/Linux_Kernel/fs/jffs2/mtd_list.h \ No newline at end of file diff --git a/bsd/dev/usb/BUILD.gn b/bsd/dev/usb/BUILD.gn new file mode 100644 index 00000000..c2cb6c1d --- /dev/null +++ b/bsd/dev/usb/BUILD.gn @@ -0,0 +1,154 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_USB) +module_name = "usb_base" +kernel_module(module_name) { + sources = [ + "implementation/bsd_busspace.c", + "implementation/bsd_kernel.c", + "implementation/usb_btree.c", + "implementation/usb_busdma_loader.c", + "implementation/usb_init.c", + "implementation/usb_version.c", + "usb_debug.c", + ] + + if (defined(LOSCFG_DRIVERS_USB)) { + sources += [ + "controller/usb_controller.c", + "quirk/usb_quirk.c", + "usb_dev.c", + "usb_device.c", + "usb_dynamic.c", + "usb_error.c", + "usb_generic.c", + "usb_handle_request.c", + "usb_hub.c", + "usb_if.c", + "usb_lookup.c", + "usb_mbuf.c", + "usb_parse.c", + "usb_process.c", + "usb_request.c", + "usb_transfer.c", + "usb_util.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_4G_MODEM)) { + sources += [ "net/if_cdce.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_ETHERNET)) { + sources += [ + "net/if_axe.c", + "net/if_axge.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) { + sources += [ "net/if_urndis.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) || + defined(LOSCFG_DRIVERS_USB_ETHERNET) || + defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) { + sources += [ + "net/usb_eth_drv.c", + "net/usb_ethernet.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) || + defined(LOSCFG_DRIVERS_USB_SERIAL)) { + sources += [ + "serial/u3g.c", + "serial/usb_serial.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_HOST_EHCI)) { + sources += [ + "controller/ehci.c", + "controller/ehci_pci.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_HOST_XHCI) || + defined(LOSCFG_DRIVERS_USB_HOST_XHCI_FOR_PORT2)) { + sources += [ + "controller/xhci.c", + "controller/xhci_pci.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_WIRELESS)) { + sources += [ "linux_usb.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_MASS_STORAGE)) { + sources += [ "storage/umass.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_HID_CLASS) && + defined(LOSCFG_DRIVERS_HDF_INPUT)) { + sources += [ + "input/uhid.c", + "usb_hid.c", + ] + + include_dirs = [ + "//drivers/framework/model/input/driver", + "//drivers/framework/include/core", + "//drivers/framework/core/common/include/host", + "//drivers/framework/utils", + "//drivers/framework/osal", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/osal", + ] + } + + configs += [ + "$HDFTOPDIR:hdf_config" + ] + + public_configs = [ ":public" ] +} + +group("usb") { + public_deps = [ ":$module_name" ] +} + +config("public") { + include_dirs = [ "." ] + include_dirs += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/dev/evdev" ] +} diff --git a/bsd/dev/usb/Kconfig b/bsd/dev/usb/Kconfig index 2bdac15f..6d365d5e 100644 --- a/bsd/dev/usb/Kconfig +++ b/bsd/dev/usb/Kconfig @@ -15,7 +15,7 @@ config DRIVERS_USB_HOST_DRIVER choice depends on DRIVERS_USB_HOST_DRIVER prompt "USB HCD" - default y + default DRIVERS_USB_HOST_EHCI help Enable EHCI for USB 2.0. Enable XHCI for USB 3.0 diff --git a/build.sh b/build.sh index be60ebf0..16794d13 100755 --- a/build.sh +++ b/build.sh @@ -41,50 +41,40 @@ outdir=${8} ohos_version=${9} sysroot_path=${10} arch_cflags=${11} +device_path=${12} echo "${board_name}" "${device_company}" echo "sh param:" "$@" function main() { destination=".config" - config_file="" tee="" - if [ "${tee_enable}" = "tee" ]; then + if [ "${tee_enable}" = "true" ]; then tee="_tee" fi + + config_file="${product_path}/config/${ohos_build_type}${tee}.config" + if [ -f "${config_file}" ]; then + cp "${config_file}" "${destination}" + return + fi + product_name=$(basename "${product_path}") - source="tools/build/config/${product_name}_release.config" + config_file="${product_name}_release.config" if [ "${ohos_build_compiler}" = "clang" ]; then if [ "${ohos_build_type}" = "debug" ]; then - config_file="${product_name}_${ohos_build_compiler}${tee}.config" - source="tools/build/config/debug/${config_file}" + config_file="debug/${product_name}_${ohos_build_compiler}${tee}.config" else config_file="${product_name}_${ohos_build_compiler}_release${tee}.config" - source="tools/build/config/${config_file}" fi elif [ "${ohos_build_compiler}" = "gcc" ]; then if [ "${ohos_build_type}" = "debug" ]; then config_file="${product_name}_debug_shell${tee}.config" - source="tools/build/config/${config_file}" else config_file="${product_name}_release${tee}.config" - source="tools/build/config/${config_file}" fi fi - if [ -d "./out" ]; then - rm -rf ./out - fi - if [ -f "${destination}" ]; then - rm -rf ${destination} - fi - if [ ! -f "${source}" ]; then - source="${product_path}/config/sys/${config_file}" - fi - cp "${source}" ${destination} - - test_info_outdir="../..${root_build_dir}/test_info/gen/kernel/test" - mkdir -p "${test_info_outdir}" - cp kernel_test.sources "${test_info_outdir}" + cp "tools/build/config/${config_file}" "${destination}" } if [ "x" != "x${sysroot_path}" ]; then @@ -95,6 +85,10 @@ if [ "x" != "x${arch_cflags}" ]; then export ARCH_CFLAGS="${arch_cflags}" fi +export OUTDIR="${outdir}" +export PRODUCT_PATH="${product_path}" +export DEVICE_PATH="${device_path}" + main && \ -make clean OUTDIR="${outdir}" PRODUCT_PATH="${product_path}" && \ -make -j rootfs VERSION="${ohos_version}" OUTDIR="${outdir}" PRODUCT_PATH="${product_path}" +make clean && \ +make -j rootfs VERSION="${ohos_version}" diff --git a/tools/scripts/make_rootfs/rootfs.sh b/compat/BUILD.gn old mode 100755 new mode 100644 similarity index 88% rename from tools/scripts/make_rootfs/rootfs.sh rename to compat/BUILD.gn index e1c46223..300dcf3e --- a/tools/scripts/make_rootfs/rootfs.sh +++ b/compat/BUILD.gn @@ -1,5 +1,3 @@ -#!/bin/bash -# # Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. # Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. # @@ -28,12 +26,13 @@ # 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. -set -e -BIN_DIR=$1 -LIB_DIR=$2 -ROOTFS_DIR=$3 -FSTYPE=$4 -CUR_DIR=$(dirname $(readlink -f "$0")) -. ${CUR_DIR}/rootfsdir.sh ${BIN_DIR} ${LIB_DIR} ${ROOTFS_DIR} -. ${CUR_DIR}/rootfsimg.sh ${ROOTFS_DIR} ${FSTYPE} \ No newline at end of file +import("//kernel/liteos_a/liteos.gni") + +group("compat") { + deps = [ "posix" ] +} + +config("public") { + configs = [ "posix:public" ] +} diff --git a/compat/posix/BUILD.gn b/compat/posix/BUILD.gn new file mode 100644 index 00000000..d145e64f --- /dev/null +++ b/compat/posix/BUILD.gn @@ -0,0 +1,55 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_COMPAT_POSIX) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/map_error.c", + "src/misc.c", + "src/mqueue.c", + "src/posix_memalign.c", + "src/pthread.c", + "src/pthread_attr.c", + "src/pthread_cond.c", + "src/pthread_mutex.c", + "src/sched.c", + "src/semaphore.c", + "src/socket.c", + "src/time.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/compat/posix/src/misc.c b/compat/posix/src/misc.c index becef6c4..6f2685b5 100644 --- a/compat/posix/src/misc.c +++ b/compat/posix/src/misc.c @@ -38,7 +38,7 @@ #include "mqueue.h" #include "semaphore.h" #include "los_process_pri.h" - +#include "los_hw.h" /* * Supply some suitable values for constants that may not be present @@ -54,17 +54,27 @@ int uname(struct utsname *name) { INT32 ret; + const char *cpuInfo = NULL; + if (name == NULL) { return -EFAULT; } (VOID)strncpy_s(name->sysname, sizeof(name->sysname), KERNEL_NAME, strlen(KERNEL_NAME) + 1); (VOID)strncpy_s(name->nodename, sizeof(name->nodename), "hisilicon", strlen("hisilicon") + 1); - ret = snprintf_s(name->version, sizeof(name->version), sizeof(name->version) - 1, "%s %u.%u.%u.%u %s %s\n", + ret = snprintf_s(name->version, sizeof(name->version), sizeof(name->version) - 1, "%s %u.%u.%u.%u %s %s", KERNEL_NAME, KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE, __DATE__, __TIME__); if (ret < 0) { return -EIO; } - name->machine[0] = '\0'; + + cpuInfo = LOS_CpuInfo(); + (VOID)strncpy_s(name->machine, sizeof(name->machine), cpuInfo, sizeof(name->machine)); + ret = snprintf_s(name->release, sizeof(name->release), sizeof(name->release) - 1, "%u.%u.%u.%u", + KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE); + if (ret < 0) { + return -EIO; + } + name->domainname[0] = '\0'; return 0; } diff --git a/compat/posix/src/pthread.c b/compat/posix/src/pthread.c index b985da4f..f8ee1bf6 100644 --- a/compat/posix/src/pthread.c +++ b/compat/posix/src/pthread.c @@ -204,7 +204,7 @@ STATIC UINT32 InitPthreadData(pthread_t threadID, pthread_attr_t *userAttr, PRINT_ERR("%s: %d, err: %d\n", __FUNCTION__, __LINE__, err); return LOS_NOK; } -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP if (userAttr->cpuset.__bits[0] > 0) { taskCB->cpuAffiMask = (UINT16)userAttr->cpuset.__bits[0]; } diff --git a/compat/posix/src/pthread_attr.c b/compat/posix/src/pthread_attr.c index 29627cd3..0368b7bb 100644 --- a/compat/posix/src/pthread_attr.c +++ b/compat/posix/src/pthread_attr.c @@ -49,7 +49,7 @@ int pthread_attr_init(pthread_attr_t *attr) attr->stacksize_set = 1; attr->stacksize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP attr->cpuset.__bits[0] = 0; #endif @@ -239,7 +239,7 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize) */ int pthread_attr_setaffinity_np(pthread_attr_t* attr, size_t cpusetsize, const cpu_set_t* cpuset) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP if (attr == NULL) { return EINVAL; } @@ -264,7 +264,7 @@ int pthread_attr_setaffinity_np(pthread_attr_t* attr, size_t cpusetsize, const c */ int pthread_attr_getaffinity_np(const pthread_attr_t* attr, size_t cpusetsize, cpu_set_t* cpuset) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP if ((attr == NULL) || (cpuset == NULL) || (cpusetsize != sizeof(cpu_set_t))) { return EINVAL; } diff --git a/compat/posix/src/sched.c b/compat/posix/src/sched.c index 1c80780b..ece7752f 100644 --- a/compat/posix/src/sched.c +++ b/compat/posix/src/sched.c @@ -61,7 +61,7 @@ int sched_get_priority_max(int policy) */ int sched_setaffinity(pid_t pid, size_t set_size, const cpu_set_t* set) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 taskID = (UINT32)pid; UINT32 ret; @@ -93,7 +93,7 @@ int sched_setaffinity(pid_t pid, size_t set_size, const cpu_set_t* set) */ int sched_getaffinity(pid_t pid, size_t set_size, cpu_set_t* set) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 taskID = (UINT32)pid; UINT16 cpuAffiMask; diff --git a/compat/posix/src/time.c b/compat/posix/src/time.c index 71870721..865f8dbd 100644 --- a/compat/posix/src/time.c +++ b/compat/posix/src/time.c @@ -456,7 +456,7 @@ static int PthreadGetCputime(clockid_t clockID, struct timespec *ats) { uint64_t runtime; UINT32 intSave; - UINT32 tid = ((UINT32) ~((clockID) >> CPUCLOCK_ID_OFFSET)); + UINT32 tid = ((UINT32) ~((UINT32)(clockID) >> CPUCLOCK_ID_OFFSET)); if (OS_TID_CHECK_INVALID(tid)) { return -EINVAL; @@ -482,7 +482,7 @@ static int ProcessGetCputime(clockid_t clockID, struct timespec *ats) { UINT64 runtime; UINT32 intSave; - const pid_t pid = ((pid_t) ~((clockID) >> CPUCLOCK_ID_OFFSET)); + const pid_t pid = ((pid_t) ~((UINT32)(clockID) >> CPUCLOCK_ID_OFFSET)); LosProcessCB *spcb = NULL; if (OsProcessIDUserCheckInvalid(pid) || pid < 0) { @@ -524,7 +524,7 @@ static int GetCputime(clockid_t clockID, struct timespec *tp) static int CheckClock(const clockid_t clockID) { int error = 0; - const pid_t pid = ((pid_t) ~((clockID) >> CPUCLOCK_ID_OFFSET)); + const pid_t pid = ((pid_t) ~((UINT32)(clockID) >> CPUCLOCK_ID_OFFSET)); if (!((UINT32)clockID & CPUCLOCK_PERTHREAD_MASK)) { LosProcessCB *spcb = NULL; diff --git a/drivers/BUILD.gn b/drivers/BUILD.gn new file mode 100644 index 00000000..4926f959 --- /dev/null +++ b/drivers/BUILD.gn @@ -0,0 +1,70 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +cmd = "if [ -f $device_path/drivers/BUILD.gn ]; then echo true; else echo false; fi" +HAVE_DEVICE_DRIVERS = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") + +module_switch = defined(LOSCFG_DRIVERS) +group("drivers") { + if (module_switch) { + deps = [ + "block/disk", + "char/bch", + "char/mem", + "char/quickstart", + "char/random", + "char/video", + "mtd/multi_partition", + "//drivers/adapter/khdf/liteos", + "//drivers/liteos", + ] + if (HAVE_DEVICE_DRIVERS) { + deps += [ "$device_path/drivers" ] + } + } +} + +config("public") { + configs = [ + "block/disk:public", + "char/bch:public", + "char/mem:public", + "char/quickstart:public", + "char/random:public", + "char/video:public", + "mtd/multi_partition:public", + "//drivers/adapter/khdf/liteos:public", + "//drivers/liteos:public", + ] + if (HAVE_DEVICE_DRIVERS) { + configs += [ "$device_path/drivers:public" ] + } +} diff --git a/drivers/block/disk/BUILD.gn b/drivers/block/disk/BUILD.gn new file mode 100644 index 00000000..48e42b06 --- /dev/null +++ b/drivers/block/disk/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT_DISK) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/disk.c", + "src/disk_shellcmd.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/block/disk/include/disk.h b/drivers/block/disk/include/disk.h index 851aa563..b1f6884b 100644 --- a/drivers/block/disk/include/disk.h +++ b/drivers/block/disk/include/disk.h @@ -725,6 +725,9 @@ INT32 los_alloc_diskid_byname(const CHAR *diskName); */ INT32 los_get_diskid_byname(const CHAR *diskName); + +los_disk *los_get_mmcdisk_bytype(UINT8 type); + #ifdef __cplusplus #if __cplusplus } diff --git a/drivers/block/disk/src/disk.c b/drivers/block/disk/src/disk.c index 6c9681c6..34f48d47 100644 --- a/drivers/block/disk/src/disk.c +++ b/drivers/block/disk/src/disk.c @@ -187,6 +187,22 @@ INT32 los_get_diskid_byname(const CHAR *diskName) return diskID; } +los_disk *los_get_mmcdisk_bytype(UINT8 type) +{ + const CHAR *mmcDevHead = "/dev/mmcblk"; + + for (INT32 diskId = 0; diskId < SYS_MAX_DISK; diskId++) { + los_disk *disk = get_disk(diskId); + if (disk == NULL) { + continue; + } else if ((disk->type == type) && (strncmp(disk->disk_name, mmcDevHead, strlen(mmcDevHead)) == 0)) { + return disk; + } + } + PRINT_ERR("Cannot find the mmc disk!\n"); + return NULL; +} + VOID OsSetUsbStatus(UINT32 diskID) { if (diskID < SYS_MAX_DISK) { diff --git a/drivers/char/bch/BUILD.gn b/drivers/char/bch/BUILD.gn new file mode 100644 index 00000000..cc684575 --- /dev/null +++ b/drivers/char/bch/BUILD.gn @@ -0,0 +1,52 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_VFS_BLOCK_DEVICE) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_driver.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_register.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_unregister.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_cache.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_read.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_sem.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_setup.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_teardown.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_write.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/mem/BUILD.gn b/drivers/char/mem/BUILD.gn new file mode 100644 index 00000000..aad2d717 --- /dev/null +++ b/drivers/char/mem/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_MEM) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/mem.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/quickstart/BUILD.gn b/drivers/char/quickstart/BUILD.gn new file mode 100644 index 00000000..9f2cb98d --- /dev/null +++ b/drivers/char/quickstart/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_QUICKSTART) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/quickstart.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/random/BUILD.gn b/drivers/char/random/BUILD.gn new file mode 100644 index 00000000..0410df5b --- /dev/null +++ b/drivers/char/random/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_RANDOM) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/random.c" ] + + if (defined(LOSCFG_HW_RANDOM_ENABLE)) { + sources += [ "src/random_hw.c" ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/random/src/random_hw.c b/drivers/char/random/src/random_hw.c index ffaa495a..a290a586 100644 --- a/drivers/char/random/src/random_hw.c +++ b/drivers/char/random/src/random_hw.c @@ -65,7 +65,7 @@ static int RandomHwClose(struct file *filep) static int RandomHwIoctl(struct file *filep, int cmd, unsigned long arg) { - int ret; + int ret = -1; switch (cmd) { default: @@ -77,7 +77,7 @@ static int RandomHwIoctl(struct file *filep, int cmd, unsigned long arg) static ssize_t RandomHwRead(struct file *filep, char *buffer, size_t buflen) { - int ret; + int ret = -1; if (g_randomOp.read != NULL) { ret = g_randomOp.read(buffer, buflen); diff --git a/drivers/char/video/BUILD.gn b/drivers/char/video/BUILD.gn new file mode 100644 index 00000000..1470983e --- /dev/null +++ b/drivers/char/video/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_VIDEO) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "$LITEOSTHIRDPARTY/NuttX/drivers/video/fb.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/NuttX/include/nuttx/video" ] +} diff --git a/drivers/mtd/multi_partition/BUILD.gn b/drivers/mtd/multi_partition/BUILD.gn new file mode 100644 index 00000000..625a89d5 --- /dev/null +++ b/drivers/mtd/multi_partition/BUILD.gn @@ -0,0 +1,54 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_VFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/mtd_partition.c", + "src/mtd_shellcmd.c", + ] + + include_dirs = [ + "$LITEOSTOPDIR/fs/jffs2/include", + "//device/hisilicon/drivers/include/mtd/common/include", + ] + + if (defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)) { + include_dirs += [ "//device/qemu/drivers/cfiflash" ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/BUILD.gn b/fs/BUILD.gn new file mode 100644 index 00000000..f148c269 --- /dev/null +++ b/fs/BUILD.gn @@ -0,0 +1,56 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("fs") { + deps = [ + "fat", + "fat/virpart", + "jffs2", + "nfs", + "proc", + "ramfs", + "romfs", + "vfs", + "vfs/bcache", + "zpfs", + ] +} + +config("public") { + include_dirs = [ "include" ] + configs = [ + "vfs:public", + "vfs/bcache:public", + "fat:public", + "fat/virpart:public", + "proc:public", + ] +} diff --git a/fs/fat/BUILD.gn b/fs/fat/BUILD.gn new file mode 100644 index 00000000..34abc034 --- /dev/null +++ b/fs/fat/BUILD.gn @@ -0,0 +1,55 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "os_adapt/fat_shellcmd.c", + "os_adapt/fatfs.c", + "os_adapt/format.c", + ] + + sources += [ + "$LITEOSTHIRDPARTY/FatFs/source/diskio.c", + "$LITEOSTHIRDPARTY/FatFs/source/ff.c", + "$LITEOSTHIRDPARTY/FatFs/source/ffsystem.c", + "$LITEOSTHIRDPARTY/FatFs/source/ffunicode.c", + ] + + include_dirs = [ "os_adapt" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/FatFs/source" ] +} diff --git a/fs/fat/os_adapt/fatfs.c b/fs/fat/os_adapt/fatfs.c index 06c33d57..8df522ab 100644 --- a/fs/fat/os_adapt/fatfs.c +++ b/fs/fat/os_adapt/fatfs.c @@ -46,6 +46,7 @@ #include "los_tables.h" #include "user_copy.h" #include "los_vm_filemap.h" +#include "los_hash.h" #include #include #include @@ -53,7 +54,7 @@ #include #include #include -#include "los_hash.h" +#include struct VnodeOps fatfs_vops; /* forward define */ @@ -190,7 +191,7 @@ static int fatfs_sync(unsigned long mountflags, FATFS *fs) { #ifdef LOSCFG_FS_FAT_CACHE los_part *part = NULL; - if (mountflags != MS_NOSYNC) { + if (!(mountflags & (MS_NOSYNC | MS_RDONLY))) { part = get_part((INT)fs->pdrv); if (part == NULL) { return -ENODEV; @@ -238,7 +239,8 @@ static mode_t fatfs_get_mode(BYTE attribute, mode_t fs_mode) return fs_mode; } -static enum VnodeType fatfstype_2_vnodetype(BYTE type) { +static enum VnodeType fatfstype_2_vnodetype(BYTE type) +{ switch (type) { case AM_ARC: return VNODE_TYPE_REG; @@ -286,7 +288,7 @@ static FRESULT init_cluster(DIR_FILE *pdfp, DIR *dp_new, FATFS *fs, int type, co mem_set(dir, 0, SS(fs)); if (type == AM_LNK && target) { /* Write target to symlink */ - strcpy_s((char *)dir, SS(fs), target); + (void)strcpy_s((char *)dir, SS(fs), target); } else { /* Write the dir cluster */ mem_set(dir, 0, SS(fs)); @@ -735,6 +737,7 @@ off64_t fatfs_lseek64(struct file *filep, off64_t offset, int whence) struct Vnode *vp = filep->f_vnode; DIR_FILE *dfp = (DIR_FILE *)vp->data; FILINFO *finfo = &(dfp->fno); + struct Mount *mount = vp->originMount; FSIZE_t fpos; FRESULT result; int ret; @@ -772,6 +775,17 @@ off64_t fatfs_lseek64(struct file *filep, off64_t offset, int whence) if (ret == FALSE) { return -EBUSY; } + + if (fpos > finfo->fsize) { + if ((filep->f_oflags & O_ACCMODE) == O_RDONLY) { + result = FR_DENIED; + goto ERROR_EXIT; + } + if (mount->mountFlags & MS_RDONLY) { + result = FR_WRITE_PROTECTED; + goto ERROR_EXIT; + } + } fp->obj.sclust = finfo->sclst; fp->obj.objsize = finfo->fsize; @@ -903,11 +917,13 @@ int fatfs_fallocate64(struct file *filep, int mode, off64_t offset, off64_t len) return -EBUSY; } result = f_expand(fp, (FSIZE_t)offset, (FSIZE_t)len, 1); - if (result == FR_OK && finfo->sclst == 0) { - finfo->sclst = fp->obj.sclust; + if (result == FR_OK) { + if (finfo->sclst == 0) { + finfo->sclst = fp->obj.sclust; + } + result = f_sync(fp); } - result = f_sync(fp); - unlock_fs(fs, FR_OK); + unlock_fs(fs, result); return -fatfs_2_vfs(result); } @@ -1400,6 +1416,9 @@ int fatfs_stat(struct Vnode *vp, struct stat* sp) time = fattime_transfer(finfo->fdate, finfo->ftime); sp->st_mtime = time; + /* Adapt to kstat member "long tv_sec" */ + sp->__st_mtim32.tv_sec = (long)time; + unlock_fs(fs, FR_OK); return 0; } diff --git a/fs/fat/virpart/BUILD.gn b/fs/fat/virpart/BUILD.gn new file mode 100644 index 00000000..08178e2d --- /dev/null +++ b/fs/fat/virpart/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT_VIRTUAL_PARTITION) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/virpart.c", + "src/virpartff.c", + ] + + include_dirs = [ "../os_adapt" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/include/fs/file.h b/fs/include/fs/file.h index cb05f0bc..11b78782 100644 --- a/fs/include/fs/file.h +++ b/fs/include/fs/file.h @@ -473,7 +473,7 @@ off64_t file_seek64(struct file *filep, off64_t offset, int whence); * ****************************************************************************/ -int files_allocate(struct Vnode *vnode, int oflags, off_t pos,void *priv, int minfd); +int files_allocate(struct Vnode *vnode, int oflags, off_t pos, void *priv, int minfd); /**************************************************************************** * Name: files_close diff --git a/fs/jffs2/BUILD.gn b/fs/jffs2/BUILD.gn new file mode 100644 index 00000000..bf5eecc1 --- /dev/null +++ b/fs/jffs2/BUILD.gn @@ -0,0 +1,75 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_JFFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/jffs2_hash.c", + "src/vfs_jffs2.c", + ] + + sources += [ + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/background.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/build.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_rtime.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_rubin.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_zlib.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/debug.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/dir.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/erase.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/file.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/fs.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/gc.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/malloc.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/nodelist.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/nodemgmt.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/read.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/readinode.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/scan.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/summary.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/super.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/write.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/writev.c", + ] + + include_dirs = [ + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/jffs2/src/vfs_jffs2.c b/fs/jffs2/src/vfs_jffs2.c index a0d3736c..43922953 100644 --- a/fs/jffs2/src/vfs_jffs2.c +++ b/fs/jffs2/src/vfs_jffs2.c @@ -123,7 +123,7 @@ int VfsJffs2Bind(struct Mount *mnt, struct Vnode *blkDriver, const void *data) partNo = p->patitionnum; - ret = jffs2_mount(partNo, &rootNode); + ret = jffs2_mount(partNo, &rootNode, mnt->mountFlags); if (ret != 0) { LOS_MuxUnlock(&g_jffs2FsLock); return ret; @@ -323,7 +323,7 @@ ssize_t VfsJffs2Write(struct file *filep, const char *buffer, size_t bufLen) c = JFFS2_SB_INFO(node->i_sb); pos = filep->f_pos; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP struct super_block *sb = node->i_sb; UINT16 gcCpuMask = LOS_TaskCpuAffiGet(sb->s_gc_thread); UINT32 curTaskId = LOS_CurTaskIDGet(); @@ -717,14 +717,17 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen) int VfsJffs2Unlink(struct Vnode *parentVnode, struct Vnode *targetVnode, const char *path) { int ret; - struct jffs2_inode *parentInode = (struct jffs2_inode *)parentVnode->data; - struct jffs2_inode *targetInode = (struct jffs2_inode *)targetVnode->data; + struct jffs2_inode *parentInode = NULL; + struct jffs2_inode *targetInode = NULL; if (!parentVnode || !targetVnode) { PRINTK("%s-%d parentVnode=%x, targetVnode=%x\n", __FUNCTION__, __LINE__, parentVnode, targetVnode); return -EINVAL; } + parentInode = (struct jffs2_inode *)parentVnode->data; + targetInode = (struct jffs2_inode *)targetVnode->data; + LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER); ret = jffs2_unlink(parentInode, targetInode, (const unsigned char *)path); @@ -804,6 +807,11 @@ int VfsJffs2Stat(struct Vnode *pVnode, struct stat *buf) buf->st_mtime = node->i_mtime; buf->st_ctime = node->i_ctime; + /* Adapt to kstat member long tv_sec */ + buf->__st_atim32.tv_sec = (long)node->i_atime; + buf->__st_mtim32.tv_sec = (long)node->i_mtime; + buf->__st_ctim32.tv_sec = (long)node->i_ctime; + LOS_MuxUnlock(&g_jffs2FsLock); return 0; diff --git a/fs/nfs/BUILD.gn b/fs/nfs/BUILD.gn new file mode 100644 index 00000000..8f987f9d --- /dev/null +++ b/fs/nfs/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_NFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/NuttX/fs/nfs/nfs_adapter.c", + "$LITEOSTHIRDPARTY/NuttX/fs/nfs/nfs_util.c", + "$LITEOSTHIRDPARTY/NuttX/fs/nfs/rpc_clnt.c", + ] +} diff --git a/fs/proc/BUILD.gn b/fs/proc/BUILD.gn index 122e956e..2c133512 100644 --- a/fs/proc/BUILD.gn +++ b/fs/proc/BUILD.gn @@ -25,23 +25,31 @@ # 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. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -static_library("fs_proc") { +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_PROC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { sources = [ + "os_adapt/fd_proc.c", + "os_adapt/fs_cache_proc.c", + "os_adapt/kernel_trace_proc.c", + "os_adapt/mounts_proc.c", + "os_adapt/power_proc.c", "os_adapt/proc_init.c", - "os_adapt/vfs_proc.c", + "os_adapt/proc_vfs.c", + "os_adapt/process_proc.c", + "os_adapt/uptime_proc.c", + "os_adapt/vmm_proc.c", + "src/proc_file.c", "src/proc_shellcmd.c", - "src/pseudofs.c", - "src/seq_file.c", ] - include_dirs = [ "include" ] - - if (LOSCFG_LLTREPORT) { - cflags += [ - "-fprofile-arcs", - "-ftest-coverage", - ] - } + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] } diff --git a/fs/proc/os_adapt/kernel_trace_proc.c b/fs/proc/os_adapt/kernel_trace_proc.c index dbb77853..16445b81 100644 --- a/fs/proc/os_adapt/kernel_trace_proc.c +++ b/fs/proc/os_adapt/kernel_trace_proc.c @@ -32,9 +32,9 @@ #include #include #include "proc_fs.h" -#include "los_trace.h" #ifdef LOSCFG_KERNEL_TRACE +#include "los_trace.h" static int KernelTraceProcFill(struct SeqBuf *m, void *v) { (void)v; diff --git a/fs/ramfs/BUILD.gn b/fs/ramfs/BUILD.gn new file mode 100644 index 00000000..5b593f83 --- /dev/null +++ b/fs/ramfs/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_RAMFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "$LITEOSTHIRDPARTY/NuttX/fs/tmpfs/fs_tmpfs.c" ] +} diff --git a/fs/romfs/BUILD.gn b/fs/romfs/BUILD.gn new file mode 100644 index 00000000..eef06c08 --- /dev/null +++ b/fs/romfs/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_ROMFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/NuttX/fs/romfs/fs_romfs.c", + "$LITEOSTHIRDPARTY/NuttX/fs/romfs/fs_romfsutil.c", + ] +} diff --git a/fs/vfs/BUILD.gn b/fs/vfs/BUILD.gn new file mode 100644 index 00000000..1cd4859e --- /dev/null +++ b/fs/vfs/BUILD.gn @@ -0,0 +1,116 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_VFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "operation/fs_chattr.c", + "operation/fs_check.c", + "operation/fs_fallocate.c", + "operation/fs_fallocate64.c", + "operation/fs_file.c", + "operation/fs_file_mapping.c", + "operation/fs_init.c", + "operation/fs_other.c", + "operation/fs_preadv.c", + "operation/fs_pwritev.c", + "operation/fs_readv.c", + "operation/fs_utime.c", + "operation/fs_writev.c", + "operation/fullpath.c", + "vfs_cmd/vfs_shellcmd.c", + ] + + sources += [ + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_closedir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_opendir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_readdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_rewinddir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_seekdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_telldir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_blockproxy.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_closeblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_findblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_openblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_registerblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_registerdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_unregisterblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_unregisterdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/inode/fs_files.c", + "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_foreachmountpoint.c", + "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_mount.c", + "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_umount.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_close.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dup.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dup2.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dupfd.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dupfd2.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_fcntl.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_fsync.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_getfilep.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_ioctl.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_link.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_lseek.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_lseek64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_mkdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_open.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_poll.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pread.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pread64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pwrite.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pwrite64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_read.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_readlink.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_rename.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_rmdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_select.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_sendfile.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_stat.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_statfs.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_symlink.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_truncate.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_truncate64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_unlink.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_write.c", + "$LITEOSTOPDIR/fs/vfs/mount.c", + "$LITEOSTOPDIR/fs/vfs/path_cache.c", + "$LITEOSTOPDIR/fs/vfs/vnode.c", + "$LITEOSTOPDIR/fs/vfs/vnode_hash.c", + ] + + include_dirs = [ "$LITEOSTOPDIR/syscall" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/vfs/bcache/BUILD.gn b/fs/vfs/bcache/BUILD.gn new file mode 100644 index 00000000..6f52a9bc --- /dev/null +++ b/fs/vfs/bcache/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT_CACHE) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/bcache.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "../include/bcache" ] +} diff --git a/fs/vfs/operation/fs_chattr.c b/fs/vfs/operation/fs_chattr.c index d01aee31..04caf82b 100644 --- a/fs/vfs/operation/fs_chattr.c +++ b/fs/vfs/operation/fs_chattr.c @@ -41,6 +41,8 @@ #include "stdlib.h" #include "sys/stat.h" #include "vnode.h" +#include "fs/mount.h" +#include /**************************************************************************** * Static Functions @@ -69,6 +71,11 @@ int chattr(const char *pathname, struct IATTR *attr) goto errout_with_lock; } + if ((vnode->originMount) && (vnode->originMount->mountFlags & MS_RDONLY)) { + ret = -EROFS; + goto errout_with_lock; + } + /* The way we handle the stat depends on the type of vnode that we * are dealing with. */ diff --git a/fs/vfs/operation/fs_file.c b/fs/vfs/operation/fs_file.c index 245d8f5d..1e600bbb 100644 --- a/fs/vfs/operation/fs_file.c +++ b/fs/vfs/operation/fs_file.c @@ -406,7 +406,7 @@ int CopyFdToProc(int fd, unsigned int targetPid) return -ESRCH; } - procFd = AssignProcessFd(fdt, 3); + procFd = AssignProcessFd(fdt, 3); // minfd is 3 if (procFd < 0) { if (sem_post(&semId) == -1) { PRINT_ERR("sem_post error, errno %d \n", get_errno()); diff --git a/fs/vfs/operation/fs_other.c b/fs/vfs/operation/fs_other.c index 791accb9..bb5b0e55 100644 --- a/fs/vfs/operation/fs_other.c +++ b/fs/vfs/operation/fs_other.c @@ -35,7 +35,9 @@ #include "dirent.h" #include "unistd.h" #include "sys/select.h" +#include "sys/mount.h" #include "sys/stat.h" +#include "sys/statfs.h" #include "sys/prctl.h" #include "fs/fd_table.h" #include "fs/file.h" @@ -256,30 +258,70 @@ char *getcwd(char *buf, size_t n) int chmod(const char *path, mode_t mode) { - int result; - struct stat buf; + struct IATTR attr = {0}; + attr.attr_chg_mode = mode; + attr.attr_chg_valid = CHG_MODE; /* change mode */ + int ret; - result = stat(path, &buf); - if (result != ENOERR) { + ret = chattr(path, &attr); + if (ret < 0) { + return VFS_ERROR; + } + + return OK; +} + +int chown(const char *pathname, uid_t owner, gid_t group) +{ + struct IATTR attr = {0}; + attr.attr_chg_valid = 0; + int ret; + + if (owner != (uid_t)-1) { + attr.attr_chg_uid = owner; + attr.attr_chg_valid |= CHG_UID; + } + if (group != (gid_t)-1) { + attr.attr_chg_gid = group; + attr.attr_chg_valid |= CHG_GID; + } + ret = chattr(pathname, &attr); + if (ret < 0) { return VFS_ERROR; } - /* no access/permission control for files now, just return OK if stat is okay*/ return OK; } int access(const char *path, int amode) { - int result; + int ret; struct stat buf; + struct statfs fsBuf; - result = stat(path, &buf); + ret = statfs(path, &fsBuf); + if (ret != 0) { + if (get_errno() != ENOSYS) { + return VFS_ERROR; + } + /* dev has no statfs ops, need devfs to handle this in feature */ + } - if (result != ENOERR) { + if ((fsBuf.f_flags & MS_RDONLY) && ((unsigned int)amode & W_OK)) { + set_errno(EROFS); + return VFS_ERROR; + } + + ret = stat(path, &buf); + if (ret != 0) { + return VFS_ERROR; + } + + if (VfsPermissionCheck(buf.st_uid, buf.st_gid, buf.st_mode, amode)) { + set_errno(EACCES); return VFS_ERROR; } - /* no access/permission control for files now, just return OK if stat is okay*/ return OK; } diff --git a/fs/vfs/operation/fs_utime.c b/fs/vfs/operation/fs_utime.c index 8bab3155..31cf98e2 100644 --- a/fs/vfs/operation/fs_utime.c +++ b/fs/vfs/operation/fs_utime.c @@ -37,9 +37,11 @@ #include "vfs_config.h" #include "sys/stat.h" #include "vnode.h" +#include "fs/mount.h" #include "string.h" #include "stdlib.h" #include "utime.h" +#include /**************************************************************************** * Global Functions @@ -79,6 +81,12 @@ int utime(const char *path, const struct utimbuf *ptimes) goto errout_with_path; } + if ((vnode->originMount) && (vnode->originMount->mountFlags & MS_RDONLY)) { + VnodeDrop(); + ret = -EROFS; + goto errout_with_path; + } + if (vnode->vop && vnode->vop->Chattr) { if (ptimes == NULL) { /* get current seconds */ diff --git a/fs/zpfs/BUILD.gn b/fs/zpfs/BUILD.gn index e8094f4f..e0cc31e2 100644 --- a/fs/zpfs/BUILD.gn +++ b/fs/zpfs/BUILD.gn @@ -27,16 +27,13 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -static_library("fs_zpfs") { +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_ZPFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { sources = [ "vfs_zpfs.c", "zpfs.c", ] - - if (LOSCFG_LLTREPORT) { - cflags += [ - "-fprofile-arcs", - "-ftest-coverage", - ] - } } diff --git a/kernel/BUILD.gn b/kernel/BUILD.gn index 34a26649..e0a1da6d 100644 --- a/kernel/BUILD.gn +++ b/kernel/BUILD.gn @@ -25,32 +25,25 @@ # 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. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") -lite_component("kernel") { - features = [ +group("kernel") { + deps = [ "base", - "syscall", + "common", + "extended", "user", ] - if (LOSCFG_KERNEL_CPUP) { - features += [ "extended/cpup" ] - } - if (LOSCFG_KERNEL_MPU) { - features += [ "extended/mpu" ] - } - if (LOSCFG_KERNEL_CPPSUPPORT) { - features += [ "extended/cppsupport" ] - } - if (LOSCFG_KERNEL_DYNLOAD) { - features += [ "extended/dynload" ] - } - if (LOSCFG_KERNEL_TRACE) { - features += [ "extended/trace" ] - } - if (LOSCFG_KERNEL_VDSO) { - features += [ "extended/vdso" ] - } +} + +config("public") { + include_dirs = [ "include" ] + configs = [ + "base:public", + "common:public", + "extended:public", + "user:public", + ] } diff --git a/kernel/base/BUILD.gn b/kernel/base/BUILD.gn index 67cb2543..b231ed27 100644 --- a/kernel/base/BUILD.gn +++ b/kernel/base/BUILD.gn @@ -25,9 +25,12 @@ # 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. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -static_library("base") { +import("//kernel/liteos_a/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { sources = [ "core/los_bitmap.c", "core/los_process.c", @@ -36,22 +39,24 @@ static_library("base") { "core/los_sys.c", "core/los_task.c", "core/los_tick.c", - "core/los_timeslice.c", "ipc/los_event.c", + "ipc/los_futex.c", "ipc/los_ipcdebug.c", "ipc/los_mux.c", - "ipc/los_mux_debug.c", "ipc/los_queue.c", "ipc/los_queue_debug.c", + "ipc/los_rwlock.c", "ipc/los_sem.c", "ipc/los_sem_debug.c", - "mem/bestfit/los_memory.c", - "mem/bestfit/los_multipledlinkhead.c", + "ipc/los_signal.c", "mem/common/los_memstat.c", "mem/membox/los_membox.c", + "mem/tlsf/los_memory.c", + "misc/kill_shellcmd.c", "misc/los_misc.c", "misc/los_stackinfo.c", "misc/mempt_shellcmd.c", + "misc/panic_shellcmd.c", "misc/swtmr_shellcmd.c", "misc/sysinfo_shellcmd.c", "misc/task_shellcmd.c", @@ -59,22 +64,33 @@ static_library("base") { "mp/los_lockdep.c", "mp/los_mp.c", "mp/los_percpu.c", + "mp/los_spinlock.c", "mp/los_stat.c", "om/los_err.c", - "sched/sched_sq/los_priqueue.c", "sched/sched_sq/los_sched.c", - "vm/filemap.c", - "vm/pmm.c", - "vm/vm.c", - "vm/vmm.c", + "vm/los_vm_boot.c", + "vm/los_vm_dump.c", + "vm/los_vm_fault.c", + "vm/los_vm_filemap.c", + "vm/los_vm_iomap.c", + "vm/los_vm_map.c", + "vm/los_vm_page.c", + "vm/los_vm_phys.c", + "vm/los_vm_scan.c", + "vm/los_vm_syscall.c", + "vm/oom.c", + "vm/shm.c", ] - include_dirs = [ - "include", - "../extended/include", - "../extended/vdso/include", - "../extended/dynload/include", - "../include", - "mem", - ] + if (defined(LOSCFG_SHELL_CMD_DEBUG)) { + configs += [ + "$HDFTOPDIR:hdf_config" + ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] } diff --git a/kernel/base/core/los_process.c b/kernel/base/core/los_process.c index 0f7c4b35..a4bf395c 100644 --- a/kernel/base/core/los_process.c +++ b/kernel/base/core/los_process.c @@ -57,7 +57,7 @@ LITE_OS_SEC_BSS LosProcessCB *g_processCBArray = NULL; LITE_OS_SEC_DATA_INIT STATIC LOS_DL_LIST g_freeProcess; -LITE_OS_SEC_DATA_INIT STATIC LOS_DL_LIST g_processRecyleList; +LITE_OS_SEC_DATA_INIT STATIC LOS_DL_LIST g_processRecycleList; LITE_OS_SEC_BSS UINT32 g_userInitProcess = OS_INVALID_VALUE; LITE_OS_SEC_BSS UINT32 g_kernelInitProcess = OS_INVALID_VALUE; LITE_OS_SEC_BSS UINT32 g_kernelIdleProcess = OS_INVALID_VALUE; @@ -183,7 +183,7 @@ VOID OsWaitWakeTask(LosTaskCB *taskCB, UINT32 wakePID) { taskCB->waitID = wakePID; OsSchedTaskWake(taskCB); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP LOS_MpSchedule(OS_MP_CPU_ALL); #endif } @@ -312,7 +312,7 @@ LITE_OS_SEC_TEXT VOID OsProcessResourcesToFree(LosProcessCB *processCB) } #endif -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC if (OsProcessIsUserMode(processCB)) { LiteIpcPoolDelete(&(processCB->ipcInfo)); (VOID)memset_s(&(processCB->ipcInfo), sizeof(ProcIpcInfo), 0, sizeof(ProcIpcInfo)); @@ -331,9 +331,9 @@ LITE_OS_SEC_TEXT STATIC VOID OsRecycleZombiesProcess(LosProcessCB *childCB, Proc LOS_ListDelete(&childCB->pendList); if (childCB->processStatus & OS_PROCESS_FLAG_EXIT) { - LOS_ListHeadInsert(&g_processRecyleList, &childCB->pendList); + LOS_ListHeadInsert(&g_processRecycleList, &childCB->pendList); } else if (childCB->processStatus & OS_PROCESS_FLAG_GROUP_LEADER) { - LOS_ListTailInsert(&g_processRecyleList, &childCB->pendList); + LOS_ListTailInsert(&g_processRecycleList, &childCB->pendList); } else { OsInsertPCBToFreeList(childCB); } @@ -413,7 +413,7 @@ STATIC VOID OsProcessNaturalExit(LosTaskCB *runTask, UINT32 status) #ifdef LOSCFG_KERNEL_VM (VOID)OsKill(processCB->parentProcessID, SIGCHLD, OS_KERNEL_KILL_PERMISSION); #endif - LOS_ListHeadInsert(&g_processRecyleList, &processCB->pendList); + LOS_ListHeadInsert(&g_processRecycleList, &processCB->pendList); OsRunTaskToDelete(runTask); return; } @@ -437,7 +437,7 @@ STATIC UINT32 OsProcessInit(VOID) (VOID)memset_s(g_processCBArray, size, 0, size); LOS_ListInit(&g_freeProcess); - LOS_ListInit(&g_processRecyleList); + LOS_ListInit(&g_processRecycleList); for (index = 0; index < g_processMaxNum; index++) { g_processCBArray[index].processID = index; @@ -457,14 +457,14 @@ STATIC UINT32 OsProcessInit(VOID) return LOS_OK; } -LITE_OS_SEC_TEXT VOID OsProcessCBRecyleToFree(VOID) +LITE_OS_SEC_TEXT VOID OsProcessCBRecycleToFree(VOID) { UINT32 intSave; LosProcessCB *processCB = NULL; SCHEDULER_LOCK(intSave); - while (!LOS_ListEmpty(&g_processRecyleList)) { - processCB = OS_PCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_processRecyleList)); + while (!LOS_ListEmpty(&g_processRecycleList)) { + processCB = OS_PCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_processRecycleList)); if (!(processCB->processStatus & OS_PROCESS_FLAG_EXIT)) { break; } @@ -487,7 +487,7 @@ LITE_OS_SEC_TEXT VOID OsProcessCBRecyleToFree(VOID) LOS_ListDelete(&processCB->pendList); if ((processCB->processStatus & OS_PROCESS_FLAG_GROUP_LEADER) || (processCB->processStatus & OS_PROCESS_STATUS_ZOMBIES)) { - LOS_ListTailInsert(&g_processRecyleList, &processCB->pendList); + LOS_ListTailInsert(&g_processRecycleList, &processCB->pendList); } else { /* Clear the bottom 4 bits of process status */ OsInsertPCBToFreeList(processCB); @@ -525,7 +525,7 @@ STATIC VOID OsDeInitPCB(LosProcessCB *processCB) processCB->processStatus &= ~OS_PROCESS_STATUS_INIT; processCB->processStatus |= OS_PROCESS_FLAG_EXIT; - LOS_ListHeadInsert(&g_processRecyleList, &processCB->pendList); + LOS_ListHeadInsert(&g_processRecycleList, &processCB->pendList); SCHEDULER_UNLOCK(intSave); (VOID)LOS_MemFree(m_aucSysMem1, group); @@ -685,7 +685,7 @@ STATIC UINT32 OsProcessCreateInit(LosProcessCB *processCB, UINT32 flags, const C goto EXIT; } -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC if (OsProcessIsUserMode(processCB)) { ret = LiteIpcPoolInit(&(processCB->ipcInfo)); if (ret != LOS_OK) { @@ -1005,7 +1005,7 @@ WAIT_BACK: return LOS_OK; } -STATIC UINT32 OsWaitRecycleChildPorcess(const LosProcessCB *childCB, UINT32 intSave, INT32 *status) +STATIC UINT32 OsWaitRecycleChildProcess(const LosProcessCB *childCB, UINT32 intSave, INT32 *status) { ProcessGroup *group = NULL; UINT32 pid = childCB->processID; @@ -1081,7 +1081,7 @@ LITE_OS_SEC_TEXT INT32 LOS_Wait(INT32 pid, USER INT32 *status, UINT32 options, V } if (childCB != NULL) { - return (INT32)OsWaitRecycleChildPorcess(childCB, intSave, status); + return (INT32)OsWaitRecycleChildProcess(childCB, intSave, status); } if ((options & LOS_WAIT_WNOHANG) != 0) { @@ -1104,7 +1104,7 @@ LITE_OS_SEC_TEXT INT32 LOS_Wait(INT32 pid, USER INT32 *status, UINT32 options, V goto ERROR; } - return (INT32)OsWaitRecycleChildPorcess(childCB, intSave, status); + return (INT32)OsWaitRecycleChildProcess(childCB, intSave, status); ERROR: SCHEDULER_UNLOCK(intSave); @@ -1294,7 +1294,7 @@ LITE_OS_SEC_TEXT UINT32 OsExecRecycleAndInit(LosProcessCB *processCB, const CHAR return ret; } -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC ret = LiteIpcPoolInit(&(processCB->ipcInfo)); if (ret != LOS_OK) { return LOS_NOK; @@ -1690,7 +1690,7 @@ STATIC UINT32 OsCopyProcessResources(UINT32 flags, LosProcessCB *child, LosProce return ret; } -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC if (OsProcessIsUserMode(child)) { ret = LiteIpcPoolReInit(&child->ipcInfo, (const ProcIpcInfo *)(&run->ipcInfo)); if (ret != LOS_OK) { diff --git a/kernel/base/core/los_sortlink.c b/kernel/base/core/los_sortlink.c index 8a997e50..2f818dfd 100644 --- a/kernel/base/core/los_sortlink.c +++ b/kernel/base/core/los_sortlink.c @@ -122,12 +122,12 @@ STATIC INLINE UINT64 OsGetSortLinkNextExpireTime(SortLinkAttribute *sortHeader, return expirTime; } -STATIC Percpu *OsFindIdleCpu(UINT16 *ildeCpuID) +STATIC Percpu *OsFindIdleCpu(UINT16 *idleCpuID) { Percpu *idleCpu = OsPercpuGetByID(0); - *ildeCpuID = 0; + *idleCpuID = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT16 cpuID = 1; UINT32 nodeNum = idleCpu->taskSortLink.nodeNum + idleCpu->swtmrSortLink.nodeNum; @@ -136,7 +136,7 @@ STATIC Percpu *OsFindIdleCpu(UINT16 *ildeCpuID) UINT32 temp = cpu->taskSortLink.nodeNum + cpu->swtmrSortLink.nodeNum; if (nodeNum > temp) { idleCpu = cpu; - *ildeCpuID = cpuID; + *idleCpuID = cpuID; } cpuID++; @@ -174,7 +174,7 @@ VOID OsAdd2SortLink(SortLinkList *node, UINT64 startTime, UINT32 waitTicks, Sort LOS_SpinLockSave(spinLock, &intSave); SET_SORTLIST_VALUE(node, startTime + (UINT64)waitTicks * OS_CYCLE_PER_TICK); OsAddNode2SortLink(sortLinkHeader, node); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP node->cpuid = idleCpu; if (idleCpu != ArchCurrCpuid()) { LOS_MpSchedule(CPUID_TO_AFFI_MASK(idleCpu)); @@ -186,7 +186,7 @@ VOID OsAdd2SortLink(SortLinkList *node, UINT64 startTime, UINT32 waitTicks, Sort VOID OsDeleteSortLink(SortLinkList *node, SortLinkType type) { UINT32 intSave; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP Percpu *cpu = OsPercpuGetByID(node->cpuid); #else Percpu *cpu = OsPercpuGetByID(0); diff --git a/kernel/base/core/los_swtmr.c b/kernel/base/core/los_swtmr.c index c2b0ba44..2cad2825 100644 --- a/kernel/base/core/los_swtmr.c +++ b/kernel/base/core/los_swtmr.c @@ -38,7 +38,7 @@ #include "los_task_pri.h" -#if (LOSCFG_BASE_CORE_SWTMR == YES) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE #if (LOSCFG_BASE_CORE_SWTMR_LIMIT <= 0) #error "swtmr maxnum cannot be zero" #endif /* LOSCFG_BASE_CORE_SWTMR_LIMIT <= 0 */ @@ -84,7 +84,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrTaskCreate(VOID) swtmrTask.pcName = "Swt_Task"; swtmrTask.usTaskPrio = 0; swtmrTask.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP swtmrTask.usCpuAffiMask = CPUID_TO_AFFI_MASK(cpuid); #endif ret = LOS_TaskCreate(&swtmrTaskID, &swtmrTask); @@ -533,4 +533,4 @@ LITE_OS_SEC_TEXT UINT32 LOS_SwtmrDelete(UINT16 swtmrID) return ret; } -#endif /* LOSCFG_BASE_CORE_SWTMR */ +#endif /* LOSCFG_BASE_CORE_SWTMR_ENABLE */ diff --git a/kernel/base/core/los_task.c b/kernel/base/core/los_task.c index 2d00d589..48e2e74d 100644 --- a/kernel/base/core/los_task.c +++ b/kernel/base/core/los_task.c @@ -51,10 +51,10 @@ #ifdef LOSCFG_KERNEL_CPUP #include "los_cpup_pri.h" #endif -#if (LOSCFG_BASE_CORE_SWTMR == YES) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE #include "los_swtmr_pri.h" #endif -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC #include "hm_liteipc.h" #endif #ifdef LOSCFG_ENABLE_OOM_LOOP_TASK @@ -67,7 +67,7 @@ LITE_OS_SEC_BSS LosTaskCB *g_taskCBArray; LITE_OS_SEC_BSS LOS_DL_LIST g_losFreeTask; -LITE_OS_SEC_BSS LOS_DL_LIST g_taskRecyleList; +LITE_OS_SEC_BSS LOS_DL_LIST g_taskRecycleList; LITE_OS_SEC_BSS UINT32 g_taskMaxNum; LITE_OS_SEC_BSS UINT32 g_taskScheduled; /* one bit for each cores */ LITE_OS_SEC_BSS EVENT_CB_S g_resourceEvent; @@ -98,7 +98,7 @@ VOID OsSetMainTask() g_mainTask[i].taskStatus = OS_TASK_STATUS_UNUSED; g_mainTask[i].taskID = LOSCFG_BASE_CORE_TSK_LIMIT; g_mainTask[i].priority = OS_TASK_PRIORITY_LOWEST; -#if (LOSCFG_KERNEL_SMP_LOCKDEP == YES) +#ifdef LOSCFG_KERNEL_SMP_LOCKDEP g_mainTask[i].lockDep.lockDepth = 0; g_mainTask[i].lockDep.waitLock = NULL; #endif @@ -201,14 +201,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTaskInit(VOID) (VOID)memset_s(g_taskCBArray, size, 0, size); LOS_ListInit(&g_losFreeTask); - LOS_ListInit(&g_taskRecyleList); + LOS_ListInit(&g_taskRecycleList); for (index = 0; index < g_taskMaxNum; index++) { g_taskCBArray[index].taskStatus = OS_TASK_STATUS_UNUSED; g_taskCBArray[index].taskID = index; LOS_ListTailInsert(&g_losFreeTask, &g_taskCBArray[index].pendList); } -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE LOS_TraceReg(LOS_TRACE_TASK, OsTaskTrace, LOS_TRACE_TASK_NAME, LOS_TRACE_ENABLE); #endif @@ -240,7 +240,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsIdleTaskCreate(VOID) taskInitParam.pcName = "Idle"; taskInitParam.usTaskPrio = OS_TASK_PRIORITY_LOWEST; taskInitParam.processID = OsGetIdleProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreateOnly(idleTaskID, &taskInitParam); @@ -381,7 +381,7 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskStackAlloc(VOID **topStack, UINT32 stack STATIC INLINE UINT32 OsTaskSyncCreate(LosTaskCB *taskCB) { -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == YES) +#ifdef LOSCFG_KERNEL_SMP_TASK_SYNC UINT32 ret = LOS_SemCreate(0, &taskCB->syncSignal); if (ret != LOS_OK) { return LOS_ERRNO_TSK_MP_SYNC_RESOURCE; @@ -394,7 +394,7 @@ STATIC INLINE UINT32 OsTaskSyncCreate(LosTaskCB *taskCB) STATIC INLINE VOID OsTaskSyncDestroy(UINT32 syncSignal) { -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == YES) +#ifdef LOSCFG_KERNEL_SMP_TASK_SYNC (VOID)LOS_SemDelete(syncSignal); #else (VOID)syncSignal; @@ -403,7 +403,7 @@ STATIC INLINE VOID OsTaskSyncDestroy(UINT32 syncSignal) LITE_OS_SEC_TEXT UINT32 OsTaskSyncWait(const LosTaskCB *taskCB) { -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == YES) +#ifdef LOSCFG_KERNEL_SMP_TASK_SYNC UINT32 ret = LOS_OK; LOS_ASSERT(LOS_SpinHeld(&g_taskSpin)); @@ -428,7 +428,7 @@ LITE_OS_SEC_TEXT UINT32 OsTaskSyncWait(const LosTaskCB *taskCB) STATIC INLINE VOID OsTaskSyncWake(const LosTaskCB *taskCB) { -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == YES) +#ifdef LOSCFG_KERNEL_SMP_TASK_SYNC (VOID)OsSemPostUnsafe(taskCB->syncSignal, NULL); #else (VOID)taskCB; @@ -450,8 +450,8 @@ LITE_OS_SEC_TEXT VOID OsTaskCBRecycleToFree() UINT32 intSave; SCHEDULER_LOCK(intSave); - while (!LOS_ListEmpty(&g_taskRecyleList)) { - taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_taskRecyleList)); + while (!LOS_ListEmpty(&g_taskRecycleList)) { + taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_taskRecycleList)); LOS_ListDelete(&taskCB->pendList); SCHEDULER_UNLOCK(intSave); @@ -485,7 +485,7 @@ LITE_OS_SEC_TEXT VOID OsTaskResourcesToFree(LosTaskCB *taskCB) processCB->processID, taskCB->taskID, mapBase, mapSize, ret); } -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC LiteIpcRemoveServiceHandle(taskCB); #endif } @@ -494,7 +494,7 @@ LITE_OS_SEC_TEXT VOID OsTaskResourcesToFree(LosTaskCB *taskCB) if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) { topOfStack = taskCB->topOfStack; taskCB->topOfStack = 0; -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == YES) +#ifdef LOSCFG_KERNEL_SMP_TASK_SYNC syncSignal = taskCB->syncSignal; taskCB->syncSignal = LOSCFG_BASE_IPC_SEM_LIMIT; #endif @@ -523,12 +523,12 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskCBInitBase(LosTaskCB *taskCB, taskCB->taskEntry = initParam->pfnTaskEntry; taskCB->signal = SIGNAL_NONE; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskCB->currCpu = OS_TASK_INVALID_CPUID; taskCB->cpuAffiMask = (initParam->usCpuAffiMask) ? initParam->usCpuAffiMask : LOSCFG_KERNEL_CPU_MASK; #endif -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC LOS_ListInit(&(taskCB->msgListHead)); #endif taskCB->policy = (initParam->policy == LOS_SCHED_FIFO) ? LOS_SCHED_FIFO : LOS_SCHED_RR; @@ -654,7 +654,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S LOS_ERREND_TCB_INIT: (VOID)LOS_MemFree(pool, topStack); LOS_ERREND_REWIND_SYNC: -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == YES) +#ifdef LOSCFG_KERNEL_SMP_TASK_SYNC OsTaskSyncDestroy(taskCB->syncSignal); #endif LOS_ERREND_REWIND_TCB: @@ -769,7 +769,7 @@ LITE_OS_SEC_TEXT_INIT STATIC BOOL OsTaskSuspendCheckOnRun(LosTaskCB *taskCB, UIN /* init default out return value */ *ret = LOS_OK; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* ASYNCHRONIZED. No need to do task lock checking */ if (taskCB->currCpu != ArchCurrCpuid()) { taskCB->signal = SIGNAL_SUSPEND; @@ -888,7 +888,7 @@ LITE_OS_SEC_TEXT VOID OsRunTaskToDelete(LosTaskCB *runTask) LOS_ListDelete(&runTask->threadList); processCB->threadNumber--; - LOS_ListTailInsert(&g_taskRecyleList, &runTask->pendList); + LOS_ListTailInsert(&g_taskRecycleList, &runTask->pendList); OsEventWriteUnsafe(&g_resourceEvent, OS_RESOURCE_EVENT_FREE, FALSE, NULL); OsSchedResched(); @@ -909,7 +909,7 @@ STATIC BOOL OsRunTaskToDeleteCheckOnRun(LosTaskCB *taskCB, UINT32 *ret) /* init default out return value */ *ret = LOS_OK; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* ASYNCHRONIZED. No need to do task lock checking */ if (taskCB->currCpu != ArchCurrCpuid()) { /* @@ -962,7 +962,7 @@ STATIC VOID OsTaskDeleteInactive(LosProcessCB *processCB, LosTaskCB *taskCB) LOS_ListDelete(&taskCB->threadList); processCB->threadNumber--; - LOS_ListTailInsert(&g_taskRecyleList, &taskCB->pendList); + LOS_ListTailInsert(&g_taskRecycleList, &taskCB->pendList); return; } @@ -994,7 +994,7 @@ LITE_OS_SEC_TEXT UINT32 OsTaskDeleteUnsafe(LosTaskCB *taskCB, UINT32 status, UIN SCHEDULER_LOCK(intSave); } -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP LOS_ASSERT(OsPercpuGet()->taskLockCnt == 1); #else LOS_ASSERT(OsPercpuGet()->taskLockCnt == 0); @@ -1235,7 +1235,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInf LITE_OS_SEC_TEXT BOOL OsTaskCpuAffiSetUnsafe(UINT32 taskID, UINT16 newCpuAffiMask, UINT16 *oldCpuAffiMask) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID); taskCB->cpuAffiMask = newCpuAffiMask; @@ -1286,7 +1286,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskCpuAffiSet(UINT32 taskID, UINT16 cpuAffiMa LITE_OS_SEC_TEXT_MINOR UINT16 LOS_TaskCpuAffiGet(UINT32 taskID) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #define INVALID_CPU_AFFI_MASK 0 LosTaskCB *taskCB = NULL; UINT16 cpuAffiMask; @@ -1346,7 +1346,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTaskProcSignal(VOID) /* suspend killed task may fail, ignore the result */ (VOID)LOS_TaskSuspend(runTask->taskID); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP } else if (runTask->signal & SIGNAL_AFFI) { runTask->signal &= ~SIGNAL_AFFI; @@ -1406,13 +1406,14 @@ STATIC VOID OsExitGroupActiveTaskKilled(LosProcessCB *processCB, LosTaskCB *task INT32 ret; taskCB->taskStatus |= OS_TASK_FLAG_EXIT_KILL; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* The other core that the thread is running on and is currently running in a non-system call */ if (!taskCB->sig.sigIntLock && (taskCB->taskStatus & OS_TASK_STATUS_RUNNING)) { taskCB->signal = SIGNAL_KILL; LOS_MpSchedule(taskCB->currCpu); } else #endif +#ifdef LOSCFG_KERNEL_VM { ret = OsTaskKillUnsafe(taskCB->taskID, SIGKILL); if (ret != LOS_OK) { @@ -1420,6 +1421,7 @@ STATIC VOID OsExitGroupActiveTaskKilled(LosProcessCB *processCB, LosTaskCB *task taskCB->processID, OsCurrTaskGet()->taskID, taskCB->taskID, ret); } } +#endif if (!(taskCB->taskStatus & OS_TASK_FLAG_PTHREAD_JOIN)) { taskCB->taskStatus |= OS_TASK_FLAG_PTHREAD_JOIN; @@ -1648,7 +1650,7 @@ STATIC VOID OsResourceRecoveryTask(VOID) if (ret & (OS_RESOURCE_EVENT_FREE | OS_RESOURCE_EVENT_OOM)) { OsTaskCBRecycleToFree(); - OsProcessCBRecyleToFree(); + OsProcessCBRecycleToFree(); } #ifdef LOSCFG_ENABLE_OOM_LOOP_TASK diff --git a/kernel/base/core/los_tick.c b/kernel/base/core/los_tick.c index e799e4db..b5c2794e 100644 --- a/kernel/base/core/los_tick.c +++ b/kernel/base/core/los_tick.c @@ -57,7 +57,7 @@ LITE_OS_SEC_TEXT VOID OsTickHandler(VOID) OsVdsoTimevalUpdate(); #endif -#if (LOSCFG_BASE_CORE_TICK_HW_TIME == YES) +#ifdef LOSCFG_BASE_CORE_TICK_HW_TIME HalClockIrqClear(); /* diff from every platform */ #endif diff --git a/kernel/base/include/los_percpu_pri.h b/kernel/base/include/los_percpu_pri.h index 0a82c530..70662bf1 100644 --- a/kernel/base/include/los_percpu_pri.h +++ b/kernel/base/include/los_percpu_pri.h @@ -43,7 +43,7 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP typedef enum { CPU_RUNNING = 0, /* cpu is running */ CPU_HALT, /* cpu in the halt */ @@ -66,7 +66,7 @@ typedef struct { UINT32 swtmrTaskID; /* software timer task id */ UINT32 schedFlag; /* pending scheduler flag */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 excFlag; /* cpu halt or exc flag */ #endif } Percpu; diff --git a/kernel/base/include/los_process_pri.h b/kernel/base/include/los_process_pri.h index 2f987fe6..d21d7115 100644 --- a/kernel/base/include/los_process_pri.h +++ b/kernel/base/include/los_process_pri.h @@ -36,7 +36,7 @@ #include "los_sem_pri.h" #include "los_process.h" #include "los_vm_map.h" -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC #include "hm_liteipc.h" #endif #ifdef LOSCFG_SECURITY_CAPABILITY @@ -97,12 +97,12 @@ typedef struct ProcessCB { volatile UINT32 threadNumber; /**< Number of threads alive under this process */ UINT32 threadCount; /**< Total number of threads created under this process */ LOS_DL_LIST waitList; /**< The process holds the waitLits to support wait/waitpid */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 timerCpu; /**< CPU core number of this task is delayed or pended */ #endif UINTPTR sigHandler; /**< Signal handler */ sigset_t sigShare; /**< Signal share bit */ -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC ProcIpcInfo ipcInfo; /**< Memory pool for lite ipc */ #endif #ifdef LOSCFG_KERNEL_VM @@ -443,7 +443,7 @@ extern UINTPTR __user_init_bss; extern UINTPTR __user_init_end; extern UINTPTR __user_init_load_addr; extern UINT32 OsSystemProcessCreate(VOID); -extern VOID OsProcessCBRecyleToFree(VOID); +extern VOID OsProcessCBRecycleToFree(VOID); extern VOID OsProcessResourcesToFree(LosProcessCB *processCB); extern VOID OsProcessExit(LosTaskCB *runTask, INT32 status); extern UINT32 OsUserInitProcess(VOID); diff --git a/kernel/base/include/los_sched_pri.h b/kernel/base/include/los_sched_pri.h index e5f1ea7c..21af8ce6 100644 --- a/kernel/base/include/los_sched_pri.h +++ b/kernel/base/include/los_sched_pri.h @@ -112,7 +112,7 @@ STATIC INLINE BOOL OsPreemptableInSched(VOID) { BOOL preemptable = FALSE; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* * For smp systems, schedule must hold the task spinlock, and this counter * will increase by 1 in that case. diff --git a/kernel/base/include/los_sortlink_pri.h b/kernel/base/include/los_sortlink_pri.h index fa2edf17..07a04d91 100644 --- a/kernel/base/include/los_sortlink_pri.h +++ b/kernel/base/include/los_sortlink_pri.h @@ -50,7 +50,7 @@ typedef enum { typedef struct { LOS_DL_LIST sortLinkNode; UINT64 responseTime; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 cpuid; #endif } SortLinkList; diff --git a/kernel/base/include/los_task_pri.h b/kernel/base/include/los_task_pri.h index 778f9c00..e2e33c02 100644 --- a/kernel/base/include/los_task_pri.h +++ b/kernel/base/include/los_task_pri.h @@ -45,7 +45,9 @@ #include "los_cpup_pri.h" #endif +#ifdef LOSCFG_KERNEL_TRACE #include "los_trace.h" +#endif #ifdef __cplusplus #if __cplusplus @@ -344,14 +346,14 @@ typedef struct { INT32 errorNo; /**< Error Num */ UINT32 signal; /**< Task signal */ sig_cb sig; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT16 currCpu; /**< CPU core number of this task is running on */ UINT16 lastCpu; /**< CPU core number of this task is running on last time */ UINT16 cpuAffiMask; /**< CPU affinity mask, support up to 16 cores */ -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == YES) +#ifdef LOSCFG_KERNEL_SMP_TASK_SYNC UINT32 syncSignal; /**< Synchronization for signal handling */ #endif -#if (LOSCFG_KERNEL_SMP_LOCKDEP == YES) +#ifdef LOSCFG_KERNEL_SMP_LOCKDEP LockDep lockDep; #endif #endif @@ -368,7 +370,7 @@ typedef struct { UINTPTR waitID; /**< Wait for the PID or GID of the child process */ UINT16 waitFlag; /**< The type of child process that is waiting, belonging to a group or parent, a specific child process, or any child process */ -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC UINT32 ipcStatus; LOS_DL_LIST msgListHead; BOOL accessMap[LOSCFG_BASE_CORE_TSK_LIMIT]; diff --git a/kernel/base/ipc/los_event.c b/kernel/base/ipc/los_event.c index fd872d64..4b745f88 100644 --- a/kernel/base/ipc/los_event.c +++ b/kernel/base/ipc/los_event.c @@ -35,7 +35,7 @@ #include "los_mp.h" #include "los_percpu_pri.h" #include "los_sched_pri.h" -#if (LOSCFG_BASE_CORE_SWTMR == YES) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE #include "los_exc.h" #endif diff --git a/kernel/base/ipc/los_futex.c b/kernel/base/ipc/los_futex.c index 9e720e2f..d831a7c5 100644 --- a/kernel/base/ipc/los_futex.c +++ b/kernel/base/ipc/los_futex.c @@ -199,6 +199,9 @@ STATIC INLINE VOID OsFutexReplaceQueueListHeadNode(FutexNode *oldHeadNode, Futex LOS_DL_LIST *futexList = oldHeadNode->futexList.pstPrev; LOS_ListDelete(&oldHeadNode->futexList); LOS_ListHeadInsert(futexList, &newHeadNode->futexList); + if ((newHeadNode->queueList.pstNext == NULL) || (newHeadNode->queueList.pstPrev == NULL)) { + LOS_ListInit(&newHeadNode->queueList); + } } STATIC INLINE VOID OsFutexDeleteKeyFromFutexList(FutexNode *node) @@ -319,11 +322,10 @@ STATIC VOID OsFutexInsertNewFutexKeyToHash(FutexNode *node) futexList != &(hashNode->lockList); futexList = futexList->pstNext) { headNode = OS_FUTEX_FROM_FUTEXLIST(futexList); - if (node->key <= headNode->key) { + if (node->key <= headNode->key) { LOS_ListTailInsert(&(headNode->futexList), &(node->futexList)); break; } - } EXIT: @@ -797,6 +799,7 @@ EXIT_UNLOCK_ERR: STATIC INT32 OsFutexRequeueInsertNewKey(UINTPTR newFutexKey, INT32 newIndex, FutexNode *oldHeadNode) { + BOOL queueListIsEmpty = FALSE; INT32 ret; UINT32 intSave; LosTaskCB *task = NULL; @@ -817,25 +820,33 @@ STATIC INT32 OsFutexRequeueInsertNewKey(UINTPTR newFutexKey, INT32 newIndex, Fut nextNode = OS_FUTEX_FROM_QUEUELIST(queueList); SCHEDULER_LOCK(intSave); if (LOS_ListEmpty(&nextNode->pendList)) { - queueList = queueList->pstNext; + if (LOS_ListEmpty(queueList)) { + queueListIsEmpty = TRUE; + } else { + queueList = queueList->pstNext; + } OsFutexDeinitFutexNode(nextNode); SCHEDULER_UNLOCK(intSave); - if (queueList->pstNext != NULL) { - continue; - } else { + if (queueListIsEmpty) { return LOS_OK; } + + continue; } task = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&(nextNode->pendList))); - queueList = queueList->pstNext; + if (LOS_ListEmpty(queueList)) { + queueListIsEmpty = TRUE; + } else { + queueList = queueList->pstNext; + } LOS_ListDelete(&nextNode->queueList); ret = OsFutexInsertTasktoPendList(&newHeadNode, nextNode, task); SCHEDULER_UNLOCK(intSave); if (ret != LOS_OK) { PRINT_ERR("Futex requeue insert new key failed!\n"); } - } while (queueList->pstNext != NULL); + } while (!queueListIsEmpty); return LOS_OK; } diff --git a/kernel/base/ipc/los_mux.c b/kernel/base/ipc/los_mux.c index 7dc321af..61ee89e0 100644 --- a/kernel/base/ipc/los_mux.c +++ b/kernel/base/ipc/los_mux.c @@ -38,7 +38,7 @@ #include "los_sched_pri.h" -#if (LOSCFG_BASE_IPC_MUX == YES) +#ifdef LOSCFG_BASE_IPC_MUX #define MUTEXATTR_TYPE_MASK 0x0FU LITE_OS_SEC_TEXT UINT32 LOS_MuxAttrInit(LosMuxAttr *attr) @@ -560,5 +560,5 @@ LITE_OS_SEC_TEXT UINT32 LOS_MuxUnlock(LosMux *mutex) return ret; } -#endif /* (LOSCFG_BASE_IPC_MUX == YES) */ +#endif /* LOSCFG_BASE_IPC_MUX */ diff --git a/kernel/base/ipc/los_queue.c b/kernel/base/ipc/los_queue.c index 983e11f1..be4d176f 100644 --- a/kernel/base/ipc/los_queue.c +++ b/kernel/base/ipc/los_queue.c @@ -38,7 +38,7 @@ #include "los_percpu_pri.h" -#if (LOSCFG_BASE_IPC_QUEUE == YES) +#ifdef LOSCFG_BASE_IPC_QUEUE #if (LOSCFG_BASE_IPC_QUEUE_LIMIT <= 0) #error "queue maxnum cannot be zero" #endif /* LOSCFG_BASE_IPC_QUEUE_LIMIT <= 0 */ @@ -493,5 +493,5 @@ QUEUE_END: return ret; } -#endif /* (LOSCFG_BASE_IPC_QUEUE == YES) */ +#endif /* LOSCFG_BASE_IPC_QUEUE */ diff --git a/kernel/base/ipc/los_sem.c b/kernel/base/ipc/los_sem.c index 7f80a0ae..a6f10a80 100644 --- a/kernel/base/ipc/los_sem.c +++ b/kernel/base/ipc/los_sem.c @@ -40,7 +40,7 @@ #include "los_percpu_pri.h" -#if (LOSCFG_BASE_IPC_SEM == YES) +#ifdef LOSCFG_BASE_IPC_SEM #if (LOSCFG_BASE_IPC_SEM_LIMIT <= 0) #error "sem maxnum cannot be zero" @@ -283,5 +283,5 @@ LITE_OS_SEC_TEXT UINT32 LOS_SemPost(UINT32 semHandle) return ret; } -#endif /* (LOSCFG_BASE_IPC_SEM == YES) */ +#endif /* LOSCFG_BASE_IPC_SEM */ diff --git a/kernel/base/ipc/los_signal.c b/kernel/base/ipc/los_signal.c index 06fee687..ec7c5d59 100644 --- a/kernel/base/ipc/los_signal.c +++ b/kernel/base/ipc/los_signal.c @@ -101,11 +101,13 @@ STATIC UINT32 OsPendingTaskWake(LosTaskCB *taskCB, INT32 signo) case OS_TASK_WAIT_SIGNAL: OsSigWaitTaskWake(taskCB, signo); break; +#ifdef LOSCFG_KERNEL_LITEIPC case OS_TASK_WAIT_LITEIPC: taskCB->ipcStatus &= ~IPC_THREAD_STATUS_PEND; OsTaskWakeClearPendMask(taskCB); OsSchedTaskWake(taskCB); break; +#endif case OS_TASK_WAIT_FUTEX: OsFutexNodeDeleteFromFutexHash(&taskCB->futex, TRUE, NULL, NULL); OsTaskWakeClearPendMask(taskCB); @@ -132,7 +134,7 @@ int OsTcbDispatch(LosTaskCB *stcb, siginfo_t *info) if (masked) { /* If signal is in wait list and mask list, need unblock it */ if (LOS_ListEmpty(&sigcb->waitList) || - (!LOS_ListEmpty(&sigcb->waitList) && !OsSigIsMember(&sigcb->sigwaitmask, info->si_signo))) { + (!LOS_ListEmpty(&sigcb->waitList) && !OsSigIsMember(&sigcb->sigwaitmask, info->si_signo))) { OsSigAddSet(&sigcb->sigPendFlag, info->si_signo); } } else { @@ -308,7 +310,7 @@ int OsSigProcessSend(LosProcessCB *spcb, siginfo_t *sigInfo) .receivedTcb = NULL }; - if (info.sigInfo == NULL){ + if (info.sigInfo == NULL) { return -EFAULT; } @@ -676,6 +678,7 @@ VOID *OsRestorSignalContext(VOID *sp) LosProcessCB *process = OsCurrProcessGet(); VOID *saveContext = sigcb->sigContext; + sigcb->sigContext = NULL; sigcb->count--; process->sigShare = 0; OsProcessExitCodeSignalClear(process); diff --git a/kernel/base/mem/tlsf/los_memory.c b/kernel/base/mem/tlsf/los_memory.c index a958ce92..0642a692 100644 --- a/kernel/base/mem/tlsf/los_memory.c +++ b/kernel/base/mem/tlsf/los_memory.c @@ -147,7 +147,7 @@ struct OsMemPoolInfo { VOID *pool; UINT32 totalSize; UINT32 attr; -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE UINT32 waterLine; /* Maximum usage size in a memory pool */ UINT32 curUsedSize; /* Current usage size in a memory pool */ #endif @@ -230,7 +230,7 @@ STATIC INLINE VOID OsMemNodeSetTaskID(struct OsMemUsedNodeHead *node) } #endif -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE STATIC INLINE VOID OsMemWaterUsedRecord(struct OsMemPoolHead *pool, UINT32 size) { pool->info.curUsedSize += size; @@ -775,7 +775,7 @@ STATIC UINT32 OsMemPoolInit(VOID *pool, UINT32 size) endNode->ptr.prev = newNode; OS_MEM_NODE_SET_USED_FLAG(endNode->sizeAndFlag); #endif -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE poolHead->info.curUsedSize = sizeof(struct OsMemPoolHead) + OS_MEM_NODE_HEAD_SIZE; poolHead->info.waterLine = poolHead->info.curUsedSize; #endif @@ -1171,7 +1171,7 @@ STATIC INLINE UINT32 OsMemFree(struct OsMemPoolHead *pool, struct OsMemNodeHead return ret; } -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE pool->info.curUsedSize -= OS_MEM_NODE_GET_SIZE(node->sizeAndFlag); #endif @@ -1256,14 +1256,14 @@ UINT32 LOS_MemFree(VOID *pool, VOID *ptr) STATIC INLINE VOID OsMemReAllocSmaller(VOID *pool, UINT32 allocSize, struct OsMemNodeHead *node, UINT32 nodeSize) { -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE struct OsMemPoolHead *poolInfo = (struct OsMemPoolHead *)pool; #endif node->sizeAndFlag = nodeSize; if ((allocSize + OS_MEM_NODE_HEAD_SIZE + OS_MEM_MIN_ALLOC_SIZE) <= nodeSize) { OsMemSplitNode(pool, node, allocSize); OS_MEM_NODE_SET_USED_FLAG(node->sizeAndFlag); -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE poolInfo->info.curUsedSize -= nodeSize - allocSize; #endif } @@ -1603,7 +1603,7 @@ STATIC VOID OsMemPoolHeadCheck(const struct OsMemPoolHead *pool) OUT: if (flag) { PRINTK("mem pool info: poolAddr: %#x, poolSize: 0x%x\n", pool, pool->info.totalSize); -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE PRINTK("mem pool info: poolWaterLine: 0x%x, poolCurUsedSize: 0x%x\n", pool->info.waterLine, pool->info.curUsedSize); #endif @@ -1844,7 +1844,7 @@ UINT32 LOS_MemInfoGet(VOID *pool, LOS_MEM_POOL_STATUS *poolStatus) OsMemInfoGet(poolInfo, tmpNode, poolStatus); } #endif -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE poolStatus->usageWaterLine = poolInfo->info.waterLine; #endif MEM_UNLOCK(poolInfo, intSave); @@ -1861,7 +1861,7 @@ STATIC VOID OsMemInfoPrint(VOID *pool) return; } -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE PRINTK("pool addr pool size used size free size " "max free node size used node num free node num UsageWaterLine\n"); PRINTK("--------------- -------- ------- -------- " diff --git a/kernel/base/misc/panic_shellcmd.c b/kernel/base/misc/panic_shellcmd.c index 0829a7e7..1923c625 100644 --- a/kernel/base/misc/panic_shellcmd.c +++ b/kernel/base/misc/panic_shellcmd.c @@ -35,7 +35,6 @@ #include "shell.h" #endif #include "los_swtmr_pri.h" -#include "watchdog_if.h" #ifdef LOSCFG_SHELL_CMD_DEBUG @@ -46,6 +45,7 @@ LITE_OS_SEC_TEXT_MINOR BOOL OsSystemExcIsReset(VOID) return systemExcReset; } #ifdef LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG +#include "watchdog_if.h" #define WATCHDOG_TIMER_INTERVAL 5 // 5 seconds #define WATCHDOG_TIMER_INTERVAL_HALF (WATCHDOG_TIMER_INTERVAL / 2) diff --git a/kernel/base/misc/sysinfo_shellcmd.c b/kernel/base/misc/sysinfo_shellcmd.c index 31431743..ba9186f8 100644 --- a/kernel/base/misc/sysinfo_shellcmd.c +++ b/kernel/base/misc/sysinfo_shellcmd.c @@ -119,9 +119,21 @@ UINT32 OsShellCmdSwtmrCntGet(VOID) LITE_OS_SEC_TEXT_MINOR VOID OsShellCmdSystemInfoGet(VOID) { UINT8 isTaskEnable = YES; - UINT8 isSemEnable = LOSCFG_BASE_IPC_SEM; - UINT8 isQueueEnable = LOSCFG_BASE_IPC_QUEUE; - UINT8 isSwtmrEnable = LOSCFG_BASE_CORE_SWTMR; +#ifdef LOSCFG_BASE_IPC_SEM + UINT8 isSemEnable = YES; +#else + UINT8 isSemEnable = NO; +#endif +#ifdef LOSCFG_BASE_IPC_QUEUE + UINT8 isQueueEnable = YES; +#else + UINT8 isQueueEnable = NO; +#endif +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE + UINT8 isSwtmrEnable = YES; +#else + UINT8 isSwtmrEnable = NO; +#endif PRINTK("\n Module Used Total Enabled\n"); PRINTK("--------------------------------------------\n"); diff --git a/kernel/base/misc/task_shellcmd.c b/kernel/base/misc/task_shellcmd.c index 085788ad..854e2d6c 100644 --- a/kernel/base/misc/task_shellcmd.c +++ b/kernel/base/misc/task_shellcmd.c @@ -85,12 +85,18 @@ STATIC UINT32 *taskWaterLine = NULL; #define OS_TASK_ALL_INFO_LEN (g_taskMaxNum * (sizeof(LosTaskCB) + sizeof(UINT32))) #ifdef LOSCFG_FS_VFS +#if defined(LOSCFG_BLACKBOX) && defined(LOSCFG_SAVE_EXCINFO) +#define SaveExcInfo(arg, ...) WriteExcInfoToBuf(arg, ##__VA_ARGS__) +#else +#define SaveExcInfo(arg, ...) +#endif #define PROCESS_INFO_SHOW(seqBuf, arg...) do { \ if (seqBuf != NULL) { \ (void)LosBufPrintf((struct SeqBuf *)seqBuf, ##arg); \ } else { \ PRINTK(arg); \ } \ + SaveExcInfo(arg); \ } while (0) #else #define PROCESS_INFO_SHOW(seqBuf, arg...) PRINTK(arg) @@ -428,7 +434,7 @@ EXIT: STATIC VOID OsShellCmdTskInfoTitle(VOID *seqBuf, UINT16 flag) { PROCESS_INFO_SHOW(seqBuf, "\r\n TID PID "); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP PROCESS_INFO_SHOW(seqBuf, "Affi CPU "); #endif PROCESS_INFO_SHOW(seqBuf, " Status StackSize WaterLine "); @@ -456,7 +462,7 @@ STATIC INLINE VOID OsShellTskInfoData(const LosTaskCB *taskCB, VOID *seqBuf, UIN #endif PROCESS_INFO_SHOW(seqBuf, " %4u%5u", taskCB->taskID, taskCB->processID); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP PROCESS_INFO_SHOW(seqBuf, "%#5x%4d ", taskCB->cpuAffiMask, (INT16)(taskCB->currCpu)); #endif diff --git a/kernel/base/mp/los_lockdep.c b/kernel/base/mp/los_lockdep.c index 2f2ac0b8..2b850eb7 100644 --- a/kernel/base/mp/los_lockdep.c +++ b/kernel/base/mp/los_lockdep.c @@ -37,7 +37,7 @@ #include "los_exc.h" -#if (LOSCFG_KERNEL_SMP_LOCKDEP == YES) +#ifdef LOSCFG_KERNEL_SMP_LOCKDEP #define LOCKDEP_GET_NAME(lockDep, index) (((SPIN_LOCK_S *)((lockDep)->heldLocks[(index)].lockPtr))->name) #define LOCKDEP_GET_ADDR(lockDep, index) ((lockDep)->heldLocks[(index)].lockAddr) diff --git a/kernel/base/mp/los_mp.c b/kernel/base/mp/los_mp.c index c98cc01e..7bdce6ac 100644 --- a/kernel/base/mp/los_mp.c +++ b/kernel/base/mp/los_mp.c @@ -36,7 +36,7 @@ #include "los_swtmr.h" #include "los_task_pri.h" -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP VOID LOS_MpSchedule(UINT32 target) { diff --git a/kernel/base/mp/los_spinlock.c b/kernel/base/mp/los_spinlock.c index 385291ec..991af71d 100644 --- a/kernel/base/mp/los_spinlock.c +++ b/kernel/base/mp/los_spinlock.c @@ -30,7 +30,7 @@ */ #include "los_spinlock.h" -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #include "los_sched_pri.h" diff --git a/kernel/base/mp/los_stat.c b/kernel/base/mp/los_stat.c index 04e71f7d..a0d25ca0 100644 --- a/kernel/base/mp/los_stat.c +++ b/kernel/base/mp/los_stat.c @@ -32,7 +32,7 @@ #include "los_task_pri.h" -#if (LOSCFG_KERNEL_SCHED_STATISTICS == YES) +#ifdef LOSCFG_KERNEL_SCHED_STATISTICS #define HIGHTASKPRI 16 #define NS_PER_MS 1000000 #define DECIMAL_TO_PERCENTAGE 100 @@ -212,7 +212,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsShellMpStaticStart(VOID) for (loop = 0; loop < g_taskMaxNum; loop++) { taskCB = (((LosTaskCB *)g_taskCBArray) + loop); if (taskCB->taskStatus & OS_TASK_STATUS_RUNNING) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP cpuid = taskCB->currCpu; #endif if ((UINT32)(OS_TASK_INVALID_CPUID) == cpuid) { @@ -293,7 +293,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsShellMpStaticStop(VOID) for (loop = 0; loop < g_taskMaxNum; loop++) { taskCB = (((LosTaskCB *)g_taskCBArray) + loop); if (taskCB->taskStatus & OS_TASK_STATUS_RUNNING) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP cpuid = taskCB->currCpu; #endif if (cpuid == (UINT32)(OS_TASK_INVALID_CPUID)) { diff --git a/kernel/base/sched/sched_sq/los_sched.c b/kernel/base/sched/sched_sq/los_sched.c index 5ab81c4b..099d83be 100644 --- a/kernel/base/sched/sched_sq/los_sched.c +++ b/kernel/base/sched/sched_sq/los_sched.c @@ -39,7 +39,7 @@ #endif #include "los_hw_tick_pri.h" #include "los_tick_pri.h" -#if (LOSCFG_BASE_CORE_TSK_MONITOR == YES) +#ifdef LOSCFG_BASE_CORE_TSK_MONITOR #include "los_stackinfo_pri.h" #endif #include "los_mp.h" @@ -443,7 +443,7 @@ STATIC INLINE VOID OsSchedWakePendTimeTask(UINT64 currTime, LosTaskCB *taskCB, B if (tempStatus & (OS_TASK_STATUS_PENDING | OS_TASK_STATUS_DELAY)) { taskCB->taskStatus &= ~(OS_TASK_STATUS_PENDING | OS_TASK_STATUS_PEND_TIME | OS_TASK_STATUS_DELAY); if (tempStatus & OS_TASK_STATUS_PENDING) { -#if (LOSCFG_KERNEL_LITEIPC == YES) +#ifdef LOSCFG_KERNEL_LITEIPC taskCB->ipcStatus &= ~IPC_THREAD_STATUS_PEND; #endif taskCB->taskStatus |= OS_TASK_STATUS_TIMEOUT; @@ -819,7 +819,7 @@ STATIC LosTaskCB *OsGetTopTask(VOID) UINT32 bitmap; LosTaskCB *newTask = NULL; UINT32 processBitmap = g_sched->queueBitmap; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 cpuid = ArchCurrCpuid(); #endif @@ -830,11 +830,11 @@ STATIC LosTaskCB *OsGetTopTask(VOID) while (bitmap) { priority = CLZ(bitmap); LOS_DL_LIST_FOR_EACH_ENTRY(newTask, &queueList->priQueueList[priority], LosTaskCB, pendList) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP if (newTask->cpuAffiMask & (1U << cpuid)) { #endif goto FIND_TASK; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP } #endif } @@ -869,7 +869,7 @@ VOID OsSchedStart(VOID) OsSchedSetStartTime(HalClockGetCycles()); newTask->startTime = OsGerCurrSchedTimeCycle(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* * attention: current cpu needs to be set, in case first task deletion * may fail because this flag mismatch with the real current cpu. @@ -889,7 +889,7 @@ VOID OsSchedStart(VOID) OsTaskContextLoad(newTask); } -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP VOID OsSchedToUserReleaseLock(VOID) { /* The scheduling lock needs to be released before returning to user mode */ @@ -900,7 +900,7 @@ VOID OsSchedToUserReleaseLock(VOID) } #endif -#if (LOSCFG_BASE_CORE_TSK_MONITOR == YES) +#ifdef LOSCFG_BASE_CORE_TSK_MONITOR STATIC VOID OsTaskStackCheck(LosTaskCB *runTask, LosTaskCB *newTask) { if (!OS_STACK_MAGIC_CHECK(runTask->topOfStack)) { @@ -917,9 +917,9 @@ STATIC VOID OsTaskStackCheck(LosTaskCB *runTask, LosTaskCB *newTask) STATIC INLINE VOID OsSchedSwitchCheck(LosTaskCB *runTask, LosTaskCB *newTask) { -#if (LOSCFG_BASE_CORE_TSK_MONITOR == YES) +#ifdef LOSCFG_BASE_CORE_TSK_MONITOR OsTaskStackCheck(runTask, newTask); -#endif /* LOSCFG_BASE_CORE_TSK_MONITOR == YES */ +#endif /* LOSCFG_BASE_CORE_TSK_MONITOR */ OsTraceTaskSchedule(newTask, runTask); } @@ -955,7 +955,7 @@ STATIC VOID OsSchedTaskSwicth(LosTaskCB *runTask, LosTaskCB *newTask) runTask->taskStatus &= ~OS_TASK_STATUS_RUNNING; newTask->taskStatus |= OS_TASK_STATUS_RUNNING; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* mask new running task's owner processor */ runTask->currCpu = OS_TASK_INVALID_CPUID; newTask->currCpu = ArchCurrCpuid(); @@ -1043,7 +1043,7 @@ VOID OsSchedIrqEndCheckNeedSched(VOID) VOID OsSchedResched(VOID) { LOS_ASSERT(LOS_SpinHeld(&g_taskSpin)); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP LOS_ASSERT(OsPercpuGet()->taskLockCnt == 1); #else LOS_ASSERT(OsPercpuGet()->taskLockCnt == 0); diff --git a/kernel/base/vm/los_vm_filemap.c b/kernel/base/vm/los_vm_filemap.c index 9a6ec2ce..18ffe117 100644 --- a/kernel/base/vm/los_vm_filemap.c +++ b/kernel/base/vm/los_vm_filemap.c @@ -41,10 +41,12 @@ #include "los_vm_fault.h" #include "los_process_pri.h" #include "los_vm_lock.h" +#ifdef LOSCFG_FS_VFS #include "vnode.h" +#endif #ifndef UNUSED -#define UNUSED(x) (VOID)x +#define UNUSED(x) (VOID)(x) #endif #ifdef LOSCFG_DEBUG_VERSION diff --git a/kernel/base/vm/los_vm_iomap.c b/kernel/base/vm/los_vm_iomap.c index dde9e472..5acc88fd 100644 --- a/kernel/base/vm/los_vm_iomap.c +++ b/kernel/base/vm/los_vm_iomap.c @@ -34,7 +34,6 @@ #include "los_vm_zone.h" #include "los_vm_common.h" #include "los_vm_map.h" -#include "los_vm_lock.h" #include "los_memory.h" diff --git a/kernel/base/vm/oom.c b/kernel/base/vm/oom.c index f0c3c471..176429d5 100644 --- a/kernel/base/vm/oom.c +++ b/kernel/base/vm/oom.c @@ -37,7 +37,7 @@ #include "los_vm_phys.h" #include "los_vm_filemap.h" #include "los_process_pri.h" -#if (LOSCFG_BASE_CORE_SWTMR == YES) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE #include "los_swtmr_pri.h" #endif @@ -55,12 +55,12 @@ LITE_OS_SEC_TEXT_MINOR STATIC UINT32 OomScoreProcess(LosProcessCB *candidateProc { UINT32 actualPm; -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP (VOID)LOS_MuxAcquire(&candidateProcess->vmSpace->regionMux); #endif /* we only consider actual physical memory here. */ OsUProcessPmUsage(candidateProcess->vmSpace, NULL, &actualPm); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP (VOID)LOS_MuxRelease(&candidateProcess->vmSpace->regionMux); #endif return actualPm; diff --git a/kernel/base/vm/shm.c b/kernel/base/vm/shm.c index 577eb160..035a456f 100644 --- a/kernel/base/vm/shm.c +++ b/kernel/base/vm/shm.c @@ -742,6 +742,7 @@ INT32 ShmDt(const VOID *shmaddr) /* remove it from aspace */ LOS_RbDelNode(&space->regionRbTree, ®ion->rbNode); LOS_ArchMmuUnmap(&space->archMmu, region->range.base, region->range.size >> PAGE_SHIFT); + (VOID)LOS_MuxRelease(&space->regionMux); /* free it */ free(region); @@ -750,7 +751,7 @@ INT32 ShmDt(const VOID *shmaddr) if (seg == NULL) { ret = EINVAL; SYSV_SHM_UNLOCK(); - goto ERROR_WITH_LOCK; + goto ERROR; } ShmPagesRefDec(seg); @@ -763,7 +764,7 @@ INT32 ShmDt(const VOID *shmaddr) seg->ds.shm_lpid = LOS_GetCurrProcessID(); } SYSV_SHM_UNLOCK(); - (VOID)LOS_MuxRelease(&space->regionMux); + return 0; ERROR_WITH_LOCK: diff --git a/kernel/common/BUILD.gn b/kernel/common/BUILD.gn new file mode 100644 index 00000000..02da36bc --- /dev/null +++ b/kernel/common/BUILD.gn @@ -0,0 +1,48 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("common") { + deps = [ + "blackbox", + "hidumper", + "patchfs", + "rootfs", + ] +} + +config("public") { + configs = [ + "blackbox:public", + "hidumper:public", + "patchfs:public", + "rootfs:public", + ] +} diff --git a/kernel/common/blackbox/BUILD.gn b/kernel/common/blackbox/BUILD.gn new file mode 100644 index 00000000..b1327cf3 --- /dev/null +++ b/kernel/common/blackbox/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_BLACKBOX) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_blackbox_common.c", + "los_blackbox_core.c", + "los_blackbox_detector.c", + "los_blackbox_system_adapter.c", + ] + include_dirs = [ "$LITEOSTOPDIR/syscall" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/blackbox/Kconfig b/kernel/common/blackbox/Kconfig new file mode 100644 index 00000000..8298b923 --- /dev/null +++ b/kernel/common/blackbox/Kconfig @@ -0,0 +1,10 @@ +config BLACKBOX + bool "Enable BlackBox" + default n + help + Answer Y to enable LiteOS support blackbox + +config LOG_ROOT_PATH + string "unknown" + help + define the default log path of blackbox \ No newline at end of file diff --git a/kernel/common/blackbox/Makefile b/kernel/common/blackbox/Makefile new file mode 100644 index 00000000..3e611c90 --- /dev/null +++ b/kernel/common/blackbox/Makefile @@ -0,0 +1,14 @@ +include $(LITEOSTOPDIR)/config.mk + +MODULE_NAME := $(notdir $(shell pwd)) + +LOCAL_SRCS := $(wildcard *.c) + +LOCAL_INCLUDE := \ + -I $(LITEOSTOPDIR)/kernel/common \ + -I $(LITEOSTOPDIR)/kernel/common/blackbox \ + -I $(LITEOSTOPDIR)/syscall + +LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) + +include $(MODULE) diff --git a/kernel/common/blackbox/los_blackbox.h b/kernel/common/blackbox/los_blackbox.h new file mode 100644 index 00000000..36a69820 --- /dev/null +++ b/kernel/common/blackbox/los_blackbox.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#ifndef LOS_BLACKBOX_H +#define LOS_BLACKBOX_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#include "stdarg.h" +#include "los_typedef.h" + +#define PATH_MAX_LEN 256 +#define EVENT_MAX_LEN 32 +#define MODULE_MAX_LEN 32 +#define ERROR_DESC_MAX_LEN 512 +#ifndef LOSCFG_LOG_ROOT_PATH +#define LOSCFG_LOG_ROOT_PATH "/storage/data/log" +#endif +#define KERNEL_FAULT_LOG_PATH LOSCFG_LOG_ROOT_PATH "/kernel_fault.log" +#define USER_FAULT_LOG_PATH LOSCFG_LOG_ROOT_PATH "/user_fault.log" + +#define MODULE_SYSTEM "SYSTEM" +#define EVENT_SYSREBOOT "SYSREBOOT" +#define EVENT_LONGPRESS "LONGPRESS" +#define EVENT_COMBINATIONKEY "COMBINATIONKEY" +#define EVENT_SUBSYSREBOOT "SUBSYSREBOOT" +#define EVENT_POWEROFF "POWEROFF" +#define EVENT_PANIC "PANIC" +#define EVENT_SYS_WATCHDOG "SYSWATCHDOG" +#define EVENT_HUNGTASK "HUNGTASK" +#define EVENT_BOOTFAIL "BOOTFAIL" + +struct ErrorInfo { + char event[EVENT_MAX_LEN]; + char module[MODULE_MAX_LEN]; + char errorDesc[ERROR_DESC_MAX_LEN]; +}; + +struct ModuleOps { + char module[MODULE_MAX_LEN]; + void (*Dump)(const char *logDir, struct ErrorInfo *info); + void (*Reset)(struct ErrorInfo *info); + int (*GetLastLogInfo)(struct ErrorInfo *info); + int (*SaveLastLog)(const char *logDir, struct ErrorInfo *info); +}; + +int BBoxRegisterModuleOps(struct ModuleOps *ops); +int BBoxNotifyError(const char event[EVENT_MAX_LEN], + const char module[MODULE_MAX_LEN], + const char errorDesc[ERROR_DESC_MAX_LEN], + int needSysReset); +int OsBBoxDriverInit(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff --git a/kernel/common/blackbox/los_blackbox_common.c b/kernel/common/blackbox/los_blackbox_common.c new file mode 100644 index 00000000..813ab8d9 --- /dev/null +++ b/kernel/common/blackbox/los_blackbox_common.c @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +/* ------------ includes ------------ */ +#include "los_blackbox_common.h" +#ifdef LOSCFG_LIB_LIBC +#include "stdlib.h" +#include "unistd.h" +#endif +#ifdef LOSCFG_FS_VFS +#include "fs/fs.h" +#endif +#include "securec.h" +#include "los_memory.h" + +/* ------------ local macroes ------------ */ +/* ------------ local prototypes ------------ */ +/* ------------ local function declarations ------------ */ +/* ------------ global function declarations ------------ */ +/* ------------ local variables ------------ */ +/* ------------ function definitions ------------ */ +int FullWriteFile(const char *filePath, const char *buf, size_t bufSize, int isAppend) +{ +#ifdef LOSCFG_FS_VFS + int fd; + int totalToWrite = (int)bufSize; + int totalWrite = 0; + + if (filePath == NULL || buf == NULL || bufSize == 0) { + BBOX_PRINT_ERR("filePath: %p, buf: %p, bufSize: %lu!\n", filePath, buf, bufSize); + return -1; + } + + if (!IsLogPartReady()) { + BBOX_PRINT_ERR("log path [%s] isn't ready to be written!\n", LOSCFG_LOG_ROOT_PATH); + return -1; + } + fd = open(filePath, O_CREAT | O_RDWR | (isAppend ? O_APPEND : O_TRUNC), 0644); + if (fd < 0) { + BBOX_PRINT_ERR("Create file [%s] failed, fd: %d!\n", filePath, fd); + return -1; + } + while (totalToWrite > 0) { + int writeThisTime = write(fd, buf, totalToWrite); + if (writeThisTime < 0) { + BBOX_PRINT_ERR("Failed to write file [%s]!\n", filePath); + (void)close(fd); + return -1; + } + buf += writeThisTime; + totalToWrite -= writeThisTime; + totalWrite += writeThisTime; + } + (void)fsync(fd); + (void)close(fd); + + return (totalWrite == (int)bufSize) ? 0 : -1; +#else + (VOID)filePath; + (VOID)buf; + (VOID)bufSize; + (VOID)isAppend; + return -1; +#endif +} + +int SaveBasicErrorInfo(const char *filePath, struct ErrorInfo *info) +{ + char *buf = NULL; + + if (filePath == NULL || info == NULL) { + BBOX_PRINT_ERR("filePath: %p, event: %p!\n", filePath, info); + return -1; + } + + buf = LOS_MemAlloc(m_aucSysMem1, ERROR_INFO_MAX_LEN); + if (buf == NULL) { + BBOX_PRINT_ERR("LOS_MemAlloc failed!\n"); + return -1; + } + (void)memset_s(buf, ERROR_INFO_MAX_LEN, 0, ERROR_INFO_MAX_LEN); + (void)snprintf_s(buf, ERROR_INFO_MAX_LEN, ERROR_INFO_MAX_LEN - 1, + ERROR_INFO_HEADER_FORMAT, info->event, info->module, info->errorDesc); + *(buf + ERROR_INFO_MAX_LEN - 1) = '\0'; + (void)FullWriteFile(filePath, buf, strlen(buf), 0); + (void)LOS_MemFree(m_aucSysMem1, buf); + + return 0; +} + +#ifdef LOSCFG_FS_VFS +bool IsLogPartReady(void) +{ + return access(LOSCFG_LOG_ROOT_PATH, W_OK) == 0; +} +#else +bool IsLogPartReady(void) +{ + return TRUE; +} +#endif diff --git a/kernel/common/blackbox/los_blackbox_common.h b/kernel/common/blackbox/los_blackbox_common.h new file mode 100644 index 00000000..6d20a934 --- /dev/null +++ b/kernel/common/blackbox/los_blackbox_common.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#ifndef LOS_BLACKBOX_COMMON_H +#define LOS_BLACKBOX_COMMON_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#include "los_blackbox.h" +#include "los_printf.h" +#include "los_typedef.h" + +#define ERROR_INFO_HEADER_FORMAT "#### error info ####\nevent: %s\nmodule: %s\nerrorDesc: %s\n" +#define ERROR_INFO_MAX_LEN 768 +#define Min(a, b) (((a) > (b)) ? (b) : (a)) +#define BBOX_PRINT_ERR(format, ...) PRINTK("bbox: func: %s, line: %d, Err: " \ + format, __func__, __LINE__, ##__VA_ARGS__) +#define BBOX_PRINT_INFO(format, ...) PRINTK("bbox: Info: " format, ##__VA_ARGS__) + +int FullWriteFile(const char *filePath, const char *buf, size_t bufSize, int isAppend); +int SaveBasicErrorInfo(const char *filePath, struct ErrorInfo *info); +bool IsLogPartReady(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff --git a/kernel/common/blackbox/los_blackbox_core.c b/kernel/common/blackbox/los_blackbox_core.c new file mode 100644 index 00000000..1e283fea --- /dev/null +++ b/kernel/common/blackbox/los_blackbox_core.c @@ -0,0 +1,458 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +/* ------------ includes ------------ */ +#include "los_blackbox.h" +#include "los_blackbox_common.h" +#include "los_blackbox_detector.h" +#ifdef LOSCFG_LIB_LIBC +#include "stdlib.h" +#include "unistd.h" +#endif +#include "los_base.h" +#include "los_config.h" +#include "los_excinfo_pri.h" +#include "los_hw.h" +#include "los_init.h" +#include "los_memory.h" +#include "los_sem.h" +#include "los_syscall.h" +#include "los_task_pri.h" +#include "securec.h" +#include "sys/reboot.h" + +/* ------------ local macroes ------------ */ +#define LOG_WAIT_TIMES 10 +#define LOG_PART_WAIT_TIME 1000 + +/* ------------ local prototypes ------------ */ +typedef struct BBoxOps { + LOS_DL_LIST opsList; + struct ModuleOps ops; +} BBoxOps; + +/* ------------ local function declarations ------------ */ +/* ------------ global function declarations ------------ */ +/* ------------ local variables ------------ */ +static bool g_bboxInitSucc = FALSE; +static UINT32 g_opsListSem = 0; +static UINT32 g_tempErrInfoSem = 0; +static UINT32 g_tempErrLogSaveSem = 0; +static LOS_DL_LIST_HEAD(g_opsList); +struct ErrorInfo *g_tempErrInfo; + +/* ------------ function definitions ------------ */ +static void FormatErrorInfo(struct ErrorInfo *info, + const char event[EVENT_MAX_LEN], + const char module[MODULE_MAX_LEN], + const char errorDesc[ERROR_DESC_MAX_LEN]) +{ + if (info == NULL || event == NULL || module == NULL || errorDesc == NULL) { + BBOX_PRINT_ERR("info: %p, event: %p, module: %p, errorDesc: %p!\n", info, event, module, errorDesc); + return; + } + + (void)memset_s(info, sizeof(*info), 0, sizeof(*info)); + (void)strncpy_s(info->event, sizeof(info->event), event, Min(strlen(event), sizeof(info->event) - 1)); + (void)strncpy_s(info->module, sizeof(info->module), module, Min(strlen(module), sizeof(info->module) - 1)); + (void)strncpy_s(info->errorDesc, sizeof(info->errorDesc), errorDesc, + Min(strlen(errorDesc), sizeof(info->errorDesc) - 1)); +} + +#ifdef LOSCFG_FS_VFS +static void WaitForLogPart(void) +{ + BBOX_PRINT_INFO("wait for log part [%s] begin!\n", LOSCFG_LOG_ROOT_PATH); + while (!IsLogPartReady()) { + LOS_Msleep(LOG_PART_WAIT_TIME); + } + BBOX_PRINT_INFO("wait for log part [%s] end!\n", LOSCFG_LOG_ROOT_PATH); +} +#else +static void WaitForLogPart(void) +{ + int i = 0; + + BBOX_PRINT_INFO("wait for log part [%s] begin!\n", LOSCFG_LOG_ROOT_PATH); + while (i++ < LOG_WAIT_TIMES) { + LOS_Msleep(LOG_PART_WAIT_TIME); + } + BBOX_PRINT_INFO("wait for log part [%s] end!\n", LOSCFG_LOG_ROOT_PATH); +} +#endif + +static bool FindModuleOps(struct ErrorInfo *info, BBoxOps **ops) +{ + bool found = false; + + if (info == NULL || ops == NULL) { + BBOX_PRINT_ERR("info: %p, ops: %p!\n", info, ops); + return found; + } + + LOS_DL_LIST_FOR_EACH_ENTRY(*ops, &g_opsList, BBoxOps, opsList) { + if (*ops != NULL && strcmp((*ops)->ops.module, info->module) == 0) { + found = true; + break; + } + } + if (!found) { + BBOX_PRINT_ERR("[%s] hasn't been registered!\n", info->module); + } + + return found; +} + +static void InvokeModuleOps(struct ErrorInfo *info, BBoxOps *ops) +{ + if (info == NULL || ops == NULL) { + BBOX_PRINT_ERR("info: %p, ops: %p!\n", info, ops); + return; + } + + if (ops->ops.Dump != NULL) { + BBOX_PRINT_INFO("[%s] starts dumping log!\n", ops->ops.module); + ops->ops.Dump(LOSCFG_LOG_ROOT_PATH, info); + BBOX_PRINT_INFO("[%s] ends dumping log!\n", ops->ops.module); + } + if (ops->ops.Reset != NULL) { + BBOX_PRINT_INFO("[%s] starts resetting!\n", ops->ops.module); + ops->ops.Reset(info); + BBOX_PRINT_INFO("[%s] ends resetting!\n", ops->ops.module); + } +} + +static void SaveLastLog(const char *logDir) +{ + struct ErrorInfo *info = NULL; + BBoxOps *ops = NULL; + + info = LOS_MemAlloc(m_aucSysMem1, sizeof(*info)); + if (info == NULL) { + BBOX_PRINT_ERR("LOS_MemAlloc failed!\n"); + return; + } + + if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) { + BBOX_PRINT_ERR("Request g_opsListSem failed!\n"); + (void)LOS_MemFree(m_aucSysMem1, info); + return; + } + + LOS_DL_LIST_FOR_EACH_ENTRY(ops, &g_opsList, BBoxOps, opsList) { + if (ops == NULL) { + BBOX_PRINT_ERR("ops: NULL, please check it!\n"); + continue; + } + if (ops->ops.GetLastLogInfo != NULL && ops->ops.SaveLastLog != NULL) { + (void)memset_s(info, sizeof(*info), 0, sizeof(*info)); + if (ops->ops.GetLastLogInfo(info) != 0) { + BBOX_PRINT_ERR("[%s] failed to get log info!\n", ops->ops.module); + continue; + } + BBOX_PRINT_INFO("[%s] starts saving log!\n", ops->ops.module); + if (ops->ops.SaveLastLog(logDir, info) != 0) { + BBOX_PRINT_ERR("[%s] failed to save log!\n", ops->ops.module); + } else { + BBOX_PRINT_INFO("[%s] ends saving log!\n", ops->ops.module); + BBOX_PRINT_INFO("[%s] starts uploading event [%s]\n", info->module, info->event); +#ifdef LOSCFG_FS_VFS + (void)UploadEventByFile(KERNEL_FAULT_LOG_PATH); +#else + BBOX_PRINT_INFO("LOSCFG_FS_VFS isn't defined!\n"); +#endif + BBOX_PRINT_INFO("[%s] ends uploading event [%s]\n", info->module, info->event); + } + } else { + BBOX_PRINT_ERR("module [%s], GetLastLogInfo: %p, SaveLastLog: %p!\n", + ops->ops.module, ops->ops.GetLastLogInfo, ops->ops.SaveLastLog); + } + } + (void)LOS_SemPost(g_opsListSem); + (void)LOS_MemFree(m_aucSysMem1, info); +} + +static void SaveLogWithoutReset(struct ErrorInfo *info) +{ + BBoxOps *ops = NULL; + + if (info == NULL) { + BBOX_PRINT_ERR("info is NULL!\n"); + return; + } + + if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) { + BBOX_PRINT_ERR("Request g_opsListSem failed!\n"); + return; + } + if (!FindModuleOps(info, &ops)) { + (void)LOS_SemPost(g_opsListSem); + return; + } + if (ops->ops.Dump == NULL && ops->ops.Reset == NULL) { + (void)LOS_SemPost(g_opsListSem); + if (SaveBasicErrorInfo(USER_FAULT_LOG_PATH, info) == 0) { + BBOX_PRINT_INFO("[%s] starts uploading event [%s]\n", info->module, info->event); +#ifdef LOSCFG_FS_VFS + (void)UploadEventByFile(USER_FAULT_LOG_PATH); +#else + BBOX_PRINT_INFO("LOSCFG_FS_VFS isn't defined!\n"); +#endif + BBOX_PRINT_INFO("[%s] ends uploading event [%s]\n", info->module, info->event); + } + return; + } + InvokeModuleOps(info, ops); + (void)LOS_SemPost(g_opsListSem); +} + +static void SaveTempErrorLog(void) +{ + if (LOS_SemPend(g_tempErrInfoSem, LOS_WAIT_FOREVER) != LOS_OK) { + BBOX_PRINT_ERR("Request g_tempErrInfoSem failed!\n"); + return; + } + if (g_tempErrInfo == NULL) { + BBOX_PRINT_ERR("g_tempErrInfo is NULL!\n"); + (void)LOS_SemPost(g_tempErrInfoSem); + return; + } + if (strlen(g_tempErrInfo->event) != 0) { + SaveLogWithoutReset(g_tempErrInfo); + } + (void)LOS_SemPost(g_tempErrInfoSem); +} + +static void SaveLogWithReset(struct ErrorInfo *info) +{ + int ret; + BBoxOps *ops = NULL; + + if (info == NULL) { + BBOX_PRINT_ERR("info is NULL!\n"); + return; + } + + if (!FindModuleOps(info, &ops)) { + return; + } + InvokeModuleOps(info, ops); + ret = SysReboot(0, 0, RB_AUTOBOOT); + BBOX_PRINT_INFO("SysReboot, ret: %d\n", ret); +} + +static void SaveTempErrorInfo(const char event[EVENT_MAX_LEN], + const char module[MODULE_MAX_LEN], + const char errorDesc[ERROR_DESC_MAX_LEN]) +{ + if (event == NULL || module == NULL || errorDesc == NULL) { + BBOX_PRINT_ERR("event: %p, module: %p, errorDesc: %p!\n", event, module, errorDesc); + return; + } + if (LOS_SemPend(g_tempErrInfoSem, LOS_NO_WAIT) != LOS_OK) { + BBOX_PRINT_ERR("Request g_tempErrInfoSem failed!\n"); + return; + } + FormatErrorInfo(g_tempErrInfo, event, module, errorDesc); + (void)LOS_SemPost(g_tempErrInfoSem); +} + +static int SaveErrorLog(UINTPTR uwParam1, UINTPTR uwParam2, UINTPTR uwParam3, UINTPTR uwParam4) +{ + const char *logDir = (const char *)uwParam1; + (void)uwParam2; + (void)uwParam3; + (void)uwParam4; + +#ifdef LOSCFG_FS_VFS + WaitForLogPart(); +#endif + SaveLastLog(logDir); + while (1) { + if (LOS_SemPend(g_tempErrLogSaveSem, LOS_WAIT_FOREVER) != LOS_OK) { + BBOX_PRINT_ERR("Request g_tempErrLogSaveSem failed!\n"); + continue; + } + SaveTempErrorLog(); + } + return 0; +} + +#ifdef LOSCFG_BLACKBOX_DEBUG +static void PrintModuleOps(void) +{ + struct BBoxOps *ops = NULL; + + BBOX_PRINT_INFO("The following modules have been registered!\n"); + LOS_DL_LIST_FOR_EACH_ENTRY(ops, &g_opsList, BBoxOps, opsList) { + if (ops == NULL) { + continue; + } + BBOX_PRINT_INFO("module: %s, Dump: %p, Reset: %p, GetLastLogInfo: %p, SaveLastLog: %p\n", + ops->ops.module, ops->ops.Dump, ops->ops.Reset, ops->ops.GetLastLogInfo, ops->ops.SaveLastLog); + } +} +#endif + +int BBoxRegisterModuleOps(struct ModuleOps *ops) +{ + BBoxOps *newOps = NULL; + BBoxOps *temp = NULL; + + if (!g_bboxInitSucc) { + BBOX_PRINT_ERR("BlackBox isn't initialized successfully!\n"); + return -1; + } + if (ops == NULL) { + BBOX_PRINT_ERR("ops is NULL!\n"); + return -1; + } + + newOps = LOS_MemAlloc(m_aucSysMem1, sizeof(*newOps)); + if (newOps == NULL) { + BBOX_PRINT_ERR("LOS_MemAlloc failed!\n"); + return -1; + } + (void)memset_s(newOps, sizeof(*newOps), 0, sizeof(*newOps)); + (void)memcpy_s(&newOps->ops, sizeof(newOps->ops), ops, sizeof(*ops)); + if (LOS_SemPend(g_opsListSem, LOS_WAIT_FOREVER) != LOS_OK) { + BBOX_PRINT_ERR("Request g_opsListSem failed!\n"); + (void)LOS_MemFree(m_aucSysMem1, newOps); + return -1; + } + if (LOS_ListEmpty(&g_opsList)) { + goto __out; + } + + LOS_DL_LIST_FOR_EACH_ENTRY(temp, &g_opsList, BBoxOps, opsList) { + if (temp == NULL) { + continue; + } + if (strcmp(temp->ops.module, ops->module) == 0) { + BBOX_PRINT_ERR("module [%s] has been registered!\n", ops->module); + (void)LOS_SemPost(g_opsListSem); + (void)LOS_MemFree(m_aucSysMem1, newOps); + return -1; + } + } + +__out: + LOS_ListTailInsert(&g_opsList, &newOps->opsList); + (void)LOS_SemPost(g_opsListSem); + BBOX_PRINT_INFO("module [%s] is registered successfully!\n", ops->module); +#ifdef LOSCFG_BLACKBOX_DEBUG + PrintModuleOps(); +#endif + + return 0; +} + +int BBoxNotifyError(const char event[EVENT_MAX_LEN], + const char module[MODULE_MAX_LEN], + const char errorDesc[ERROR_DESC_MAX_LEN], + int needSysReset) +{ + if (event == NULL || module == NULL || errorDesc == NULL) { + BBOX_PRINT_ERR("event: %p, module: %p, errorDesc: %p!\n", event, module, errorDesc); + return -1; + } + if (!g_bboxInitSucc) { + BBOX_PRINT_ERR("BlackBox isn't initialized successfully!\n"); + return -1; + } + + if (needSysReset == 0) { + SaveTempErrorInfo(event, module, errorDesc); + (void)LOS_SemPost(g_tempErrLogSaveSem); + } else { + struct ErrorInfo *info = LOS_MemAlloc(m_aucSysMem1, sizeof(struct ErrorInfo)); + if (info == NULL) { + BBOX_PRINT_ERR("LOS_MemAlloc failed!\n"); + return -1; + } + FormatErrorInfo(info, event, module, errorDesc); + SaveLogWithReset(info); + (void)LOS_MemFree(m_aucSysMem1, info); + } + + return 0; +} + +int OsBBoxDriverInit(void) +{ + UINT32 taskID; + TSK_INIT_PARAM_S taskParam; + + if (LOS_BinarySemCreate(1, &g_opsListSem) != LOS_OK) { + BBOX_PRINT_ERR("Create g_opsListSem failed!\n"); + return LOS_NOK; + } + if (LOS_BinarySemCreate(1, &g_tempErrInfoSem) != LOS_OK) { + BBOX_PRINT_ERR("Create g_tempErrInfoSem failed!\n"); + goto __err; + } + if (LOS_BinarySemCreate(0, &g_tempErrLogSaveSem) != LOS_OK) { + BBOX_PRINT_ERR("Create g_tempErrLogSaveSem failed!\n"); + goto __err; + } + LOS_ListInit(&g_opsList); + g_tempErrInfo = LOS_MemAlloc(m_aucSysMem1, sizeof(*g_tempErrInfo)); + if (g_tempErrInfo == NULL) { + BBOX_PRINT_ERR("LOS_MemAlloc failed!\n"); + goto __err; + } + (void)memset_s(g_tempErrInfo, sizeof(*g_tempErrInfo), 0, sizeof(*g_tempErrInfo)); + (void)memset_s(&taskParam, sizeof(taskParam), 0, sizeof(taskParam)); + taskParam.auwArgs[0] = (UINTPTR)LOSCFG_LOG_ROOT_PATH; + taskParam.pfnTaskEntry = (TSK_ENTRY_FUNC)SaveErrorLog; + taskParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; + taskParam.pcName = "SaveErrorLog"; + taskParam.usTaskPrio = LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO; + taskParam.uwResved = LOS_TASK_STATUS_DETACHED; +#ifdef LOSCFG_KERNEL_SMP + taskParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); +#endif + (void)LOS_TaskCreate(&taskID, &taskParam); + g_bboxInitSucc = TRUE; + return LOS_OK; + +__err: + if (g_opsListSem != 0) { + (void)LOS_SemDelete(g_opsListSem); + } + if (g_tempErrInfoSem != 0) { + (void)LOS_SemDelete(g_tempErrInfoSem); + } + if (g_tempErrLogSaveSem != 0) { + (void)LOS_SemDelete(g_tempErrLogSaveSem); + } + return LOS_NOK; +} +LOS_MODULE_INIT(OsBBoxDriverInit, LOS_INIT_LEVEL_ARCH); \ No newline at end of file diff --git a/kernel/common/blackbox/los_blackbox_detector.c b/kernel/common/blackbox/los_blackbox_detector.c new file mode 100644 index 00000000..ea14c9ea --- /dev/null +++ b/kernel/common/blackbox/los_blackbox_detector.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +/* ------------ includes ------------ */ +#include "los_blackbox_detector.h" +#include "los_blackbox_common.h" +#ifdef LOSCFG_LIB_LIBC +#include "stdlib.h" +#include "unistd.h" +#endif + +/* ------------ local macroes ------------ */ +/* ------------ local prototypes ------------ */ +/* ------------ local function declarations ------------ */ +/* ------------ global function declarations ------------ */ +/* ------------ local variables ------------ */ +/* ------------ function definitions ------------ */ +int UploadEventByFile(const char *filePath) +{ + if (filePath == NULL) { + BBOX_PRINT_ERR("filePath is NULL\n"); + return -1; + } + + return 0; +} + +int UploadEventByStream(const char *buf, size_t bufSize) +{ + if (buf == NULL || bufSize == 0) { + BBOX_PRINT_ERR("buf: %p, bufSize: %u\n", buf, (UINT32)bufSize); + return -1; + } + + return 0; +} \ No newline at end of file diff --git a/kernel/common/blackbox/los_blackbox_detector.h b/kernel/common/blackbox/los_blackbox_detector.h new file mode 100644 index 00000000..f6714aad --- /dev/null +++ b/kernel/common/blackbox/los_blackbox_detector.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#ifndef LOS_BLACKBOX_DETECTOR_H +#define LOS_BLACKBOX_DETECTOR_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#include "los_typedef.h" + +int UploadEventByFile(const char *filePath); +int UploadEventByStream(const char *buf, size_t bufSize); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff --git a/kernel/common/blackbox/los_blackbox_system_adapter.c b/kernel/common/blackbox/los_blackbox_system_adapter.c new file mode 100644 index 00000000..6e5b87d6 --- /dev/null +++ b/kernel/common/blackbox/los_blackbox_system_adapter.c @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +/* ------------ includes ------------ */ +#include "los_blackbox_system_adapter.h" +#include "los_blackbox_common.h" +#include "los_blackbox_detector.h" +#ifdef LOSCFG_LIB_LIBC +#include "stdlib.h" +#include "unistd.h" +#endif +#include "los_base.h" +#include "los_config.h" +#ifdef LOSCFG_SAVE_EXCINFO +#include "los_excinfo_pri.h" +#endif +#include "los_hw.h" +#include "los_init.h" +#include "los_memory.h" +#include "los_vm_phys.h" +#include "los_vm_common.h" +#include "securec.h" + +/* ------------ local macroes ------------ */ +#define MEM_OVERLAP_COUNT 50 +#define LOG_FLAG "GOODLOG" +#define FAULT_LOG_SIZE 0x4000 /* 16KB */ + +/* ------------ local prototypes ------------ */ +struct FaultLogInfo { + char flag[8]; /* 8 is the length of the flag */ + int len; /* length of the fault log saved by the module excinfo */ + struct ErrorInfo info; +}; + +/* ------------ local function declarations ------------ */ +/* ------------ global function declarations ------------ */ +/* ------------ local variables ------------ */ +static char *g_logBuffer = NULL; + +/* ------------ function definitions ------------ */ +static void SaveFaultLog(const char *filePath, const char *dataBuf, size_t bufSize, struct ErrorInfo *info) +{ + (void)SaveBasicErrorInfo(filePath, info); + (void)FullWriteFile(filePath, dataBuf, bufSize, 1); +} + +#ifdef LOSCFG_SAVE_EXCINFO +static void WriteExcFile(UINT32 startAddr, UINT32 space, UINT32 rwFlag, char *buf) +{ + (void)startAddr; + (void)space; + (void)rwFlag; + (void)buf; +} +#endif + +static void RegisterExcInfoHook(void) +{ + if (g_logBuffer != NULL) { +#ifdef LOSCFG_SAVE_EXCINFO + LOS_ExcInfoRegHook(0, FAULT_LOG_SIZE - sizeof(struct FaultLogInfo), + g_logBuffer + sizeof(struct FaultLogInfo), WriteExcFile); +#endif + } else { + BBOX_PRINT_ERR("Alloc mem failed!\n"); + } +} + +static int AllocLogBuffer(void) +{ + int i = 0; + size_t nPages = ROUNDUP(FAULT_LOG_SIZE, PAGE_SIZE) >> PAGE_SHIFT; + void *tempBuffer[MEM_OVERLAP_COUNT] = { NULL }; + + for (i = 0; i < MEM_OVERLAP_COUNT; i++) { + tempBuffer[i] = LOS_PhysPagesAllocContiguous(nPages); + } + for (i = 0; i < (MEM_OVERLAP_COUNT - 1); i++) { + LOS_PhysPagesFreeContiguous(tempBuffer[i], nPages); + } + g_logBuffer = tempBuffer[i]; + BBOX_PRINT_INFO("g_logBuffer: %p for blackbox!\n", g_logBuffer); + + return (g_logBuffer != NULL) ? 0 : -1; +} + +static void Dump(const char *logDir, struct ErrorInfo *info) +{ + struct FaultLogInfo *pLogInfo = NULL; + + if (logDir == NULL || info == NULL) { + BBOX_PRINT_ERR("logDir: %p, info: %p!\n", logDir, info); + return; + } + if (g_logBuffer == NULL) { + BBOX_PRINT_ERR("g_logBuffer is NULL, alloc physical pages failed!\n"); + return; + } + + if (strcmp(info->event, EVENT_PANIC) == 0) { + pLogInfo = (struct FaultLogInfo *)g_logBuffer; + (void)memset_s(pLogInfo, sizeof(*pLogInfo), 0, sizeof(*pLogInfo)); +#ifdef LOSCFG_SAVE_EXCINFO + pLogInfo->len = GetExcInfoIndex(); +#else + pLogInfo->len = 0; +#endif + (void)memcpy_s(&pLogInfo->flag, sizeof(pLogInfo->flag), LOG_FLAG, strlen(LOG_FLAG)); + (void)memcpy_s(&pLogInfo->info, sizeof(pLogInfo->info), info, sizeof(*info)); + DCacheFlushRange((UINTPTR)g_logBuffer, (UINTPTR)(g_logBuffer + FAULT_LOG_SIZE)); + } else { +#ifdef LOSCFG_SAVE_EXCINFO + SaveFaultLog(USER_FAULT_LOG_PATH, g_logBuffer + sizeof(struct FaultLogInfo), + Min(FAULT_LOG_SIZE - sizeof(struct FaultLogInfo), GetExcInfoIndex()), info); +#else + SaveFaultLog(USER_FAULT_LOG_PATH, g_logBuffer + sizeof(struct FaultLogInfo), 0, info); +#endif + } +} + +static void Reset(struct ErrorInfo *info) +{ + if (info == NULL) { + BBOX_PRINT_ERR("info is NULL!\n"); + return; + } + + if (strcmp(info->event, EVENT_PANIC) != 0) { + BBOX_PRINT_INFO("[%s] starts uploading event [%s]\n", info->module, info->event); + (void)UploadEventByFile(USER_FAULT_LOG_PATH); + BBOX_PRINT_INFO("[%s] ends uploading event [%s]\n", info->module, info->event); + } +} + +static int GetLastLogInfo(struct ErrorInfo *info) +{ + struct FaultLogInfo *pLogInfo = NULL; + + if (info == NULL) { + BBOX_PRINT_ERR("info is NULL!\n"); + return -1; + } + if (g_logBuffer == NULL) { + BBOX_PRINT_ERR("g_logBuffer is NULL, alloc physical pages failed!\n"); + return -1; + } + + pLogInfo = (struct FaultLogInfo *)g_logBuffer; + if (memcmp(pLogInfo->flag, LOG_FLAG, strlen(LOG_FLAG)) == 0) { + (void)memcpy_s(info, sizeof(*info), &pLogInfo->info, sizeof(pLogInfo->info)); + return 0; + } + + return -1; +} + +static int SaveLastLog(const char *logDir, struct ErrorInfo *info) +{ +#ifdef LOSCFG_FS_VFS + struct FaultLogInfo *pLogInfo = NULL; + + if (logDir == NULL || info == NULL) { + BBOX_PRINT_ERR("logDir: %p, info: %p!\n", logDir, info); + return -1; + } + if (g_logBuffer == NULL) { + BBOX_PRINT_ERR("g_logBuffer is NULL, alloc physical pages failed!\n"); + return -1; + } + + pLogInfo = (struct FaultLogInfo *)g_logBuffer; + if (memcmp(pLogInfo->flag, LOG_FLAG, strlen(LOG_FLAG)) == 0) { + SaveFaultLog(KERNEL_FAULT_LOG_PATH, g_logBuffer + sizeof(*pLogInfo), + Min(FAULT_LOG_SIZE - sizeof(*pLogInfo), pLogInfo->len), info); + } + (void)memset_s(g_logBuffer, FAULT_LOG_SIZE, 0, FAULT_LOG_SIZE); + BBOX_PRINT_INFO("[%s] starts uploading event [%s]\n", info->module, info->event); + (void)UploadEventByFile(KERNEL_FAULT_LOG_PATH); + BBOX_PRINT_INFO("[%s] ends uploading event [%s]\n", info->module, info->event); + return 0; +#else + (VOID)logDir; + (VOID)info; + BBOX_PRINT_ERR("LOSCFG_FS_VFS isn't defined!\n"); + return -1; +#endif +} + +#ifdef LOSCFG_BLACKBOX_TEST +static void BBoxTest(void) +{ + struct ModuleOps ops = { + .module = "MODULE_TEST", + .Dump = NULL, + .Reset = NULL, + .GetLastLogInfo = NULL, + .SaveLastLog = NULL, + }; + + if (BBoxRegisterModuleOps(&ops) != 0) { + BBOX_PRINT_ERR("BBoxRegisterModuleOps failed!\n"); + return; + } + BBoxNotifyError("EVENT_TEST1", "MODULE_TEST", "Test BBoxNotifyError111", 0); +} +#endif + +int OsBBoxSystemAdapterInit(void) +{ + struct ModuleOps ops = { + .module = MODULE_SYSTEM, + .Dump = Dump, + .Reset = Reset, + .GetLastLogInfo = GetLastLogInfo, + .SaveLastLog = SaveLastLog, + }; + + /* allocate buffer for kmsg */ + if (AllocLogBuffer() == 0) { + RegisterExcInfoHook(); + if (BBoxRegisterModuleOps(&ops) != 0) { + BBOX_PRINT_ERR("BBoxRegisterModuleOps failed!\n"); + LOS_PhysPagesFreeContiguous(g_logBuffer, ROUNDUP(FAULT_LOG_SIZE, PAGE_SIZE) >> PAGE_SHIFT); + g_logBuffer = NULL; + return LOS_NOK; + } + } else { + BBOX_PRINT_ERR("AllocLogBuffer failed!\n"); + } + +#ifdef LOSCFG_BLACKBOX_TEST + BBoxTest(); +#endif + + return LOS_OK; +} +LOS_MODULE_INIT(OsBBoxSystemAdapterInit, LOS_INIT_LEVEL_PLATFORM); \ No newline at end of file diff --git a/kernel/common/blackbox/los_blackbox_system_adapter.h b/kernel/common/blackbox/los_blackbox_system_adapter.h new file mode 100644 index 00000000..eb61bf83 --- /dev/null +++ b/kernel/common/blackbox/los_blackbox_system_adapter.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#ifndef LOS_BLACKBOX_SYSTEM_ADAPTER_H +#define LOS_BLACKBOX_SYSTEM_ADAPTER_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#include "los_blackbox.h" +#include "los_blackbox_common.h" + +int OsBBoxSystemAdapterInit(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff --git a/kernel/common/hidumper/BUILD.gn b/kernel/common/hidumper/BUILD.gn new file mode 100644 index 00000000..93f74119 --- /dev/null +++ b/kernel/common/hidumper/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_HIDUMPER) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "los_hidumper.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/hidumper/Kconfig b/kernel/common/hidumper/Kconfig new file mode 100644 index 00000000..b15d50a8 --- /dev/null +++ b/kernel/common/hidumper/Kconfig @@ -0,0 +1,5 @@ +config HIDUMPER + bool "Enable hidumper" + default n + help + Answer Y to enable LiteOS support hidumper diff --git a/kernel/common/hidumper/Makefile b/kernel/common/hidumper/Makefile new file mode 100644 index 00000000..230c1d8a --- /dev/null +++ b/kernel/common/hidumper/Makefile @@ -0,0 +1,13 @@ +include $(LITEOSTOPDIR)/config.mk + +MODULE_NAME := $(notdir $(shell pwd)) + +LOCAL_SRCS := $(wildcard *.c) + +LOCAL_INCLUDE := \ + -I $(LITEOSTOPDIR)/kernel/common \ + -I $(LITEOSTOPDIR)/kernel/common/hidumper \ + +LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) + +include $(MODULE) diff --git a/kernel/common/hidumper/los_hidumper.c b/kernel/common/hidumper/los_hidumper.c new file mode 100644 index 00000000..d04647db --- /dev/null +++ b/kernel/common/hidumper/los_hidumper.c @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +/* ------------ includes ------------ */ +#include "los_hidumper.h" +#ifdef LOSCFG_BLACKBOX +#include "los_blackbox.h" +#endif +#ifdef LOSCFG_CPUP_INCLUDE_IRQ +#include "los_cpup_pri.h" +#endif +#include "los_hwi_pri.h" +#include "los_init.h" +#include "los_mp.h" +#include "los_mux.h" +#include "los_printf.h" +#include "los_process_pri.h" +#include "los_task_pri.h" +#include "los_vm_dump.h" +#include "los_vm_lock.h" +#include "los_vm_map.h" +#ifdef LOSCFG_FS_VFS +#include "fs/file.h" +#endif +#include "fs/driver.h" +#include "securec.h" +#ifdef LOSCFG_LIB_LIBC +#include "unistd.h" +#endif +#include "user_copy.h" + +/* ------------ local macroes ------------ */ +#define CPUP_TYPE_COUNT 3 +#define HIDUMPER_DEVICE "/dev/hidumper" +#define HIDUMPER_DEVICE_MODE 0666 +#define KERNEL_FAULT_ADDR 0x1 +#define KERNEL_FAULT_VALUE 0x2 +#define READ_BUF_SIZE 128 +#define SYS_INFO_HEADER "************ sys info ***********" +#define CPU_USAGE_HEADER "************ cpu usage ***********" +#define MEM_USAGE_HEADER "************ mem usage ***********" +#define PAGE_USAGE_HEADER "************ physical page usage ***********" +#define TASK_INFO_HEADER "************ task info ***********" +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) +#endif +#define REPLACE_INTERFACE(dst, src, type, func) {\ + if (((type *)src)->func != NULL) {\ + ((type *)dst)->func = ((type *)src)->func;\ + } else {\ + PRINT_ERR("%s->%s is NULL!\n", #src, #func);\ + }\ +} +#define INVOKE_INTERFACE(adapter, type, func) {\ + if (((type *)adapter)->func != NULL) {\ + ((type *)adapter)->func();\ + } else {\ + PRINT_ERR("%s->%s is NULL!\n", #adapter, #func);\ + }\ +} + +/* ------------ local prototypes ------------ */ +/* ------------ local function declarations ------------ */ +STATIC INT32 HiDumperOpen(struct file *filep); +STATIC INT32 HiDumperClose(struct file *filep); +STATIC INT32 HiDumperIoctl(struct file *filep, INT32 cmd, unsigned long arg); + +/* ------------ global function declarations ------------ */ +#ifdef LOSCFG_SHELL +extern VOID OsShellCmdSystemInfoGet(VOID); +extern UINT32 OsShellCmdFree(INT32 argc, const CHAR *argv[]); +extern UINT32 OsShellCmdUname(INT32 argc, const CHAR *argv[]); +extern UINT32 OsShellCmdDumpPmm(VOID); +#endif + +/* ------------ local variables ------------ */ +static struct HiDumperAdapter g_adapter; +STATIC struct file_operations_vfs g_hidumperDevOps = { + HiDumperOpen, /* open */ + HiDumperClose, /* close */ + NULL, /* read */ + NULL, /* write */ + NULL, /* seek */ + HiDumperIoctl, /* ioctl */ + NULL, /* mmap */ +#ifndef CONFIG_DISABLE_POLL + NULL, /* poll */ +#endif + NULL, /* unlink */ +}; + +/* ------------ function definitions ------------ */ +STATIC INT32 HiDumperOpen(struct file *filep) +{ + (VOID)filep; + return 0; +} + +STATIC INT32 HiDumperClose(struct file *filep) +{ + (VOID)filep; + return 0; +} + +static void DumpSysInfo(void) +{ + PRINTK("\n%s\n", SYS_INFO_HEADER); +#ifdef LOSCFG_SHELL + const char *argv[1] = {"-a"}; + (VOID)OsShellCmdUname(ARRAY_SIZE(argv), &argv[0]); + (VOID)OsShellCmdSystemInfoGet(); +#else + PRINTK("\nUnsupported!\n"); +#endif +} + +#ifdef LOSCFG_KERNEL_CPUP +static void DoDumpCpuUsageUnsafe(CPUP_INFO_S *processCpupAll, + CPUP_INFO_S *processCpup10s, + CPUP_INFO_S *processCpup1s) +{ + UINT32 pid; + + PRINTK("%-32s PID CPUUSE CPUUSE10S CPUUSE1S\n", "PName"); + for (pid = 0; pid < g_processMaxNum; pid++) { + LosProcessCB *processCB = g_processCBArray + pid; + if (OsProcessIsUnused(processCB)) { + continue; + } + PRINTK("%-32s %u %5u.%1u%8u.%1u%7u.%-1u\n", + processCB->processName, processCB->processID, + processCpupAll[pid].usage / LOS_CPUP_PRECISION_MULT, + processCpupAll[pid].usage % LOS_CPUP_PRECISION_MULT, + processCpup10s[pid].usage / LOS_CPUP_PRECISION_MULT, + processCpup10s[pid].usage % LOS_CPUP_PRECISION_MULT, + processCpup1s[pid].usage / LOS_CPUP_PRECISION_MULT, + processCpup1s[pid].usage % LOS_CPUP_PRECISION_MULT); + } +} +#endif + +static void DumpCpuUsageUnsafe(void) +{ + PRINTK("\n%s\n", CPU_USAGE_HEADER); +#ifdef LOSCFG_KERNEL_CPUP + UINT32 size; + CPUP_INFO_S *processCpup = NULL; + CPUP_INFO_S *processCpupAll = NULL; + CPUP_INFO_S *processCpup10s = NULL; + CPUP_INFO_S *processCpup1s = NULL; + + size = sizeof(*processCpup) * g_processMaxNum * CPUP_TYPE_COUNT; + processCpup = LOS_MemAlloc(m_aucSysMem1, size); + if (processCpup == NULL) { + PRINT_ERR("func: %s, LOS_MemAlloc failed, Line: %d\n", __func__, __LINE__); + return; + } + processCpupAll = processCpup; + processCpup10s = processCpupAll + g_processMaxNum; + processCpup1s = processCpup10s + g_processMaxNum; + (VOID)memset_s(processCpup, size, 0, size); + LOS_GetAllProcessCpuUsage(CPUP_ALL_TIME, processCpupAll, g_processMaxNum * sizeof(CPUP_INFO_S)); + LOS_GetAllProcessCpuUsage(CPUP_LAST_TEN_SECONDS, processCpup10s, g_processMaxNum * sizeof(CPUP_INFO_S)); + LOS_GetAllProcessCpuUsage(CPUP_LAST_ONE_SECONDS, processCpup1s, g_processMaxNum * sizeof(CPUP_INFO_S)); + DoDumpCpuUsageUnsafe(processCpupAll, processCpup10s, processCpup1s); + (VOID)LOS_MemFree(m_aucSysMem1, processCpup); +#else + PRINTK("\nUnsupported!\n"); +#endif +} + +static void DumpMemUsage(void) +{ + PRINTK("\n%s\n", MEM_USAGE_HEADER); +#ifdef LOSCFG_SHELL + PRINTK("Unit: KB\n"); + const char *argv[1] = {"-k"}; + (VOID)OsShellCmdFree(ARRAY_SIZE(argv), &argv[0]); + PRINTK("%s\n", PAGE_USAGE_HEADER); + (VOID)OsShellCmdDumpPmm(); +#else + PRINTK("\nUnsupported!\n"); +#endif +} + +static void DumpTaskInfo(void) +{ + PRINTK("\n%s\n", TASK_INFO_HEADER); +#ifdef LOSCFG_SHELL + (VOID)OsShellCmdTskInfoGet(OS_ALL_TASK_MASK, NULL, OS_PROCESS_INFO_ALL); +#else + PRINTK("\nUnsupported!\n"); +#endif +} + +#ifdef LOSCFG_BLACKBOX +static void PrintFileData(INT32 fd) +{ +#ifdef LOSCFG_FS_VFS + CHAR buf[READ_BUF_SIZE]; + + if (fd < 0) { + PRINT_ERR("fd: %d!\n", fd); + return; + } + + (void)memset_s(buf, sizeof(buf), 0, sizeof(buf)); + while (read(fd, buf, sizeof(buf) - 1) > 0) { + PRINTK("%s", buf); + (void)memset_s(buf, sizeof(buf), 0, sizeof(buf)); + } +#else + (VOID)fd; + PRINT_ERR("LOSCFG_FS_VFS isn't defined!\n"); +#endif +} + +static void PrintFile(const char *filePath, const char *pHeader) +{ +#ifdef LOSCFG_FS_VFS + int fd; + + if (filePath == NULL || pHeader == NULL) { + PRINT_ERR("filePath: %p, pHeader: %p\n", filePath, pHeader); + return; + } + + fd = open(filePath, O_RDONLY); + if (fd >= 0) { + PRINTK("\n%s\n", pHeader); + PrintFileData(fd); + (void)close(fd); + } else { + PRINT_ERR("Open [%s] failed or there's no fault log!\n", filePath); + } +#else + (VOID)filePath; + (VOID)pHeader; + PRINT_ERR("LOSCFG_FS_VFS isn't defined!\n"); +#endif +} +#endif + +static void DumpFaultLog(void) +{ +#ifdef LOSCFG_BLACKBOX + PrintFile(KERNEL_FAULT_LOG_PATH, "************kernel fault info************"); + PrintFile(USER_FAULT_LOG_PATH, "************user fault info************"); +#endif +} + +static void DumpMemData(struct MemDumpParam *param) +{ + PRINTK("\nDumpType: %d\n", param->type); + PRINTK("Unsupported now!\n"); +} + +static void InjectKernelCrash(void) +{ +#ifdef LOSCFG_DEBUG_VERSION + *((INT32 *)KERNEL_FAULT_ADDR) = KERNEL_FAULT_VALUE; +#else + PRINTK("\nUnsupported!\n"); +#endif +} + +static INT32 HiDumperIoctl(struct file *filep, INT32 cmd, unsigned long arg) +{ + INT32 ret = 0; + + switch (cmd) { + case HIDUMPER_DUMP_ALL: + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpSysInfo); + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpCpuUsage); + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpMemUsage); + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpTaskInfo); + break; + case HIDUMPER_CPU_USAGE: + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpCpuUsage); + break; + case HIDUMPER_MEM_USAGE: + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpMemUsage); + break; + case HIDUMPER_TASK_INFO: + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpTaskInfo); + break; + case HIDUMPER_INJECT_KERNEL_CRASH: + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, InjectKernelCrash); + break; + case HIDUMPER_DUMP_FAULT_LOG: + INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpFaultLog); + break; + case HIDUMPER_MEM_DATA: + if (g_adapter.DumpMemData != NULL) { + g_adapter.DumpMemData((struct MemDumpParam *)arg); + } + break; + default: + ret = EPERM; + PRINTK("Invalid CMD: 0x%x\n", (UINT32)cmd); + break; + } + + return ret; +} + +static void RegisterCommonAdapter(void) +{ + struct HiDumperAdapter adapter; + + adapter.DumpSysInfo = DumpSysInfo; + adapter.DumpCpuUsage = DumpCpuUsageUnsafe; + adapter.DumpMemUsage = DumpMemUsage; + adapter.DumpTaskInfo = DumpTaskInfo; + adapter.DumpFaultLog = DumpFaultLog; + adapter.DumpMemData = DumpMemData; + adapter.InjectKernelCrash = InjectKernelCrash; + HiDumperRegisterAdapter(&adapter); +} + +int HiDumperRegisterAdapter(struct HiDumperAdapter *pAdapter) +{ + if (pAdapter == NULL) { + PRINT_ERR("pAdapter: %p\n", pAdapter); + return -1; + } + + REPLACE_INTERFACE(&g_adapter, pAdapter, struct HiDumperAdapter, DumpSysInfo); + REPLACE_INTERFACE(&g_adapter, pAdapter, struct HiDumperAdapter, DumpCpuUsage); + REPLACE_INTERFACE(&g_adapter, pAdapter, struct HiDumperAdapter, DumpMemUsage); + REPLACE_INTERFACE(&g_adapter, pAdapter, struct HiDumperAdapter, DumpTaskInfo); + REPLACE_INTERFACE(&g_adapter, pAdapter, struct HiDumperAdapter, DumpFaultLog); + REPLACE_INTERFACE(&g_adapter, pAdapter, struct HiDumperAdapter, DumpMemData); + REPLACE_INTERFACE(&g_adapter, pAdapter, struct HiDumperAdapter, InjectKernelCrash); + + return 0; +} + +int OsHiDumperDriverInit(void) +{ + INT32 ret; + +#ifdef LOSCFG_DEBUG_VERSION + RegisterCommonAdapter(); + ret = register_driver(HIDUMPER_DEVICE, &g_hidumperDevOps, HIDUMPER_DEVICE_MODE, NULL); + if (ret != 0) { + PRINT_ERR("Hidumper register driver failed!\n"); + return -1; + } +#endif + + return 0; +} +LOS_MODULE_INIT(OsHiDumperDriverInit, LOS_INIT_LEVEL_KMOD_EXTENDED); diff --git a/kernel/common/hidumper/los_hidumper.h b/kernel/common/hidumper/los_hidumper.h new file mode 100644 index 00000000..ab48f302 --- /dev/null +++ b/kernel/common/hidumper/los_hidumper.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#ifndef LOS_HIDUMPER_H +#define LOS_HIDUMPER_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#ifndef __user +#define __user +#endif + +#define PATH_MAX_LEN 256 + +enum MemDumpType { + DUMP_TO_STDOUT, + DUMP_REGION_TO_STDOUT, + DUMP_TO_FILE, + DUMP_REGION_TO_FILE +}; + +struct MemDumpParam { + enum MemDumpType type; + unsigned long long start; + unsigned long long size; + char filePath[PATH_MAX_LEN]; +}; + +struct HiDumperAdapter { + void (*DumpSysInfo)(void); + void (*DumpCpuUsage)(void); + void (*DumpMemUsage)(void); + void (*DumpTaskInfo)(void); + void (*DumpFaultLog)(void); + void (*DumpMemData)(struct MemDumpParam *param); + void (*InjectKernelCrash)(void); +}; + +#define HIDUMPER_IOC_BASE 'd' +#define HIDUMPER_DUMP_ALL _IO(HIDUMPER_IOC_BASE, 1) +#define HIDUMPER_CPU_USAGE _IO(HIDUMPER_IOC_BASE, 2) +#define HIDUMPER_MEM_USAGE _IO(HIDUMPER_IOC_BASE, 3) +#define HIDUMPER_TASK_INFO _IO(HIDUMPER_IOC_BASE, 4) +#define HIDUMPER_INJECT_KERNEL_CRASH _IO(HIDUMPER_IOC_BASE, 5) +#define HIDUMPER_DUMP_FAULT_LOG _IO(HIDUMPER_IOC_BASE, 6) +#define HIDUMPER_MEM_DATA _IOW(HIDUMPER_IOC_BASE, 7, struct MemDumpParam) + +int HiDumperRegisterAdapter(struct HiDumperAdapter *pAdapter); +int OsHiDumperDriverInit(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff --git a/kernel/common/los_rootfs.c b/kernel/common/los_rootfs.c deleted file mode 100644 index a1e442fe..00000000 --- a/kernel/common/los_rootfs.c +++ /dev/null @@ -1,582 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 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. - */ -#include "los_base.h" -#include "los_typedef.h" -#include "string.h" -#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) -#include "mtd_partition.h" -#endif -#ifdef LOSCFG_DRIVERS_MMC -#include "disk.h" -#endif -#include "sys/mount.h" -#ifdef LOSCFG_PLATFORM_ROOTFS -#include "los_rootfs.h" -#endif -#include "mtd_list.h" -#include "fs/driver.h" - -#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 -#include "mtd_partition.h" -#include "cfiflash.h" -#define DEV_STORAGE_PATH "/dev/cfiflash1" -#define SECOND_MTD_PART_NUM 1 -#define STORAGE_SIZE 0x1400000 -#endif - -#ifdef LOSCFG_STORAGE_SPINOR -#define DEV_STORAGE_PATH "/dev/spinorblk2" -#define SECOND_MTD_PART_NUM 2 -#define STORAGE_SIZE 0x80000 -#endif - -#ifdef LOSCFG_STORAGE_SPINAND -#define DEV_STORAGE_PATH "/dev/nandblk2" -#define SECOND_MTD_PART_NUM 2 -#define STORAGE_SIZE 0xa00000 -#endif - -#ifdef LOSCFG_STORAGE_EMMC -#include "ff.h" -#define STORAGE_SIZE 0x3200000 -STATIC los_disk *g_emmcDisk = NULL; -#endif - - -#ifndef LOSCFG_SECURITY_BOOT -STATIC INT32 g_alignSize = 0; -#endif - -#define VFAT_STORAGE_MOUNT_DIR_MODE 0777 -#define DEFAULT_STORAGE_MOUNT_DIR_MODE 0755 - -#ifdef LOSCFG_DRIVERS_MMC -los_disk *GetMmcDisk(UINT8 type) -{ - const CHAR *mmcDevHead = "/dev/mmcblk"; - - for (INT32 diskId = 0; diskId < SYS_MAX_DISK; diskId++) { - los_disk *disk = get_disk(diskId); - if (disk == NULL) { - continue; - } else if (disk->disk_name == NULL) { - continue; - } else if (strncmp(disk->disk_name, mmcDevHead, strlen(mmcDevHead))) { - continue; - } else { - if (disk->type == type) { - return disk; - } - } - } - PRINT_ERR("Cannot find the mmc disk!\n"); - return NULL; -} -#endif - -#ifdef LOSCFG_STORAGE_EMMC -struct disk_divide_info *StorageBlockGetEmmc(void); -struct block_operations *StorageBlockGetMmcOps(void); -char *StorageBlockGetEmmcNodeName(void *block); - -STATIC const CHAR *AddEmmcRootfsPart(INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32 userSize) -{ - INT32 ret; - - void *block = ((struct drv_data *)g_emmcDisk->dev->data)->priv; - const char *node_name = StorageBlockGetEmmcNodeName(block); - if (los_disk_deinit(g_emmcDisk->disk_id) != ENOERR) { - PRINT_ERR("Failed to deinit emmc disk!\n"); - return NULL; - } - - struct disk_divide_info *emmc = StorageBlockGetEmmc(); - ret = add_mmc_partition(emmc, rootAddr / EMMC_SEC_SIZE, rootSize / EMMC_SEC_SIZE); - if (ret != LOS_OK) { - PRINT_ERR("Failed to add mmc root partition!\n"); - return NULL; - } else { - UINT64 storageStartCnt = userAddr / EMMC_SEC_SIZE; - UINT64 storageSizeCnt = userSize / EMMC_SEC_SIZE; - UINT64 userdataStartCnt = storageStartCnt + storageSizeCnt; - UINT64 userdataSizeCnt = g_emmcDisk->sector_count - userdataStartCnt; - ret = add_mmc_partition(emmc, storageStartCnt, storageSizeCnt); - if (ret != LOS_OK) { - PRINT_ERR("Failed to add mmc storage partition!\n"); - } - ret = add_mmc_partition(emmc, userdataStartCnt, userdataSizeCnt); - if (ret != LOS_OK) { - PRINT_ERR("Failed to add mmc userdata partition!\n"); - } - LOS_Msleep(10); /* waiting for device identification */ - INT32 diskId = los_alloc_diskid_byname(node_name); - if (diskId < 0) { - PRINT_ERR("Failed to alloc disk %s!\n", node_name); - return NULL; - } - if (los_disk_init(node_name, StorageBlockGetMmcOps(), block, diskId, emmc) != ENOERR) { - PRINT_ERR("Failed to init emmc disk!\n"); - return NULL; - } - return node_name; - } -} -#endif - -STATIC const CHAR *GetDevName(const CHAR *rootType, INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32 userSize) -{ - const CHAR *rootDev = NULL; - -#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) - INT32 ret; - if (strcmp(rootType, "flash") == 0) { - ret = add_mtd_partition(FLASH_TYPE, rootAddr, rootSize, 0); - if (ret != LOS_OK) { - PRINT_ERR("Failed to add spinor/spinand root partition!\n"); - } else { - rootDev = FLASH_DEV_NAME; - ret = add_mtd_partition(FLASH_TYPE, userAddr, userSize, SECOND_MTD_PART_NUM); - if (ret != LOS_OK) { - PRINT_ERR("Failed to add spinor/spinand storage partition!\n"); - } - } - } else -#endif - -#ifdef LOSCFG_DRIVERS_USB_MASS_STORAGE - if (strcmp(rootType, "usb") == 0) { - rootDev = "/dev/sda"; - } else -#endif - -#ifdef LOSCFG_DRIVERS_SD - if (strcmp(rootType, "sdcard") == 0) { - los_disk *sdDisk = GetMmcDisk(OTHERS); - if (sdDisk == NULL) { - PRINT_ERR("Get sdcard failed!\n"); - } else { - rootDev = sdDisk->disk_name; - } - } else -#endif - -#ifdef LOSCFG_STORAGE_EMMC - if (strcmp(rootType, "emmc") == 0) { - rootDev = AddEmmcRootfsPart(rootAddr, rootSize, userAddr, userSize); - } else -#endif - -#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 - if (strcmp(rootType, FLASH_TYPE) == 0) { - INT32 ret; - if (rootAddr != CFIFLASH_ROOT_ADDR) { - PRINT_ERR("Error rootAddr, must be %#0x!\n", CFIFLASH_ROOT_ADDR); - return NULL; - } - ret = add_mtd_partition(FLASH_TYPE, rootAddr, rootSize, 0); - if (ret != LOS_OK) { - PRINT_ERR("Failed to add %s root partition!\n", FLASH_TYPE); - } else { - rootDev = "/dev/cfiflash0"; - ret = add_mtd_partition(FLASH_TYPE, (rootAddr + rootSize), - CFIFLASH_CAPACITY - rootAddr - rootSize, SECOND_MTD_PART_NUM); - if (ret != LOS_OK) { - PRINT_ERR("Failed to add %s storage partition!\n", FLASH_TYPE); - } - } - } else -#endif - { - PRINT_ERR("Failed to find root dev type: %s\n", rootType); - } - return rootDev; -} - -#ifndef LOSCFG_SECURITY_BOOT -STATIC INT32 GetArgs(CHAR **args) -{ -#ifdef LOSCFG_BOOTENV_RAM - *args = OsGetArgsAddr(); - return LOS_OK; - -#else - INT32 ret; - INT32 i; - INT32 len = 0; - CHAR *cmdLine = NULL; - CHAR *tmp = NULL; - const CHAR *bootargName = "bootargs="; - - cmdLine = (CHAR *)malloc(COMMAND_LINE_SIZE); - if (cmdLine == NULL) { - PRINT_ERR("Malloc cmdLine space error!\n"); - return LOS_NOK; - } - -#ifdef LOSCFG_STORAGE_EMMC - g_emmcDisk = GetMmcDisk(EMMC); - if (g_emmcDisk == NULL) { - PRINT_ERR("Get EMMC disk failed!\n"); - goto ERROUT; - } - /* param4 is TRUE for not reading large contiguous data */ - ret = los_disk_read(g_emmcDisk->disk_id, cmdLine, COMMAND_LINE_ADDR / EMMC_SEC_SIZE, - COMMAND_LINE_SIZE / EMMC_SEC_SIZE, TRUE); - if (ret != 0) { - PRINT_ERR("Read EMMC command line failed!\n"); - goto ERROUT; - } - g_alignSize = EMMC_SEC_SIZE; -#endif - -#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) - struct MtdDev *mtd = GetMtd(FLASH_TYPE); - if (mtd == NULL) { - PRINT_ERR("Get spinor mtd failed!\n"); - goto ERROUT; - } - g_alignSize = mtd->eraseSize; - ret = mtd->read(mtd, COMMAND_LINE_ADDR, COMMAND_LINE_SIZE, cmdLine); - if (ret != COMMAND_LINE_SIZE) { - PRINT_ERR("Read spinor command line failed!\n"); - goto ERROUT; - } -#endif -#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 - struct MtdDev *mtd = GetCfiMtdDev(); - if (mtd == NULL) { - PRINT_ERR("Get CFI mtd failed!\n"); - goto ERROUT; - } - g_alignSize = mtd->eraseSize; - ret = mtd->read(mtd, CFIFLASH_BOOTARGS_ADDR, COMMAND_LINE_SIZE, cmdLine); - if (ret != COMMAND_LINE_SIZE) { - PRINT_ERR("Read CFI command line failed!\n"); - goto ERROUT; - } -#endif - - for (i = 0; i < COMMAND_LINE_SIZE; i += len + 1) { - len = strlen(cmdLine + i); - tmp = strstr(cmdLine + i, bootargName); - if (tmp != NULL) { - *args = strdup(tmp + strlen(bootargName)); - if (*args == NULL) { - goto ERROUT; - } - free(cmdLine); - return LOS_OK; - } - } - PRINT_ERR("Cannot find bootargs!\n"); - -ERROUT: - free(cmdLine); - return LOS_NOK; -#endif -} - -STATIC INT32 MatchRootPos(CHAR *p, const CHAR *rootInfoName, INT32 *rootInfo) -{ - UINT32 offset; - CHAR *value = NULL; - - if (strncmp(p, rootInfoName, strlen(rootInfoName)) == 0) { - value = p + strlen(rootInfoName); - offset = strspn(value, DEC_NUMBER_STRING); - if (strcmp(p + strlen(p) - 1, "M") == 0) { - if ((offset < (strlen(value) - 1)) || (sscanf_s(value, "%d", rootInfo) <= 0)) { - goto ERROUT; - } - *rootInfo = *rootInfo * BYTES_PER_MBYTE; - } else if (strcmp(p + strlen(p) - 1, "K") == 0) { - if ((offset < (strlen(value) - 1)) || (sscanf_s(value, "%d", rootInfo) <= 0)) { - goto ERROUT; - } - *rootInfo = *rootInfo * BYTES_PER_KBYTE; - } else if (sscanf_s(value, "0x%x", rootInfo) > 0) { - value += strlen("0x"); - if (strspn(value, HEX_NUMBER_STRING) < strlen(value)) { - goto ERROUT; - } - } else { - goto ERROUT; - } - } - - if ((*rootInfo >= 0) && (g_alignSize != 0) && ((UINT32)(*rootInfo) & (UINT32)(g_alignSize - 1))) { - PRINT_ERR("The bootarg \"%s\" will be 0x%x aligned!\n", p, g_alignSize); - } - return LOS_OK; - -ERROUT: - PRINT_ERR("Invalid bootarg \"%s\"!\n", p); - return LOS_NOK; -} - -STATIC INT32 MatchRootInfo(CHAR *p, CHAR **rootType, CHAR **fsType, INT32 *rootAddr, INT32 *rootSize, INT32 *userAddr, INT32 *userSize) -{ - const CHAR *rootName = "root="; - const CHAR *fsName = "fstype="; - const CHAR *rootAddrName = "rootaddr="; - const CHAR *rootSizeName = "rootsize="; - const CHAR *userAddrName = "useraddr="; - const CHAR *userSizeName = "usersize="; - - if ((*rootType == NULL) && (strncmp(p, rootName, strlen(rootName)) == 0)) { - *rootType = strdup(p + strlen(rootName)); - if (*rootType == NULL) { - return LOS_NOK; - } - return LOS_OK; - } - - if ((*fsType == NULL) && (strncmp(p, fsName, strlen(fsName)) == 0)) { - *fsType = strdup(p + strlen(fsName)); - if (*fsType == NULL) { - return LOS_NOK; - } - return LOS_OK; - } - - if (*rootAddr < 0) { - if (MatchRootPos(p, rootAddrName, rootAddr) != LOS_OK) { - return LOS_NOK; - } else if (*rootAddr >= 0) { - return LOS_OK; - } - } - - if (*rootSize < 0) { - if (MatchRootPos(p, rootSizeName, rootSize) != LOS_OK) { - return LOS_NOK; - } - } - - if (*userAddr < 0) { - if (MatchRootPos(p, userAddrName, userAddr) != LOS_OK) { - return LOS_NOK; - } else if (*userAddr >= 0) { - return LOS_OK; - } - } - - if (*userSize < 0) { - if (MatchRootPos(p, userSizeName, userSize) != LOS_OK) { - return LOS_NOK; - } - } - - return LOS_OK; -} - -STATIC INT32 GetRootType(CHAR **rootType, CHAR **fsType, INT32 *rootAddr, INT32 *rootSize, INT32 *userAddr, INT32 *userSize) -{ - CHAR *args = NULL; - CHAR *p = NULL; - - if (GetArgs(&args) != LOS_OK) { - PRINT_ERR("Cannot get bootargs!\n"); - return LOS_NOK; - } -#ifndef LOSCFG_BOOTENV_RAM - CHAR *argsBak = NULL; - argsBak = args; -#endif - p = strsep(&args, " "); - while (p != NULL) { - if (MatchRootInfo(p, rootType, fsType, rootAddr, rootSize, userAddr, userSize) != LOS_OK) { - goto ERROUT; - } - p = strsep(&args, " "); - } - if ((*fsType != NULL) && (*rootType != NULL)) { -#ifndef LOSCFG_BOOTENV_RAM - free(argsBak); -#endif - return LOS_OK; - } - -ERROUT: - PRINT_ERR("Invalid rootfs information!\n"); - if (*rootType != NULL) { - free(*rootType); - *rootType = NULL; - } - if (*fsType != NULL) { - free(*fsType); - *fsType = NULL; - } -#ifndef LOSCFG_BOOTENV_RAM - free(argsBak); -#endif - return LOS_NOK; -} -#endif - -#ifdef LOSCFG_STORAGE_EMMC -STATIC VOID OsMountUserdata(const CHAR *fsType) -{ - INT32 ret; - INT32 err; - const CHAR *userdataDir = "/userdata"; - ret = mkdir(userdataDir, VFAT_STORAGE_MOUNT_DIR_MODE); - if ((ret != LOS_OK) && ((err = get_errno()) != EEXIST)) { - PRINT_ERR("Failed to mkdir /userdata, errno %d: %s\n", err, strerror(err)); - return; - } - CHAR emmcUserdataDev[DISK_NAME] = {0}; - if (snprintf_s(emmcUserdataDev, sizeof(emmcUserdataDev), sizeof(emmcUserdataDev) - 1, - "%s%s", g_emmcDisk->disk_name, "p2") < 0) { - PRINT_ERR("Failed to get emmc userdata dev name!\n"); - return; - } - ret = mount(emmcUserdataDev, userdataDir, fsType, 0, "umask=000"); - if (ret == LOS_OK) { - return; - } - err = get_errno(); - if (err == ENOTSUP) { -#ifdef LOSCFG_FS_FAT - ret = format(emmcUserdataDev, 0, FM_FAT32); - if (ret != LOS_OK) { - PRINT_ERR("Failed to format %s\n", emmcUserdataDev); - return; - } -#endif - ret = mount(emmcUserdataDev, userdataDir, fsType, 0, "umask=000"); - if (ret != LOS_OK) { - err = get_errno(); - PRINT_ERR("Failed to mount /userdata, errno %d: %s\n", err, strerror(err)); - } - } else { - PRINT_ERR("Failed to mount /userdata, errno %d: %s\n", err, strerror(err)); - } - return; -} -#endif - -STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType) -{ - INT32 ret; - INT32 err; - if (strcmp(fsType, "vfat") == 0) { - ret = mount(rootDev, "/", fsType, MS_RDONLY, NULL); - if (ret != LOS_OK) { - err = get_errno(); - PRINT_ERR("Failed to mount vfat rootfs, errno %d: %s\n", err, strerror(err)); - return ret; - } -#ifdef LOSCFG_STORAGE_EMMC - ret = mkdir("/storage", VFAT_STORAGE_MOUNT_DIR_MODE); - if ((ret != LOS_OK) && ((err = get_errno()) != EEXIST)) { - PRINT_ERR("Failed to mkdir /storage, errno %d: %s\n", err, strerror(err)); - return ret; - } else { - CHAR emmcStorageDev[DISK_NAME] = {0}; - if (snprintf_s(emmcStorageDev, sizeof(emmcStorageDev), sizeof(emmcStorageDev) - 1, - "%s%s", g_emmcDisk->disk_name, "p1") < 0) { - PRINT_ERR("Failed to get emmc storage dev name!\n"); - } else { - ret = mount(emmcStorageDev, "/storage", fsType, 0, "umask=000"); - if (ret != LOS_OK) { - err = get_errno(); - PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err)); - } - } - } - OsMountUserdata(fsType); -#endif - } else { - ret = mount(rootDev, "/", fsType, MS_RDONLY, NULL); - if (ret != LOS_OK) { - err = get_errno(); - PRINT_ERR("Failed to mount rootfs,rootDev %s, errno %d: %s\n", rootDev, err, strerror(err)); - return ret; - } -#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7) - ret = mkdir("/storage", DEFAULT_STORAGE_MOUNT_DIR_MODE); - if ((ret != LOS_OK) && ((err = get_errno()) != EEXIST)) { - PRINT_ERR("Failed to mkdir /storage, errno %d: %s\n", err, strerror(err)); - return ret; - } else { - ret = mount(DEV_STORAGE_PATH, "/storage", fsType, 0, NULL); - if (ret != LOS_OK) { - err = get_errno(); - PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err)); - } - } -#endif - } - return LOS_OK; -} - -INT32 OsMountRootfs(VOID) -{ - INT32 ret = LOS_OK; - INT32 err; - INT32 rootAddr = -1; - INT32 rootSize = -1; - INT32 userAddr = -1; - INT32 userSize = -1; - CHAR *rootType = NULL; - CHAR *fsType = NULL; - const CHAR *rootDev = NULL; - -#ifdef LOSCFG_SECURITY_BOOT - rootType = strdup(ROOTFS_ROOT_TYPE); - fsType = strdup(ROOTFS_FS_TYPE); - rootAddr = ROOTFS_FLASH_ADDR; - rootSize = ROOTFS_FLASH_SIZE; -#else - ret = GetRootType(&rootType, &fsType, &rootAddr, &rootSize, &userAddr, &userSize); - if (ret != LOS_OK) { - return ret; - } - rootAddr = (rootAddr >= 0) ? rootAddr : ROOTFS_FLASH_ADDR; - rootSize = (rootSize >= 0) ? rootSize : ROOTFS_FLASH_SIZE; -#endif - userAddr = (userAddr >= 0) ? userAddr : rootAddr + rootSize; - userSize = (userSize >= 0) ? userSize : STORAGE_SIZE; - - rootDev = GetDevName(rootType, rootAddr, rootSize, userAddr, userSize); - if (rootDev != NULL) { - ret = OsMountRootfsAndUserfs(rootDev, fsType); - if (ret != LOS_OK) { - err = get_errno(); - PRINT_ERR("Failed to mount rootfs, errno %d: %s\n", err, strerror(err)); - } - } - - free(rootType); - free(fsType); - return ret; -} diff --git a/kernel/common/patchfs/BUILD.gn b/kernel/common/patchfs/BUILD.gn new file mode 100644 index 00000000..28d5e761 --- /dev/null +++ b/kernel/common/patchfs/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_PLATFORM_PATCHFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_partition_utils.c", + "los_patchfs.c", + ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/rootfs/BUILD.gn b/kernel/common/rootfs/BUILD.gn new file mode 100644 index 00000000..e69ae93e --- /dev/null +++ b/kernel/common/rootfs/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_PLATFORM_ROOTFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_bootargs.c", + "los_rootfs.c", + ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/Kconfig b/kernel/common/rootfs/Kconfig similarity index 100% rename from kernel/common/Kconfig rename to kernel/common/rootfs/Kconfig diff --git a/kernel/common/Makefile b/kernel/common/rootfs/Makefile similarity index 95% rename from kernel/common/Makefile rename to kernel/common/rootfs/Makefile index 662f496e..6762cab4 100644 --- a/kernel/common/Makefile +++ b/kernel/common/rootfs/Makefile @@ -31,7 +31,7 @@ include $(LITEOSTOPDIR)/config.mk MODULE_NAME := rootfs -LOCAL_SRCS := $(wildcard los_rootfs.c) +LOCAL_SRCS := $(wildcard los_rootfs.c los_bootargs.c) LOCAL_INCLUDE := \ -I $(LITEOSTOPDIR)/kernel/common \ diff --git a/kernel/common/rootfs/los_bootargs.c b/kernel/common/rootfs/los_bootargs.c new file mode 100644 index 00000000..815a27c4 --- /dev/null +++ b/kernel/common/rootfs/los_bootargs.c @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2020-2021 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. + */ + +#include "los_bootargs.h" +#include "los_base.h" +#include "string.h" + +#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7) +#include "mtd_list.h" +#endif + +#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 +#include "cfiflash.h" +#endif + +#ifdef LOSCFG_STORAGE_EMMC +#include "disk.h" +#endif + +STATIC CHAR *g_cmdLine = NULL; +STATIC UINT64 g_alignSize = 0; +STATIC struct BootArgs g_bootArgs[MAX_ARGS_NUM] = {0}; + +INT32 LOS_GetCmdLine() { + int ret = 0; + + g_cmdLine = (CHAR *)malloc(COMMAND_LINE_SIZE); + if (g_cmdLine == NULL) { + PRINT_ERR("Malloc g_cmdLine space error!\n"); + return LOS_NOK; + } + +#ifdef LOSCFG_STORAGE_EMMC + los_disk *emmcDisk = los_get_mmcdisk_bytype(EMMC); + if (emmcDisk == NULL) { + PRINT_ERR("Get EMMC disk failed!\n"); + goto ERROUT; + } + g_alignSize = EMMC_SEC_SIZE; + ret = los_disk_read(emmcDisk->disk_id, g_cmdLine, COMMAND_LINE_ADDR / EMMC_SEC_SIZE, + COMMAND_LINE_SIZE / EMMC_SEC_SIZE, TRUE); + if (ret == 0) { + return LOS_OK; + } +#endif + +#ifdef LOSCFG_STORAGE_SPINOR + struct MtdDev *mtd = GetMtd("spinor"); + if (mtd == NULL) { + PRINT_ERR("Get spinor mtd failed!\n"); + goto ERROUT; + } + g_alignSize = mtd->eraseSize; + ret = mtd->read(mtd, COMMAND_LINE_ADDR, COMMAND_LINE_SIZE, g_cmdLine); + if (ret == COMMAND_LINE_SIZE) { + return LOS_OK; + } +#endif + +#ifdef LOSCFG_STORAGE_SPINAND + struct MtdDev *mtd = GetMtd("nand"); + if (mtd == NULL) { + PRINT_ERR("Get nand mtd failed!\n"); + goto ERROUT; + } + g_alignSize = mtd->eraseSize; + ret = mtd->read(mtd, COMMAND_LINE_ADDR, COMMAND_LINE_SIZE, g_cmdLine); + if (ret == COMMAND_LINE_SIZE) { + return LOS_OK; + } +#endif + +#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 + struct MtdDev *mtd = GetCfiMtdDev(); + if (mtd == NULL) { + PRINT_ERR("Get CFI mtd failed!\n"); + goto ERROUT; + } + g_alignSize = mtd->eraseSize; + ret = mtd->read(mtd, CFIFLASH_BOOTARGS_ADDR, COMMAND_LINE_SIZE, g_cmdLine); + if (ret == COMMAND_LINE_SIZE) { + return LOS_OK; + } +#endif + + PRINT_ERR("Read cmdline error!\n"); +ERROUT: + free(g_cmdLine); + g_cmdLine = NULL; + return LOS_NOK; +} + +VOID LOS_FreeCmdLine() { + if (g_cmdLine != NULL) { + free(g_cmdLine); + g_cmdLine = NULL; + } +} + +STATIC INT32 GetBootargs(CHAR **args) +{ +#ifdef LOSCFG_BOOTENV_RAM + *args = OsGetArgsAddr(); + return LOS_OK; +#else + INT32 i; + INT32 len = 0; + CHAR *tmp = NULL; + const CHAR *bootargsName = "bootargs="; + + if (g_cmdLine == NULL) { + PRINT_ERR("Should call LOS_GetCmdLine() first!\n"); + return LOS_NOK; + } + + for (i = 0; i < COMMAND_LINE_SIZE; i += len + 1) { + len = strlen(g_cmdLine + i); + tmp = strstr(g_cmdLine + i, bootargsName); + if (tmp != NULL) { + *args = tmp + strlen(bootargsName); + return LOS_OK; + } + } + PRINT_ERR("Cannot find bootargs!\n"); + return LOS_NOK; +#endif +} + +INT32 LOS_ParseBootargs() { + INT32 idx = 0; + INT32 ret; + CHAR *args; + CHAR *argName; + CHAR *argValue; + + ret = GetBootargs(&args); + if (ret != LOS_OK) { + return LOS_NOK; + } + + while ((argValue = strsep(&args, " ")) != NULL) { + argName = strsep(&argValue, "="); + if (argValue == NULL) { + /* If the argument is not compliance with the format 'foo=bar' */ + g_bootArgs[idx].argName = argName; + g_bootArgs[idx].argValue = argName; + } else { + g_bootArgs[idx].argName = argName; + g_bootArgs[idx].argValue = argValue; + } + if (++idx >= MAX_ARGS_NUM) { + /* Discard the rest arguments */ + break; + } + } + return LOS_OK; +} + +INT32 LOS_GetArgValue(CHAR *argName, CHAR **argValue) { + INT32 idx = 0; + + while (idx < MAX_ARGS_NUM) { + if (g_bootArgs[idx].argName == NULL) { + break; + } + if (strcmp(argName, g_bootArgs[idx].argName) == 0) { + *argValue = g_bootArgs[idx].argValue; + return LOS_OK; + } + idx++; + } + + return LOS_NOK; +} + +UINT64 LOS_GetAlignsize() { + return g_alignSize; +} + +UINT64 LOS_SizeStrToNum(CHAR *value) +{ + UINT64 num = 0; + + /* If the string is a hexadecimal value */ + if (sscanf_s(value, "0x%x", &num) > 0) { + value += strlen("0x"); + if (strspn(value, "0123456789abcdefABCDEF") < strlen(value)) { + goto ERROUT; + } + return num; + } + + /* If the string is a decimal value in unit *Bytes */ + INT32 ret = sscanf_s(value, "%d", &num); + INT32 decOffset = strspn(value, "0123456789"); + CHAR *endPos = value + decOffset; + if ((ret <= 0) || (decOffset < (strlen(value) - 1))) { + goto ERROUT; + } + + if (strlen(endPos) == 0) { + return num; + } else if (strcasecmp(endPos, "k") == 0) { + num = num * BYTES_PER_KBYTE; + } else if (strcasecmp(endPos, "m") == 0) { + num = num * BYTES_PER_MBYTE; + } else if (strcasecmp(endPos, "g") == 0) { + num = num * BYTES_PER_GBYTE; + } else { + goto ERROUT; + } + + return num; + +ERROUT: + PRINT_ERR("Invalid value string \"%s\"!\n", value); + return num; +} \ No newline at end of file diff --git a/kernel/common/los_rootfs.h b/kernel/common/rootfs/los_bootargs.h similarity index 56% rename from kernel/common/los_rootfs.h rename to kernel/common/rootfs/los_bootargs.h index f2de0986..3cb73d0c 100644 --- a/kernel/common/los_rootfs.h +++ b/kernel/common/rootfs/los_bootargs.h @@ -1,5 +1,4 @@ /* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -28,55 +27,35 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#ifndef _LOS_BOOTARGS_H +#define _LOS_BOOTARGS_H -#ifndef _LOS_ROOTFS_H -#define _LOS_ROOTFS_H +#include "los_typedef.h" -#define BYTES_PER_MBYTE 0x100000 -#define BYTES_PER_KBYTE 0x400 - -#define COMMAND_LINE_ADDR LOSCFG_BOOTENV_ADDR * BYTES_PER_KBYTE +#define BYTES_PER_GBYTE (1 << 30) +#define BYTES_PER_MBYTE (1 << 20) +#define BYTES_PER_KBYTE (1 << 10) +#define COMMAND_LINE_ADDR (LOSCFG_BOOTENV_ADDR * BYTES_PER_KBYTE) #define COMMAND_LINE_SIZE 1024 - -#ifdef LOSCFG_STORAGE_SPINOR -#define ROOTFS_ROOT_TYPE "flash" -#define ROOTFS_FS_TYPE "jffs2" -#elif defined(LOSCFG_STORAGE_SPINAND) -#define ROOTFS_ROOT_TYPE "nand" -#define ROOTFS_FS_TYPE "yaffs2" -#endif - +#define MAX_ARGS_NUM 100 #ifdef LOSCFG_STORAGE_EMMC -#define ROOTFS_ROOT_TYPE "emmc" -#define ROOTFS_FS_TYPE "vfat" -#endif - -#ifdef LOSCFG_TEE_ENABLE -#define ROOTFS_FLASH_ADDR 0x600000 -#define ROOTFS_FLASH_SIZE 0x800000 -#else -#define ROOTFS_FLASH_ADDR 0x400000 -#define ROOTFS_FLASH_SIZE 0xa00000 -#endif - -#ifdef LOSCFG_STORAGE_SPINOR -#define FLASH_TYPE "spinor" -#define FLASH_DEV_NAME "/dev/spinorblk0" -#elif defined(LOSCFG_STORAGE_SPINAND) -#define FLASH_TYPE "nand" -#define FLASH_DEV_NAME "/dev/nandblk0" -#endif - #define EMMC_SEC_SIZE 512 +#endif -#define DEC_NUMBER_STRING "0123456789" -#define HEX_NUMBER_STRING "0123456789abcdefABCDEF" +struct BootArgs { + CHAR *argName; + CHAR *argValue; +}; -INT32 OsMountRootfs(VOID); -VOID OsSetCmdLineAddr(UINT64 addr); -UINT64 OsGetCmdLineAddr(VOID); +INT32 LOS_GetCmdLine(VOID); +VOID LOS_FreeCmdLine(VOID); +INT32 LOS_ParseBootargs(VOID); +INT32 LOS_GetArgValue(CHAR *argName, CHAR **argValue); +UINT64 LOS_GetAlignsize(VOID); +UINT64 LOS_SizeStrToNum(CHAR *value); #ifdef LOSCFG_BOOTENV_RAM CHAR *OsGetArgsAddr(VOID); #endif -#endif /* _LOS_ROOTFS_H */ +#endif /* _LOS_BOOTARGS_H */ \ No newline at end of file diff --git a/kernel/common/rootfs/los_rootfs.c b/kernel/common/rootfs/los_rootfs.c new file mode 100644 index 00000000..e9b19849 --- /dev/null +++ b/kernel/common/rootfs/los_rootfs.c @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 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. + */ + +#include "los_rootfs.h" +#include "los_bootargs.h" +#include "los_base.h" +#include "string.h" +#include "sys/mount.h" +#include "sys/stat.h" +#include "sys/types.h" + +#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7) +#include "mtd_list.h" +#include "mtd_partition.h" +#endif + +#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 +#include "cfiflash.h" +#endif + +#ifdef LOSCFG_STORAGE_EMMC +#include "disk.h" +#include "ff.h" +#endif + + +#ifdef LOSCFG_STORAGE_EMMC +struct disk_divide_info *StorageBlockGetEmmc(void); +struct block_operations *StorageBlockGetMmcOps(void); +char *StorageBlockGetEmmcNodeName(void *block); + +STATIC INT32 AddEmmcParts(INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32 userSize) +{ + INT32 ret; + + los_disk *emmcDisk = los_get_mmcdisk_bytype(EMMC); + if (emmcDisk == NULL) { + PRINT_ERR("Get EMMC disk failed!\n"); + return LOS_NOK; + } + + void *block = ((struct drv_data *)emmcDisk->dev->data)->priv; + const char *node_name = StorageBlockGetEmmcNodeName(block); + if (los_disk_deinit(emmcDisk->disk_id) != ENOERR) { + PRINT_ERR("Failed to deinit emmc disk!\n"); + return LOS_NOK; + } + + struct disk_divide_info *emmc = StorageBlockGetEmmc(); + ret = add_mmc_partition(emmc, rootAddr / EMMC_SEC_SIZE, rootSize / EMMC_SEC_SIZE); + if (ret != LOS_OK) { + PRINT_ERR("Failed to add mmc root partition!\n"); + return LOS_NOK; + } + + UINT64 storageStartCnt = userAddr / EMMC_SEC_SIZE; + UINT64 storageSizeCnt = userSize / EMMC_SEC_SIZE; + UINT64 userdataStartCnt = storageStartCnt + storageSizeCnt; + UINT64 userdataSizeCnt = emmcDisk->sector_count - userdataStartCnt; + ret = add_mmc_partition(emmc, storageStartCnt, storageSizeCnt); + if (ret != LOS_OK) { + PRINT_ERR("Failed to add mmc storage partition!\n"); + return LOS_NOK; + } + + ret = add_mmc_partition(emmc, userdataStartCnt, userdataSizeCnt); + if (ret != LOS_OK) { + PRINT_ERR("Failed to add mmc userdata partition!\n"); + return LOS_NOK; + } + + LOS_Msleep(10); /* waiting for device identification */ + + INT32 diskId = los_alloc_diskid_byname(node_name); + if (diskId < 0) { + PRINT_ERR("Failed to alloc disk %s!\n", node_name); + return LOS_NOK; + } + + if (los_disk_init(node_name, StorageBlockGetMmcOps(), block, diskId, emmc) != ENOERR) { + PRINT_ERR("Failed to init emmc disk!\n"); + return LOS_NOK; + } + + return LOS_OK; +} +#endif + + +STATIC INT32 AddPartitions(CHAR *dev, UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize) +{ +#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 + if ((strcmp(dev, "cfi-flash") == 0) && (rootAddr != CFIFLASH_ROOT_ADDR)) { + PRINT_ERR("Error rootAddr, must be %#0x!\n", CFIFLASH_ROOT_ADDR); + return LOS_NOK; + } +#endif + +#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7) + INT32 ret; + INT32 blk0 = 0; + INT32 blk2 = 2; + if (strcmp(dev, "flash") == 0 || strcmp(dev, FLASH_TYPE) == 0) { + ret = add_mtd_partition(FLASH_TYPE, rootAddr, rootSize, blk0); + if (ret != LOS_OK) { + PRINT_ERR("Failed to add mtd root partition!\n"); + return LOS_NOK; + } + + ret = add_mtd_partition(FLASH_TYPE, userAddr, userSize, blk2); + if (ret != LOS_OK) { + PRINT_ERR("Failed to add mtd storage partition!\n"); + return LOS_NOK; + } + + return LOS_OK; + } +#endif + +#ifdef LOSCFG_STORAGE_EMMC + if (strcmp(dev, "emmc") == 0) { + return AddEmmcParts(rootAddr, rootSize, userAddr, userSize); + } +#endif + + PRINT_ERR("Unsupport dev type: %s\n", dev); + return LOS_NOK; +} + + +STATIC INT32 ParseRootArgs(CHAR **dev, CHAR **fstype, UINT64 *rootAddr, UINT64 *rootSize, UINT32 *mountFlags) { + INT32 ret; + CHAR *rootAddrStr; + CHAR *rootSizeStr; + CHAR *rwTag; + + ret = LOS_GetArgValue("root", dev); + if (ret != LOS_OK) { + PRINT_ERR("Cannot find root!"); + return ret; + } + + ret = LOS_GetArgValue("fstype", fstype); + if (ret != LOS_OK) { + PRINT_ERR("Cannot find fstype!"); + return ret; + } + + ret = LOS_GetArgValue("rootaddr", &rootAddrStr); + if (ret != LOS_OK) { + *rootAddr = ROOTFS_ADDR; + } else { + *rootAddr = LOS_SizeStrToNum(rootAddrStr); + } + + ret = LOS_GetArgValue("rootsize", &rootSizeStr); + if (ret != LOS_OK) { + *rootSize = ROOTFS_SIZE; + } else { + *rootSize = LOS_SizeStrToNum(rootSizeStr); + } + + ret = LOS_GetArgValue("ro", &rwTag); + if (ret == LOS_OK) { + *mountFlags = MS_RDONLY; + } else { + *mountFlags = 0; + } + + return LOS_OK; +} + +STATIC INT32 ParseUserArgs(UINT64 rootAddr, UINT64 rootSize, UINT64 *userAddr, UINT64 *userSize) { + INT32 ret; + CHAR *userAddrStr; + CHAR *userSizeStr; + + ret = LOS_GetArgValue("useraddr", &userAddrStr); + if (ret != LOS_OK) { + *userAddr = rootAddr + rootSize; + } else { + *userAddr = LOS_SizeStrToNum(userAddrStr); + } + + ret = LOS_GetArgValue("usersize", &userSizeStr); + if (ret != LOS_OK) { + *userSize = USERFS_SIZE; + } else { + *userSize = LOS_SizeStrToNum(userSizeStr); + } + + return LOS_OK; +} + +STATIC INT32 MountPartitions(CHAR *fsType, UINT32 mountFlags) { + INT32 ret; + INT32 err; + + /* Mount rootfs */ + ret = mount(ROOT_DEV_NAME, ROOT_DIR_NAME, fsType, mountFlags, NULL); + if (ret != LOS_OK) { + err = get_errno(); + PRINT_ERR("Failed to mount %s, rootDev %s, errno %d: %s\n", ROOT_DIR_NAME, ROOT_DEV_NAME, err, strerror(err)); + return ret; + } + + /* Mount userfs */ + ret = mkdir(STORAGE_DIR_NAME, DEFAULT_MOUNT_DIR_MODE); + if ((ret != LOS_OK) && ((err = get_errno()) != EEXIST)) { + PRINT_ERR("Failed to mkdir %s, errno %d: %s\n", STORAGE_DIR_NAME, err, strerror(err)); + return ret; + } + + ret = mount(USER_DEV_NAME, STORAGE_DIR_NAME, fsType, 0, DEFAULT_MOUNT_DATA); + if (ret != LOS_OK) { + err = get_errno(); + PRINT_ERR("Failed to mount %s, errno %d: %s\n", STORAGE_DIR_NAME, err, strerror(err)); + return ret; + } + +#ifdef LOSCFG_STORAGE_EMMC + /* Mount userdata */ + ret = mkdir(USERDATA_DIR_NAME, DEFAULT_MOUNT_DIR_MODE); + if ((ret != LOS_OK) && ((err = get_errno()) != EEXIST)) { + PRINT_ERR("Failed to mkdir %s, errno %d: %s\n", USERDATA_DIR_NAME, err, strerror(err)); + return ret; + } + + ret = mount(USERDATA_DEV_NAME, USERDATA_DIR_NAME, fsType, 0, DEFAULT_MOUNT_DATA); + if ((ret != LOS_OK) && ((err = get_errno()) == ENOTSUP)) { + ret = format(USERDATA_DEV_NAME, 0, FM_FAT32); + if (ret != LOS_OK) { + PRINT_ERR("Failed to format %s\n", USERDATA_DEV_NAME); + return ret; + } + + ret = mount(USERDATA_DEV_NAME, USERDATA_DIR_NAME, fsType, 0, DEFAULT_MOUNT_DATA); + if (ret != LOS_OK) { + err = get_errno(); + } + } + if (ret != LOS_OK) { + PRINT_ERR("Failed to mount %s, errno %d: %s\n", USERDATA_DIR_NAME, err, strerror(err)); + return ret; + } +#endif + return LOS_OK; +} + +STATIC INT32 CheckValidation(UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize) { + UINT64 alignSize = LOS_GetAlignsize(); + + if (alignSize == 0) { + return LOS_OK; + } + + if ((rootAddr & (alignSize - 1)) || (rootSize & (alignSize - 1)) || + (userAddr & (alignSize - 1)) || (userSize & (alignSize - 1))) { + PRINT_ERR("The address or size value should be 0x%x aligned!\n", alignSize); + return LOS_NOK; + } + + return LOS_OK; +} + +INT32 OsMountRootfs() { + INT32 ret; + CHAR *dev; + CHAR *fstype; + UINT64 rootAddr; + UINT64 rootSize; + UINT64 userAddr; + UINT64 userSize; + UINT32 mountFlags; + + ret = ParseRootArgs(&dev, &fstype, &rootAddr, &rootSize, &mountFlags); + if (ret != LOS_OK) { + return ret; + } + + ret = ParseUserArgs(rootAddr, rootSize, &userAddr, &userSize); + if (ret != LOS_OK) { + return ret; + } + + ret = CheckValidation(rootAddr, rootSize, userAddr, userSize); + if (ret != LOS_OK) { + return ret; + } + + ret = AddPartitions(dev, rootAddr, rootSize, userAddr, userSize); + if (ret != LOS_OK) { + return ret; + } + + ret = MountPartitions(fstype, mountFlags); + if (ret != LOS_OK) { + return ret; + } + + return LOS_OK; +} \ No newline at end of file diff --git a/kernel/common/rootfs/los_rootfs.h b/kernel/common/rootfs/los_rootfs.h new file mode 100644 index 00000000..9f3aebef --- /dev/null +++ b/kernel/common/rootfs/los_rootfs.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 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. + */ + +#ifndef _LOS_ROOTFS_H +#define _LOS_ROOTFS_H + +#include "los_typedef.h" + +#define ROOT_DIR_NAME "/" +#define STORAGE_DIR_NAME "/storage" +#ifdef LOSCFG_STORAGE_EMMC +#define USERDATA_DIR_NAME "/userdata" +#endif +#define DEFAULT_MOUNT_DIR_MODE 0755 +#define DEFAULT_MOUNT_DATA NULL + +#ifdef LOSCFG_STORAGE_SPINOR +#define FLASH_TYPE "spinor" +#define ROOT_DEV_NAME "/dev/spinorblk0" +#define USER_DEV_NAME "/dev/spinorblk2" +#define ROOTFS_ADDR 0x600000 +#define ROOTFS_SIZE 0x800000 +#define USERFS_SIZE 0x80000 +#elif defined (LOSCFG_STORAGE_SPINAND) +#define FLASH_TYPE "nand" +#define ROOT_DEV_NAME "/dev/nandblk0" +#define USER_DEV_NAME "/dev/nandblk2" +#define ROOTFS_ADDR 0x600000 +#define ROOTFS_SIZE 0x800000 +#define USERFS_SIZE 0x80000 +#elif defined (LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7) +#define ROOT_DEV_NAME "/dev/cfiflash0" +#define USER_DEV_NAME "/dev/cfiflash2" +#define ROOTFS_ADDR CFIFLASH_ROOT_ADDR +#define ROOTFS_SIZE 0x1B00000 +#define USERFS_SIZE (CFIFLASH_CAPACITY - ROOTFS_ADDR - ROOTFS_SIZE) +#elif defined (LOSCFG_STORAGE_EMMC) +#define ROOT_DEV_NAME "/dev/mmcblk0p0" +#define USER_DEV_NAME "/dev/mmcblk0p1" +#define USERDATA_DEV_NAME "/dev/mmcblk0p2" +#define ROOTFS_ADDR 0xA00000 +#define ROOTFS_SIZE 0x1400000 +#define USERFS_SIZE 0x3200000 +#ifdef DEFAULT_MOUNT_DIR_MODE +#undef DEFAULT_MOUNT_DIR_MODE +#endif +#ifdef DEFAULT_MOUNT_DATA +#undef DEFAULT_MOUNT_DATA +#endif +#define DEFAULT_MOUNT_DIR_MODE 0777 +#define DEFAULT_MOUNT_DATA "umask=000" +#endif + +INT32 OsMountRootfs(VOID); + +#endif /* _LOS_ROOTFS_H */ diff --git a/kernel/extended/BUILD.gn b/kernel/extended/BUILD.gn new file mode 100644 index 00000000..d171bc1f --- /dev/null +++ b/kernel/extended/BUILD.gn @@ -0,0 +1,56 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("extended") { + deps = [ + "cppsupport", + "cpup", + "dynload", + "hilog", + "liteipc", + "pipes", + "power", + "trace", + "vdso", + ] +} + +config("public") { + configs = [ + "cpup:public", + "dynload:public", + "vdso:public", + "trace:public", + "liteipc:public", + "pipes:public", + "hilog:public", + ] +} diff --git a/kernel/extended/cppsupport/BUILD.gn b/kernel/extended/cppsupport/BUILD.gn new file mode 100644 index 00000000..d264cd20 --- /dev/null +++ b/kernel/extended/cppsupport/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_CPPSUPPORT) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "los_cppsupport.c" ] +} diff --git a/kernel/extended/cpup/BUILD.gn b/kernel/extended/cpup/BUILD.gn new file mode 100644 index 00000000..2482774f --- /dev/null +++ b/kernel/extended/cpup/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_CPUP) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "cpup_shellcmd.c", + "los_cpup.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/extended/include/los_cpup_pri.h b/kernel/extended/cpup/los_cpup_pri.h similarity index 100% rename from kernel/extended/include/los_cpup_pri.h rename to kernel/extended/cpup/los_cpup_pri.h diff --git a/kernel/extended/dynload/BUILD.gn b/kernel/extended/dynload/BUILD.gn new file mode 100644 index 00000000..110abc4c --- /dev/null +++ b/kernel/extended/dynload/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_DYNLOAD) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/los_exec_elf.c", + "src/los_load_elf.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/kernel/extended/hilog/BUILD.gn b/kernel/extended/hilog/BUILD.gn new file mode 100644 index 00000000..16e05fe9 --- /dev/null +++ b/kernel/extended/hilog/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_BASE_CORE_HILOG) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "//base/hiviewdfx/hilog_lite/frameworks/featured/hiview_log.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ + "//base/hiviewdfx/hilog_lite/interfaces/native/kits", + "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog", + ] +} diff --git a/kernel/extended/liteipc/BUILD.gn b/kernel/extended/liteipc/BUILD.gn new file mode 100644 index 00000000..5074fe3a --- /dev/null +++ b/kernel/extended/liteipc/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_LITEIPC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "hm_liteipc.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/extended/liteipc/hm_liteipc.c b/kernel/extended/liteipc/hm_liteipc.c index fc45bd7d..b836a6b1 100644 --- a/kernel/extended/liteipc/hm_liteipc.c +++ b/kernel/extended/liteipc/hm_liteipc.c @@ -40,7 +40,7 @@ #include "los_sched_pri.h" #include "los_spinlock.h" #include "los_task_pri.h" -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE #include "los_trace.h" #include "los_trace_frame.h" #endif @@ -100,7 +100,7 @@ STATIC const struct file_operations_vfs g_liteIpcFops = { .mmap = LiteIpcMmap, /* mmap */ }; -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE typedef enum { WRITE, WRITE_DROP, @@ -161,7 +161,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsLiteIpcInit(VOID) for (i = 0; i < LOSCFG_BASE_CORE_PROCESS_LIMIT; i++) { LOS_ListInit(&(g_ipcUsedNodelist[i])); } -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE ret = LOS_TraceReg(LOS_TRACE_IPC, OsIpcTrace, LOS_TRACE_IPC_NAME, LOS_TRACE_ENABLE); if (ret != LOS_OK) { PRINT_ERR("liteipc LOS_TraceReg failed:%d\n", ret); @@ -940,7 +940,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 CheckPara(IpcContent *content, UINT32 *dstTid) } #if (USE_TIMESTAMP == YES) if (now > msg->timestamp + LITEIPC_TIMEOUT_NS) { -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE IpcTrace(msg, WRITE_DROP, 0, msg->type); #endif PRINT_ERR("A timeout reply, request timestamp:%lld, now:%lld\n", msg->timestamp, now); @@ -998,7 +998,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 LiteIpcWrite(IpcContent *content) SCHEDULER_LOCK(intSave); LosTaskCB *tcb = OS_TCB_FROM_TID(dstTid); LOS_ListTailInsert(&(tcb->msgListHead), &(buf->listNode)); -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE IpcTrace(&buf->msg, WRITE, tcb->ipcStatus, buf->msg.type); #endif if (tcb->ipcStatus & IPC_THREAD_STATUS_PEND) { @@ -1058,13 +1058,13 @@ LITE_OS_SEC_TEXT STATIC UINT32 CheckRecievedMsg(IpcListNode *node, IpcContent *c ret = -EINVAL; } if (ret != LOS_OK) { -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE IpcTrace(&node->msg, READ_DROP, tcb->ipcStatus, node->msg.type); #endif (VOID)HandleSpecialObjects(LOS_CurTaskIDGet(), node, TRUE); (VOID)LiteIpcNodeFree(LOS_GetCurrProcessID(), (VOID *)node); } else { -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE IpcTrace(&node->msg, READ, tcb->ipcStatus, node->msg.type); #endif } @@ -1086,14 +1086,14 @@ LITE_OS_SEC_TEXT STATIC UINT32 LiteIpcRead(IpcContent *content) do { SCHEDULER_LOCK(intSave); if (LOS_ListEmpty(listHead)) { -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE IpcTrace(NULL, TRY_READ, tcb->ipcStatus, syncFlag ? MT_REPLY : MT_REQUEST); #endif tcb->ipcStatus |= IPC_THREAD_STATUS_PEND; OsTaskWaitSetPendMask(OS_TASK_WAIT_LITEIPC, OS_INVALID_VALUE, timeout); ret = OsSchedTaskWait(&g_ipcPendlist, timeout, TRUE); if (ret == LOS_ERRNO_TSK_TIMEOUT) { -#if (LOSCFG_KERNEL_TRACE == YES) +#ifdef LOSCFG_KERNEL_TRACE IpcTrace(NULL, READ_TIMEOUT, tcb->ipcStatus, syncFlag ? MT_REPLY : MT_REQUEST); #endif SCHEDULER_UNLOCK(intSave); diff --git a/kernel/extended/power/BUILD.gn b/kernel/extended/power/BUILD.gn new file mode 100644 index 00000000..d21ffda6 --- /dev/null +++ b/kernel/extended/power/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_PM) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "los_pm.c" ] +} diff --git a/kernel/extended/trace/BUILD.gn b/kernel/extended/trace/BUILD.gn new file mode 100644 index 00000000..ac772b6e --- /dev/null +++ b/kernel/extended/trace/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_TRACE) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_trace.c", + "los_trace_frame.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/extended/include/los_trace_pri.h b/kernel/extended/trace/los_trace_pri.h similarity index 100% rename from kernel/extended/include/los_trace_pri.h rename to kernel/extended/trace/los_trace_pri.h diff --git a/kernel/extended/vdso/BUILD.gn b/kernel/extended/vdso/BUILD.gn new file mode 100644 index 00000000..fd7608f5 --- /dev/null +++ b/kernel/extended/vdso/BUILD.gn @@ -0,0 +1,53 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_VDSO) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/los_vdso.c", + "src/los_vdso_text.S", + ] + + asmflags = [ "-DOHOS_VDSO_SO=\"OHOS-vdso.so\"" ] + deps = [ ":copy_ohos_vdso" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} + +copy("copy_ohos_vdso") { + deps = [ "usr:OHOS-vdso" ] + sources = [ get_path_info("usr/", "out_dir") + "/libOHOS-vdso.so" ] + outputs = [ "$root_out_dir/OHOS-vdso.so" ] +} diff --git a/kernel/extended/vdso/src/Makefile b/kernel/extended/vdso/src/Makefile index 90e2c714..f5de37ee 100644 --- a/kernel/extended/vdso/src/Makefile +++ b/kernel/extended/vdso/src/Makefile @@ -35,6 +35,6 @@ LOCAL_SRCS := $(wildcard *.c) $(wildcard *.S) LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/base/include -I $(LITEOSTOPDIR)/kernel/extended/include -I $(LITEOSTOPDIR)/kernel/extended/vdso/include -LOCAL_FLAGS := $(LOCAL_INCLUDE) +LOCAL_FLAGS := $(LOCAL_INCLUDE) -DOHOS_VDSO_SO=\"../usr/OHOS-vdso.so\" include $(MODULE) \ No newline at end of file diff --git a/kernel/extended/vdso/src/los_vdso_text.S b/kernel/extended/vdso/src/los_vdso_text.S index fcf8224e..c8e1f268 100644 --- a/kernel/extended/vdso/src/los_vdso_text.S +++ b/kernel/extended/vdso/src/los_vdso_text.S @@ -31,4 +31,4 @@ .globl __vdso_text_start .section .data.vdso.text __vdso_text_start: - .incbin "../usr/OHOS-vdso.so" \ No newline at end of file + .incbin OHOS_VDSO_SO \ No newline at end of file diff --git a/kernel/extended/vdso/usr/BUILD.gn b/kernel/extended/vdso/usr/BUILD.gn new file mode 100644 index 00000000..2c6edf94 --- /dev/null +++ b/kernel/extended/vdso/usr/BUILD.gn @@ -0,0 +1,62 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +shared_library("OHOS-vdso") { + sources = [ "los_vdso_sys.c" ] + + include_dirs = [ + "$LITEOSTOPDIR/kernel/extended/vdso/include", + "$LITEOSTOPDIR/kernel/include", + "$LITEOSTOPDIR/platform", + "$LITEOSTOPDIR/bsd/compat/linuxkpi/include", + ] + + cflags = [ + "-fPIC", + "-fno-common", + "-fno-strict-aliasing", + ] + + configs = [] + configs += [ "$LITEOSTOPDIR:los_common" ] + configs += [ "$LITEOSTOPDIR:los_nostdlib" ] + configs += [ "$LITEOSTOPDIR:arch_config" ] + + defines = [ "_XOPEN_SOURCE=700" ] + + ldflags = [ + "-Wl,-s", + "-Wl,-Bsymbolic", + "-Wl,-T" + rebase_path("los_vdso.ld", root_build_dir), + ] + + output_dir = target_out_dir +} diff --git a/kernel/extended/vdso/usr/Makefile b/kernel/extended/vdso/usr/Makefile index 33b04ebc..68819e19 100644 --- a/kernel/extended/vdso/usr/Makefile +++ b/kernel/extended/vdso/usr/Makefile @@ -34,13 +34,13 @@ VDSO_SO = OHOS-vdso VDSO_SRCS := los_vdso_sys.c VDSO_INCLUDE := -I $(LITEOSTOPDIR)/kernel/extended/vdso/include \ -I $(LITEOSTOPDIR)/kernel/include \ - -I $(LITEOSTOPDIR)/kernel/common \ + -I $(LITEOSTOPDIR)/platform \ -I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include VDSO_CCFLAGS := -nostdlib -fPIC -fno-common -fno-strict-aliasing \ $(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LITEOS_COPTS_OPTMIZE) ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -VDSO_CCFLAGS += $(LLVM_EXTRA_OPTS) --sysroot=$(SYSROOT_PATH) $(ARCH_CFLAGS) +VDSO_CCFLAGS += $(LLVM_EXTRA_OPTS) --sysroot=$(SYSROOT_PATH) endif VDSO_LDFLAGS := -shared -s -Bsymbolic -T los_vdso.ld diff --git a/kernel/include/los_memory.h b/kernel/include/los_memory.h index 3ced9ad0..8dd00599 100644 --- a/kernel/include/los_memory.h +++ b/kernel/include/los_memory.h @@ -77,19 +77,6 @@ extern UINT8 *m_aucSysMem0; */ extern UINT8 *m_aucSysMem1; -/** - * @ingroup los_memory - * The memory Maximum memory usage statistics. - * @attention - *
  • If running as debug mode, it will affect the performance of memory malloc and free.
  • - *
  • OS_MEM_WATERLINE=YES: open the function for Maximum memory usage statistics
  • - *
  • OS_MEM_WATERLINE=NO: close the function for Maximum memory usage statistics, it set to NO as usual
  • - *
- */ -#ifdef LOSCFG_MEM_WATERLINE -#define OS_MEM_WATERLINE YES -#endif - #ifdef LOSCFG_MEM_MUL_POOL /** * @ingroup los_memory @@ -141,7 +128,7 @@ typedef struct { UINT32 maxFreeNodeSize; UINT32 usedNodeNum; UINT32 freeNodeNum; -#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) +#ifdef LOSCFG_MEM_WATERLINE UINT32 usageWaterLine; #endif } LOS_MEM_POOL_STATUS; diff --git a/kernel/include/los_mp.h b/kernel/include/los_mp.h index 2b456620..dcb3e4cd 100644 --- a/kernel/include/los_mp.h +++ b/kernel/include/los_mp.h @@ -50,7 +50,7 @@ typedef enum { LOS_MP_IPI_HALT, } MP_IPI_TYPE; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP extern VOID LOS_MpSchedule(UINT32 target); extern VOID OsMpWakeHandler(VOID); extern VOID OsMpScheduleHandler(VOID); diff --git a/kernel/include/los_spinlock.h b/kernel/include/los_spinlock.h index 504fcfb0..8ee14b9d 100644 --- a/kernel/include/los_spinlock.h +++ b/kernel/include/los_spinlock.h @@ -49,14 +49,14 @@ extern INT32 ArchSpinTrylock(size_t *lock); typedef struct Spinlock { size_t rawLock; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 cpuid; VOID *owner; const CHAR *name; #endif } SPIN_LOCK_S; -#if (LOSCFG_KERNEL_SMP_LOCKDEP == YES) +#ifdef LOSCFG_KERNEL_SMP_LOCKDEP #define LOCKDEP_CHECK_IN(lock) OsLockDepCheckIn(lock) #define LOCKDEP_RECORD(lock) OsLockDepRecord(lock) #define LOCKDEP_CHECK_OUT(lock) OsLockDepCheckOut(lock) @@ -68,7 +68,7 @@ typedef struct Spinlock { #define LOCKDEP_CLEAR_LOCKS() #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #define SPINLOCK_OWNER_INIT NULL #define SPIN_LOCK_INITIALIZER(lockName) \ diff --git a/kernel/include/los_task.h b/kernel/include/los_task.h index 49df83b3..6477c735 100644 --- a/kernel/include/los_task.h +++ b/kernel/include/los_task.h @@ -498,7 +498,7 @@ typedef struct tagTskInitParam { UINTPTR auwArgs[4]; /**< Task parameters, of which the maximum number is four */ UINT32 uwStackSize; /**< Task stack size */ CHAR *pcName; /**< Task name */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT16 usCpuAffiMask; /**< Task cpu affinity mask */ #endif UINT32 uwResved; /**< It is automatically deleted if set to LOS_TASK_STATUS_DETACHED. diff --git a/kernel/user/BUILD.gn b/kernel/user/BUILD.gn new file mode 100644 index 00000000..975b37e4 --- /dev/null +++ b/kernel/user/BUILD.gn @@ -0,0 +1,63 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_name = "userinit" +executable(module_name) { + sources = [ "src/los_user_init.c" ] + + include_dirs = [ + "include", + "$LITEOSTOPDIR/syscall", + ] + + configs = [] + configs += [ + "$LITEOSTOPDIR:public", + "$LITEOSTOPDIR:los_config", + ] + + ldflags = [ + "-static", + "-Wl,-r", + ] + + output_dir = target_out_dir + output_name = "lib$module_name" + output_extension = "O" +} + +group("user") { + public_deps = [ ":$module_name" ] +} + +config("public") { + lib_dirs = [ "$target_out_dir/unstripped/bin" ] +} diff --git a/kernel_test.sources b/kernel_test.sources deleted file mode 100644 index cab52bfd..00000000 --- a/kernel_test.sources +++ /dev/null @@ -1 +0,0 @@ -../../kernel/liteos_a/test/apps/src/osTest.c diff --git a/lib/BUILD.gn b/lib/BUILD.gn new file mode 100644 index 00000000..03142ff2 --- /dev/null +++ b/lib/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("lib") { + deps = [ + "libc", + "libmbedtls", + "libscrew", + "libsec", + "zlib", + ] +} + +config("public") { + configs = [ + "libc:public", + "libmbedtls:public", + "libscrew:public", + "libsec:public", + "zlib:public", + ] +} diff --git a/lib/libc/BUILD.gn b/lib/libc/BUILD.gn new file mode 100644 index 00000000..d7087821 --- /dev/null +++ b/lib/libc/BUILD.gn @@ -0,0 +1,92 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +MUSLDIR = "$LITEOSTHIRDPARTY/musl" +OPTRTDIR = "$LITEOSTHIRDPARTY/optimized-routines" + +import("$MUSLDIR/porting/liteos_a/kernel/musl.gni") + +module_switch = defined(LOSCFG_LIB_LIBC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = MUSL_SRC_COMMON + + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + sources += MUSL_SRC_ARM + foreach(f, MUSL_SRC_ARM) { + sources -= [ string_replace(f, "/arm/", "/") ] + } + } + + if (LOSCFG_ARCH_ARM_VER == "armv7-a") { + sources -= [ + "$MUSLPORTINGDIR/src/string/memchr.c", + "$MUSLPORTINGDIR/src/string/memcpy.c", + "$MUSLPORTINGDIR/src/string/strcmp.c", + "$MUSLPORTINGDIR/src/string/strcpy.c", + "$MUSLPORTINGDIR/src/string/strlen.c", + ] + sources += [ + "$OPTRTDIR/string/arm/memchr.S", + "$OPTRTDIR/string/arm/memcpy.S", + "$OPTRTDIR/string/arm/strcmp.S", + "$OPTRTDIR/string/arm/strcpy.c", + "$OPTRTDIR/string/arm/strlen-armv6t2.S", + ] + } + + public_configs = [ ":public" ] + configs += [ ":private" ] +} + +config("public") { + include_dirs = [ "$MUSLPORTINGDIR/include" ] +} + +config("private") { + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags = [ + "-Wno-char-subscripts", + "-Wno-unknown-pragmas", + ] + } else { + cflags = [ + "-frounding-math", + "-Wno-unused-but-set-variable", + "-Wno-unknown-pragmas", + ] + } + + include_dirs = [ + "$MUSLPORTINGDIR/src/include", + "$MUSLPORTINGDIR/src/internal", + ] +} diff --git a/lib/libmbedtls/BUILD.gn b/lib/libmbedtls/BUILD.gn new file mode 100644 index 00000000..d9aa20af --- /dev/null +++ b/lib/libmbedtls/BUILD.gn @@ -0,0 +1,122 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_TZDRIVER) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/mbedtls/library/aes.c", + "$LITEOSTHIRDPARTY/mbedtls/library/aesni.c", + "$LITEOSTHIRDPARTY/mbedtls/library/arc4.c", + "$LITEOSTHIRDPARTY/mbedtls/library/aria.c", + "$LITEOSTHIRDPARTY/mbedtls/library/asn1parse.c", + "$LITEOSTHIRDPARTY/mbedtls/library/asn1write.c", + "$LITEOSTHIRDPARTY/mbedtls/library/base64.c", + "$LITEOSTHIRDPARTY/mbedtls/library/bignum.c", + "$LITEOSTHIRDPARTY/mbedtls/library/blowfish.c", + "$LITEOSTHIRDPARTY/mbedtls/library/camellia.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ccm.c", + "$LITEOSTHIRDPARTY/mbedtls/library/certs.c", + "$LITEOSTHIRDPARTY/mbedtls/library/chacha20.c", + "$LITEOSTHIRDPARTY/mbedtls/library/chachapoly.c", + "$LITEOSTHIRDPARTY/mbedtls/library/cipher.c", + "$LITEOSTHIRDPARTY/mbedtls/library/cipher_wrap.c", + "$LITEOSTHIRDPARTY/mbedtls/library/cmac.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ctr_drbg.c", + "$LITEOSTHIRDPARTY/mbedtls/library/debug.c", + "$LITEOSTHIRDPARTY/mbedtls/library/des.c", + "$LITEOSTHIRDPARTY/mbedtls/library/dhm.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecdh.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecdsa.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecjpake.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecp.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecp_curves.c", + "$LITEOSTHIRDPARTY/mbedtls/library/entropy.c", + "$LITEOSTHIRDPARTY/mbedtls/library/entropy_poll.c", + "$LITEOSTHIRDPARTY/mbedtls/library/error.c", + "$LITEOSTHIRDPARTY/mbedtls/library/gcm.c", + "$LITEOSTHIRDPARTY/mbedtls/library/havege.c", + "$LITEOSTHIRDPARTY/mbedtls/library/hkdf.c", + "$LITEOSTHIRDPARTY/mbedtls/library/hmac_drbg.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md2.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md4.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md5.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md_wrap.c", + "$LITEOSTHIRDPARTY/mbedtls/library/memory_buffer_alloc.c", + "$LITEOSTHIRDPARTY/mbedtls/library/net_sockets.c", + "$LITEOSTHIRDPARTY/mbedtls/library/nist_kw.c", + "$LITEOSTHIRDPARTY/mbedtls/library/oid.c", + "$LITEOSTHIRDPARTY/mbedtls/library/padlock.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pem.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pk.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pk_wrap.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkcs11.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkcs12.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkcs5.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkparse.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkwrite.c", + "$LITEOSTHIRDPARTY/mbedtls/library/platform.c", + "$LITEOSTHIRDPARTY/mbedtls/library/platform_util.c", + "$LITEOSTHIRDPARTY/mbedtls/library/poly1305.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ripemd160.c", + "$LITEOSTHIRDPARTY/mbedtls/library/rsa.c", + "$LITEOSTHIRDPARTY/mbedtls/library/rsa_internal.c", + "$LITEOSTHIRDPARTY/mbedtls/library/sha1.c", + "$LITEOSTHIRDPARTY/mbedtls/library/sha256.c", + "$LITEOSTHIRDPARTY/mbedtls/library/sha512.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_cache.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_ciphersuites.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_cli.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_cookie.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_srv.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_ticket.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_tls.c", + "$LITEOSTHIRDPARTY/mbedtls/library/threading.c", + "$LITEOSTHIRDPARTY/mbedtls/library/timing.c", + "$LITEOSTHIRDPARTY/mbedtls/library/version.c", + "$LITEOSTHIRDPARTY/mbedtls/library/version_features.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_create.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_crl.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_crt.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_csr.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509write_crt.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509write_csr.c", + "$LITEOSTHIRDPARTY/mbedtls/library/xtea.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/mbedtls/include" ] +} diff --git a/lib/libscrew/BUILD.gn b/lib/libscrew/BUILD.gn new file mode 100644 index 00000000..87b4cae6 --- /dev/null +++ b/lib/libscrew/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/los_crc32.c", + "src/los_rbtree.c", + ] + + sources += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/libkern/crc32.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/lib/libsec/BUILD.gn b/lib/libsec/BUILD.gn new file mode 100644 index 00000000..f93a7652 --- /dev/null +++ b/lib/libsec/BUILD.gn @@ -0,0 +1,83 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_LIB_LIBC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/bounds_checking_function/src/fscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/fwscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/gets_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/memcpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/memmove_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/memset_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/scanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/securecutil.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureinput_a.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureinput_w.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureprintoutput_a.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureprintoutput_w.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/snprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/sprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/sscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strcat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strcpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strncat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strncpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strtok_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/swprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/swscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vfscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vfwscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vsnprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vsprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vsscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vswprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vswscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vwscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcscat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcscpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcsncat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcsncpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcstok_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wmemcpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wmemmove_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wscanf_s.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/bounds_checking_function/include" ] + defines = [ "SECUREC_IN_KERNEL=0" ] +} diff --git a/lib/zlib/BUILD.gn b/lib/zlib/BUILD.gn new file mode 100644 index 00000000..5b75164e --- /dev/null +++ b/lib/zlib/BUILD.gn @@ -0,0 +1,62 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_LIB_ZLIB) +module_name = "z" +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/zlib/adler32.c", + "$LITEOSTHIRDPARTY/zlib/compress.c", + "$LITEOSTHIRDPARTY/zlib/crc32.c", + "$LITEOSTHIRDPARTY/zlib/deflate.c", + "$LITEOSTHIRDPARTY/zlib/gzclose.c", + "$LITEOSTHIRDPARTY/zlib/gzlib.c", + "$LITEOSTHIRDPARTY/zlib/gzread.c", + "$LITEOSTHIRDPARTY/zlib/gzwrite.c", + "$LITEOSTHIRDPARTY/zlib/infback.c", + "$LITEOSTHIRDPARTY/zlib/inffast.c", + "$LITEOSTHIRDPARTY/zlib/inflate.c", + "$LITEOSTHIRDPARTY/zlib/inftrees.c", + "$LITEOSTHIRDPARTY/zlib/trees.c", + "$LITEOSTHIRDPARTY/zlib/uncompr.c", + "$LITEOSTHIRDPARTY/zlib/zutil.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/zlib" ] +} + +group("zlib") { + public_deps = [ ":$module_name" ] +} diff --git a/liteos.gni b/liteos.gni new file mode 100644 index 00000000..5e2e723c --- /dev/null +++ b/liteos.gni @@ -0,0 +1,63 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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("$root_out_dir/config.gni") + +LITEOSTOPDIR = "//kernel/liteos_a" +LITEOSTHIRDPARTY = "//third_party" +HDFTOPDIR = "//drivers/adapter/khdf/liteos" + +template("kernel_module") { + if (defined(invoker.module_switch) && !invoker.module_switch) { + group(target_name) { + not_needed(invoker, "*") + } + } else { + static_library(target_name) { + forward_variables_from(invoker, "*") + } + } +} + +template("config") { + config(target_name) { + if (defined(invoker.module_switch) && !invoker.module_switch && target_name == "public") { + not_needed(invoker, "*") + } else { + forward_variables_from(invoker, "*") + } + } +} + +set_defaults("kernel_module") { + configs = [ + "$LITEOSTOPDIR:public", + "$LITEOSTOPDIR:los_config", + ] +} diff --git a/net/BUILD.gn b/net/BUILD.gn new file mode 100644 index 00000000..9dcb78a2 --- /dev/null +++ b/net/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("net") { + deps = [ + "lwip-2.1", + "telnet", + ] +} + +config("public") { + configs = [ + "lwip-2.1:public", + "telnet:public", + ] +} diff --git a/net/Kconfig b/net/Kconfig index 36a9e16b..ca7f8458 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -17,7 +17,7 @@ config NET_LWIP_SACK choice depends on NET_LWIP_SACK prompt "Lwipsack" - default y + default NET_LWIP_SACK_2_1 help Enable Lwipsack for 2.x diff --git a/net/lwip-2.1/BUILD.gn b/net/lwip-2.1/BUILD.gn new file mode 100644 index 00000000..f4009b22 --- /dev/null +++ b/net/lwip-2.1/BUILD.gn @@ -0,0 +1,63 @@ +# Copyright (c) 2021-2021 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_a/liteos.gni") +import("$LITEOSTHIRDPARTY/lwip/lwip.gni") +import("lwip_porting.gni") + +module_switch = defined(LOSCFG_NET_LWIP_SACK_2_1) +module_name = "lwip" +kernel_module(module_name) { + include_dirs = [ "$LWIP_PORTING_DIR/enhancement/include" ] + + sources = LWIP_PORTING_FILES + LWIPNOAPPSFILES + + sources -= [ + "$LWIPDIR/api/sockets.c", + "$LWIPDIR/core/ipv4/dhcp.c", + "$LWIPDIR/core/ipv4/etharp.c", + ] + + public_configs = [ ":public" ] + + defines = [ + "__LWIP__", + "LWIP_NOASSERT", + "_BSD_SOURCE=1", + ] +} + +config("public") { + include_dirs = [ "../mac" ] + include_dirs += LWIP_PORTING_INCLUDE_DIRS + include_dirs += LWIP_INCLUDE_DIRS +} + +group("lwip-2.1") { + public_deps = [ ":$module_name" ] +} diff --git a/net/lwip-2.1/lwip_porting.gni b/net/lwip-2.1/lwip_porting.gni new file mode 100644 index 00000000..1f373670 --- /dev/null +++ b/net/lwip-2.1/lwip_porting.gni @@ -0,0 +1,40 @@ +# Copyright (c) 2021-2021 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. + +LWIP_PORTING_DIR = get_path_info(".", "abspath") + +LWIP_PORTING_INCLUDE_DIRS = [ "$LWIP_PORTING_DIR/porting/include" ] + +LWIP_PORTING_FILES = [ + "$LWIP_PORTING_DIR/porting/src/driverif.c", + "$LWIP_PORTING_DIR/porting/src/sockets.c", + "$LWIP_PORTING_DIR/porting/src/sys_arch.c", + "$LWIP_PORTING_DIR/enhancement/src/api_shell.c", + "$LWIP_PORTING_DIR/enhancement/src/fixme.c", + "$LWIP_PORTING_DIR/enhancement/src/dhcps.c", +] diff --git a/net/lwip-2.1/porting/src/sys_arch.c b/net/lwip-2.1/porting/src/sys_arch.c index 9826fba7..7e08ec57 100644 --- a/net/lwip-2.1/porting/src/sys_arch.c +++ b/net/lwip-2.1/porting/src/sys_arch.c @@ -40,11 +40,11 @@ #include #include -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP SPIN_LOCK_INIT(arch_protect_spin); static u32_t lwprot_thread = LOS_ERRNO_TSK_ID_INVALID; static int lwprot_count = 0; -#endif /* LOSCFG_KERNEL_SMP == YES */ +#endif /* LOSCFG_KERNEL_SMP */ #define ROUND_UP_DIV(val, div) (((val) + (div) - 1) / (div)) @@ -103,7 +103,7 @@ u16_t lwip_standard_chksum(const void *dataptr, int len) sys_prot_t sys_arch_protect(void) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* Note that we are using spinlock instead of mutex for LiteOS-SMP here: * 1. spinlock is more effective for short critical region protection. * 2. this function is called only in task context, not in interrupt handler. @@ -121,14 +121,14 @@ sys_prot_t sys_arch_protect(void) } #else LOS_TaskLock(); -#endif /* LOSCFG_KERNEL_SMP == YES */ +#endif /* LOSCFG_KERNEL_SMP */ return 0; /* return value is unused */ } void sys_arch_unprotect(sys_prot_t pval) { LWIP_UNUSED_ARG(pval); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP if (lwprot_thread == LOS_CurTaskIDGet()) { lwprot_count--; if (lwprot_count == 0) { @@ -138,7 +138,7 @@ void sys_arch_unprotect(sys_prot_t pval) } #else LOS_TaskUnlock(); -#endif /* LOSCFG_KERNEL_SMP == YES */ +#endif /* LOSCFG_KERNEL_SMP */ } diff --git a/net/telnet/BUILD.gn b/net/telnet/BUILD.gn new file mode 100644 index 00000000..0601c60a --- /dev/null +++ b/net/telnet/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_NET_TELNET) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/telnet_dev.c", + "src/telnet_loop.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/net/telnet/src/telnet_dev.c b/net/telnet/src/telnet_dev.c index 06ab5685..0af77518 100644 --- a/net/telnet/src/telnet_dev.c +++ b/net/telnet/src/telnet_dev.c @@ -38,7 +38,7 @@ #include "pthread.h" #include "los_printf.h" -#if (LOSCFG_BASE_CORE_SWTMR == YES) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE #include "los_swtmr_pri.h" #endif #include "los_sched_pri.h" @@ -265,7 +265,7 @@ STATIC ssize_t TelnetWrite(struct file *file, const CHAR *buf, const size_t bufL } if (telnetDev->clientFd != 0) { -#if (LOSCFG_BASE_CORE_SWTMR == YES) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE /* DO NOT call blocking API in software timer task */ if (((LosTaskCB*)OsCurrTaskGet())->taskEntry == (TSK_ENTRY_FUNC)OsSwtmrTask) { TelnetUnlock(); diff --git a/platform/BUILD.gn b/platform/BUILD.gn new file mode 100644 index 00000000..13c15ef1 --- /dev/null +++ b/platform/BUILD.gn @@ -0,0 +1,101 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +cmd = "if [ -f " + rebase_path("//$LOSCFG_BOARD_CONFIG_PATH/BUILD.gn") + " ]; then echo true; else echo false; fi" +HAVE_BOARD_CONFIG = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") + +module_name = "bsp" +kernel_module(module_name) { + sources = [ "main.c" ] + + sources += [ + "hwi_shell.c", + "los_cir_buf.c", + "los_config.c", + "los_excinfo.c", + "los_init.c", + "los_magickey.c", + "los_printf.c", + "los_seq_buf.c", + ] + + if (defined(LOSCFG_FS_VFS)) { + sources += [ + "console.c", + "virtual_serial.c", + ] + } + + if (defined(LOSCFG_BASE_CORE_HILOG)) { + sources += [ "los_hilog.c" ] + } + + public_configs = [ ":public" ] +} + +group("platform") { + public_deps = [ ":$module_name" ] + deps = [ ":board.ld" ] + if (HAVE_BOARD_CONFIG) { + deps += [ "//$LOSCFG_BOARD_CONFIG_PATH" ] + } +} + +config("public") { + include_dirs = [ + ".", + ] + if (HAVE_BOARD_CONFIG) { + configs = [ "//$LOSCFG_BOARD_CONFIG_PATH:public" ] + } +} + +source_set("board") { + sources = [ "board.ld.S" ] + + configs = [] + configs += [ + "$LITEOSTOPDIR:los_config", + "$LITEOSTOPDIR/kernel/base:public", + ":public", + ] + + asmflags = [ + "-P", + "-E", + ] +} + +copy("board.ld") { + deps = [ ":board" ] + sources = [ "$target_out_dir/board.board.ld.o" ] + outputs = [ "$root_out_dir/board.ld" ] +} diff --git a/platform/Makefile b/platform/Makefile index 940337fd..94f9dd24 100644 --- a/platform/Makefile +++ b/platform/Makefile @@ -36,13 +36,12 @@ LOCAL_SRCS = $(wildcard ./main.c) LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/compat/posix/src \ -I $(LITEOSTOPDIR)/bsd/dev/random -LOCAL_SRCS += $(wildcard ../kernel/common/*.c) -LOCAL_SRCS := $(filter-out ../kernel/common/los_rootfs.c, $(LOCAL_SRCS)) +LOCAL_SRCS += $(wildcard *.c) ifneq ($(LOSCFG_FS_VFS), y) -LOCAL_SRCS := $(filter-out ../kernel/common/console.c ../kernel/common/virtual_serial.c, $(LOCAL_SRCS)) +LOCAL_SRCS := $(filter-out console.c virtual_serial.c, $(LOCAL_SRCS)) endif ifneq ($(LOSCFG_BASE_CORE_HILOG), y) -LOCAL_SRCS := $(filter-out ../kernel/common/los_hilog.c, $(LOCAL_SRCS)) +LOCAL_SRCS := $(filter-out los_hilog.c, $(LOCAL_SRCS)) endif ifeq ($(LOSCFG_KERNEL_TICKLESS), y) diff --git a/platform/bsp.mk b/platform/bsp.mk index c937f81a..0d1fe022 100644 --- a/platform/bsp.mk +++ b/platform/bsp.mk @@ -49,7 +49,8 @@ PLATFORM_BSP_BASE := $(LITEOSTOPDIR)/platform PLATFORM_INCLUDE := -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) \ -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include \ - -I $(PLATFORM_BSP_BASE)/../kernel/common \ + -I $(PLATFORM_BSP_BASE)/../kernel/common/rootfs \ + -I $(PLATFORM_BSP_BASE) \ -I $(PLATFORM_BSP_BASE)/../../../drivers/liteos/platform/pm \ -I $(PLATFORM_BSP_BASE)/hw/include \ -I $(PLATFORM_BSP_BASE)/include diff --git a/kernel/common/console.c b/platform/console.c similarity index 99% rename from kernel/common/console.c rename to platform/console.c index c70466c3..4e09335f 100644 --- a/kernel/common/console.c +++ b/platform/console.c @@ -437,10 +437,10 @@ STATIC VOID StoreReadChar(CONSOLE_CB *consoleCB, char ch, INT32 readcount) VOID KillPgrp() { - INT32 consoleId = -1; + INT32 consoleId; LosProcessCB *process = OsCurrProcessGet(); - if ((process->consoleID > CONSOLE_NUM -1 ) || (process->consoleID < 0)) { + if ((process->consoleID > CONSOLE_NUM - 1) || (process->consoleID < 0)) { return; } @@ -842,7 +842,7 @@ STATIC INT32 ConsoleSetSW(CONSOLE_CB *consoleCB, unsigned long arg) return LOS_OK; } -#define DEFAULT_WINDOW_SIZE_COL 80 +#define DEFAULT_WINDOW_SIZE_COL 400 #define DEFAULT_WINDOW_SIZE_ROW 24 STATIC INT32 ConsoleGetWinSize(unsigned long arg) { @@ -872,7 +872,7 @@ STATIC INT32 ConsoleGetTermios(unsigned long arg) return -EFAULT; } - if(LOS_ArchCopyToUser((VOID *)arg, &consoleCB->consoleTermios, sizeof(struct termios)) != 0) { + if (LOS_ArchCopyToUser((VOID *)arg, &consoleCB->consoleTermios, sizeof(struct termios)) != 0) { return -EFAULT; } else { return LOS_OK; @@ -1662,7 +1662,7 @@ STATIC UINT32 ConsoleSendTask(UINTPTR param) return LOS_OK; } -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP VOID OsWaitConsoleSendTaskPend(UINT32 taskID) { UINT32 i; diff --git a/kernel/common/console.h b/platform/console.h similarity index 99% rename from kernel/common/console.h rename to platform/console.h index ff50d3c8..68018385 100644 --- a/kernel/common/console.h +++ b/platform/console.h @@ -120,7 +120,7 @@ extern INT32 FilepWrite(struct file *filep, const struct file_operations_vfs *fo extern INT32 FilepPoll(struct file *filep, const struct file_operations_vfs *fops, poll_table *fds); extern INT32 FilepIoctl(struct file *filep, const struct file_operations_vfs *fops, INT32 cmd, unsigned long arg); extern INT32 GetFilepOps(const struct file *filep, struct file **privFilep, const struct file_operations_vfs **fops); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP extern VOID OsWaitConsoleSendTaskPend(UINT32 taskID); extern VOID OsWakeConsoleSendTask(VOID); #endif diff --git a/kernel/common/hwi_shell.c b/platform/hwi_shell.c similarity index 100% rename from kernel/common/hwi_shell.c rename to platform/hwi_shell.c diff --git a/kernel/common/los_builddef.h b/platform/los_builddef.h similarity index 100% rename from kernel/common/los_builddef.h rename to platform/los_builddef.h diff --git a/kernel/common/los_cir_buf.c b/platform/los_cir_buf.c similarity index 100% rename from kernel/common/los_cir_buf.c rename to platform/los_cir_buf.c diff --git a/kernel/common/los_cir_buf_pri.h b/platform/los_cir_buf_pri.h similarity index 100% rename from kernel/common/los_cir_buf_pri.h rename to platform/los_cir_buf_pri.h diff --git a/kernel/common/los_config.c b/platform/los_config.c similarity index 96% rename from kernel/common/los_config.c rename to platform/los_config.c index afd45a78..d99161ab 100644 --- a/kernel/common/los_config.c +++ b/platform/los_config.c @@ -65,7 +65,7 @@ SystemRebootFunc OsGetRebootHook(VOID) extern UINT32 OsSystemInit(VOID); extern VOID SystemInit(VOID); -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP extern VOID release_secondary_cores(VOID); #endif @@ -83,14 +83,14 @@ LITE_OS_SEC_TEXT_INIT STATIC UINT32 EarliestInit(VOID) LITE_OS_SEC_TEXT_INIT STATIC UINT32 ArchEarlyInit(VOID) { - UINT32 ret = LOS_OK; + UINT32 ret; /* set system counter freq */ #ifndef LOSCFG_TEE_ENABLE HalClockFreqWrite(OS_SYS_CLOCK); #endif -#if (LOSCFG_PLATFORM_HWI == 1) +#ifdef LOSCFG_PLATFORM_HWI OsHwiInit(); #endif @@ -118,7 +118,7 @@ LITE_OS_SEC_TEXT_INIT STATIC UINT32 OsIpcInit(VOID) { UINT32 ret; -#if (LOSCFG_BASE_IPC_SEM == 1) +#ifdef LOSCFG_BASE_IPC_SEM ret = OsSemInit(); if (ret != LOS_OK) { PRINT_ERR("OsSemInit error\n"); @@ -126,7 +126,7 @@ LITE_OS_SEC_TEXT_INIT STATIC UINT32 OsIpcInit(VOID) } #endif -#if (LOSCFG_BASE_IPC_QUEUE == 1) +#ifdef LOSCFG_BASE_IPC_QUEUE ret = OsQueueInit(); if (ret != LOS_OK) { PRINT_ERR("OsQueueInit error\n"); @@ -151,7 +151,7 @@ LITE_OS_SEC_TEXT_INIT STATIC UINT32 PlatformInit(VOID) LITE_OS_SEC_TEXT_INIT STATIC UINT32 KModInit(VOID) { -#if (LOSCFG_BASE_CORE_SWTMR == 1) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE OsSwtmrInit(); #endif return LOS_OK; @@ -167,7 +167,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsSystemInfo(VOID) PRINT_RELEASE("\n******************Welcome******************\n\n" "Processor : %s" -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP " * %d\n" "Run Mode : SMP\n" #else @@ -179,7 +179,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsSystemInfo(VOID) "Kernel : %s %d.%d.%d.%d/%s\n" "\n*******************************************\n", LOS_CpuInfo(), -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP LOSCFG_KERNEL_SMP_CORE_NUM, #endif HalIrqVersion(), __DATE__, __TIME__,\ @@ -265,7 +265,7 @@ LITE_OS_SEC_TEXT_INIT INT32 OsMain(VOID) OsInitCall(LOS_INIT_LEVEL_KMOD_EXTENDED); -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP release_secondary_cores(); #endif @@ -303,7 +303,7 @@ STATIC UINT32 OsSystemInitTaskCreate(VOID) sysTask.pcName = "SystemInit"; sysTask.usTaskPrio = LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO; sysTask.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP sysTask.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif return LOS_TaskCreate(&taskID, &sysTask); diff --git a/kernel/common/los_config.h b/platform/los_config.h similarity index 92% rename from kernel/common/los_config.h rename to platform/los_config.h index 520bf56a..36c3c4d5 100644 --- a/kernel/common/los_config.h +++ b/platform/los_config.h @@ -115,17 +115,16 @@ extern UINT32 __heap_end; * @ingroup los_config * External configuration item for timer tailoring */ -#ifndef LOSCFG_BASE_CORE_TICK_HW_TIME -#define LOSCFG_BASE_CORE_TICK_HW_TIME NO +#if defined(LOSCFG_BASE_CORE_TICK_HW_TIME) && (LOSCFG_BASE_CORE_TICK_HW_TIME == 0) +#undef LOSCFG_BASE_CORE_TICK_HW_TIME #endif - /****************************** Hardware interrupt module configuration ******************************/ /** * @ingroup los_config * Configuration item for hardware interrupt tailoring */ #ifndef LOSCFG_PLATFORM_HWI -#define LOSCFG_PLATFORM_HWI YES +#define LOSCFG_PLATFORM_HWI #endif /** @@ -221,15 +220,7 @@ extern UINT32 __heap_end; * Configuration item for task (stack) monitoring module tailoring */ #ifndef LOSCFG_BASE_CORE_TSK_MONITOR -#define LOSCFG_BASE_CORE_TSK_MONITOR YES -#endif - -/** - * @ingroup los_config - * Configuration item for task perf task filter hook - */ -#ifndef OS_PERF_TSK_FILTER -#define OS_PERF_TSK_FILTER NO +#define LOSCFG_BASE_CORE_TSK_MONITOR #endif /****************************** Semaphore module configuration ******************************/ @@ -238,7 +229,7 @@ extern UINT32 __heap_end; * Configuration item for semaphore module tailoring */ #ifndef LOSCFG_BASE_IPC_SEM -#define LOSCFG_BASE_IPC_SEM YES +#define LOSCFG_BASE_IPC_SEM #endif /** @@ -263,7 +254,7 @@ extern UINT32 __heap_end; * Configuration item for mutex module tailoring */ #ifndef LOSCFG_BASE_IPC_MUX -#define LOSCFG_BASE_IPC_MUX YES +#define LOSCFG_BASE_IPC_MUX #endif /****************************** Queue module configuration ********************************/ @@ -272,7 +263,7 @@ extern UINT32 __heap_end; * Configuration item for queue module tailoring */ #ifndef LOSCFG_BASE_IPC_QUEUE -#define LOSCFG_BASE_IPC_QUEUE YES +#define LOSCFG_BASE_IPC_QUEUE #endif /** @@ -283,14 +274,20 @@ extern UINT32 __heap_end; #define LOSCFG_BASE_IPC_QUEUE_LIMIT 1024 #endif /****************************** Software timer module configuration **************************/ -#if (LOSCFG_BASE_IPC_QUEUE == YES) +#ifdef LOSCFG_BASE_IPC_QUEUE /** * @ingroup los_config * Configuration item for software timer module tailoring */ -#ifndef LOSCFG_BASE_CORE_SWTMR -#define LOSCFG_BASE_CORE_SWTMR YES +#ifndef LOSCFG_BASE_CORE_SWTMR_ENABLE +#define LOSCFG_BASE_CORE_SWTMR_ENABLE +#endif + +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE +#define LOSCFG_BASE_CORE_SWTMR 1 +#else +#define LOSCFG_BASE_CORE_SWTMR 0 #endif /** @@ -338,23 +335,7 @@ extern UINT32 __heap_end; #endif /****************************** SMP module configuration **************************/ -#ifndef LOSCFG_KERNEL_SMP -#define LOSCFG_KERNEL_SMP NO -#endif - -#ifndef LOSCFG_KERNEL_SMP_LOCKDEP -#define LOSCFG_KERNEL_SMP_LOCKDEP NO -#endif - -#ifndef LOSCFG_KERNEL_SMP_TASK_SYNC -#define LOSCFG_KERNEL_SMP_TASK_SYNC NO -#endif - -#ifndef LOSCFG_KERNEL_SCHED_STATISTICS -#define LOSCFG_KERNEL_SCHED_STATISTICS NO -#endif - -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #define LOSCFG_KERNEL_CORE_NUM LOSCFG_KERNEL_SMP_CORE_NUM #else #define LOSCFG_KERNEL_CORE_NUM 1 @@ -391,11 +372,6 @@ extern UINT32 __heap_end; #define VERSION_NUM(a, b, c, d) (((a) << 24) | ((b) << 16) | (c) << 8 | (d)) #define KERNEL_OPEN_VERSION_NUM VERSION_NUM(KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE) -/****************************** Dynamic loading module configuration **************************/ -#ifndef OS_AUTOINIT_DYNLOADER -#define OS_AUTOINIT_DYNLOADER YES -#endif - /****************************** Exception information configuration ******************************/ #ifdef LOSCFG_SAVE_EXCINFO /** diff --git a/kernel/common/los_excinfo.c b/platform/los_excinfo.c similarity index 98% rename from kernel/common/los_excinfo.c rename to platform/los_excinfo.c index b18ee23b..7bf01236 100644 --- a/kernel/common/los_excinfo.c +++ b/platform/los_excinfo.c @@ -34,6 +34,10 @@ #ifdef LOSCFG_SHELL #include "shcmd.h" #endif +#ifdef LOSCFG_FS_VFS +#include "fs/fs.h" +#include "fs/fs_operation.h" +#endif #ifdef LOSCFG_SAVE_EXCINFO STATIC log_read_write_fn g_excInfoRW = NULL; /* the hook of read-writing exception information */ diff --git a/kernel/common/los_excinfo_pri.h b/platform/los_excinfo_pri.h similarity index 100% rename from kernel/common/los_excinfo_pri.h rename to platform/los_excinfo_pri.h diff --git a/kernel/common/los_hilog.c b/platform/los_hilog.c similarity index 100% rename from kernel/common/los_hilog.c rename to platform/los_hilog.c diff --git a/kernel/common/los_hilog.h b/platform/los_hilog.h similarity index 100% rename from kernel/common/los_hilog.h rename to platform/los_hilog.h diff --git a/kernel/common/los_init.c b/platform/los_init.c similarity index 100% rename from kernel/common/los_init.c rename to platform/los_init.c diff --git a/kernel/common/los_init.h b/platform/los_init.h similarity index 100% rename from kernel/common/los_init.h rename to platform/los_init.h diff --git a/kernel/common/los_init_info.h b/platform/los_init_info.h similarity index 100% rename from kernel/common/los_init_info.h rename to platform/los_init_info.h diff --git a/kernel/common/los_init_pri.h b/platform/los_init_pri.h similarity index 100% rename from kernel/common/los_init_pri.h rename to platform/los_init_pri.h diff --git a/kernel/common/los_magickey.c b/platform/los_magickey.c similarity index 93% rename from kernel/common/los_magickey.c rename to platform/los_magickey.c index 7e5f00ee..1db5c88c 100644 --- a/kernel/common/los_magickey.c +++ b/platform/los_magickey.c @@ -66,12 +66,6 @@ STATIC MagicKeyOp g_magicHelpOp = { .magicKey = 0x1a /* ctrl + z */ }; -STATIC MagicKeyOp g_magicKillPgrp = { - .opHandler = KillPgrp, - .helpMsg = "Show all magic op key(ctrl+c) ", - .magicKey = 0x03 /* ctrl + c */ -}; - /* * NOTICE:Suggest don't use * ctrl+h/backspace=0x8, @@ -87,7 +81,7 @@ STATIC MagicKeyOp *g_magicOpTable[MAGIC_KEY_NUM] = { &g_magicPanicOp, /* ctrl + p */ &g_magicTaskShowOp, /* ctrl + t */ &g_magicHelpOp, /* ctrl + z */ - &g_magicKillPgrp /* ctrl + c */ + NULL }; STATIC VOID OsMagicHelp(VOID) @@ -129,7 +123,11 @@ INT32 CheckMagicKey(CHAR key) #ifdef LOSCFG_ENABLE_MAGICKEY INT32 i; STATIC UINT32 magicKeySwitch = 0; - if (key == 0x12) { /* ctrl + r */ + + if (key == 0x03) { /* ctrl + c */ + KillPgrp(); + return 0; + } else if (key == 0x12) { /* ctrl + r */ magicKeySwitch = ~magicKeySwitch; if (magicKeySwitch != 0) { PRINTK("Magic key on\n"); @@ -137,11 +135,7 @@ INT32 CheckMagicKey(CHAR key) PRINTK("Magic key off\n"); } return 1; - } else if (key == 0x03){ /* ctrl + c */ - KillPgrp(); - return 0; } - if (magicKeySwitch != 0) { for (i = 0; i < MAGIC_KEY_NUM; i++) { if (g_magicOpTable[i] != NULL && key == g_magicOpTable[i]->magicKey) { diff --git a/kernel/common/los_magickey.h b/platform/los_magickey.h similarity index 100% rename from kernel/common/los_magickey.h rename to platform/los_magickey.h diff --git a/kernel/common/los_printf.c b/platform/los_printf.c similarity index 100% rename from kernel/common/los_printf.c rename to platform/los_printf.c diff --git a/kernel/common/los_seq_buf.c b/platform/los_seq_buf.c similarity index 100% rename from kernel/common/los_seq_buf.c rename to platform/los_seq_buf.c diff --git a/kernel/common/los_seq_buf.h b/platform/los_seq_buf.h similarity index 100% rename from kernel/common/los_seq_buf.h rename to platform/los_seq_buf.h diff --git a/kernel/common/los_timer_pri.h b/platform/los_timer_pri.h similarity index 100% rename from kernel/common/los_timer_pri.h rename to platform/los_timer_pri.h diff --git a/platform/main.c b/platform/main.c index a021b1d9..7a9aa62c 100644 --- a/platform/main.c +++ b/platform/main.c @@ -40,13 +40,13 @@ #include "los_swtmr_pri.h" #include "los_task_pri.h" -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP STATIC Atomic g_ncpu = 1; #endif LITE_OS_SEC_TEXT_INIT VOID secondary_cpu_start(VOID) { -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP UINT32 cpuid = ArchCurrCpuid(); OsCurrTaskSet(OsGetMainTask()); @@ -73,7 +73,7 @@ LITE_OS_SEC_TEXT_INIT VOID secondary_cpu_start(VOID) OsCurrProcessSet(OS_PCB_FROM_PID(OsGetKernelInitProcessID())); OsInitCall(LOS_INIT_LEVEL_KMOD_BASIC); -#if (LOSCFG_BASE_CORE_SWTMR == 1) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE OsSwtmrInit(); #endif @@ -89,7 +89,7 @@ LITE_OS_SEC_TEXT_INIT VOID secondary_cpu_start(VOID) #endif } -#if (LOSCFG_KERNEL_SMP == 1) +#ifdef LOSCFG_KERNEL_SMP #ifdef LOSCFG_TEE_ENABLE #define TSP_CPU_ON 0xb2000011UL STATIC INT32 raw_smc_send(UINT32 cmd) diff --git a/kernel/common/sys_config.h b/platform/sys_config.h similarity index 100% rename from kernel/common/sys_config.h rename to platform/sys_config.h diff --git a/kernel/common/virtual_serial.c b/platform/virtual_serial.c similarity index 100% rename from kernel/common/virtual_serial.c rename to platform/virtual_serial.c diff --git a/kernel/common/virtual_serial.h b/platform/virtual_serial.h similarity index 100% rename from kernel/common/virtual_serial.h rename to platform/virtual_serial.h diff --git a/security/BUILD.gn b/security/BUILD.gn new file mode 100644 index 00000000..1a7f6f3f --- /dev/null +++ b/security/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("security") { + deps = [ + "cap", + "vid", + ] +} + +config("public") { + configs = [ + "cap:public", + "vid:public", + ] +} diff --git a/security/cap/BUILD.gn b/security/cap/BUILD.gn new file mode 100644 index 00000000..a4e95342 --- /dev/null +++ b/security/cap/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_SECURITY_CAPABILITY) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "capability.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/security/vid/BUILD.gn b/security/vid/BUILD.gn new file mode 100644 index 00000000..7b53edc7 --- /dev/null +++ b/security/vid/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_SECURITY_VID) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "vid.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/shell/BUILD.gn b/shell/BUILD.gn index 6e8dc0bb..c3b8e522 100644 --- a/shell/BUILD.gn +++ b/shell/BUILD.gn @@ -25,19 +25,28 @@ # 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. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") -lite_component("shell") { - version = "1.0.0" - dependences = [ - "fs:^1.0.0", - "kernel:^1.0.0", +module_switch = defined(LOSCFG_SHELL) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "full/src/base/shcmd.c", + "full/src/base/shcmdparse.c", + "full/src/base/shell_lk.c", + "full/src/base/shmsg.c", + "full/src/base/show.c", + "full/src/cmds/date_shell.c", + "full/src/cmds/dmesg.c", + "full/src/cmds/shell_shellcmd.c", + "full/src/cmds/watch_shell.c", ] - features = [] - if (LOSCFG_SHELL) { - features += [ "full:shell_full" ] - } + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "full/include" ] } diff --git a/syscall/BUILD.gn b/syscall/BUILD.gn new file mode 100644 index 00000000..b3f2b3e9 --- /dev/null +++ b/syscall/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_SYSCALL) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "fs_syscall.c", + "ipc_syscall.c", + "los_syscall.c", + "misc_syscall.c", + "net_syscall.c", + "process_syscall.c", + "syscall_pub.c", + "time_syscall.c", + "vm_syscall.c", + ] +} diff --git a/syscall/fs_syscall.c b/syscall/fs_syscall.c index 9bb01f3a..676402a5 100644 --- a/syscall/fs_syscall.c +++ b/syscall/fs_syscall.c @@ -29,11 +29,13 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "syscall_pub.h" #ifdef LOSCFG_FS_VFS #include "errno.h" #include "unistd.h" #include "fs/fd_table.h" #include "fs/file.h" +#include "fs/fs.h" #include "fs/fs_operation.h" #include "sys/mount.h" #include "los_task_pri.h" @@ -56,29 +58,77 @@ #include "sys/statfs.h" #define HIGH_SHIFT_BIT 32 +#define TIMESPEC_TIMES_NUM 2 -static int UserPathCopy(const char *userPath, char **pathBuf) +static int CheckNewAttrTime(struct IATTR *attr, struct timespec times[TIMESPEC_TIMES_NUM]) +{ + int ret = ENOERR; + struct timespec stp = {0}; + + if (times) { + if (times[0].tv_nsec == UTIME_OMIT) { + attr->attr_chg_valid &= ~CHG_ATIME; + } else if (times[0].tv_nsec == UTIME_NOW) { + ret = clock_gettime(CLOCK_REALTIME, &stp); + if (ret < 0) { + return -get_errno(); + } + attr->attr_chg_atime = (unsigned int)stp.tv_sec; + attr->attr_chg_valid |= CHG_ATIME; + } else { + attr->attr_chg_atime = (unsigned int)times[0].tv_sec; + attr->attr_chg_valid |= CHG_ATIME; + } + + if (times[1].tv_nsec == UTIME_OMIT) { + attr->attr_chg_valid &= ~CHG_MTIME; + } else if (times[1].tv_nsec == UTIME_NOW) { + ret = clock_gettime(CLOCK_REALTIME, &stp); + if (ret < 0) { + return -get_errno(); + } + attr->attr_chg_mtime = (unsigned int)stp.tv_sec; + attr->attr_chg_valid |= CHG_MTIME; + } else { + attr->attr_chg_mtime = (unsigned int)times[1].tv_sec; + attr->attr_chg_valid |= CHG_MTIME; + } + } else { + ret = clock_gettime(CLOCK_REALTIME, &stp); + if (ret < 0) { + return -get_errno(); + } + attr->attr_chg_atime = (unsigned int)stp.tv_sec; + attr->attr_chg_mtime = (unsigned int)stp.tv_sec; + attr->attr_chg_valid |= CHG_ATIME; + attr->attr_chg_valid |= CHG_MTIME; + } + + return ret; +} + +static int GetFullpathNull(int fd, const char *path, char **filePath) { int ret; + char *fullPath = NULL; + struct file *file = NULL; - *pathBuf = (char *)LOS_MemAlloc(OS_SYS_MEM_ADDR, PATH_MAX + 1); - if (*pathBuf == NULL) { - return -ENOMEM; + if ((fd != AT_FDCWD) && (path == NULL)) { + fd = GetAssociatedSystemFd(fd); + ret = fs_getfilep(fd, &file); + if (ret < 0) { + return -get_errno(); + } + fullPath = file->f_path; + } else { + ret = GetFullpath(fd, path, &fullPath); + if (ret < 0) { + return ret; + } } - ret = LOS_StrncpyFromUser(*pathBuf, userPath, PATH_MAX + 1); - if (ret < 0) { - (void)LOS_MemFree(OS_SYS_MEM_ADDR, *pathBuf); - *pathBuf = NULL; - return ret; - } else if (ret > PATH_MAX) { - (void)LOS_MemFree(OS_SYS_MEM_ADDR, *pathBuf); - *pathBuf = NULL; - return -ENAMETOOLONG; - } - (*pathBuf)[ret] = '\0'; - - return 0; + *filePath = fullPath; + return ret; } static int UserIovItemCheck(const struct iovec *iov, const int iovcnt) @@ -703,8 +753,6 @@ OUT: int SysAccess(const char *path, int amode) { int ret; - struct stat buf; - struct statfs fsBuf; char *pathRet = NULL; if (path != NULL) { @@ -714,30 +762,9 @@ int SysAccess(const char *path, int amode) } } - ret = statfs((path ? pathRet : NULL), &fsBuf); - if (ret != 0) { + ret = access(pathRet, amode); + if (ret < 0) { ret = -get_errno(); - if (ret != -ENOSYS) { - goto OUT; - } else { - /* dev has no statfs ops, need devfs to handle this in feature */ - ret = LOS_OK; - } - } - - if ((fsBuf.f_flags & MS_RDONLY) && ((unsigned int)amode & W_OK)) { - ret = -EROFS; - goto OUT; - } - - ret = stat((path ? pathRet : NULL), &buf); - if (ret != 0) { - ret = -get_errno(); - goto OUT; - } - - if (VfsPermissionCheck(buf.st_uid, buf.st_gid, buf.st_mode, amode)) { - ret = -EACCES; } OUT: @@ -1229,7 +1256,7 @@ OUT: return ret; } -int SysStat(const char *path, struct stat *buf) +int SysStat(const char *path, struct kstat *buf) { int ret; char *pathRet = NULL; @@ -1248,7 +1275,7 @@ int SysStat(const char *path, struct stat *buf) goto OUT; } - ret = LOS_ArchCopyToUser(buf, &bufRet, sizeof(struct stat)); + ret = LOS_ArchCopyToUser(buf, &bufRet, sizeof(struct kstat)); if (ret != 0) { ret = -EFAULT; } @@ -1260,7 +1287,7 @@ OUT: return ret; } -int SysLstat(const char *path, struct stat *buffer) +int SysLstat(const char *path, struct kstat *buffer) { int ret; char *pathRet = NULL; @@ -1279,7 +1306,7 @@ int SysLstat(const char *path, struct stat *buffer) goto OUT; } - ret = LOS_ArchCopyToUser(buffer, &bufRet, sizeof(struct stat)); + ret = LOS_ArchCopyToUser(buffer, &bufRet, sizeof(struct kstat)); if (ret != 0) { ret = -EFAULT; } @@ -2147,11 +2174,39 @@ OUT: return result; } +int SysUtimensat(int fd, const char *path, struct timespec times[TIMESPEC_TIMES_NUM], int flag) +{ + int ret; + int timeLen; + struct IATTR attr = {0}; + char *filePath = NULL; + + timeLen = TIMESPEC_TIMES_NUM * sizeof(struct timespec); + CHECK_ASPACE(times, timeLen); + DUP_FROM_USER(times, timeLen); + ret = CheckNewAttrTime(&attr, times); + FREE_DUP(times); + if (ret < 0) { + goto OUT; + } + + ret = GetFullpathNull(fd, path, &filePath); + if (ret < 0) { + goto OUT; + } + + ret = chattr(filePath, &attr); + if (ret < 0) { + ret = -get_errno(); + } + +OUT: + PointerFree(filePath); + return ret; +} + int SysChmod(const char *pathname, mode_t mode) { - struct IATTR attr = {0}; - attr.attr_chg_mode = mode; - attr.attr_chg_valid = CHG_MODE; /* change mode */ int ret; char *pathRet = NULL; @@ -2162,7 +2217,7 @@ int SysChmod(const char *pathname, mode_t mode) } } - ret = chattr((pathname ? pathRet : NULL), &attr); + ret = chmod(pathRet, mode); if (ret < 0) { ret = -get_errno(); } @@ -2174,20 +2229,58 @@ OUT: return ret; } -int SysChown(const char *pathname, uid_t owner, gid_t group) +int SysFchmodat(int fd, const char *path, mode_t mode, int flag) { - struct IATTR attr = {0}; - attr.attr_chg_valid = 0; int ret; char *pathRet = NULL; + char *fullpath = NULL; + struct IATTR attr = { + .attr_chg_mode = mode, + .attr_chg_valid = CHG_MODE, + }; - if (pathname != NULL) { - ret = UserPathCopy(pathname, &pathRet); + if (path != NULL) { + ret = UserPathCopy(path, &pathRet); if (ret != 0) { goto OUT; } } + if (fd != AT_FDCWD) { + /* Process fd convert to system global fd */ + fd = GetAssociatedSystemFd(fd); + } + + ret = vfs_normalize_pathat(fd, pathRet, &fullpath); + if (ret < 0) { + goto OUT; + } + + ret = chattr(fullpath, &attr); + if (ret < 0) { + ret = -get_errno(); + } + +OUT: + PointerFree(pathRet); + PointerFree(fullpath); + + return ret; +} + +int SysFchownat(int fd, const char *path, uid_t owner, gid_t group, int flag) +{ + int ret; + char *fullpath = NULL; + struct IATTR attr = { + .attr_chg_valid = 0, + }; + + ret = GetFullpath(fd, path, &fullpath); + if (ret < 0) { + goto OUT; + } + if (owner != (uid_t)-1) { attr.attr_chg_uid = owner; attr.attr_chg_valid |= CHG_UID; @@ -2196,7 +2289,65 @@ int SysChown(const char *pathname, uid_t owner, gid_t group) attr.attr_chg_gid = group; attr.attr_chg_valid |= CHG_GID; } - ret = chattr((pathname ? pathRet : NULL), &attr); + + ret = chattr(fullpath, &attr); + if (ret < 0) { + ret = -get_errno(); + } + +OUT: + PointerFree(fullpath); + + return ret; +} + +int SysFchown(int fd, uid_t owner, gid_t group) +{ + int ret; + int sysFd; + struct IATTR attr = {0}; + attr.attr_chg_valid = 0; + struct file *file = NULL; + + sysFd = GetAssociatedSystemFd(fd); + if (sysFd < 0) { + return -EBADF; + } + + ret = fs_getfilep(sysFd, &file); + if (ret < 0) { + return -get_errno(); + } + + if (owner != (uid_t)-1) { + attr.attr_chg_uid = owner; + attr.attr_chg_valid |= CHG_UID; + } + if (group != (gid_t)-1) { + attr.attr_chg_gid = group; + attr.attr_chg_valid |= CHG_GID; + } + ret = chattr(file->f_path, &attr); + if (ret < 0) { + ret = -get_errno(); + } + + return ret; +} + +int SysChown(const char *pathname, uid_t owner, gid_t group) +{ + int ret; + char *pathRet = NULL; + + if (pathname != NULL) { + ret = UserPathCopy(pathname, &pathRet); + if (ret != 0) { + goto OUT; + } + } + + ret = chown(pathRet, owner, group); if (ret < 0) { ret = -get_errno(); } @@ -2254,4 +2405,43 @@ OUT: } return ret; } + +int SysFaccessat(int fd, const char *filename, int amode, int flag) +{ + int ret; + struct stat buf; + struct statfs fsBuf; + char *fullDirectory = NULL; + + ret = GetFullpath(fd, filename, &fullDirectory); + if (ret < 0) { + goto OUT; + } + + ret = statfs(fullDirectory, &fsBuf); + if (ret != 0) { + ret = -get_errno(); + goto OUT; + } + + if ((fsBuf.f_flags & MS_RDONLY) && ((unsigned int)amode & W_OK)) { + ret = -EROFS; + goto OUT; + } + + ret = stat(fullDirectory, &buf); + if (ret != 0) { + ret = -get_errno(); + goto OUT; + } + + if (VfsPermissionCheck(buf.st_uid, buf.st_gid, buf.st_mode, amode)) { + ret = -EACCES; + } + +OUT: + PointerFree(fullDirectory); + + return ret; +} #endif diff --git a/syscall/los_syscall.c b/syscall/los_syscall.c index b590c97a..6761fff7 100644 --- a/syscall/los_syscall.c +++ b/syscall/los_syscall.c @@ -32,7 +32,6 @@ #define _GNU_SOURCE #ifdef LOSCFG_FS_VFS #include "fs/file.h" -#include "fs/file.h" #endif #include "los_init.h" #include "los_signal.h" diff --git a/syscall/los_syscall.h b/syscall/los_syscall.h index 1d7a8c16..09db0e58 100644 --- a/syscall/los_syscall.h +++ b/syscall/los_syscall.h @@ -55,6 +55,7 @@ #include "time.h" #include "sys/time.h" #include "sys/stat.h" +#include "sys/kstat.h" #ifdef LOSCFG_FS_VFS #include "sys/socket.h" #include "dirent.h" @@ -62,7 +63,9 @@ #endif #include #include "sys/resource.h" +#ifdef LOSCFG_FS_VFS #include "vnode.h" +#endif /* process */ extern unsigned int SysGetGroupId(void); @@ -228,7 +231,11 @@ extern ssize_t SysReadlinkat(int dirfd, const char *pathname, char *buf, size_t extern int SysUnlink( const char *pathname); extern int SysExecve(const char *fileName, char *const *argv, char *const *envp); extern int SysChdir(const char *path); +extern int SysUtimensat(int fd, const char *path, struct timespec times[2], int flag); +extern int SysFchmodat(int fd, const char *path, mode_t mode, int flag); extern int SysChmod(const char *path, mode_t mode); +extern int SysFchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); +extern int SysFchown(int fd, uid_t owner, gid_t group); extern int SysChown(const char *pathname, uid_t owner, gid_t group); extern off_t SysLseek(int fd, off_t offset, int whence); extern off64_t SysLseek64(int fd, int offsetHigh, int offsetLow, off64_t *result, int whence); @@ -236,6 +243,7 @@ extern int SysMount(const char *source, const char *target, const char *filesyst const void *data); extern int SysUmount(const char *target); extern int SysAccess(const char *path, int amode); +extern int SysFaccessat(int fd, const char *filename, int amode, int flag); extern int SysRename(const char *oldpath, const char *newpath); extern int SysMkdir(const char *pathname, mode_t mode); extern int SysRmdir(const char *pathname); @@ -250,8 +258,8 @@ extern int SysFtruncate(int fd, off_t length); extern int SysStatfs(const char *path, struct statfs *buf); extern int SysStatfs64(const char *path, size_t sz, struct statfs *buf); -extern int SysStat(const char *path, struct stat *buf); -extern int SysLstat(const char *path, struct stat *buffer); +extern int SysStat(const char *path, struct kstat *buf); +extern int SysLstat(const char *path, struct kstat *buffer); extern int SysFstat(int fildes, struct stat *buf); extern int SysStatx(int fd, const char *restrict path, int flag, unsigned mask, struct statx *restrict stx); extern int SysFsync(int fd); diff --git a/syscall/misc_syscall.c b/syscall/misc_syscall.c index e27afd32..d92649ff 100644 --- a/syscall/misc_syscall.c +++ b/syscall/misc_syscall.c @@ -35,7 +35,6 @@ #include "sys/resource.h" #include "sys/times.h" #include "sys/utsname.h" -#include "time.h" #include "capability_type.h" #include "capability_api.h" #include "los_process_pri.h" diff --git a/syscall/process_syscall.c b/syscall/process_syscall.c index b4f5d002..997f631c 100644 --- a/syscall/process_syscall.c +++ b/syscall/process_syscall.c @@ -1037,7 +1037,7 @@ int SysSchedGetAffinity(int id, unsigned int *cpuset, int flag) } } -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP cpuAffiMask = (unsigned int)OS_TCB_FROM_TID(taskID)->cpuAffiMask; #else cpuAffiMask = 1; diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index 8206d735..07d70892 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -48,11 +48,15 @@ SYSCALL_HAND_DEF(__NR_execve, SysExecve, int, ARG_NUM_3) SYSCALL_HAND_DEF(__NR_sysinfo, SysInfo, int, ARG_NUM_1) SYSCALL_HAND_DEF(__NR_chdir, SysChdir, int, ARG_NUM_1) +SYSCALL_HAND_DEF(__NR_utimensat, SysUtimensat, int, ARG_NUM_4) +SYSCALL_HAND_DEF(__NR_fchmodat, SysFchmodat, int, ARG_NUM_4) +SYSCALL_HAND_DEF(__NR_utimensat, SysUtimensat, int, ARG_NUM_4) SYSCALL_HAND_DEF(__NR_chmod, SysChmod, int, ARG_NUM_2) SYSCALL_HAND_DEF(__NR_lseek, SysLseek, off_t, ARG_NUM_7) /* current only support 32bit max 4G file */ SYSCALL_HAND_DEF(__NR_mount, SysMount, int, ARG_NUM_5) SYSCALL_HAND_DEF(__NR_umount, SysUmount, int, ARG_NUM_1) SYSCALL_HAND_DEF(__NR_access, SysAccess, int, ARG_NUM_2) +SYSCALL_HAND_DEF(__NR_faccessat, SysFaccessat, int, ARG_NUM_4) SYSCALL_HAND_DEF(__NR_sync, SysSync, void, ARG_NUM_0) SYSCALL_HAND_DEF(__NR_rename, SysRename, int, ARG_NUM_2) SYSCALL_HAND_DEF(__NR_mkdir, SysMkdir, int, ARG_NUM_2) @@ -166,6 +170,8 @@ SYSCALL_HAND_DEF(__NR_rt_sigpending, SysSigPending, int, ARG_NUM_1) SYSCALL_HAND_DEF(__NR_rt_sigtimedwait, SysSigTimedWait, int, ARG_NUM_4) SYSCALL_HAND_DEF(__NR_rt_sigsuspend, SysSigSuspend, int, ARG_NUM_1) +SYSCALL_HAND_DEF(__NR_fchownat, SysFchownat, int, ARG_NUM_5) +SYSCALL_HAND_DEF(__NR_fchown32, SysFchown, int, ARG_NUM_3) SYSCALL_HAND_DEF(__NR_chown, SysChown, int, ARG_NUM_3) SYSCALL_HAND_DEF(__NR_chown32, SysChown, int, ARG_NUM_3) #ifdef LOSCFG_SECURITY_CAPABILITY diff --git a/syscall/syscall_pub.c b/syscall/syscall_pub.c index dbfd0f5a..759b74a3 100644 --- a/syscall/syscall_pub.c +++ b/syscall/syscall_pub.c @@ -60,3 +60,68 @@ void *DupUserMem(const void *ptr, size_t len, int needCopy) return p; } + +int GetFullpath(int fd, const char *path, char **fullpath) +{ + int ret = 0; + char *pathRet = NULL; + struct file *file = NULL; + struct stat bufRet = {0}; + + if (path != NULL) { + ret = UserPathCopy(path, &pathRet); + if (ret != 0) { + goto OUT; + } + } + + if ((pathRet != NULL) && (*pathRet == '/')) { + *fullpath = pathRet; + pathRet = NULL; + } else { + if (fd != AT_FDCWD) { + /* Process fd convert to system global fd */ + fd = GetAssociatedSystemFd(fd); + } + ret = fs_getfilep(fd, &file); + if (file) { + ret = stat(file->f_path, &bufRet); + if (!ret) { + if (!S_ISDIR(bufRet.st_mode)) { + set_errno(ENOTDIR); + ret = -ENOTDIR; + goto OUT; + } + } + } + ret = vfs_normalize_pathat(fd, pathRet, fullpath); + } + +OUT: + PointerFree(pathRet); + return ret; +} + +int UserPathCopy(const char *userPath, char **pathBuf) +{ + int ret; + + *pathBuf = (char *)LOS_MemAlloc(OS_SYS_MEM_ADDR, PATH_MAX + 1); + if (*pathBuf == NULL) { + return -ENOMEM; + } + + ret = LOS_StrncpyFromUser(*pathBuf, userPath, PATH_MAX + 1); + if (ret < 0) { + (void)LOS_MemFree(OS_SYS_MEM_ADDR, *pathBuf); + *pathBuf = NULL; + return ret; + } else if (ret > PATH_MAX) { + (void)LOS_MemFree(OS_SYS_MEM_ADDR, *pathBuf); + *pathBuf = NULL; + return -ENAMETOOLONG; + } + (*pathBuf)[ret] = '\0'; + + return 0; +} diff --git a/syscall/syscall_pub.h b/syscall/syscall_pub.h index 52993987..e784a510 100644 --- a/syscall/syscall_pub.h +++ b/syscall/syscall_pub.h @@ -36,9 +36,14 @@ #include "los_vm_lock.h" #include "los_vm_map.h" #include "user_copy.h" +#include "fs/fs.h" +#include "fcntl.h" +#include "los_strncpy_from_user.h" extern int CheckRegion(const LosVmSpace *space, VADDR_T ptr, size_t len); extern void *DupUserMem(const void *ptr, size_t len, int needCopy); +extern int GetFullpath(int fd, const char *path, char **fullpath); +extern int UserPathCopy(const char *userPath, char **pathBuf); #define CHECK_ASPACE(ptr, len, ...) \ do { \ diff --git a/syscall/time_syscall.c b/syscall/time_syscall.c index e433e2de..ea87f298 100644 --- a/syscall/time_syscall.c +++ b/syscall/time_syscall.c @@ -356,13 +356,18 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp) { int ret; struct timespec srqtp; - struct timespec srmtp = { 0 }; + struct timespec srmtp; if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) { errno = EFAULT; return -EFAULT; } + if (rmtp && LOS_ArchCopyFromUser(&srmtp, rmtp, sizeof(struct timespec))) { + errno = EFAULT; + return -EFAULT; + } + ret = nanosleep(&srqtp, rmtp ? &srmtp : NULL); if (ret < 0) { return -get_errno(); diff --git a/testsuites/BUILD.gn b/testsuites/BUILD.gn new file mode 100644 index 00000000..17bddbfe --- /dev/null +++ b/testsuites/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 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_a/liteos.gni") + +group("testsuites") { + deps = [ + #"kernel", + "unittest", + ] +} diff --git a/testsuites/kernel/include/iCunit.h b/testsuites/kernel/include/iCunit.h index a0de0031..c0c67484 100644 --- a/testsuites/kernel/include/iCunit.h +++ b/testsuites/kernel/include/iCunit.h @@ -522,7 +522,7 @@ extern void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode); } while (0) #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP extern SPIN_LOCK_S g_testSuitSpin; #define TESTSUIT_LOCK(state) LOS_SpinLockSave(&g_testSuitSpin, &(state)) #define TESTSUIT_UNLOCK(state) LOS_SpinUnlockRestore(&g_testSuitSpin, state) diff --git a/testsuites/kernel/include/osTest.h b/testsuites/kernel/include/osTest.h index 7ad31b69..901dcf72 100644 --- a/testsuites/kernel/include/osTest.h +++ b/testsuites/kernel/include/osTest.h @@ -96,7 +96,7 @@ extern "C" { testTask.uwResved = LOS_TASK_STATUS_DETACHED; \ } while (0); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #define TEST_TASK_PARAM_INIT_AFFI(testTask, task_name, entry, prio, affi) \ TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \ testTask.usCpuAffiMask = affi; diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/It_smp_hwi.c b/testsuites/kernel/sample/kernel_base/core/hwi/It_smp_hwi.c index 36bea719..68d45192 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/It_smp_hwi.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/It_smp_hwi.c @@ -38,7 +38,7 @@ extern "C" { #endif /* __cpluscplus */ VOID ItSuiteSmpHwi(VOID) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP ItSmpLosHwi001(); ItSmpLosHwi002(); ItSmpLosHwi003(); @@ -84,7 +84,7 @@ VOID ItSuiteSmpHwi(VOID) ItSmpLosHwiNest007(); ItSmpLosHwiNest008(); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, 1); HalIrqSetAffinity(HWI_NUM_TEST1, 1); HalIrqSetAffinity(HWI_NUM_TEST2, 1); diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_001.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_001.c index aa823736..a60728b6 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_001.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_001.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_testTimes; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_002.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_002.c index 06fde600..bc8bbf94 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_002.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_002.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static VOID HwiF01(void) { LOS_AtomicInc(&g_testCount); diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_003.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_003.c index f0b422da..c7cb8f1e 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_003.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_003.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_testTimes; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_004.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_004.c index ed809362..8a6e5138 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_004.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_004.c @@ -37,7 +37,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_testTimes; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_005.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_005.c index 2a408e27..3811c4e1 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_005.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_005.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static VOID HwiF01(void) { diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_006.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_006.c index 221678df..f3d58cda 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_006.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_006.c @@ -37,7 +37,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static VOID HwiF01(void) { diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_007.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_007.c index a63b39b0..1a901cc3 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_007.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_007.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static VOID HwiF01(void) { diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_008.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_008.c index b26f6adf..497d73eb 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_008.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_008.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_ret = 0; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_009.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_009.c index 22bb709f..f1541a4e 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_009.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_009.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_ret = 0; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_010.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_010.c index b28b2f42..230ae933 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_010.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_010.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0}; static VOID SwtmrF01(void) { diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_011.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_011.c index b9ee190b..d58221d9 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_011.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_011.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0}; static VOID SwtmrF01(void) { diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_012.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_012.c index 4d6ba350..ae21951c 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_012.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_012.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0}; static VOID SwtmrF01(void) { diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_013.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_013.c index 7c3a571e..9b4604b3 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_013.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_013.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static VOID SwtmrF01(void) { diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_001.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_001.c index 820e3858..7507779e 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_001.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_001.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_002.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_002.c index a19ad70c..054771aa 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_002.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_002.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_003.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_003.c index 180b5065..d7c82d16 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_003.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_003.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_004.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_004.c index a37d3108..b1ef1588 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_004.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_004.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_005.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_005.c index 663e37e4..03964fc9 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_005.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_005.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_006.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_006.c index d7f2a75b..4e4cc7b2 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_006.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_006.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0}; diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_007.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_007.c index 3597112f..e8decb70 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_007.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_007.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; /* for debugging */ diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_008.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_008.c index eb621014..ccfe146c 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_008.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_ipi_008.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID SwtmrF01(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_001.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_001.c index 4d863e68..8bd2d2f0 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_001.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_001.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_002.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_002.c index 6e334c56..4d8f9a27 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_002.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_002.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; extern EVENT_CB_S g_event; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_003.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_003.c index 8be106dd..9f71aa5d 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_003.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_003.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_004.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_004.c index ef9720b0..62a285c0 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_004.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_004.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_005.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_005.c index ce7aa34d..87414631 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_005.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_005.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_006.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_006.c index f06786b3..fb416702 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_006.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_006.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_007.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_007.c index 609c2275..b9050a8b 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_007.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_007.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_008.c b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_008.c index 9d6a4ef6..d1fea484 100644 --- a/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_008.c +++ b/testsuites/kernel/sample/kernel_base/core/hwi/smp/It_smp_los_hwi_nest_008.c @@ -36,7 +36,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static VOID HwiF02(void) diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/It_los_swtmr.c b/testsuites/kernel/sample/kernel_base/core/swtmr/It_los_swtmr.c index 7ad82c51..f49d472c 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/It_los_swtmr.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/It_los_swtmr.c @@ -53,7 +53,7 @@ VOID ItSuiteLosSwtmr(VOID) ItLosSwtmr053(); ItLosSwtmr058(); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP ItSmpLosSwtmr001(); /* Concurrent Multi-core */ ItSmpLosSwtmr002(); /* Stop Across Cores */ ItSmpLosSwtmr003(); diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_033.c b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_033.c index 7aa9b526..40cf3c17 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_033.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_033.c @@ -87,7 +87,7 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_039.c b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_039.c index 954f9d1a..f349fdf7 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_039.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_039.c @@ -74,7 +74,7 @@ static UINT32 Testcase(VOID) hwiMode = 0; ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)SwtmrF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif TestHwiTrigger(HWI_NUM_TEST); diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_040.c b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_040.c index d42b666c..c9e0dc7d 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_040.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_040.c @@ -79,7 +79,7 @@ static UINT32 Testcase(VOID) hwiMode = 0; ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)HwiF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_041.c b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_041.c index 34a6aa23..05e28865 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_041.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_041.c @@ -95,7 +95,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)SwtmrF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT5); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_043.c b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_043.c index 070da1c3..b0e37b0f 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_043.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_043.c @@ -76,7 +76,7 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_064.c b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_064.c index afcb99f4..543eab9c 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_064.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_064.c @@ -72,7 +72,7 @@ static UINT32 Testcase(VOID) hwiMode = 0; ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)HwiF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_065.c b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_065.c index 190056f6..ddd739c2 100644 --- a/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_065.c +++ b/testsuites/kernel/sample/kernel_base/core/swtmr/full/It_los_swtmr_065.c @@ -72,7 +72,7 @@ static UINT32 Testcase(VOID) hwiMode = 0; ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)HwiF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif ret = LOS_SwtmrStart(g_swTmrID1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/It_los_task.c b/testsuites/kernel/sample/kernel_base/core/task/It_los_task.c index 48f146bc..b200fc64 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/It_los_task.c +++ b/testsuites/kernel/sample/kernel_base/core/task/It_los_task.c @@ -62,7 +62,7 @@ void ItSuiteLosTask(void) ItLosTask105(); ItLosTask099(); ItLosTaskTimeslice001(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP // reserved 20 for smoke test ItSmpLosTask001(); /* Task Affinity */ ItSmpLosTask002(); /* Task Deletion Across Cores */ @@ -137,7 +137,7 @@ void ItSuiteLosTask(void) ItLosTask072(); ItLosTask073(); ItLosTask074(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ItLosTask075(); #endif ItLosTask076(); @@ -193,7 +193,7 @@ void ItSuiteLosTask(void) ItLosTaskTimeslice002(); ItLosTaskTimeslice003(); ItLosTaskTimeslice004(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #ifndef LOSCFG_ARCH_FPU_DISABLE ItSmpLosFloatSwitch001(); @@ -290,7 +290,7 @@ void ItSuiteLosTask(void) ItSmpLosTask112(); ItSmpLosTask114(); ItSmpLosTask115(); -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == NO) +#ifndef LOSCFG_KERNEL_SMP_TASK_SYNC ItSmpLosTask117(); #endif ItSmpLosTask126(); @@ -325,7 +325,7 @@ void ItSuiteLosTask(void) #endif #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, 1); HalIrqSetAffinity(HWI_NUM_TEST1, 1); HalIrqSetAffinity(HWI_NUM_TEST3, 1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/It_los_task.h b/testsuites/kernel/sample/kernel_base/core/task/It_los_task.h index 9b0e9058..7f47bb5f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/It_los_task.h +++ b/testsuites/kernel/sample/kernel_base/core/task/It_los_task.h @@ -51,7 +51,7 @@ extern "C" { #define SWTMR_LOOP_NUM 10 #define TEST_HWI_RUNTIME 0x100000 #define TASK_LOOP_NUM 0x100000 -#if (YES == LOSCFG_BASE_CORE_SWTMR) +#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE #define TASK_EXISTED_NUM 4 #else #define TASK_EXISTED_NUM 2 @@ -364,4 +364,4 @@ void ItLosTaskTimeslice004(void); #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#endif \ No newline at end of file +#endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/float/It_smp_los_float_switch_007.c b/testsuites/kernel/sample/kernel_base/core/task/float/It_smp_los_float_switch_007.c index 3aee9fb0..ce199698 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/float/It_smp_los_float_switch_007.c +++ b/testsuites/kernel/sample/kernel_base/core/task/float/It_smp_los_float_switch_007.c @@ -38,7 +38,7 @@ extern "C" { #endif /* __cpluscplus */ #ifndef LOSCFG_ARCH_FPU_DISABLE -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_targetCpuid; static void HwiF01(UINT32 arg) diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_008.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_008.c index 7bb9ec52..7302772f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_008.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_008.c @@ -55,7 +55,7 @@ static UINT32 Testcase(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "Tsk007A_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_011.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_011.c index 0fc65c5c..3d985709 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_011.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_011.c @@ -61,7 +61,7 @@ static UINT32 Testcase(void) ret = LOS_TaskCreate(&g_testTaskID01, &task1); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* Wait TaskF01 to start */ while (g_testCount == 0) { } diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_016.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_016.c index 4d8d6dad..94549436 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_016.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_016.c @@ -88,7 +88,7 @@ static UINT32 Testcase(void) task1.uwResved = LOS_TASK_STATUS_DETACHED; // 0xffff, initializes the args. this parameter has no special meaning. task1.auwArgs[0] = 0xffff; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_017.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_017.c index bc91737a..8adb7c1d 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_017.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_017.c @@ -51,7 +51,7 @@ static UINT32 Testcase(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "Tsk017A"; task1.usTaskPrio = 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_018.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_018.c index 26fa787f..7f22abba 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_018.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_018.c @@ -51,7 +51,7 @@ static UINT32 Testcase(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "Tsk018A"; task1.usTaskPrio = OS_TASK_PRIORITY_LOWEST; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_025.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_025.c index 738d30cd..37a3619f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_025.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_025.c @@ -56,7 +56,7 @@ static UINT32 Testcase(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "Tsk025A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_029.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_029.c index 1b913a63..87a18286 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_029.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_029.c @@ -67,7 +67,7 @@ static UINT32 Testcase(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "Tsk029A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_031.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_031.c index 1a444084..5065607e 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_031.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_031.c @@ -65,7 +65,7 @@ static UINT32 Testcase(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "Tsk031A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_033.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_033.c index 39712122..b4ba7424 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_033.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_033.c @@ -65,7 +65,7 @@ static UINT32 Testcase(void) task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task1.pcName = "Tsk033A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_038.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_038.c index d7965f31..6df1d299 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_038.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_038.c @@ -68,7 +68,7 @@ static UINT32 Testcase(void) task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; g_testCount = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_039.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_039.c index 9ec8fb14..38fbdef6 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_039.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_039.c @@ -56,7 +56,7 @@ static UINT32 Testcase(void) task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.usTaskPrio = TASK_PRIO_TEST_TASK + 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_040.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_040.c index 005d3b83..9b7fcb23 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_040.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_040.c @@ -51,7 +51,7 @@ static UINT32 Testcase(void) TSK_INIT_PARAM_S task1 = { 0 }; task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01; task1.uwStackSize = TASK_STACK_SIZE_TEST; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif LOS_TaskLock(); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_041.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_041.c index 02f46c11..a5268b06 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_041.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_041.c @@ -60,7 +60,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk041A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_042.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_042.c index 21e5fa0c..9ff64254 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_042.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_042.c @@ -63,7 +63,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk042A"; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_043.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_043.c index 881b9689..3b9a6f16 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_043.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_043.c @@ -59,7 +59,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk043A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_047.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_047.c index 00c35910..bb983c34 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_047.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_047.c @@ -69,7 +69,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_050.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_050.c index 3352043d..b02ac19e 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_050.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_050.c @@ -54,7 +54,7 @@ static void TaskF01(void) task1.pcName = "Tsk050B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -82,7 +82,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_052.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_052.c index 9e8b5699..fe98cbf9 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_052.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_052.c @@ -55,7 +55,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount); @@ -80,7 +80,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk052A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_053.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_053.c index 710cae51..a1c80e09 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_053.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_053.c @@ -57,7 +57,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -78,7 +78,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk053A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_054.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_054.c index 09a7c3c0..d746a77d 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_054.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_054.c @@ -67,7 +67,7 @@ static void TaskF01(void) task1.pcName = "Tsk054B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount++; @@ -78,7 +78,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -100,7 +100,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_055.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_055.c index b4edf7d7..66b9dd72 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_055.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_055.c @@ -51,7 +51,7 @@ static void TaskF01(void) task1.pcName = "Tsk055B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -80,7 +80,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_056.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_056.c index 0f453580..ac7823f9 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_056.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_056.c @@ -59,7 +59,7 @@ static void TaskF01(void) task1.pcName = "Tsk056B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -89,7 +89,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_057.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_057.c index f38e21ca..7f1451e3 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_057.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_057.c @@ -76,7 +76,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk057A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_058.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_058.c index f5684124..0137b11a 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_058.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_058.c @@ -95,7 +95,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk058A"; // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_060.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_060.c index 6673370b..2e0a188f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_060.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_060.c @@ -78,7 +78,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_061.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_061.c index 59a683a0..c0ed2a19 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_061.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_061.c @@ -60,7 +60,7 @@ static void TaskF02(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -101,7 +101,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; @@ -116,7 +116,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk061B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_063.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_063.c index 922a2f99..9da5327e 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_063.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_063.c @@ -81,7 +81,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -97,7 +97,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk063B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_064.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_064.c index 2571a845..b82cceeb 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_064.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_064.c @@ -60,7 +60,7 @@ static void TaskF02(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -84,7 +84,7 @@ static void TaskF01(void) task1.pcName = "Tsk064B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount++; @@ -110,7 +110,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_065.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_065.c index ed904307..92623f6a 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_065.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_065.c @@ -54,7 +54,7 @@ static void TaskF01(void) task1.pcName = "Tsk065B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount); @@ -79,7 +79,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_066.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_066.c index b5509d4d..b85ecf61 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_066.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_066.c @@ -63,7 +63,7 @@ static void TaskF01(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount); @@ -76,7 +76,7 @@ static void TaskF01(void) task1.pcName = "Tsk066C"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID03, &task1); @@ -98,7 +98,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_067.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_067.c index 5d1a7f05..d7b9cf90 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_067.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_067.c @@ -60,7 +60,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount); @@ -90,7 +90,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk067A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_068.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_068.c index 93a1149f..92f726aa 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_068.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_068.c @@ -59,7 +59,7 @@ static void TaskF01(void) task1.pcName = "Tsk068B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount); @@ -85,7 +85,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_069.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_069.c index fd08e7ff..d3668b0f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_069.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_069.c @@ -56,7 +56,7 @@ static void TaskF01(void) task1.pcName = "Tsk069B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 0, g_testCount); @@ -86,7 +86,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_071.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_071.c index 5d043d0e..963df73a 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_071.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_071.c @@ -54,7 +54,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk071A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_072.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_072.c index ae27bf8b..3a72268f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_072.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_072.c @@ -54,7 +54,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk072A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_073.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_073.c index 7e0cb5dd..dee78432 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_073.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_073.c @@ -94,7 +94,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_074.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_074.c index e8a003d4..44a86715 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_074.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_074.c @@ -63,7 +63,7 @@ static UINT32 Testcase(void) task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.pcName = "Tsk074A"; task1.uwStackSize = TASK_STACK_SIZE_TEST; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_075.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_075.c index 9d9a81ba..2ba3c829 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_075.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_075.c @@ -99,7 +99,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; @@ -117,7 +117,7 @@ static UINT32 Testcase(void) task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02; task1.pcName = "Tsk075B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_076.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_076.c index 2074443e..bc193435 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_076.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_076.c @@ -77,7 +77,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_077.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_077.c index 0c0dc6ea..5189bb24 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_077.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_077.c @@ -79,7 +79,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_078.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_078.c index 1c02aa73..22a88563 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_078.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_078.c @@ -66,7 +66,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk078A"; // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_079.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_079.c index 885f2c15..41d12880 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_079.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_079.c @@ -65,7 +65,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_080.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_080.c index b2209d73..43e792c0 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_080.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_080.c @@ -65,7 +65,7 @@ static UINT32 Testcase(void) ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_082.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_082.c index f270941a..ac9b3a88 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_082.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_082.c @@ -77,7 +77,7 @@ static UINT32 Testcase(void) LOS_EventWrite(&g_eventCb01, 0x1); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, assert that g_testCount is equal to this. diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_090.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_090.c index 3154d945..3a8c9803 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_090.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_090.c @@ -70,7 +70,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk090A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_093.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_093.c index 6bcfc350..7cd2591a 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_093.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_093.c @@ -69,7 +69,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk093A"; // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_094.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_094.c index c3712a2b..f3269e4f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_094.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_094.c @@ -82,7 +82,7 @@ static UINT32 Testcase(void) // 0xffff, initializes the args. this parameter has no special meaning. task1.auwArgs[0] = 0xffff; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; @@ -104,7 +104,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); @@ -129,7 +129,7 @@ static UINT32 Testcase(void) // 4, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 4; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_095.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_095.c index ffde8962..41ee35b1 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_095.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_095.c @@ -54,7 +54,7 @@ static UINT32 Testcase(void) task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_096.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_096.c index 09be0708..57b5c8a0 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_096.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_096.c @@ -56,7 +56,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -81,7 +81,7 @@ static UINT32 Testcase(void) task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = 0; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_098.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_098.c index 0be50c2c..e8ef4d8f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_098.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_098.c @@ -54,7 +54,7 @@ static void TaskF01(void) task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); @@ -87,7 +87,7 @@ static UINT32 Testcase(void) task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_100.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_100.c index 6cbc00f2..da22e5b4 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_100.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_100.c @@ -60,7 +60,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk100A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_102.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_102.c index b6669305..e395c577 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_102.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_102.c @@ -59,7 +59,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -80,7 +80,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk102A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_103.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_103.c index 46ac159b..ef91eb9d 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_103.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_103.c @@ -59,7 +59,7 @@ static void TaskF01(void) task1.pcName = "Tsk103B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -95,7 +95,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_104.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_104.c index 3d5b1923..844f38f6 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_104.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_104.c @@ -68,7 +68,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -98,7 +98,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_106.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_106.c index ad166138..e3b067d2 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_106.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_106.c @@ -74,7 +74,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -96,7 +96,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk106A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_107.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_107.c index 6674235d..3b8430bd 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_107.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_107.c @@ -68,7 +68,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -99,7 +99,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_108.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_108.c index 72c0b976..afefcb22 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_108.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_108.c @@ -67,7 +67,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); @@ -102,7 +102,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_109.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_109.c index 627369e7..981af5ce 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_109.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_109.c @@ -67,7 +67,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -98,7 +98,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_110.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_110.c index bdf1791f..117485d8 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_110.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_110.c @@ -68,7 +68,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); @@ -104,7 +104,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_111.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_111.c index 5fd53d2c..9036dc02 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_111.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_111.c @@ -67,7 +67,7 @@ static void TaskF01(void) task1.pcName = "Tsk111B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -99,7 +99,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_112.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_112.c index 62d01f3f..09d6fc9d 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_112.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_112.c @@ -67,7 +67,7 @@ static void TaskF01(void) // 4, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 4; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -105,7 +105,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_113.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_113.c index bfc87872..70d96b3a 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_113.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_113.c @@ -67,7 +67,7 @@ static void TaskF01(void) task1.pcName = "Tsk113B"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); @@ -107,7 +107,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_114.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_114.c index 2eb472f2..414a279c 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_114.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_114.c @@ -61,7 +61,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -90,7 +90,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_115.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_115.c index 2677f918..5cfd8fb8 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_115.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_115.c @@ -74,7 +74,7 @@ static void TaskF01(void) // 4, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 4; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -112,7 +112,7 @@ static UINT32 Testcase(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_116.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_116.c index b1e2806c..7b5fdd2d 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_116.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_116.c @@ -97,7 +97,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_118.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_118.c index 85531ef9..7054a2fd 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_118.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_118.c @@ -85,7 +85,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -136,7 +136,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task1); @@ -149,7 +149,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_119.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_119.c index 467c8d39..908e332e 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_119.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_119.c @@ -56,7 +56,7 @@ static UINT32 Testcase(void) task1.pcName = "Task_119"; // 32, Set the priority according to the task purpose task1.usTaskPrio = 32; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_120.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_120.c index d1f4a1e4..03b989f1 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_120.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_120.c @@ -61,7 +61,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_121.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_121.c index 0e8aef7f..1d569e65 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_121.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_121.c @@ -56,7 +56,7 @@ static UINT32 Testcase(void) task1.pcName = "Task_121"; // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_122.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_122.c index 94d36286..e3ccd8b1 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_122.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_122.c @@ -55,7 +55,7 @@ static void TaskF01(void) task1.pcName = "Task_122_1"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -91,7 +91,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_123.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_123.c index f2636d2c..b7346365 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_123.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_123.c @@ -54,7 +54,7 @@ static void TaskF01(void) task1.pcName = "Task_123_1"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -86,7 +86,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_124.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_124.c index d51caa7c..79244497 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_124.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_124.c @@ -58,7 +58,7 @@ static void TaskF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -90,7 +90,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_125.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_125.c index 24b56ca1..28d09aad 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_125.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_125.c @@ -62,7 +62,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -88,7 +88,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_126.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_126.c index 030ac91e..46d46126 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_126.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_126.c @@ -76,7 +76,7 @@ static void TaskF01(void) task1.pcName = "Task_126_1"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -85,7 +85,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -120,7 +120,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_127.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_127.c index c9ed5a99..e3ea0943 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_127.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_127.c @@ -51,7 +51,7 @@ static void TaskF01(void) task1.pcName = "Task_127_1"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -77,7 +77,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_128.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_128.c index 04614748..ff52a0b3 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_128.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_128.c @@ -63,7 +63,7 @@ static void TaskF01(void) task1.pcName = "Task_128_1"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -92,7 +92,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_129.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_129.c index c80a883e..051c06b4 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_129.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_129.c @@ -52,7 +52,7 @@ static void HwiF01(void) // 3, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif TEST_HwiClear(HWI_NUM_TEST); @@ -79,7 +79,7 @@ static UINT32 Testcase(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_130.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_130.c index 1af58128..ab3e7bd3 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_130.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_130.c @@ -95,7 +95,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; @@ -110,7 +110,7 @@ static UINT32 Testcase(void) task1.pcName = "Task_130_1"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_131.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_131.c index 136011b1..7bc428d0 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_131.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_131.c @@ -68,7 +68,7 @@ static void TaskF02(void) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -130,7 +130,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; @@ -145,7 +145,7 @@ static UINT32 Testcase(void) task1.pcName = "Task_131_1"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_133.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_133.c index a607f4f8..9385e15a 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_133.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_133.c @@ -58,7 +58,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_134.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_134.c index ceb015fc..ac30ed74 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_134.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_134.c @@ -56,7 +56,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK + 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_135.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_135.c index 03f5ba0c..f95914f3 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_135.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_135.c @@ -60,7 +60,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk138A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_136.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_136.c index 78e86856..5a142e34 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_136.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_136.c @@ -73,7 +73,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task2.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02; @@ -81,7 +81,7 @@ static UINT32 Testcase(void) task2.pcName = "Task_136_2"; task2.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task2.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif for (i = 0; i < IT_TASK_SMP_LOOP; i++) { diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_138.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_138.c index 74aa61fb..e3410976 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_138.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_138.c @@ -85,7 +85,7 @@ static void TaskF01(void) ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, (HwiIrqParam *)arg); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -136,7 +136,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task1); @@ -149,7 +149,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_141.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_141.c index 8e56235a..a41d892a 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_141.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_141.c @@ -83,7 +83,7 @@ static UINT32 Testcase(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "TskTstA"; task1.usTaskPrio = TASK_PRIO_TEST_TASK + 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_142.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_142.c index daeb6075..0f3f260c 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_142.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_142.c @@ -73,7 +73,7 @@ static UINT32 Testcase(void) ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)ItHwi, arg); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST3, ArchCurrCpuid() + 1); // curret cpu #endif float d1 = 100.0f; diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_002.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_002.c index 9b5b56ef..d055f0cd 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_002.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_002.c @@ -84,7 +84,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST * 2; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -96,7 +96,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_003.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_003.c index c8de1cc6..c62a362f 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_003.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_003.c @@ -126,7 +126,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST * 2; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -139,7 +139,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST * 2; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -151,7 +151,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_004.c b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_004.c index c96e453a..d59e9882 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_004.c +++ b/testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_004.c @@ -131,7 +131,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST * 3; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -143,7 +143,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_049.c b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_049.c index b3e8d03a..3742a238 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_049.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_049.c @@ -83,7 +83,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_081.c b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_081.c index 359c9aee..d37870f7 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_081.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_081.c @@ -105,7 +105,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk081A"; // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_097.c b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_097.c index 5b67c366..dee48ee6 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_097.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_097.c @@ -57,7 +57,7 @@ static void TaskF01(void) task1.usTaskPrio = TASK_PRIO_TEST_TASK - 3; task1.uwResved = 0; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); @@ -87,7 +87,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = -1; diff --git a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_099.c b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_099.c index 5b884572..79459cf6 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_099.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_099.c @@ -55,7 +55,7 @@ static UINT32 Testcase(void) // 2, It is used to calculate a priority relative to TASK_PRIO_TEST_TASK. task1.usTaskPrio = TASK_PRIO_TEST_TASK - 2; task1.processID = LOS_GetCurrProcessID(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif task1.processID = LOS_GetCurrProcessID(); diff --git a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_101.c b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_101.c index c84a6869..d16703f0 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_101.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_101.c @@ -60,7 +60,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk101A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_105.c b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_105.c index e186f8ed..55932c80 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_105.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_105.c @@ -63,7 +63,7 @@ static UINT32 Testcase(void) task1.pcName = "Tsk105A"; task1.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_timeslice_001.c b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_timeslice_001.c index 93515685..bc5ad154 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_timeslice_001.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smoke/It_los_task_timeslice_001.c @@ -75,7 +75,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST * 2; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -87,7 +87,7 @@ static UINT32 Testcase(void) task.uwStackSize = TASK_STACK_SIZE_TEST; task.usTaskPrio = TASK_PRIO_TEST_TASK - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_002.c b/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_002.c index ad1ee4a4..0958e7bc 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_002.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_002.c @@ -62,7 +62,7 @@ static UINT32 Testcase(void) LOS_TaskDelay(2); // 2, set delay time. ret = LOS_TaskDelete(testid); -#if (LOSCFG_KERNEL_SMP_TASK_SYNC == NO) +#ifndef LOSCFG_KERNEL_SMP_TASK_SYNC /* delay and check */ LOS_TaskDelay(10); // 10, set delay time. #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_024.c b/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_024.c index a35fcfc9..d1b38e31 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_024.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_024.c @@ -76,7 +76,7 @@ static UINT32 Testcase(void) g_itTestResult = LOS_OK; LOS_TaskLock(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; #endif diff --git a/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_025.c b/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_025.c index b0c7cd42..33270a17 100644 --- a/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_025.c +++ b/testsuites/kernel/sample/kernel_base/core/task/smp/It_smp_los_task_025.c @@ -95,7 +95,7 @@ static UINT32 Testcase(void) g_itTestResult = LOS_NOK; LOS_TaskLock(); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.c b/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.c index ee305b7f..949e547f 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.c @@ -39,7 +39,7 @@ extern "C" { VOID ItSuiteLosEvent(VOID) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP ItSmpLosEvent001(); ItSmpLosEvent002(); ItSmpLosEvent003(); @@ -107,7 +107,7 @@ VOID ItSuiteLosEvent(VOID) ItLosEvent023(); ItLosEvent024(); ItLosEvent025(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ItLosEvent026(); #endif ItLosEvent027(); @@ -117,7 +117,7 @@ VOID ItSuiteLosEvent(VOID) ItLosEvent033(); // / ItLosEvent037(); ItLosEvent038(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ItLosEvent039(); #endif ItLosEvent040(); @@ -134,7 +134,7 @@ VOID ItSuiteLosEvent(VOID) ItLosEvent017(); ItLosEvent034(); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, 1); #endif } diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.h b/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.h index 61451f0c..26dad0f9 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.h +++ b/testsuites/kernel/sample/kernel_base/ipc/event/It_los_event.h @@ -151,7 +151,7 @@ extern VOID ItLosEvent017(VOID); extern VOID ItLosEvent034(VOID); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP VOID ItSmpLosEvent001(VOID); VOID ItSmpLosEvent002(VOID); VOID ItSmpLosEvent003(VOID); diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_018.c b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_018.c index cb6b34b0..9f43e7cb 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_018.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_018.c @@ -46,7 +46,7 @@ static VOID TaskF02(VOID) ret = LOS_EventWrite(&g_event, 0x10); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4. #endif g_testCount++; diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_023.c b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_023.c index f08a1c6f..24ffccee 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_023.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_023.c @@ -61,7 +61,7 @@ static VOID TaskF01(VOID) ICUNIT_GOTO_EQUAL(ret, g_event.uwEventID, ret, EXIT); ICUNIT_ASSERT_EQUAL_VOID(ret, 0x11, ret); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, Here, assert that g_testCount is equal to 5. #endif g_testCount++; @@ -80,7 +80,7 @@ static VOID TaskF02(VOID) ICUNIT_GOTO_EQUAL(ret, g_event.uwEventID, ret, EXIT); ICUNIT_ASSERT_EQUAL_VOID(ret, 0x11, ret); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT); // 6, Here, assert that g_testCount is equal to 6. #endif g_testCount++; @@ -121,7 +121,7 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_024.c b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_024.c index 988a6d1b..32d754be 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_024.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_024.c @@ -58,7 +58,7 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_026.c b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_026.c index 73069046..fc30d6a2 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_026.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_026.c @@ -73,7 +73,7 @@ static UINT32 Testcase(VOID) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task. task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_038.c b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_038.c index 6a523f9f..ff269c61 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_038.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_038.c @@ -116,7 +116,7 @@ static UINT32 Testcase(VOID) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task. task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -128,7 +128,7 @@ static UINT32 Testcase(VOID) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.usTaskPrio = TASK_PRIO_TEST - 1; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -139,7 +139,7 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_039.c b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_039.c index 4afc4dcf..7ded8636 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_039.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_039.c @@ -65,7 +65,7 @@ static UINT32 Testcase(VOID) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task. task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/smoke/It_los_event_036.c b/testsuites/kernel/sample/kernel_base/ipc/event/smoke/It_los_event_036.c index a5edd54a..7428ff16 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/smoke/It_los_event_036.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/smoke/It_los_event_036.c @@ -66,7 +66,7 @@ static UINT32 Testcase(VOID) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task. task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/ipc/event/smp/It_smp_los_event_032.c b/testsuites/kernel/sample/kernel_base/ipc/event/smp/It_smp_los_event_032.c index ef39eb66..9c56de16 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/event/smp/It_smp_los_event_032.c +++ b/testsuites/kernel/sample/kernel_base/ipc/event/smp/It_smp_los_event_032.c @@ -37,7 +37,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_ret1, g_ret2, g_ret3; static UINT32 g_szId[3] = {0}; diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/It_los_mux.c b/testsuites/kernel/sample/kernel_base/ipc/mux/It_los_mux.c index c68b18f3..b0cb2a26 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/It_los_mux.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/It_los_mux.c @@ -107,7 +107,7 @@ VOID ItSuiteLosMux(void) ItLosMux043(); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP ItSmpLosMux001(); ItSmpLosMux002(); ItSmpLosMux003(); @@ -143,7 +143,7 @@ VOID ItSuiteLosMux(void) ItSmpLosMux2029(); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, 1); HalIrqSetAffinity(HWI_NUM_TEST1, 1); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_013.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_013.c index 76e1167e..d7b003b0 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_013.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_013.c @@ -72,11 +72,11 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif TestHwiTrigger(HWI_NUM_TEST); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP TestBusyTaskDelay(5); // 5, delay for Timing control. #endif ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_016.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_016.c index 3db8a392..cd2ab6e1 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_016.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_016.c @@ -65,12 +65,12 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif TestHwiTrigger(HWI_NUM_TEST); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP TestBusyTaskDelay(10); // 10, delay for Timing control. #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_017.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_017.c index 27ad8361..c98ff4e9 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_017.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_017.c @@ -64,7 +64,7 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif TestHwiTrigger(HWI_NUM_TEST); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_020.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_020.c index 97230ac6..4da64155 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_020.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_020.c @@ -78,7 +78,7 @@ static UINT32 Testcase(VOID) ret = LOS_HwiCreate(HWI_NUM_TEST0, 0, 0, (HWI_PROC_FUNC)HwiF02, 0); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); HalIrqSetAffinity(HWI_NUM_TEST0, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_021.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_021.c index 0c7873c1..b91b06af 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_021.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_021.c @@ -69,7 +69,7 @@ VOID TaskF02(void) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.usTaskPrio = TASK_PRIO_TEST - 3; // 3, set reasonable priority. task1.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -101,7 +101,7 @@ static UINT32 Testcase(VOID) task.pcName = "LosMB2_1"; task.uwStackSize = 0x900; task.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_026.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_026.c index 5220c6fc..edb52dfe 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_026.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_026.c @@ -117,7 +117,7 @@ static VOID TaskAFunc(VOID) task1.pcName = "TaskB"; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -135,7 +135,7 @@ static VOID TaskAFunc(VOID) task2.pcName = "TaskC"; task2.uwStackSize = TASK_STACK_SIZE_TEST; task2.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID03, &task2); @@ -152,7 +152,7 @@ static VOID TaskAFunc(VOID) task3.pcName = "TaskD"; task3.uwStackSize = TASK_STACK_SIZE_TEST; task3.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task3.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID04, &task3); @@ -210,7 +210,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskA"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_027.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_027.c index bf957e9a..01db9295 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_027.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_027.c @@ -111,7 +111,7 @@ static VOID TaskA1Func(VOID) task1.pcName = "TaskB"; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -122,7 +122,7 @@ static VOID TaskA1Func(VOID) task2.pcName = "TaskC"; task2.uwStackSize = TASK_STACK_SIZE_TEST; task2.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID03, &task2); @@ -133,7 +133,7 @@ static VOID TaskA1Func(VOID) task3.pcName = "TaskD"; task3.uwStackSize = TASK_STACK_SIZE_TEST; task3.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task3.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID04, &task3); @@ -168,7 +168,7 @@ static UINT32 Testcase(void) task.pcName = "TaskA"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_028.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_028.c index de9234b4..6e367d5a 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_028.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_028.c @@ -103,7 +103,7 @@ static VOID TaskA2Func(VOID) task1.pcName = "TaskB"; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -115,7 +115,7 @@ static VOID TaskA2Func(VOID) task2.pcName = "TaskC"; task2.uwStackSize = TASK_STACK_SIZE_TEST; task2.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID03, &task2); @@ -127,7 +127,7 @@ static VOID TaskA2Func(VOID) task3.pcName = "TaskD"; task3.uwStackSize = TASK_STACK_SIZE_TEST; task3.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task3.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID04, &task3); @@ -164,7 +164,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskA"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_029.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_029.c index cdb90189..a46e0e36 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_029.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_029.c @@ -75,7 +75,7 @@ static VOID TaskC3Func(VOID) task1.pcName = "TaskD"; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID04, &task1); @@ -130,7 +130,7 @@ static VOID TaskA3Func(VOID) task1.pcName = "TaskB"; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -141,7 +141,7 @@ static VOID TaskA3Func(VOID) task2.pcName = "TaskC"; task2.uwStackSize = TASK_STACK_SIZE_TEST; task2.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID03, &task2); @@ -178,7 +178,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskA"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_031.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_031.c index f0afad92..dde87d11 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_031.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_031.c @@ -119,7 +119,7 @@ static VOID TaskA5Func(VOID) task1.pcName = "TaskB"; task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID02, &task1); @@ -130,7 +130,7 @@ static VOID TaskA5Func(VOID) task2.pcName = "TaskC"; task2.uwStackSize = TASK_STACK_SIZE_TEST; task2.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task2.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID03, &task2); @@ -141,7 +141,7 @@ static VOID TaskA5Func(VOID) task3.pcName = "TaskD"; task3.uwStackSize = TASK_STACK_SIZE_TEST; task3.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task3.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID04, &task3); @@ -182,7 +182,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskA"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testTaskID01, &task); diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_035.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_035.c index b9c75822..db1e4f62 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_035.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_035.c @@ -100,7 +100,7 @@ static VOID TaskMisc10Func(VOID) task1.pcName = "TaskService_3"; task1.uwStackSize = LOS_TASK_MIN_STACK_SIZE; task1.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -134,7 +134,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskMisc_10"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -146,7 +146,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_2"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_036.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_036.c index dd41f227..a050575e 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_036.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_036.c @@ -87,7 +87,7 @@ static VOID TaskMisc10Func(VOID) task1.pcName = "TaskService_5"; task1.uwStackSize = LOS_TASK_MIN_STACK_SIZE; task1.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -118,7 +118,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskMisc_10"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -132,7 +132,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_4"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = 0; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_037.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_037.c index 046a06fc..e0cf203b 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_037.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_037.c @@ -95,7 +95,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskMisc_10"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -107,7 +107,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_4"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_038.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_038.c index 8ca4c571..a4560186 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_038.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_038.c @@ -89,7 +89,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskMisc_10"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -101,7 +101,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_4"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_039.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_039.c index 854dc3ff..63d13309 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_039.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_039.c @@ -106,7 +106,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskMisc_10"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -121,7 +121,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_4"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_040.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_040.c index 1a0523bd..e362c7fe 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_040.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_040.c @@ -199,7 +199,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskMisc_10"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -214,7 +214,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_9"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -229,7 +229,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_8"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -244,7 +244,7 @@ static UINT32 Testcase(VOID) task.pcName = "TaskFe_7"; task.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_041.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_041.c index a0b9fdf8..4fb84b90 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_041.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_041.c @@ -81,7 +81,7 @@ static UINT32 Testcase(VOID) taskParam.pcName = "TaskMisc_10"; taskParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_042.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_042.c index 59ecf212..f0cdfc3d 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_042.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_042.c @@ -99,7 +99,7 @@ static UINT32 Testcase(VOID) taskParam.pcName = "TaskMisc_10"; taskParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -115,7 +115,7 @@ static UINT32 Testcase(VOID) taskParam.pcName = "TaskFe_4"; taskParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_043.c b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_043.c index 0aa758fb..41324aef 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_043.c +++ b/testsuites/kernel/sample/kernel_base/ipc/mux/full/It_los_mutex_043.c @@ -120,7 +120,7 @@ static UINT32 Testcase(VOID) taskParam.pcName = "TaskMisc_10"; taskParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif @@ -136,7 +136,7 @@ static UINT32 Testcase(VOID) taskParam.pcName = "TaskFe_4"; taskParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.c b/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.c index 2a7816a1..a1dd0a3a 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.c @@ -40,7 +40,7 @@ extern "C" { VOID ItSuiteLosQueue(VOID) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP ItSmpLosQueue001(); ItSmpLosQueue002(); ItSmpLosQueue003(); @@ -101,7 +101,7 @@ VOID ItSuiteLosQueue(VOID) ItLosQueue018(); ItLosQueue019(); ItLosQueue020(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ItLosQueue021(); #endif ItLosQueue022(); @@ -228,7 +228,7 @@ VOID ItSuiteLosQueue(VOID) ItLosQueueHead042(); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, 1); #endif } diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.h b/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.h index fb0b30b6..0309563c 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.h +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/It_los_queue.h @@ -256,7 +256,7 @@ VOID ItLosQueueDebug001(void); #endif #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP VOID ItSmpLosQueue001(VOID); VOID ItSmpLosQueue002(VOID); VOID ItSmpLosQueue003(VOID); diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_044.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_044.c index 3ceae8d8..f47b3586 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_044.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_044.c @@ -70,7 +70,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_045.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_045.c index e11fcd6f..e57f3ec8 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_045.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_045.c @@ -64,7 +64,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_046.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_046.c index 24336641..19bca4a7 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_046.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_046.c @@ -83,7 +83,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST3, 1, 0, HwiF02, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_047.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_047.c index 3fb31a6c..f336392b 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_047.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_047.c @@ -95,7 +95,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_048.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_048.c index 99f6dd66..3847f03f 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_048.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_048.c @@ -88,7 +88,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_050.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_050.c index f1d4a9f6..205ab668 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_050.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_050.c @@ -68,7 +68,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_108.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_108.c index 9a2d44b2..48e42202 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_108.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_108.c @@ -75,7 +75,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_111.c b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_111.c index 72e22d82..84ed0f2a 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_111.c +++ b/testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_111.c @@ -77,7 +77,7 @@ static UINT32 Testcase(VOID) ret = TEST_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.c b/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.c index 4a07e548..08468c7d 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.c +++ b/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.c @@ -39,7 +39,7 @@ extern "C" { VOID ItSuiteLosSem(void) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* fixed */ ItSmpLosSem008(); ItSmpLosSem022(); @@ -114,7 +114,7 @@ VOID ItSuiteLosSem(void) ItLosSem036(); ItLosSem037(); ItLosSem038(); -#if (LOSCFG_KERNEL_SMP_TASK_SYNC != YES) +#ifndef LOSCFG_KERNEL_SMP_TASK_SYNC // LOSCFG_KERNEL_SMP_TASK_SYNC is opened ,create task success is depend on created semaphore successed; ItLosSem039(); ItLosSem040(); @@ -134,7 +134,7 @@ VOID ItSuiteLosSem(void) ItLosSem024(); ItLosSem030(); ItLosSem032(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ItLosSem033(); #endif LltLosSem001(); @@ -153,7 +153,7 @@ VOID ItSuiteLosSem(void) #endif #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, 1); #endif } diff --git a/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.h b/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.h index 0da88acf..62368917 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.h +++ b/testsuites/kernel/sample/kernel_base/ipc/sem/It_los_sem.h @@ -102,7 +102,7 @@ VOID ItLosSem043(void); VOID ItLosSem044(void); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP VOID ItSmpLosSem001(VOID); VOID ItSmpLosSem002(VOID); VOID ItSmpLosSem003(VOID); diff --git a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_020.c b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_020.c index be911426..47bb469c 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_020.c +++ b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_020.c @@ -59,7 +59,7 @@ static UINT32 Testcase(VOID) task.uwStackSize = TASK_STACK_SIZE_TEST; task.usTaskPrio = TASK_PRIO_TEST - 1; task.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_testCount = 0; diff --git a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_022.c b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_022.c index db7ae18d..56ffb69d 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_022.c +++ b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_022.c @@ -60,12 +60,12 @@ static VOID TaskF02(void) LOS_TaskLock(); ret = LOS_SemPost(g_semID); ICUNIT_TRACK_EQUAL(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ICUNIT_TRACK_EQUAL(g_testCount, 1, g_testCount); #endif LOS_TaskUnlock(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ICUNIT_TRACK_EQUAL(g_testCount, 1, g_testCount); #endif g_testCount++; diff --git a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_023.c b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_023.c index 4eb0ab8c..263c6c41 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_023.c +++ b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_023.c @@ -88,7 +88,7 @@ static UINT32 Testcase(VOID) TEST_HwiDelete(HWI_NUM_TEST); ret = TEST_HwiCreate(HWI_NUM_TEST, 0, 0, HwiF01, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_026.c b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_026.c index 5195b921..65132b95 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_026.c +++ b/testsuites/kernel/sample/kernel_base/ipc/sem/full/It_los_sem_026.c @@ -44,7 +44,7 @@ static VOID TaskF02(void) g_testCount++; ret = LOS_SemPend(g_semID, LOS_WAIT_FOREVER); ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ICUNIT_TRACK_EQUAL(g_testCount, 2, g_testCount); // 2, Here, assert that g_testCount is equal to #endif g_testCount++; @@ -61,7 +61,7 @@ static VOID TaskF01(void) ret = LOS_SemPend(g_semID, LOS_WAIT_FOREVER); ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ICUNIT_TRACK_EQUAL(g_testCount, 3, g_testCount); // 3, Here, assert that g_testCount is equal to #endif g_testCount++; diff --git a/testsuites/kernel/sample/kernel_base/ipc/sem/smp/It_smp_los_sem_030.c b/testsuites/kernel/sample/kernel_base/ipc/sem/smp/It_smp_los_sem_030.c index 742a1042..fdc8155b 100644 --- a/testsuites/kernel/sample/kernel_base/ipc/sem/smp/It_smp_los_sem_030.c +++ b/testsuites/kernel/sample/kernel_base/ipc/sem/smp/It_smp_los_sem_030.c @@ -38,7 +38,7 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP static UINT32 g_ret1, g_ret2, g_ret3; static UINT32 g_szId[3] = {0}; diff --git a/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.c b/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.c index f4217d4e..fc348ff5 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.c @@ -99,7 +99,7 @@ VOID ItSuiteExtendCpup(VOID) ItExtendCpup010(); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP ItSmpExtendCpup001(); ItSmpExtendCpup002(); #ifdef LOSCFG_CPUP_INCLUDE_IRQ diff --git a/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.h b/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.h index 7e54b537..7a4d8eea 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.h +++ b/testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.h @@ -116,7 +116,7 @@ VOID ItExtendCpup009(VOID); VOID ItExtendCpup010(VOID); #endif -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP VOID ItSmpExtendCpup001(VOID); VOID ItSmpExtendCpup002(VOID); #ifdef LOSCFG_CPUP_INCLUDE_IRQ diff --git a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_004.c b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_004.c index 98cb5671..2643a713 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_004.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_004.c @@ -70,7 +70,7 @@ static UINT32 TaskF01(VOID) task1.pcName = "TestCpupTsk2"; task1.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. task1.uwResved = TASK_STATUS_UNDETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL(g_cpupTestCount, 0, g_cpupTestCount); @@ -104,7 +104,7 @@ static UINT32 Testcase(VOID) task1.pcName = "TestCpupTsk1"; task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. task1.uwResved = TASK_STATUS_UNDETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_cpupTestCount = 0; diff --git a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_005.c b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_005.c index b47ac536..2e80bad8 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_005.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_005.c @@ -77,7 +77,7 @@ static UINT32 Testcase(VOID) task1.pcName = "TskTst1"; task1.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. task1.uwResved = TASK_STATUS_UNDETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_cpupTestCount = 0; diff --git a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_006.c b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_006.c index e90de96d..152f2e29 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_006.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_006.c @@ -71,7 +71,7 @@ static VOID TaskF01(VOID) task1.pcName = "TskTst2"; task1.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. task1.uwResved = TASK_STATUS_UNDETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ICUNIT_ASSERT_EQUAL_VOID(g_cpupTestCount, 0, g_cpupTestCount); @@ -114,7 +114,7 @@ static UINT32 Testcase(VOID) task1.pcName = "TskTst1"; task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. task1.uwResved = TASK_STATUS_UNDETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_cpupTestCount = 0; diff --git a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_008.c b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_008.c index 86e9e792..45188fd0 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_008.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/full/It_extend_cpup_008.c @@ -72,7 +72,7 @@ static UINT32 Testcase(VOID) task1.pcName = "TestCpupTsk1"; task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. task1.uwResved = TASK_STATUS_UNDETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP task1.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif g_cpupTestCount = 0; diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_001.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_001.c index d72a879b..5efd147e 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_001.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_001.c @@ -76,7 +76,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup001_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -89,7 +89,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup001_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_002.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_002.c index a05abf00..be0802cc 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_002.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_002.c @@ -68,7 +68,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup002_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_003.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_003.c index 4b476b9a..c3649397 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_003.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_003.c @@ -99,7 +99,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup003_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -112,7 +112,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup003_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_004.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_004.c index 1fecac72..853a0643 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_004.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_004.c @@ -119,7 +119,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup004_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -132,7 +132,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup004_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_005.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_005.c index 6b247384..72d12677 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_005.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_005.c @@ -68,7 +68,7 @@ static void Task01(void) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup005_task03"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID03, &taskInitParam); @@ -79,7 +79,7 @@ static void Task01(void) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup005_task04"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID04, &taskInitParam); @@ -142,7 +142,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup005_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -155,7 +155,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup005_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_007.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_007.c index 6f596788..4b401738 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_007.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_007.c @@ -73,7 +73,7 @@ static UINT32 Testcase(VOID) taskInitParam.pcName = "SmpCpup007_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. taskInitParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -86,7 +86,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup007_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_008.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_008.c index 3be498fc..3a961ac9 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_008.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_008.c @@ -72,7 +72,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup008_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -85,7 +85,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup008_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_009.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_009.c index d64b8486..034ad59d 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_009.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_009.c @@ -56,7 +56,7 @@ static void Task01(void) taskInitParam.pcName = "SmpCpup009_task03"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. taskInitParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID03, &taskInitParam); @@ -96,7 +96,7 @@ static UINT32 Testcase(VOID) taskInitParam.pcName = "SmpCpup009_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. taskInitParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -109,7 +109,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup009_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_010.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_010.c index d2037338..3bcbb4b5 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_010.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_010.c @@ -75,7 +75,7 @@ static UINT32 Testcase(VOID) taskInitParam.pcName = "SmpCpup001_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. taskInitParam.uwResved = LOS_TASK_STATUS_DETACHED; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -88,7 +88,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup001_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_011.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_011.c index b572f834..a4056e0e 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_011.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_011.c @@ -95,7 +95,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup001_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -108,7 +108,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup001_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_012.c b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_012.c index 7a320ed6..42206fb7 100644 --- a/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_012.c +++ b/testsuites/kernel/sample/kernel_extend/cpup/smp/It_smp_extend_cpup_012.c @@ -78,7 +78,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup001_task01"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 2; // 2, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP /* make sure that created test task is definitely on another core */ UINT32 currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(currCpuid); @@ -91,7 +91,7 @@ static UINT32 Testcase(VOID) taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; taskInitParam.pcName = "SmpCpup001_task02"; taskInitParam.usTaskPrio = TASK_PRIO_TEST - 1; // 1, used to calculate the task priority. -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif ret = LOS_TaskCreate(&g_testSmpCpupTaskID02, &taskInitParam); diff --git a/testsuites/kernel/sample/posix/mutex/It_posix_mutex.c b/testsuites/kernel/sample/posix/mutex/It_posix_mutex.c index da2a543f..c253061e 100644 --- a/testsuites/kernel/sample/posix/mutex/It_posix_mutex.c +++ b/testsuites/kernel/sample/posix/mutex/It_posix_mutex.c @@ -119,7 +119,7 @@ VOID ItSuitePosixMutex(void) ItPosixMux072(); ItPosixMux073(); ItPosixMux074(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ItPosixMux075(); #endif ItPosixMux076(); diff --git a/testsuites/kernel/sample/posix/pthread/It_posix_pthread.c b/testsuites/kernel/sample/posix/pthread/It_posix_pthread.c index 160b5a5f..3607d837 100644 --- a/testsuites/kernel/sample/posix/pthread/It_posix_pthread.c +++ b/testsuites/kernel/sample/posix/pthread/It_posix_pthread.c @@ -251,7 +251,7 @@ VOID ItSuitePosixPthread() ItPosixPthread044(); ItPosixPthread045(); ItPosixPthread046(); -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP ItPosixPthread047(); // pthread preemption, may not happen on smp #endif ItPosixPthread048(); diff --git a/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_066.c b/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_066.c index a7e03f6c..76132c12 100644 --- a/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_066.c +++ b/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_066.c @@ -76,7 +76,7 @@ static VOID *PthreadF01(void *argument) ret = pthread_create(&g_newTh2, &attr, PthreadF02, NULL); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP while (g_testCount < 2) { // 2, delay until g_testCount is equal to 2. TestBusyTaskDelay(1); } diff --git a/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_068.c b/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_068.c index 6ced64b9..a71ec33b 100644 --- a/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_068.c +++ b/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_068.c @@ -74,7 +74,7 @@ static VOID *PthreadF01(VOID *argument) ret = pthread_create(&g_newTh2, &attr, PthreadF02, NULL); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP while (g_testCount < 2) { // 2, delay until g_testCount is equal to 2. TestBusyTaskDelay(1); } diff --git a/testsuites/kernel/src/iCunit.c b/testsuites/kernel/src/iCunit.c index 9b8b709a..1515ba2d 100644 --- a/testsuites/kernel/src/iCunit.c +++ b/testsuites/kernel/src/iCunit.c @@ -50,7 +50,7 @@ extern "C" { #define ARRAY_SIZE 2 -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_testSuitSpin); #endif @@ -125,13 +125,13 @@ u_long ICunitRand(void) void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP UINT32 intSave; TESTSUIT_LOCK(intSave); #endif g_iCunitErrCode = ((g_iCunitErrCode == 0) && (g_iCunitErrLineNo == 0)) ? (iiUINT32)retCode : g_iCunitErrCode; g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? line : g_iCunitErrLineNo; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP TESTSUIT_UNLOCK(intSave); #endif } @@ -184,7 +184,7 @@ iUINT32 ICunitAddCase(const iCHAR *caseName, CASE_FUNCTION caseFunc, iUINT16 tes UINT32 g_cunitInitFlag = 0; iUINT32 ICunitInit(void) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP if (LOS_AtomicCmpXchg32bits(&g_cunitInitFlag, 1, 0)) { PRINTK("other core already done iCunitInit\n"); return (iUINT32)ICUNIT_SUCCESS; diff --git a/testsuites/kernel/src/osTest.c b/testsuites/kernel/src/osTest.c index a9762cec..5317ea77 100644 --- a/testsuites/kernel/src/osTest.c +++ b/testsuites/kernel/src/osTest.c @@ -259,7 +259,7 @@ void TestHwiTrigger(unsigned int irq) VOID TestExtraTaskDelay(UINT32 tick) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP // trigger task schedule may occor on another core // needs adding delay and checking status later LOS_TaskDelay(tick); @@ -327,7 +327,7 @@ VOID TestTestHwiDelete(unsigned int irq, VOID *devId) VOID TestDumpCpuid(VOID) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP PRINT_DEBUG("%d,cpuid = %d\n", LOS_CurTaskIDGet(), ArchCurrCpuid()); #endif return; @@ -530,7 +530,7 @@ void TestSystemInit(void) testProcess = OS_PCB_FROM_PID(pid); g_testTskHandle = testProcess->threadGroupID; -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP ((LosTaskCB *)OS_TCB_FROM_TID(g_testTskHandle))->cpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid()); #endif } diff --git a/testsuites/unittest/BUILD.gn b/testsuites/unittest/BUILD.gn index da118cdf..f287a343 100644 --- a/testsuites/unittest/BUILD.gn +++ b/testsuites/unittest/BUILD.gn @@ -81,13 +81,13 @@ group("unittest") { } if (LOSCFG_USER_TEST_FS_VFAT == true) { if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest_door" ] + deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_door" ] } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest" ] + deps += [ "fs/vfat:liteos_a_fs_vfat_unittest" ] } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { - deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest_pressure" ] + deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_pressure" ] } } if (LOSCFG_USER_TEST_FS_PROC == true) { diff --git a/testsuites/unittest/common/include/osTest.h b/testsuites/unittest/common/include/osTest.h index 5fa25e69..3ee6fb5d 100644 --- a/testsuites/unittest/common/include/osTest.h +++ b/testsuites/unittest/common/include/osTest.h @@ -84,7 +84,7 @@ stTestTask.uwResved = LOS_TASK_STATUS_DETACHED; \ } while (0) -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP #define TEST_TASK_PARAM_INIT_AFFI(stTestTask, task_name, entry, prio, affi) \ TEST_TASK_PARAM_INIT(stTestTask, task_name, entry, prio) \ stTestTask.usCpuAffiMask = affi; @@ -132,6 +132,7 @@ extern void TestBusyTaskDelay(UINT32 tick); extern void *malloc(size_t size); extern void TEST_DumpCpuid(void); extern u_long T_random(void); +extern VOID TestAssertWaitDelay(UINT32 *testCount, UINT32 flag); UINT32 LosTaskDelay(UINT32 tick); #define TEST_HwiDelete(ID) TEST_TEST_HwiDelete(ID, NULL) diff --git a/testsuites/unittest/common/osTest.cpp b/testsuites/unittest/common/osTest.cpp index 6bcb34de..0c02e5e6 100644 --- a/testsuites/unittest/common/osTest.cpp +++ b/testsuites/unittest/common/osTest.cpp @@ -162,7 +162,7 @@ UINT32 LosTaskDelay(UINT32 tick) VOID TestExtraTaskDelay(UINT32 uwTick) { -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP // trigger task schedule may occor on another core // needs adding delay and checking status later LosTaskDelay(uwTick); @@ -215,6 +215,13 @@ VOID TestAssertBusyTaskDelay(UINT32 timeout, UINT32 flag) } } +VOID TestAssertWaitDelay(UINT32 *testCount, UINT32 flag) +{ + while (*testCount != flag) { + usleep(1); + } +} + UINT32 PosixPthreadInit(pthread_attr_t *attr, int pri) { UINT32 uwRet = 0; diff --git a/testsuites/unittest/config.gni b/testsuites/unittest/config.gni index d7c6da1c..0520a702 100644 --- a/testsuites/unittest/config.gni +++ b/testsuites/unittest/config.gni @@ -73,4 +73,4 @@ LOSCFG_USER_TEST_SIGNAL = true LOSCFG_USER_TEST_SYS = true LOSCFG_USER_TEST_TIME_CLOCK = true LOSCFG_USER_TEST_TIME_TIMER = true -LOSCFG_USER_TEST_UTIL = true \ No newline at end of file +LOSCFG_USER_TEST_UTIL = true diff --git a/testsuites/unittest/fs/BUILD.gn b/testsuites/unittest/fs/BUILD.gn index 7fc066b3..468b795e 100644 --- a/testsuites/unittest/fs/BUILD.gn +++ b/testsuites/unittest/fs/BUILD.gn @@ -55,7 +55,7 @@ sources_smoke = [ "jffs/smoke/It_vfs_jffs_035.cpp", "jffs/smoke/It_vfs_jffs_094.cpp", "jffs/smoke/It_vfs_jffs_095.cpp", - #"jffs/smoke/It_vfs_jffs_103.cpp", + "jffs/smoke/It_vfs_jffs_103.cpp", "jffs/smoke/It_vfs_jffs_535.cpp", "jffs/smoke/It_vfs_jffs_Dac_001.cpp", ] @@ -128,7 +128,7 @@ sources_pressure = [ "jffs/pressure/It_fs_jffs_pressure_053.cpp", "jffs/pressure/It_fs_jffs_pressure_301.cpp", "jffs/pressure/It_fs_jffs_pressure_302.cpp", - #"jffs/pressure/It_fs_jffs_pressure_303.cpp", + "jffs/pressure/It_fs_jffs_pressure_303.cpp", "jffs/pressure/It_fs_jffs_pressure_304.cpp", "jffs/pressure/It_fs_jffs_pressure_305.cpp", "jffs/pressure/It_fs_jffs_pressure_306.cpp", @@ -289,7 +289,7 @@ sources_full = [ "jffs/full/It_vfs_jffs_048.cpp", "jffs/full/It_vfs_jffs_049.cpp", "jffs/full/It_vfs_jffs_050.cpp", - #"jffs/full/It_vfs_jffs_051.cpp", + "jffs/full/It_vfs_jffs_051.cpp", "jffs/full/It_vfs_jffs_053.cpp", "jffs/full/It_vfs_jffs_055.cpp", "jffs/full/It_vfs_jffs_056.cpp", @@ -790,6 +790,9 @@ sources_full = [ "jffs/full/It_vfs_test_symlink_002.cpp", "jffs/full/It_vfs_test_symlink_003.cpp", "jffs/full/It_vfs_test_symlinkat_001.cpp", + "jffs/full/It_vfs_test_mount_rdonly_001.cpp", + "jffs/full/It_vfs_test_mount_rdonly_002.cpp", + "jffs/full/It_vfs_test_mount_rdonly_003.cpp", ] if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { @@ -837,4 +840,4 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { configs = [ "..:public_config_for_pressure" ] deps = [ "//third_party/bounds_checking_function:libsec_shared" ] } -} \ No newline at end of file +} diff --git a/testsuites/unittest/fs/jffs/It_vfs_jffs.h b/testsuites/unittest/fs/jffs/It_vfs_jffs.h index f1fd0b30..41d89e57 100644 --- a/testsuites/unittest/fs/jffs/It_vfs_jffs.h +++ b/testsuites/unittest/fs/jffs/It_vfs_jffs.h @@ -137,7 +137,7 @@ constexpr int JFFS_MAX_DEF_BUF_NUM = 21; constexpr int JFFS_FILE_LIMITTED_NUM = 200; constexpr int JFFS_FILE_SIZE_TEST = 100 * 1024 * 1024; // *1024 -constexpr int JFFS_PERFORMANCE_W_R_SIZE = 10 * 1024 * 1024; +constexpr int JFFS_PERFORMANCE_W_R_SIZE = 5 * 1024 * 1024; constexpr int JFFS_FILE_PER_WRITE_SIZE = 5 * 1024 * 1024; constexpr int JFFS_PRESSURE_W_R_SIZE1 = 1 * 1024 * 1024; constexpr int JFFS_PRESSURE_W_R_SIZE2 = 5 * 1024 * 1024; @@ -962,6 +962,9 @@ VOID ItFsTestSymlink001(VOID); VOID ItFsTestSymlink002(VOID); VOID ItFsTestSymlink003(VOID); VOID ItFsTestSymlinkat001(VOID); +VOID ItFsTestMountRdonly001(VOID); +VOID ItFsTestMountRdonly002(VOID); +VOID ItFsTestMountRdonly003(VOID); #endif #if defined(LOSCFG_USER_TESTSUIT_SHELL) diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_011.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_011.cpp index 451e274a..df31ea3f 100644 --- a/testsuites/unittest/fs/jffs/full/It_jffs_011.cpp +++ b/testsuites/unittest/fs/jffs/full/It_jffs_011.cpp @@ -40,7 +40,7 @@ static UINT32 Testcase(VOID) CHAR *pfd = NULL; ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); pfd = mktemp(tempFile); ICUNIT_GOTO_NOT_EQUAL(pfd, NULL, pfd, EXIT1); diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_012.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_012.cpp index 29ea6a29..931adfd6 100644 --- a/testsuites/unittest/fs/jffs/full/It_jffs_012.cpp +++ b/testsuites/unittest/fs/jffs/full/It_jffs_012.cpp @@ -40,7 +40,7 @@ static UINT32 Testcase(VOID) CHAR *pfd = NULL; ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); pfd = mkdtemp(tempFile); ICUNIT_GOTO_NOT_EQUAL(pfd, NULL, pfd, EXIT1); diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp index 650663b7..f99e7df8 100644 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp +++ b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp @@ -55,7 +55,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); + ICUNIT_GOTO_EQUAL(len, 10, len, EXIT3); // 10 means read size len = write(fd1, "abcde", 6); // 6 means write len ICUNIT_GOTO_EQUAL(len, 6, len, EXIT3); diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp index 127ad1b7..0665026f 100644 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp +++ b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp @@ -47,6 +47,7 @@ static UINT32 Testcase(VOID) ret = mkdir(pathname1, HIGHEST_AUTHORITY); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); + strcat_s(pathname2, sizeof(pathname2), "/test"); strcat_s(pathname2, sizeof(pathname2), "/test"); ret = mkdir(pathname2, HIGHEST_AUTHORITY); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp index 7399288b..c9d5c6d7 100644 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp +++ b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp @@ -48,7 +48,7 @@ static UINT32 Testcase(VOID) fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - strcat_s(pathname2, sizeof(pathname2), "/test"); + strcat_s(pathname2, sizeof(pathname2), "/TEst"); fd2 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT2); diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp index 70ad022a..6927fc30 100644 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp +++ b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp @@ -48,7 +48,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); ICUNIT_GOTO_STRING_EQUAL(buf, JFFS_PATH_NAME0, buf, EXIT); - pret = getcwd(buf, JFFS_STANDARD_NAME_LENGTH); + pret = getcwd(buf, 5); // 5 is less than path length ICUNIT_GOTO_EQUAL(pret, NULL, pret, EXIT); ICUNIT_GOTO_EQUAL(errno, ERANGE, errno, EXIT); diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp index a36d242f..4f3b227c 100644 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp +++ b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp @@ -105,12 +105,12 @@ static UINT32 Testcase(VOID) memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); + ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT6); g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = 0xffff; + g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = 0xffff; + g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp new file mode 100644 index 00000000..338927ad --- /dev/null +++ b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#include "It_vfs_jffs.h" + +static UINT32 testcase(VOID) +{ + INT32 fd = -1; + INT32 ret; + CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; + CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; + + fd = creat(pathname1, 0777); + ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); + + ret = close(fd); + ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); + + ret = umount(JFFS_MAIN_DIR0); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); + + ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); + + fd = open(pathname1, O_RDWR); + ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); + + ret = symlink(pathname1, pathname2); + ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); + + ret = rename(pathname1, pathname2); + ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); + + ret = unlink(pathname1); + ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); + + ret = umount(JFFS_MAIN_DIR0); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); + + ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); + + ret = unlink(pathname1); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); + + return JFFS_NO_ERROR; + +EXIT5: + unlink(pathname2); + goto EXIT3; +EXIT4: + close(fd); +EXIT3: + umount(JFFS_MAIN_DIR0); +EXIT2: + mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); +EXIT1: + unlink(pathname1); +EXIT: + return JFFS_NO_ERROR; +} + +VOID ItFsTestMountRdonly001(VOID) +{ + TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); +} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp new file mode 100644 index 00000000..7fc30971 --- /dev/null +++ b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#include "It_vfs_jffs.h" + +static UINT32 testcase(VOID) +{ + INT32 fd = -1; + INT32 ret; + CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; + + ret = umount(JFFS_MAIN_DIR0); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); + + ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); + + fd = creat(pathname1, 0755); + ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); + + fd = open(pathname1, O_CREAT | O_RDONLY, 0755); + ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); + + fd = open(pathname1, O_CREAT | O_RDWR, 0755); + ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); + + ret = mkdir(pathname1, 0755); + ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); + + ret = umount(JFFS_MAIN_DIR0); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); + + ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); + + return JFFS_NO_ERROR; + +EXIT3: + close(fd); +EXIT2: + remove(pathname1); +EXIT1: + umount(JFFS_MAIN_DIR0); + mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); +EXIT: + return JFFS_NO_ERROR; +} + +VOID ItFsTestMountRdonly002(VOID) +{ + TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); +} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp new file mode 100644 index 00000000..68cd07aa --- /dev/null +++ b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2021-2021 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. + */ + +#include "It_vfs_jffs.h" + +static UINT32 testcase(VOID) +{ + INT32 fd = -1; + INT32 ret; + CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; + const CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; + CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; + + fd = creat(pathname1, 0777); + ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); + + ret = write(fd, writebuf, strlen(writebuf)); + ICUNIT_GOTO_EQUAL(ret, strlen(writebuf), ret, EXIT4); + + ret = close(fd); + ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); + + ret = umount(JFFS_MAIN_DIR0); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); + + ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); + + fd = open(pathname1, O_RDWR); + ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); + + fd = open(pathname1, O_RDONLY); + ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); + + ret = read(fd, readbuf, strlen(writebuf)); + ICUNIT_GOTO_EQUAL(ret, strlen(writebuf), ret, EXIT4); + ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); + + ret = close(fd); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); + + ret = umount(JFFS_MAIN_DIR0); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); + + ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); + + ret = unlink(pathname1); + ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); + + return JFFS_NO_ERROR; + +EXIT4: + close(fd); +EXIT3: + umount(JFFS_MAIN_DIR0); +EXIT2: + mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); +EXIT1: + unlink(pathname1); +EXIT: + return JFFS_NO_ERROR; +} + +VOID ItFsTestMountRdonly003(VOID) +{ + TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); +} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp index ac22734f..3d744ad5 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp @@ -75,6 +75,8 @@ static UINT32 TestCase(VOID) len = write(fd[index], bufW, strlen(bufW)); if (len <= 0) { flag = 1; + ret = close(fd[index]); + ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); break; } diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp index 2c827eeb..842ed161 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp @@ -38,6 +38,7 @@ static UINT32 TestCase(VOID) INT32 i = 0; INT32 j = 0; INT32 k = JFFS_SHORT_ARRAY_LENGTH; + INT32 jffsPressureCycles = 4; // write size 4 * 1024 * 1024 signed long long offset; CHAR filebuf[FILE_BUF_SIZE] = @@ -101,11 +102,11 @@ static UINT32 TestCase(VOID) fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { + for (j = 0; j < jffsPressureCycles; j++) { off = lseek(fd, 0, SEEK_SET); ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { + for (i = 0; i < jffsPressureCycles; i++) { ret = write(fd, bufW, strlen(bufW)); printf("cnt=%d %d\n", i, j); ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); @@ -115,8 +116,8 @@ static UINT32 TestCase(VOID) } ret = stat(pathname1, &statfile); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // file size: 10 * 1024 * 1024 - ICUNIT_GOTO_EQUAL(statfile.st_size, 10 * 1024 * 1024, statfile.st_size, EXIT2); + // file size: 4 * 1024 * 1024 + ICUNIT_GOTO_EQUAL(statfile.st_size, 4 * 1024 * 1024, statfile.st_size, EXIT2); } ret = close(fd); diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp index 8b4fb549..c0075f20 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp @@ -44,7 +44,7 @@ static UINT32 TestCase(VOID) CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = "123"; CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; + CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; @@ -67,7 +67,8 @@ static UINT32 TestCase(VOID) for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/test%d", i); - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, bufname); + strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname); + strcpy_s(pathname3[i], JFFS_NAME_LIMITTED_SIZE, pathname2); ret = mkdir(pathname3[i], HIGHEST_AUTHORITY); diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp index e6e486aa..04498908 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp @@ -170,7 +170,7 @@ static VOID *PthreadF02(void *arg) CHAR *bufR = NULL; CHAR *bufW = NULL; off_t off; - INT32 bufRSize = 6075; // 6075: read length + INT32 bufRSize = 6074; // 6074: read length ret = pthread_mutex_lock(&g_jffs2GlobalLock1); printf("[%d] Thread2 Start frist get lock\n", __LINE__); diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp index 10c0ebb0..2e207ae3 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp @@ -34,7 +34,7 @@ static VOID *PthreadF01(void *arg) { INT32 ret, len; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE2; + UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; CHAR *writeBuf = NULL; @@ -66,7 +66,7 @@ static VOID *PthreadF01(void *arg) printf("[%d]lseek64 off64:%lld Fd:%d \n", __LINE__, off64, g_jffsFd); ICUNIT_GOTO_EQUAL(statbuf1.st_size, off64, statbuf1.st_size, EXIT1); - len = write(g_jffsFd, writebuf, strlen(writebuf)); + len = write(g_jffsFd, writeBuf, strlen(writeBuf)); printf("[%d]lseek64 len:%d Fd:%d, errno:%d\n", __LINE__, len, g_jffsFd, errno); ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT1); ICUNIT_GOTO_EQUAL(errno, ENOSPC, errno, EXIT1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp index 06ea0f94..de6b6c9a 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp @@ -98,8 +98,9 @@ static VOID *PthreadF01(void *arg) testSpeed); return NULL; -EXIT: +EXIT1: close(g_jffsFd); +EXIT: return NULL; } diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp index 3549107e..bec8b3f2 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp @@ -33,7 +33,8 @@ static UINT32 TestCase(VOID) { - INT32 ret, i; + INT32 ret; + INT32 i = 0; INT32 scandirCount = 0; CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = ""; @@ -52,7 +53,6 @@ static UINT32 TestCase(VOID) memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); strcat_s(pathname6, JFFS_NAME_LIMITTED_SIZE, "/"); - // PATH_MAX test. The dirname has occupied 14 bytes. while (i < 241) { // loop times: 241 i++; diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp index 5b36e4b7..40fa396c 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp @@ -33,7 +33,8 @@ static UINT32 TestCase(VOID) { - INT32 ret, i; + INT32 ret; + INT32 i = 0; INT32 fd = -1; INT32 scandirCount = 0; CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; @@ -82,7 +83,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(strlen(pathname3), 256, strlen(pathname3), EXIT); // pathname length: 256 fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); + ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); ret = chdir("/"); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp index 98175ae3..f09d48cd 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp @@ -40,6 +40,7 @@ static VOID *PthreadF01(void *arg) INT32 i = 0; INT32 j = 0; INT32 k = JFFS_SHORT_ARRAY_LENGTH; + INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size CHAR filebuf[FILE_BUF_SIZE] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" @@ -87,7 +88,7 @@ static VOID *PthreadF01(void *arg) strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/004.txt"); // /storage/test/004.txt fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); + ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); len = write(fd1, writebuf, strlen(writebuf)); ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); @@ -112,7 +113,7 @@ static VOID *PthreadF01(void *arg) off = lseek(fd, 0, SEEK_SET); ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - for (i = 0; i < JFFS_MAX_CYCLES; i++) { + for (i = 0; i < jffsMaxCycles; i++) { ret = write(fd, bufW, strlen(bufW)); ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); @@ -131,8 +132,8 @@ static VOID *PthreadF01(void *arg) ret = stat(pathname1, &statfile); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 5 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 5 * 1024 * 1024, statfile.st_size, EXIT2); + // 1 * 1024 * 1024: filesize + ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); ret = close(fd); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); @@ -167,6 +168,7 @@ static VOID *PthreadF02(void *arg) INT32 i = 0; INT32 j = 0; INT32 k = JFFS_SHORT_ARRAY_LENGTH; + INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size CHAR filebuf[FILE_BUF_SIZE] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" @@ -213,7 +215,7 @@ static VOID *PthreadF02(void *arg) strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/005.txt"); fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); + ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); len = write(fd1, writebuf, strlen(writebuf)); ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); @@ -238,7 +240,7 @@ static VOID *PthreadF02(void *arg) off = lseek(fd, 0, SEEK_SET); ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - for (i = 0; i < JFFS_MAX_CYCLES; i++) { + for (i = 0; i < jffsMaxCycles; i++) { ret = write(fd, bufW, strlen(bufW)); ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); @@ -257,8 +259,8 @@ static VOID *PthreadF02(void *arg) ret = stat(pathname1, &statfile); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 5 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 5 * 1024 * 1024, statfile.st_size, EXIT2); + // 1 * 1024 * 1024: filesize + ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); ret = close(fd); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); @@ -293,6 +295,7 @@ static VOID *PthreadF03(void *arg) INT32 i = 0; INT32 j = 0; INT32 k = JFFS_SHORT_ARRAY_LENGTH; + INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size CHAR filebuf[FILE_BUF_SIZE] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" @@ -339,7 +342,7 @@ static VOID *PthreadF03(void *arg) strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/006.txt"); fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); + ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); len = write(fd1, writebuf, strlen(writebuf)); ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); @@ -364,7 +367,7 @@ static VOID *PthreadF03(void *arg) off = lseek(fd, 0, SEEK_SET); ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - for (i = 0; i < JFFS_MAX_CYCLES; i++) { + for (i = 0; i < jffsMaxCycles; i++) { ret = write(fd, bufW, strlen(bufW)); ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); @@ -383,8 +386,8 @@ static VOID *PthreadF03(void *arg) ret = stat(pathname1, &statfile); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 5 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 5 * 1024 * 1024, statfile.st_size, EXIT2); + // 1 * 1024 * 1024: filesize + ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); ret = close(fd); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp index 6173228a..da8bed12 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp @@ -30,7 +30,7 @@ */ #include "It_vfs_jffs.h" -static INT32 g_testNum = 20; +static INT32 g_testNum = 2; static VOID *PthreadF01(void *arg) { diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp index 0f963dfc..2c1b72f4 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp @@ -48,7 +48,7 @@ static VOID *PthreadF01(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB + INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB flag = 0; bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); @@ -224,7 +224,7 @@ static VOID *PthreadF02(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB + INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB flag = 0; bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); @@ -400,7 +400,7 @@ static VOID *PthreadF03(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB + INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB flag = 0; bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp index 33752c4e..fde6104e 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -219,7 +219,7 @@ static VOID *PthreadF02(void *arg) DIR *dirbuf[100] = {NULL}; struct stat buf1 = { 0 }; struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -390,7 +390,7 @@ static VOID *PthreadF03(void *arg) DIR *dirbuf[100] = {NULL}; struct stat buf1 = { 0 }; struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp index 6600a7e2..63cad8e1 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp @@ -47,7 +47,7 @@ static VOID *PthreadF01(void *arg) DIR *dirbuf[100] = {NULL}; struct stat buf1 = { 0 }; struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -150,7 +150,7 @@ static VOID *PthreadF02(void *arg) DIR *dirbuf[100] = {NULL}; struct stat buf1 = { 0 }; struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -256,7 +256,7 @@ static VOID *PthreadF03(void *arg) DIR *dirbuf[100] = {NULL}; struct stat buf1 = { 0 }; struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp index f4047664..6c097601 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -217,7 +217,7 @@ static VOID *PthreadF02(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -388,7 +388,7 @@ static VOID *PthreadF03(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp index cdfb448f..cd24c4cf 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -153,7 +153,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -262,7 +262,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp index ff23eca5..079ada44 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -153,7 +153,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -260,7 +260,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp index 4a1f5323..ef2ffbb7 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp @@ -44,7 +44,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -151,7 +151,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -257,7 +257,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp index 6d003662..59e7a066 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp @@ -44,7 +44,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -151,7 +151,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -260,7 +260,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp index 77dd872e..962a5d3c 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp @@ -44,7 +44,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -153,7 +153,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -261,7 +261,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp index 9ad59b44..c08fb7cb 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -153,7 +153,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -260,7 +260,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0000"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp index 735e5276..047d1e90 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp @@ -44,7 +44,7 @@ static VOID *PthreadF01(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB bufW = (CHAR *)malloc(bufWLen + 1); ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); @@ -107,7 +107,7 @@ static VOID *PthreadF02(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB bufW = (CHAR *)malloc(bufWLen + 1); ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); @@ -170,7 +170,7 @@ static VOID *PthreadF03(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB bufW = (CHAR *)malloc(bufWLen + 1); ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp index a23040fd..13e106f0 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp @@ -43,7 +43,7 @@ static VOID *PthreadF01(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -147,7 +147,7 @@ static VOID *PthreadF02(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -251,7 +251,7 @@ static VOID *PthreadF03(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp index 93ed9ff7..55fb8abe 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp @@ -43,7 +43,7 @@ static VOID *PthreadF01(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -148,7 +148,7 @@ static VOID *PthreadF02(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -253,7 +253,7 @@ static VOID *PthreadF03(void *arg) "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp index 1137fe71..9d3ce6ce 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp @@ -44,7 +44,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -267,7 +267,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp index 5709c906..d1eaae8d 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp @@ -44,7 +44,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -267,7 +267,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp index 95b1a84d..516ac388 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp @@ -44,7 +44,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -267,7 +267,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp index 73a96e72..5786640d 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -270,7 +270,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp index d8297b09..b5d8dcf8 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -270,7 +270,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp index 6330ae3d..543b261a 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -270,7 +270,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp index 7ab2bf69..0ebe9c36 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -270,7 +270,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp index 0ee85f36..a4269f45 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -270,7 +270,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp index 9cb76484..b17c81f5 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp @@ -45,7 +45,7 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); @@ -270,7 +270,7 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufW = NULL; struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; + INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB flag = 0; bufW = (CHAR *)malloc(bufWLen + 1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp index a4529fae..fe64c537 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp @@ -71,8 +71,6 @@ static VOID *MutiJffs05202(void *arg) strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_52"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); - // file size: 1024, write size: 1024 ret = JffsMultiWrite(pathname, 1024, 1024, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp index 57639165..454c190c 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp @@ -68,7 +68,6 @@ static VOID *MutiJffs05302(void *arg) dprintf(" start muti_jffs_053_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_53"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); fd = open(pathname, O_RDONLY, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp index b6edd489..0ca30aa1 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp @@ -69,7 +69,6 @@ static VOID *MutiJffs05402(void *arg) dprintf(" start muti_jffs_054_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_54"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp index 083a137a..3c26506f 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp @@ -68,7 +68,6 @@ static VOID *MutiJffs05502(void *arg) dprintf(" start muti_jffs_055_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_55"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp index 69bc0f79..7a3de5d9 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp @@ -69,7 +69,6 @@ static VOID *MutiJffs05602(void *arg) strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_56"); strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_56_rename"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); rename(pathname, pathname1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp index eee55b4c..479eeb7b 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp @@ -66,7 +66,6 @@ static VOID *MutiJffs05702(void *arg) dprintf(" start muti_jffs_057_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_57"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); umount(pathname); mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp index c7b92b9f..ffdc0c11 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp @@ -66,7 +66,6 @@ static VOID *MutiJffs05802(void *arg) CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; dprintf(" start muti_jffs_058_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_58"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); // file size: 1024, write size: 16 ret = JffsMultiWrite(pathname, 1024, 16, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp index bfc980c8..909e76f2 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp @@ -70,7 +70,6 @@ static VOID *MutiJffs05902(void *arg) dprintf(" start muti_jffs_059_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_59"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp index b6649e5e..7e23e03f 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp @@ -70,7 +70,6 @@ static VOID *MutiJffs06002(void *arg) dprintf(" start muti_jffs_060_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_60"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); fd = open(pathname, O_RDONLY | O_CREAT, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp index 453ff4b2..e9147dc8 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp @@ -70,7 +70,6 @@ static VOID *MutiJffs06102(void *arg) dprintf(" start muti_jffs_061_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_61"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); fd = open(pathname, O_RDONLY | O_CREAT, HIGHEST_AUTHORITY); ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp index 0a213ffa..2bc77731 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp @@ -71,7 +71,6 @@ static VOID *MutiJffs06202(void *arg) dprintf(" start muti_jffs_062_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_62"); strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_62_rename"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); rename(pathname, pathname1); diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp index 92955888..e192c193 100644 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp +++ b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp @@ -67,7 +67,6 @@ static VOID *MutiJffs06302(void *arg) dprintf(" start muti_jffs_063_02 1 \n"); strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_63"); - ICUNIT_GOTO_EQUAL(g_TestCnt, 0, g_TestCnt, EXIT); umount(pathname); diff --git a/testsuites/unittest/fs/jffs/vfs_jffs_test.cpp b/testsuites/unittest/fs/jffs/vfs_jffs_test.cpp index 531fed81..5c66f8ab 100644 --- a/testsuites/unittest/fs/jffs/vfs_jffs_test.cpp +++ b/testsuites/unittest/fs/jffs/vfs_jffs_test.cpp @@ -983,9 +983,19 @@ INT32 JffsStatfsPrintf(struct statfs buf) using namespace testing::ext; namespace OHOS { +#if defined(LOSCFG_USER_TEST_PRESSURE) +pthread_mutexattr_t mutex; +#endif class VfsJffsTest : public testing::Test { public: - static void SetUpTestCase(void) {} + static void SetUpTestCase(void) + { +#if defined(LOSCFG_USER_TEST_PRESSURE) + pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); + pthread_mutex_init(&g_jffs2GlobalLock1, &mutex); + pthread_mutex_init(&g_jffs2GlobalLock2, &mutex); +#endif + } static void TearDownTestCase(void) {} }; #if defined(LOSCFG_USER_TEST_FULL) @@ -6875,6 +6885,21 @@ HWTEST_F(VfsJffsTest, ItFsTestSymlinkat001, TestSize.Level0) ItFsTestSymlinkat001(); } +HWTEST_F(VfsJffsTest, ItFsTestMountRdonly001, TestSize.Level0) +{ + ItFsTestMountRdonly001(); +} + +HWTEST_F(VfsJffsTest, ItFsTestMountRdonly002, TestSize.Level0) +{ + ItFsTestMountRdonly002(); +} + +HWTEST_F(VfsJffsTest, ItFsTestMountRdonly003, TestSize.Level0) +{ + ItFsTestMountRdonly003(); +} + #endif #if defined(LOSCFG_USER_TEST_SMOKE) /* * @@ -7001,10 +7026,6 @@ HWTEST_F(VfsJffsTest, ItFsJffs535, TestSize.Level0) #endif #if defined(LOSCFG_USER_TEST_PRESSURE) -pthreadMutexattrT mutex; -PthreadMutexattrSettype(&mutex, PTHREAD_MUTEX_NORMAL); -PthreadMutexInit(&g_jffs2GlobalLock1, &mutex); -PthreadMutexInit(&g_jffs2GlobalLock2, &mutex); /* * * @tc.name: ItFsJffsPRESSURE_001 * @tc.desc: function for VfsJffsTest @@ -8481,17 +8502,6 @@ HWTEST_F(VfsJffsTest, ItFsJffsPerformance006, TestSize.Level0) ItFsJffsPerformance006(); } -/* * - * @tc.name: ItFsJffsPERFORMANCE_007 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance007, TestSize.Level0) -{ - ItFsJffsPerformance007(); -} - /* * * @tc.name: ItFsJffsPERFORMANCE_008 * @tc.desc: function for VfsJffsTest diff --git a/testsuites/unittest/fs/proc/It_vfs_proc.cpp b/testsuites/unittest/fs/proc/It_vfs_proc.cpp index df08e332..a4d42574 100644 --- a/testsuites/unittest/fs/proc/It_vfs_proc.cpp +++ b/testsuites/unittest/fs/proc/It_vfs_proc.cpp @@ -48,7 +48,7 @@ VOID ItSuiteVfsProc(VOID) #endif #if defined(LOSCFG_USER_TEST_PRESSURE) -#if(LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP #endif #endif } diff --git a/testsuites/unittest/fs/vfat2/BUILD.gn b/testsuites/unittest/fs/vfat/BUILD.gn similarity index 99% rename from testsuites/unittest/fs/vfat2/BUILD.gn rename to testsuites/unittest/fs/vfat/BUILD.gn index 47d650d1..cae4233e 100644 --- a/testsuites/unittest/fs/vfat2/BUILD.gn +++ b/testsuites/unittest/fs/vfat/BUILD.gn @@ -34,7 +34,7 @@ common_include_dirs = [ "//third_party/googletest/googletest/include", "../../common/include", "//kernel/liteos_a/testsuites/unittest/fs/vfs", - "//kernel/liteos_a/testsuites/unittest/fs/vfat2", + "//kernel/liteos_a/testsuites/unittest/fs/vfat", ] sources_entry = [ diff --git a/testsuites/unittest/fs/vfat2/It_vfs_fat.h b/testsuites/unittest/fs/vfat/It_vfs_fat.h similarity index 99% rename from testsuites/unittest/fs/vfat2/It_vfs_fat.h rename to testsuites/unittest/fs/vfat/It_vfs_fat.h index a2e0c125..e863e1fc 100644 --- a/testsuites/unittest/fs/vfat2/It_vfs_fat.h +++ b/testsuites/unittest/fs/vfat/It_vfs_fat.h @@ -33,7 +33,6 @@ #define IT_VFS_FAT_H #include "osTest.h" -#include "syslog.h" #include "sys/uio.h" #include "utime.h" #include @@ -265,6 +264,8 @@ VOID ItFsFat903(VOID); VOID ItFsFat904(VOID); VOID ItFsFat909(VOID); +#endif + #if defined(LOSCFG_USER_TEST_PRESSURE) VOID ItFsFatMutipthread003(VOID); VOID ItFsFatMutipthread004(VOID); @@ -334,5 +335,3 @@ VOID ItFsFatPerformance007(VOID); VOID ItFsFatPerformance008(VOID); #endif - -#endif \ No newline at end of file diff --git a/testsuites/unittest/fs/vfat2/VfsFatTest.cpp b/testsuites/unittest/fs/vfat/VfsFatTest.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/VfsFatTest.cpp rename to testsuites/unittest/fs/vfat/VfsFatTest.cpp index ba226ec4..b87e7f31 100644 --- a/testsuites/unittest/fs/vfat2/VfsFatTest.cpp +++ b/testsuites/unittest/fs/vfat/VfsFatTest.cpp @@ -788,26 +788,20 @@ public: { INT32 ret = 0; sleep(3); // 3s - if (ret != 0) - perror("format sd card"); - return; + ret = mkdir("/vs/", S_IRWXU | S_IRWXG | S_IRWXO); if (ret != 0) { perror("mkdir mount dir"); - return; - - ret = mkdir(FAT_MOUNT_DIR, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret != 0) { - perror("mkdir mount dir"); - return; - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, nullptr); - if (ret != 0) { - perror("mount sd card"); - return; - } - } } + + ret = mkdir(FAT_MOUNT_DIR, S_IRWXU | S_IRWXG | S_IRWXO); + if (ret != 0) { + perror("mkdir mount dir"); + } + + g_fatFilesystem = 2; + ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, nullptr); + ASSERT_EQ(0, ret); } static void TearDownTestCase(void) { @@ -815,6 +809,13 @@ public: } }; +#if defined(LOSCFG_USER_TEST_SMOKE) +HWTEST_F(VfsFatTest, ItFsFat026, TestSize.Level0) +{ + ItFsFat026(); +} +#endif + #if defined(LOSCFG_USER_TEST_FULL) HWTEST_F(VfsFatTest, ItFsFat066, TestSize.Level0) { @@ -1146,7 +1147,8 @@ HWTEST_F(VfsFatTest, ItFsFat909, TestSize.Level0) ItFsFat909(); // plug and unplug during writing or reading } -#endif +#endif // LOSCFG_USER_TEST_FULL + #if defined(LOSCFG_USER_TEST_PRESSURE) HWTEST_F(VfsFatTest, ItFsFatPressure040, TestSize.Level0) { @@ -1460,11 +1462,5 @@ HWTEST_F(VfsFatTest, ItFsFatPerformance008, TestSize.Level0) ItFsFatPerformance008(); // fix write and read for three pthread } -#endif -#if defined(LOSCFG_USER_TEST_SMOKE) -HWTEST_F(VfsFatTest, ItFsFat026, TestSize.Level0) -{ - ItFsFat026(); // statfs Unsupport -} -#endif +#endif // LOSCFG_USER_TEST_PRESSURE } // namespace OHOS diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_066.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_066.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_066.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_066.cpp index 13c60710..8bd2ddec 100644 --- a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_066.cpp +++ b/testsuites/unittest/fs/vfat/full/It_vfs_fat_066.cpp @@ -53,7 +53,7 @@ static const int CLUSTER_SIZE64 = 64; static const int CLUSTER_SIZE128 = 128; static const int CLUSTER_SIZE255 = 255; static const int CLUSTER_SIZE256 = 256; -static const int SECTOR_SIZE = 128; +static const int SECTOR_SIZE = 512; static UINT32 TestCase(VOID) { diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_068.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_068.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_068.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_068.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_072.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_072.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_072.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_072.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_073.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_073.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_073.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_073.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_074.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_074.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_074.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_074.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_496.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_496.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_496.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_496.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_497.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_497.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_497.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_497.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_498.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_498.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_498.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_498.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_499.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_499.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_499.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_499.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_500.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_500.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_500.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_500.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_501.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_501.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_501.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_501.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_502.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_502.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_502.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_502.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_503.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_503.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_503.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_503.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_504.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_504.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_504.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_504.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_506.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_506.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_506.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_506.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_507.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_507.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_507.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_507.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_508.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_508.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_508.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_508.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_509.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_509.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_509.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_509.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_510.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_510.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_510.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_510.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_511.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_511.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_511.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_511.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_512.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_512.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_512.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_512.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_513.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_513.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_513.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_513.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_514.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_514.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_514.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_514.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_515.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_515.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_515.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_515.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_516.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_516.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_516.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_516.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_517.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_517.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_517.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_517.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_518.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_518.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_518.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_518.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_519.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_519.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_519.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_519.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_662.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_662.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_662.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_662.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_663.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_663.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_663.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_663.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_664.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_664.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_664.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_664.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_665.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_665.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_665.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_665.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_666.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_666.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_666.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_666.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_667.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_667.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_667.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_667.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_668.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_668.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_668.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_668.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_669.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_669.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_669.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_669.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_670.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_670.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_670.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_670.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_671.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_671.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_671.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_671.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_672.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_672.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_672.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_672.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_673.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_673.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_673.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_673.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_674.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_674.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_674.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_674.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_675.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_675.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_675.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_675.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_676.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_676.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_676.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_676.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_677.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_677.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_677.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_677.cpp index 51b2483c..4c8dca7a 100644 --- a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_677.cpp +++ b/testsuites/unittest/fs/vfat/full/It_vfs_fat_677.cpp @@ -130,10 +130,6 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); FatStatfsPrintf(buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ret = statfs(pathname1, &buf2); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); FatStatfsPrintf(buf2); diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_678.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_678.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_678.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_678.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_679.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_679.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_679.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_679.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_680.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_680.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_680.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_680.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_681.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_681.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_681.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_681.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_682.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_682.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_682.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_682.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_683.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_683.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_683.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_683.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_684.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_684.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_684.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_684.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_685.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_685.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_685.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_685.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_686.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_686.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_686.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_686.cpp index cc5e1cf1..33573f51 100644 --- a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_686.cpp +++ b/testsuites/unittest/fs/vfat/full/It_vfs_fat_686.cpp @@ -62,7 +62,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); (void)memset_s(writebuf, size + 1, 0, size + 1); ret = memset_s(writebuf, size + 1, 0x61, size); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); + ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_687.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_687.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_687.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_687.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_692.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_692.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_692.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_692.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_693.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_693.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_693.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_693.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_694.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_694.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_694.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_694.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_870.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_870.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_870.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_870.cpp index cf88c74f..aaec7768 100644 --- a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_870.cpp +++ b/testsuites/unittest/fs/vfat/full/It_vfs_fat_870.cpp @@ -113,7 +113,7 @@ static UINT32 TestCase(VOID) ret = write(g_fatFd, bufWrite, strlen(bufWrite)); if (ret <= 0) { if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB"); + printf("The biggest file size is smaller than the 4GB\n"); goto EXIT2; } printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_872.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_872.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_872.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_872.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_873.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_873.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_873.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_873.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_874.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_874.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_874.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_874.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_875.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_875.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_875.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_875.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_902.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_902.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_902.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_902.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_903.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_903.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_903.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_903.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_904.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_904.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_904.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_904.cpp diff --git a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_909.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_909.cpp similarity index 97% rename from testsuites/unittest/fs/vfat2/full/It_vfs_fat_909.cpp rename to testsuites/unittest/fs/vfat/full/It_vfs_fat_909.cpp index bba7944b..28ce4c79 100644 --- a/testsuites/unittest/fs/vfat2/full/It_vfs_fat_909.cpp +++ b/testsuites/unittest/fs/vfat/full/It_vfs_fat_909.cpp @@ -62,8 +62,8 @@ static UINT32 TestCase(VOID) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // 1M * BYTES_PER_KBYTES * 4 = 4GB - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // 256 * BYTES_PER_KBYTES * 4 = 1MB + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_001.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_001.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_001.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_001.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_002.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_002.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_002.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_002.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_003.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_003.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_003.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_003.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_004.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_004.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_004.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_004.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_005.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_005.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_005.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_005.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_006.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_006.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_006.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_006.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_007.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_007.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_007.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_007.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_008.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_008.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_008.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_008.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_013.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_013.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_013.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_013.cpp index ed82e423..b71a9256 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_013.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_013.cpp @@ -65,7 +65,7 @@ static UINT32 TestCase(VOID) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB // 1M for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(pathname0, S_IRWXU | S_IRWXG | S_IRWXO); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_014.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_014.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_014.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_014.cpp index 2b0276f1..1fe244bd 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_014.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_014.cpp @@ -75,7 +75,7 @@ static UINT32 TestCase(VOID) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_015.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_015.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_015.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_015.cpp index dcdda2d4..39dced3d 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_015.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_015.cpp @@ -64,7 +64,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); @@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); @@ -247,7 +247,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_016.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_016.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_016.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_016.cpp index d47d8d66..c6f64ce2 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_performance_016.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_016.cpp @@ -50,7 +50,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); @@ -139,7 +139,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); @@ -228,7 +228,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_029.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_029.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_029.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_029.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_030.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_030.cpp similarity index 86% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_030.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_030.cpp index a366f118..23f42249 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_030.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_030.cpp @@ -77,23 +77,23 @@ static UINT32 TestCase(VOID) (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb + (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb + (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb + (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb + (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb } for (i = 0; i < 4; i++) { // loop 4 times - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb + (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb + (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb + (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb + (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb } for (i = 0; i < 5; i++) { // loop 5 times - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); + (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); } free(bufWrite1); free(bufWrite2); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_031.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_031.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_031.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_031.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_038.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_038.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_038.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_038.cpp index 72a6dfa3..a0d9531f 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_038.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_038.cpp @@ -214,8 +214,8 @@ static VOID *PthreadF02(void *arg) } for (i = 0; i < 10; i++) { // loop 10 times - (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB - (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB + (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB + (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB } free(bufWrite1); free(bufWrite2); @@ -331,11 +331,11 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); + ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); printf("\tg_fatFlag=:%d\t", g_fatFlag); } printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); + ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT); dir = opendir(FAT_PATH_NAME); ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_040.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_040.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_040.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_040.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_041.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_041.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_041.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_041.cpp index 21ff9f4c..b85a244d 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_041.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_041.cpp @@ -212,6 +212,7 @@ static VOID *PthreadF02(void *arg) (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb + (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb } free(bufWrite4); @@ -357,7 +358,6 @@ static UINT32 TestCase(VOID) printf("\tg_fatFlag=:%d\t", g_fatFlag); } printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); dir = opendir(FAT_PATH_NAME); ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); @@ -368,6 +368,8 @@ static UINT32 TestCase(VOID) ret = closedir(dir); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); + ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT); + ret = rmdir(FAT_PATH_NAME); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_042.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_042.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_042.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_042.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_301.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_301.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_301.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_301.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_302.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_302.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_302.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_302.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_303.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_303.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_303.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_303.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_305.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_305.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_305.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_305.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_306.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_306.cpp similarity index 97% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_306.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_306.cpp index 469e0618..dd508314 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_306.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_306.cpp @@ -75,9 +75,9 @@ static UINT32 TestCase(VOID) for (i = 0; i < 50; i++) { // loop 50 times (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); + (void)memset_s(pathname2[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); - FatStrcat2(pathname2[i], bufname, strlen(bufname)); + FatStrcat2(pathname2[i], bufname, FAT_STANDARD_NAME_LENGTH); ret = mkdir(pathname2[i], S_IRWXU | S_IRWXG | S_IRWXO); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_309.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_309.cpp similarity index 100% rename from testsuites/unittest/fs/vfat2/pressure/It_fs_fat_pressure_309.cpp rename to testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_309.cpp diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_003.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_003.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp index ca93e976..05798938 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_003.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp @@ -51,7 +51,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -186,7 +186,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -320,7 +320,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_004.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_004.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp index cf9b091e..ca68b6b7 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_004.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp @@ -52,7 +52,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } printf("In %s,line %d\n", __FUNCTION__, __LINE__); index = 0; @@ -179,7 +179,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } printf("In %s,line %d\n", __FUNCTION__, __LINE__); @@ -307,7 +307,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } printf("In %s,line %d\n", __FUNCTION__, __LINE__); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_005.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp similarity index 95% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_005.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp index 0a063f65..adcbf5df 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_005.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp @@ -51,7 +51,7 @@ static VOID *PthreadF01(void *arg) printf("pthread_f01 is excecuting\n"); bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb + (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); @@ -76,8 +76,8 @@ static VOID *PthreadF01(void *arg) } for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); } free(bufWrite1); @@ -157,7 +157,7 @@ static VOID *PthreadF02(void *arg) printf("pthread_f02 is excecuting\n"); bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb + (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); @@ -182,8 +182,8 @@ static VOID *PthreadF02(void *arg) } for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); } free(bufWrite1); @@ -263,7 +263,7 @@ static VOID *PthreadF03(void *arg) printf("pthread_f03 is excecuting\n"); bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb + (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); @@ -288,8 +288,8 @@ static VOID *PthreadF03(void *arg) } for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); } free(bufWrite1); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_006.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp similarity index 97% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_006.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp index 29e22841..4a3212f6 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_006.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp @@ -53,7 +53,7 @@ static VOID *PthreadF01(void *arg) bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb + (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); @@ -78,8 +78,8 @@ static VOID *PthreadF01(void *arg) } for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); } free(bufWrite1); @@ -239,7 +239,7 @@ static VOID *PthreadF02(void *arg) bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb + (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); @@ -264,8 +264,8 @@ static VOID *PthreadF02(void *arg) } for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); } free(bufWrite1); @@ -425,7 +425,7 @@ static VOID *PthreadF03(void *arg) bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb + (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); @@ -450,8 +450,8 @@ static VOID *PthreadF03(void *arg) } for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); + (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); } free(bufWrite1); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_008.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_008.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp index 2e5b8a49..619eb952 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_008.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp @@ -55,7 +55,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -191,7 +191,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -327,7 +327,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_009.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_009.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp index fa619d10..6959b2a1 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_009.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ @@ -134,7 +134,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ @@ -219,7 +219,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_010.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_010.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp index 798f922d..a7e1f733 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_010.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp @@ -53,7 +53,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -194,7 +194,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -336,7 +336,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_012.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_012.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp index fbb3acdc..4dd8e105 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_012.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp @@ -56,7 +56,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -218,7 +218,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -378,7 +378,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_014.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_014.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp index a0dd652f..23824d53 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_014.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp @@ -55,7 +55,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -215,7 +215,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -376,7 +376,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_016.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_016.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp index 17c1f2ee..7880ef62 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_016.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp @@ -54,7 +54,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -226,7 +226,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -398,7 +398,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_017.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_017.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp index 4a87a7d2..06d41d21 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_017.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -147,7 +147,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -247,7 +247,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_018.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_018.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp index 3c19cf76..c66e24f0 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_018.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp @@ -54,7 +54,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -219,7 +219,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -385,7 +385,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_019.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_019.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp index 606a36fd..8e71f3bf 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_019.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -262,7 +262,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_020.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_020.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp index 28fbcf23..0299cc5c 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_020.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -262,7 +262,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_021.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_021.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp index e9cde0f0..29116342 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_021.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -155,7 +155,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -261,7 +261,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_022.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_022.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp index 3a5273b4..6369422a 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_022.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -157,7 +157,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -262,7 +262,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_023.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_023.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp index dc994c2a..06b7a1fb 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_023.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -262,7 +262,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_024.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_024.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp index a4e429bf..ad6d4e27 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_024.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -155,7 +155,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -261,7 +261,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_027.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_027.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp index ea8858a8..0e36a7b0 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_027.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp @@ -48,7 +48,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -133,7 +133,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -218,7 +218,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_029.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp similarity index 97% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_029.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp index fd100322..bc67be1e 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_029.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp @@ -48,7 +48,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -133,7 +133,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -218,7 +218,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -333,7 +333,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads + ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads ret = rmdir(bufname3); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_030.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp similarity index 97% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_030.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp index 66d04432..40a2180e 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_030.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp @@ -48,7 +48,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -132,7 +132,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -216,7 +216,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -332,7 +332,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads + ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads ret = rmdir(bufname3); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_032.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp similarity index 97% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_032.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp index 93506b18..5d9a68a3 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_032.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp @@ -48,7 +48,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -132,7 +132,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -217,7 +217,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -333,7 +333,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads + ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads ret = rmdir(bufname3); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_033.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_033.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp index 38c55105..b5ac0acd 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_033.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -148,7 +148,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -247,7 +247,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_035.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_035.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp index 67439785..623acc00 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_035.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -148,7 +148,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -249,7 +249,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_036.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_036.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp index d9bbcba8..16e66e5a 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_036.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -149,7 +149,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -249,7 +249,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_038.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_038.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp index fd4d78b1..0a43ba6c 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_038.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -150,7 +150,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -253,7 +253,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_039.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_039.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp index 37cb5620..bd35dc08 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_039.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -395,7 +395,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); } - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads + ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads ret = rmdir(bufname); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_040.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_040.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp index 460d1c05..a2dc3b99 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_040.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_041.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_041.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp index 520c3ffa..19f31f2d 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_041.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_042.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_042.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp index 8db6215d..161ac289 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_042.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_043.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_043.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp index 7699a766..a003fa33 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_043.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_044.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_044.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp index 0af397d4..14b9f3a3 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_044.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_045.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_045.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp index 54d726ea..64d81794 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_045.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_046.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp similarity index 87% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_046.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp index 8b4c640e..3bf81ed5 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_046.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp @@ -33,7 +33,7 @@ static VOID *PthreadF01(void *arg) { - INT32 i, j, ret, len, flag, index; + INT32 i, j, ret, len, index; INT32 fd[100] = {}; CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; @@ -43,13 +43,12 @@ static VOID *PthreadF01(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufWrite = nullptr; - flag = 0; bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -58,35 +57,27 @@ static VOID *PthreadF01(void *arg) index); fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); if (fd[index] == -1) { - break; + index--; + ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); } switch (index % 3) { // mod 3 case 0: for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); } LosTaskDelay(3); // delay 3 s break; case 1: for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); } LosTaskDelay(5); // delay 5 s break; case 2: // the 2 nd case len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); LosTaskDelay(7); // delay 7 s break; default: @@ -100,16 +91,10 @@ static VOID *PthreadF01(void *arg) ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); ret = close(fd[index]); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } index++; } - if (flag == 0) { - index--; - } - for (i = index; i >= 0; i--) { + for (i = index - 1; i >= 0; i--) { (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, i); ret = unlink(pathname); @@ -135,7 +120,7 @@ EXIT: static VOID *PthreadF02(void *arg) { - INT32 i, j, ret, len, flag, index; + INT32 i, j, ret, len, index; INT32 fd[100] = {}; CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" @@ -145,13 +130,12 @@ static VOID *PthreadF02(void *arg) CHAR *bufWrite = nullptr; struct stat statbuf; - flag = 0; bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -160,35 +144,27 @@ static VOID *PthreadF02(void *arg) index); fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); if (fd[index] == -1) { - break; + index--; + ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); } switch (index % 3) { // mod 3 case 0: for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); } LosTaskDelay(3); // delay 3 s break; case 1: for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); } LosTaskDelay(5); // delay 5 s break; case 2: // the 2 nd case len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); LosTaskDelay(7); // delay 7 s break; default: @@ -202,17 +178,10 @@ static VOID *PthreadF02(void *arg) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); FatStatPrintf(statbuf); - if (flag == 1) { - break; - } index++; } - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { + for (i = index - 1; i >= 0; i--) { (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, i); ret = unlink(pathname); @@ -240,7 +209,7 @@ EXIT: static VOID *PthreadF03(void *arg) { - INT32 i, j, ret, len, flag, index; + INT32 i, j, ret, len, index; INT32 fd[100] = {}; CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; @@ -250,13 +219,12 @@ static VOID *PthreadF03(void *arg) CHAR writebuf[20] = "0123456789"; CHAR *bufWrite = nullptr; - flag = 0; bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -265,35 +233,27 @@ static VOID *PthreadF03(void *arg) index); fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); if (fd[index] == -1) { - break; + index--; + ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); } switch (index % 3) { // mod 3 case 0: for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); } LosTaskDelay(3); // delay 3 s break; case 1: for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); } LosTaskDelay(5); // delay 5 s break; case 2: // the 2 nd case len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } + ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); LosTaskDelay(7); // delay 7 s break; default: @@ -308,16 +268,10 @@ static VOID *PthreadF03(void *arg) ret = rename(pathname, pathname1); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } index++; } - if (flag == 0) { - index--; - } - for (i = index; i >= 0; i--) { + for (i = index - 1; i >= 0; i--) { (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, i); ret = unlink(pathname); @@ -380,7 +334,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); } - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads + ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads ret = rmdir(bufname); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_047.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_047.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp index 58e9b5dc..4b68477a 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_047.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_048.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_048.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp index bf6fde50..deb6fa9b 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_048.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -159,7 +159,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -267,7 +267,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_049.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_049.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp index 8a18abf3..84a307c4 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_049.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_050.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp similarity index 98% rename from testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_050.cpp rename to testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp index d565ac09..38f4ab95 100644 --- a/testsuites/unittest/fs/vfat2/pressure/It_vfs_fat_mutipthread_050.cpp +++ b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp @@ -49,7 +49,7 @@ static VOID *PthreadF01(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -158,7 +158,7 @@ static VOID *PthreadF02(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; @@ -266,7 +266,7 @@ static VOID *PthreadF03(void *arg) (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); + (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); } index = 0; diff --git a/testsuites/unittest/fs/vfat2/smoke/It_vfs_fat_026.cpp b/testsuites/unittest/fs/vfat/smoke/It_vfs_fat_026.cpp similarity index 99% rename from testsuites/unittest/fs/vfat2/smoke/It_vfs_fat_026.cpp rename to testsuites/unittest/fs/vfat/smoke/It_vfs_fat_026.cpp index 7a418526..b19fbe97 100644 --- a/testsuites/unittest/fs/vfat2/smoke/It_vfs_fat_026.cpp +++ b/testsuites/unittest/fs/vfat/smoke/It_vfs_fat_026.cpp @@ -39,7 +39,7 @@ static UINT32 TestCase(VOID) INT32 ret; INT32 fd = 0; INT32 len = 0; - INT32 i = 0; + INT32 i = FAT_SHORT_ARRAY_LENGTH; CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; CHAR filebuf[FAT_STANDARD_NAME_LENGTH] = "12345678901234567890"; diff --git a/testsuites/unittest/posix/mqueue/full/It_posix_queue_075.cpp b/testsuites/unittest/posix/mqueue/full/It_posix_queue_075.cpp index 137b60a2..2fea2090 100644 --- a/testsuites/unittest/posix/mqueue/full/It_posix_queue_075.cpp +++ b/testsuites/unittest/posix/mqueue/full/It_posix_queue_075.cpp @@ -29,6 +29,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "It_posix_queue.h" +static int g_testFlag = 0; static VOID *PthreadF01(VOID *arg) { @@ -37,12 +38,12 @@ static VOID *PthreadF01(VOID *arg) CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; struct timespec ts = { 0 }; ts.tv_sec = 0xffff; - for (i = 0; i < MQUEUE_STANDARD_NAME_LENGTH * 2; i++) { // 2, The loop frequency name length. ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); } + g_testFlag = 0; // 0 means the sub thread has executed return NULL; EXIT: return NULL; @@ -62,6 +63,7 @@ static UINT32 Testcase(VOID) attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; + g_testFlag = 1; // 1 initialize the flag LOS_TaskLock(); snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq075_%d", LosCurTaskIDGet()); @@ -85,7 +87,10 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); } - TestExtraTaskDelay(10); // 10, Set delay time. + // waitting for the flag is 0, means the sub thread has executed + while (g_testFlag) { + usleep(1); + } ret = mq_close(g_gqueue); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); diff --git a/testsuites/unittest/posix/mqueue/full/It_posix_queue_097.cpp b/testsuites/unittest/posix/mqueue/full/It_posix_queue_097.cpp index e11c5034..00fad7b1 100644 --- a/testsuites/unittest/posix/mqueue/full/It_posix_queue_097.cpp +++ b/testsuites/unittest/posix/mqueue/full/It_posix_queue_097.cpp @@ -107,9 +107,6 @@ static UINT32 Testcase(VOID) ret = pthread_create(&newTh, &attr1, PthreadF01, NULL); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - LosTaskDelay(1); - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT1); - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); @@ -119,7 +116,7 @@ static UINT32 Testcase(VOID) ret = LosTaskDelay(10); // 10, Set delay time. ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT2); // 4, Here, assert the g_testCount. + TestAssertWaitDelay(&g_testCount, 4); // 4, Here, assert the g_testCount. ret = PosixPthreadDestroy(&attr1, newTh2); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); diff --git a/testsuites/unittest/posix/mqueue/full/It_posix_queue_124.cpp b/testsuites/unittest/posix/mqueue/full/It_posix_queue_124.cpp index a1e96331..774c8dd1 100644 --- a/testsuites/unittest/posix/mqueue/full/It_posix_queue_124.cpp +++ b/testsuites/unittest/posix/mqueue/full/It_posix_queue_124.cpp @@ -106,7 +106,7 @@ static UINT32 Testcase(VOID) uret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif @@ -117,7 +117,7 @@ static UINT32 Testcase(VOID) uret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT1); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); #endif diff --git a/testsuites/unittest/posix/mqueue/posix_mqueue_test.cpp b/testsuites/unittest/posix/mqueue/posix_mqueue_test.cpp index 49475701..b49ce837 100644 --- a/testsuites/unittest/posix/mqueue/posix_mqueue_test.cpp +++ b/testsuites/unittest/posix/mqueue/posix_mqueue_test.cpp @@ -257,7 +257,7 @@ HWTEST_F(PosixMqueueTest, ItPosixQueue016, TestSize.Level0) ItPosixQueue016(); } -#if (LOSCFG_KERNEL_SMP != YES) +#ifndef LOSCFG_KERNEL_SMP /** * @tc.name: IT_POSIX_QUEUE_113 * @tc.desc: function for PosixMqueueTest diff --git a/testsuites/unittest/posix/mqueue/smoke/It_posix_queue_053.cpp b/testsuites/unittest/posix/mqueue/smoke/It_posix_queue_053.cpp index 2308073d..01dd6aa2 100644 --- a/testsuites/unittest/posix/mqueue/smoke/It_posix_queue_053.cpp +++ b/testsuites/unittest/posix/mqueue/smoke/It_posix_queue_053.cpp @@ -37,10 +37,7 @@ static VOID *PthreadF01(VOID *argument) g_testCount = 1; - ret = LosTaskDelay(5); // 5, Set the timeout of task delay; - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert the g_testCount. + TestAssertWaitDelay(&g_testCount, 3); // 3, Here, assert the g_testCount. ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); @@ -105,8 +102,7 @@ static UINT32 Testcase(VOID) ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - LosTaskDelay(1); - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT1); + TestAssertWaitDelay(&g_testCount, 1); ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); @@ -121,7 +117,7 @@ static UINT32 Testcase(VOID) #endif ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT2); // 4, Here, assert the g_testCount. + TestAssertWaitDelay(&g_testCount, 4); // 4, Here, assert the g_testCount. ret = PosixPthreadDestroy(&attr1, newTh2); ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); diff --git a/testsuites/unittest/posix/pthread/full/It_posix_pthread_066.cpp b/testsuites/unittest/posix/pthread/full/It_posix_pthread_066.cpp index 260017e7..193faba3 100644 --- a/testsuites/unittest/posix/pthread/full/It_posix_pthread_066.cpp +++ b/testsuites/unittest/posix/pthread/full/It_posix_pthread_066.cpp @@ -71,7 +71,7 @@ static VOID *pthread_f01(void *argument) ret = pthread_create(&g_newTh2, &attr, pthread_f02, NULL); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); -#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_KERNEL_SMP while (g_testCount < 2) { TestBusyTaskDelay(1); } diff --git a/testsuites/unittest/security/capability/smoke/cap_test_001.cpp b/testsuites/unittest/security/capability/smoke/cap_test_001.cpp index 95f6eb9f..f8887989 100644 --- a/testsuites/unittest/security/capability/smoke/cap_test_001.cpp +++ b/testsuites/unittest/security/capability/smoke/cap_test_001.cpp @@ -82,22 +82,38 @@ static int TestChild(VOID) capheader.pid = INVAILD_PID; ret = capget(&capheader, &capdatac[0]); ICUNIT_ASSERT_EQUAL(ret, -1, ret); + errno = 0; capheader.pid = 3; - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + kill(capheader.pid, 0); + if (errno != ESRCH) { + ret = capget(&capheader, &capdatac[0]); + ICUNIT_ASSERT_EQUAL(ret, 0, ret); + printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + } + errno = 0; capheader.pid = 4; - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + kill(capheader.pid, 0); + if (errno != ESRCH) { + ret = capget(&capheader, &capdatac[0]); + ICUNIT_ASSERT_EQUAL(ret, 0, ret); + printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + } + errno = 0; capheader.pid = 5; - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + kill(capheader.pid, 0); + if (errno != ESRCH) { + ret = capget(&capheader, &capdatac[0]); + ICUNIT_ASSERT_EQUAL(ret, 0, ret); + printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + } + errno = 0; capheader.pid = 6; - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + kill(capheader.pid, 0); + if (errno != ESRCH) { + ret = capget(&capheader, &capdatac[0]); + ICUNIT_ASSERT_EQUAL(ret, 0, ret); + printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); + } capheader.pid = 0; int pid = fork(); diff --git a/testsuites/unittest/signal/full/It_ipc_fdclr_001.cpp b/testsuites/unittest/signal/full/It_ipc_fdclr_001.cpp index 0a1f1897..13fd61a4 100644 --- a/testsuites/unittest/signal/full/It_ipc_fdclr_001.cpp +++ b/testsuites/unittest/signal/full/It_ipc_fdclr_001.cpp @@ -46,7 +46,7 @@ static UINT32 Testcase(VOID) ret = pipe(pipeFd[i]); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); fdmax = pipeFd[i][1] > fdmax ? pipeFd[i][1] : fdmax; - ret = write(pipeFd[i][1], "hello world", TAR_STR_LEN); + ret = write(pipeFd[i][1], "aloha world", TAR_STR_LEN); printf("write first status: %d\n", ret); ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); } diff --git a/testsuites/unittest/signal/full/It_ipc_fdset_001.cpp b/testsuites/unittest/signal/full/It_ipc_fdset_001.cpp index f244971b..dda0395b 100644 --- a/testsuites/unittest/signal/full/It_ipc_fdset_001.cpp +++ b/testsuites/unittest/signal/full/It_ipc_fdset_001.cpp @@ -49,7 +49,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); fdmax = pipeFd[i][1] > fdmax ? pipeFd[i][1] : fdmax; fdmax = pipeFd[i][0] > fdmax ? pipeFd[i][0] : fdmax; - ret = write(pipeFd[i][1], "hello world", TAR_STR_LEN); + ret = write(pipeFd[i][1], "Aloha World", TAR_STR_LEN); printf("write first status: %d\n", ret); ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); } diff --git a/testsuites/unittest/signal/full/It_ipc_fdzero_001.cpp b/testsuites/unittest/signal/full/It_ipc_fdzero_001.cpp index 34d14f83..33a45823 100644 --- a/testsuites/unittest/signal/full/It_ipc_fdzero_001.cpp +++ b/testsuites/unittest/signal/full/It_ipc_fdzero_001.cpp @@ -48,7 +48,7 @@ static UINT32 Testcase(VOID) ret = pipe(pipeFd[i]); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); fdmax = pipeFd[i][1] > fdmax ? pipeFd[i][1] : fdmax; - ret = write(pipeFd[i][1], "hello world", TAR_STR_LEN); + ret = write(pipeFd[i][1], "Aloha world", TAR_STR_LEN); printf("write first status: %d\n", ret); ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); } diff --git a/testsuites/unittest/signal/full/It_ipc_pipe_002.cpp b/testsuites/unittest/signal/full/It_ipc_pipe_002.cpp index f5dfbc21..be0e2578 100644 --- a/testsuites/unittest/signal/full/It_ipc_pipe_002.cpp +++ b/testsuites/unittest/signal/full/It_ipc_pipe_002.cpp @@ -29,28 +29,41 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "it_test_signal.h" - +#include "sys/shm.h" static UINT32 Testcase(VOID) { int pipeFd[2], ret, spid; // 2, pipe return 2 file descripter char buffer[20]; // 20, target buffer size + int *sharedflag = NULL; + int shmid; + ret = pipe(pipeFd); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); + shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm + ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); + sharedflag = (int *)shmat(shmid, NULL, 0); + *sharedflag = 0; + spid = fork(); ICUNIT_GOTO_NOT_EQUAL(spid, -1, spid, EXIT1); if (spid == 0) { + sharedflag = (int *)shmat(shmid, NULL, 0); close(pipeFd[0]); - sleep(10); // 10, sleep 10 second. ret = write(pipeFd[1], "hello world", 12); // 12, "hello world" length and '\0' printf("write first status: %d\n", ret); if (ret != 12) { // 12, "hello world" length and '\0' exit(11); // 11, the value of son process unexpect exit, convenient to debug } + *sharedflag = 1; close(pipeFd[1]); exit(RED_FLAG); } close(pipeFd[1]); + // waitting for the sub process has written the sentence + while (*sharedflag != 1) { + usleep(1); + } ret = read(pipeFd[0], buffer, 12); // 12, "hello world" length and '\0' ICUNIT_GOTO_EQUAL(ret, 12, ret, EXIT); // 12, "hello world" length and '\0' ret = strcmp(buffer, "hello world"); diff --git a/testsuites/unittest/signal/full/It_ipc_pipe_003.cpp b/testsuites/unittest/signal/full/It_ipc_pipe_003.cpp index d4e697a1..e19417f8 100644 --- a/testsuites/unittest/signal/full/It_ipc_pipe_003.cpp +++ b/testsuites/unittest/signal/full/It_ipc_pipe_003.cpp @@ -29,7 +29,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "it_test_signal.h" - +#include "sys/shm.h" static const int TAR_STR_LEN = 12; @@ -37,25 +37,38 @@ static UINT32 Testcase(VOID) { int pipeFd[2], ret, spid; // 2, pipe return 2 file descripter char buffer[20]; // 20, target buffer size + int *sharedflag = NULL; + int shmid; + ret = pipe(pipeFd); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); + shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm + ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); + sharedflag = (int *)shmat(shmid, NULL, 0); + *sharedflag = 0; + spid = fork(); ICUNIT_GOTO_NOT_EQUAL(spid, -1, spid, EXIT1); if (spid == 0) { + sharedflag = (int *)shmat(shmid, NULL, 0); close(pipeFd[0]); - ret = write(pipeFd[1], "hello world", TAR_STR_LEN); + ret = write(pipeFd[1], "Hello world", TAR_STR_LEN); printf("write first status: %d\n", ret); if (ret != TAR_STR_LEN) { exit(11); // 11, the value of son process unexpect exit, convenient to debug } + *sharedflag = 1; close(pipeFd[1]); exit(RED_FLAG); } close(pipeFd[1]); - sleep(2); // 2, sleep 2 second + // waitting for the sub process has written the sentence + while (*sharedflag != 1) { + usleep(1); + } ret = read(pipeFd[0], buffer, TAR_STR_LEN); ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - ret = strcmp(buffer, "hello world"); + ret = strcmp(buffer, "Hello world"); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); printf("read pipe success: %s\n", buffer); wait(&ret); diff --git a/testsuites/unittest/signal/full/pipe_test_005.cpp b/testsuites/unittest/signal/full/pipe_test_005.cpp index f17964ef..9b490529 100644 --- a/testsuites/unittest/signal/full/pipe_test_005.cpp +++ b/testsuites/unittest/signal/full/pipe_test_005.cpp @@ -28,6 +28,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "sys/shm.h" #include "it_test_signal.h" #include "signal.h" @@ -41,58 +42,59 @@ static int PipecommonWrite() int pipefd[2]; // 2, array subscript pid_t pid; int retValue = -1; - retValue = pipe(pipefd); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - signal(SIGPIPE, SigPrint); - + int *sharedflag = NULL; + int shmid; int *readFd = &pipefd[0]; int *writeFd = &pipefd[1]; - char sentence[] = "Hello World"; char readbuffer[100]; int status, ret; + retValue = pipe(pipefd); + ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); + if (signal(SIGPIPE, SigPrint) == SIG_ERR) { + printf("signal error\n"); + } + + shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm + ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); + sharedflag = (int *)shmat(shmid, NULL, 0); + *sharedflag = 0; + pid = fork(); if (pid == -1) { printf("Fork Error!\n"); return -1; } else if (pid == 0) { - for (int i = 0; i < 3; i++) { // 3, Number of cycles - close(*readFd); - retValue = write(*writeFd, sentence, strlen(sentence) + 1); - - if (i == 0) { - if (retValue != strlen(sentence) + 1) { - exit(retValue); - } - } else { - if (retValue != -1) { - exit(retValue); - } - if (errno != EPIPE) { - exit(errno); - } - } - usleep(150000); // 150000, Used to calculate the delay time. + sharedflag = (int *)shmat(shmid, NULL, 0); + close(*readFd); + retValue = write(*writeFd, sentence, strlen(sentence) + 1); + ICUNIT_ASSERT_EQUAL(retValue, strlen(sentence) + 1, retValue); + *sharedflag = 1; + // 2 waitting for the father process close the pipe's read port + while (*sharedflag != 2) { + usleep(1); } + retValue = write(*writeFd, sentence, strlen(sentence) + 1); + ICUNIT_ASSERT_EQUAL(retValue, -1, retValue); + ICUNIT_ASSERT_EQUAL(errno, EPIPE, errno); exit(0); } else { - usleep(10000); // 10000, Used to calculate the delay time. - for (int i = 0; i < 3; i++) { // 3, Number of cycles - close(*readFd); + close(*writeFd); + // 1 waitting for the sub process has written the sentence first + while (*sharedflag != 1) { + usleep(1); } + close(*readFd); + // 2 father process close the pipe's read port + *sharedflag = 2; ret = waitpid(pid, &status, 0); ICUNIT_ASSERT_EQUAL(ret, pid, ret); ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); } - - close(*readFd); - close(*writeFd); return 0; } - void ItPosixPipe005(void) { TEST_ADD_CASE(__FUNCTION__, PipecommonWrite, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); diff --git a/testsuites/unittest/signal/signal_test.cpp b/testsuites/unittest/signal/signal_test.cpp index 959457a5..7ddd1a97 100644 --- a/testsuites/unittest/signal/signal_test.cpp +++ b/testsuites/unittest/signal/signal_test.cpp @@ -627,6 +627,17 @@ HWTEST_F(SignalTest, ItPosixPipe003, TestSize.Level0) ItPosixPipe003(); } +/* * + * @tc.name: ItPosixPipe004 + * @tc.desc: function for SignalTest + * @tc.type: FUNC + * @tc.require: AR000EEMQ9 + */ +HWTEST_F(SignalTest, ItPosixPipe004, TestSize.Level0) +{ + ItPosixPipe004(); +} + /* * * @tc.name: ItPosixPipe005 * @tc.desc: function for SignalTest diff --git a/testsuites/unittest/signal/smoke/It_ipc_fdisset_001.cpp b/testsuites/unittest/signal/smoke/It_ipc_fdisset_001.cpp index 21205390..806f38d0 100644 --- a/testsuites/unittest/signal/smoke/It_ipc_fdisset_001.cpp +++ b/testsuites/unittest/signal/smoke/It_ipc_fdisset_001.cpp @@ -39,7 +39,7 @@ static UINT32 Testcase(VOID) fd_set reads; ret = pipe(pipeFd); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = write(pipeFd[1], "hello world", TAR_STR_LEN); + ret = write(pipeFd[1], "Hello World", TAR_STR_LEN); printf("write first status: %d\n", ret); ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); FD_ZERO(&reads); diff --git a/testsuites/unittest/signal/smoke/pipe_test_002.cpp b/testsuites/unittest/signal/smoke/pipe_test_002.cpp index ccbcfbc6..fafa5f3b 100644 --- a/testsuites/unittest/signal/smoke/pipe_test_002.cpp +++ b/testsuites/unittest/signal/smoke/pipe_test_002.cpp @@ -31,6 +31,7 @@ #include "it_test_signal.h" #include "signal.h" #include "fcntl.h" +#include "sys/shm.h" static int TestPipeMultiProcess() { @@ -42,46 +43,62 @@ static int TestPipeMultiProcess() int *readFd = &pipefd[0]; int *writeFd = &pipefd[1]; - - char readbuffer[100]; + char readbuffer[100] = {0}; int status, ret; int totalNum = 3; + int *sharedflag = NULL; + int shmid; int flag = fcntl(*readFd, F_GETFL); fcntl(*readFd, F_SETFL, flag | O_NONBLOCK); + shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm + ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); + sharedflag = (int *)shmat(shmid, NULL, 0); + *sharedflag = 0; pid = fork(); if (pid == -1) { printf("Fork Error!\n"); return -1; } else if (pid == 0) { + sharedflag = (int *)shmat(shmid, NULL, 0); + close(pipefd[0]); for (int i = 0; i < totalNum; i++) { errno = 0; char sentence1[15] = "Hello World"; - char a[4] = {0}; + char a[2] = {0}; sprintf(a, "%d", i); strcat(sentence1, a); int ret = write(*writeFd, sentence1, strlen(sentence1) + 1); + ICUNIT_ASSERT_EQUAL(ret, strlen(sentence1) + 1, ret); usleep(10000); // 10000, Used to calculate the delay time. } + *sharedflag = 1; + ret = close(pipefd[1]); + ICUNIT_ASSERT_EQUAL(ret, 0, ret); exit(0); } else { + close(pipefd[1]); + // waitting for the sub process has written the sentence first + while (*sharedflag != 1) { + usleep(1); + } for (int i = 0; i < totalNum; i++) { printf("read\n"); char sentence1[15] = "Hello World"; - char a[4] = {0}; + char a[2] = {0}; + sprintf(a, "%d", i); + strcat(sentence1, a); memset(readbuffer, 0, sizeof(readbuffer)); - retValue = read(*readFd, readbuffer, sizeof(readbuffer)); - printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer, errno); - ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer, readbuffer, strlen(sentence1), errno); + retValue = read(*readFd, readbuffer, strlen(sentence1) + 1); + printf("Receive %d bytes data : %s, errno : %d\n", retValue, readbuffer, errno); + ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer, sentence1, strlen(sentence1), errno); } } ret = waitpid(pid, &status, 0); ICUNIT_ASSERT_EQUAL(ret, pid, ret); ret = close(pipefd[0]); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = close(pipefd[1]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); return 0; } diff --git a/tools/build/config/debug/hispark_taurus_clang.config b/tools/build/config/debug/hispark_taurus_clang.config index b82c6764..ccc6dfda 100644 --- a/tools/build/config/debug/hispark_taurus_clang.config +++ b/tools/build/config/debug/hispark_taurus_clang.config @@ -40,6 +40,8 @@ LOSCFG_DRIVERS_HDF_INPUT=y LOSCFG_DRIVERS_HDF_TP_5P5_GT911=y LOSCFG_DRIVERS_HDF_SENSOR=y LOSCFG_DRIVERS_HDF_STORAGE=y +LOSCFG_DRIVERS_HDF_VIBRATOR=y +LOSCFG_DRIVERS_HDF_VIBRATOR_LINEAR=y LOSCFG_DRIVERS_SD=y LOSCFG_DRIVERS_EMMC=y LOSCFG_DRIVERS_HIEVENT=y diff --git a/tools/build/config/debug/hispark_taurus_clang_tee.config b/tools/build/config/debug/hispark_taurus_clang_tee.config index b61bc4e2..45276b37 100644 --- a/tools/build/config/debug/hispark_taurus_clang_tee.config +++ b/tools/build/config/debug/hispark_taurus_clang_tee.config @@ -40,6 +40,8 @@ LOSCFG_DRIVERS_HDF_INPUT=y LOSCFG_DRIVERS_HDF_TP_5P5_GT911=y LOSCFG_DRIVERS_HDF_SENSOR=y LOSCFG_DRIVERS_HDF_STORAGE=y +LOSCFG_DRIVERS_HDF_VIBRATOR=y +LOSCFG_DRIVERS_HDF_VIBRATOR_LINEAR=y LOSCFG_DRIVERS_SD=y LOSCFG_DRIVERS_EMMC=y LOSCFG_DRIVERS_TZDRIVER=y diff --git a/tools/build/config/debug/mini_qemu_liteos_a_clang.config b/tools/build/config/debug/mini_qemu_liteos_a_clang.config new file mode 100644 index 00000000..f5ab9aa4 --- /dev/null +++ b/tools/build/config/debug/mini_qemu_liteos_a_clang.config @@ -0,0 +1,14 @@ +LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7=y +LOSCFG_BOARD_CONFIG_PATH="device/qemu/arm_virt/liteos_a/config/board" +# LOSCFG_HRTIMER_ENABLE is not set +# LOSCFG_IRQ_USE_STANDALONE_STACK is not set +# LOSCFG_BLACKBOX is not set +# LOSCFG_KERNEL_MMU is not set +# LOSCFG_KERNEL_EXTKERNEL is not set +# LOSCFG_BASE_CORE_HILOG is not set +# LOSCFG_LIB_ZLIB is not set +# LOSCFG_FS_VFS is not set +# LOSCFG_NET_LWIP_SACK is not set +# LOSCFG_PLATFORM_ADAPT is not set +# LOSCFG_DRIVERS is not set +# LOSCFG_SECURITY is not set diff --git a/tools/build/config/hispark_aries_release.config b/tools/build/config/hispark_aries_release.config index 2bdc4dea..36fba84b 100644 --- a/tools/build/config/hispark_aries_release.config +++ b/tools/build/config/hispark_aries_release.config @@ -8,7 +8,6 @@ LOSCFG_FS_VFS_BLOCK_DEVICE=y LOSCFG_FS_FAT_CACHE_SYNC_THREAD=y LOSCFG_FS_FAT_VIRTUAL_PARTITION=y LOSCFG_ENABLE_OOM_LOOP_TASK=y -# LOSCFG_ENABLE_MAGICKEY is not set LOSCFG_DRIVERS_USB_HOST_XHCI=y LOSCFG_DRIVERS_USB_ETHERNET=y LOSCFG_DRIVERS_USB_WIRELESS=y diff --git a/tools/build/config/hispark_taurus_clang_release.config b/tools/build/config/hispark_taurus_clang_release.config index 3076dd4f..43b1143f 100644 --- a/tools/build/config/hispark_taurus_clang_release.config +++ b/tools/build/config/hispark_taurus_clang_release.config @@ -37,6 +37,8 @@ LOSCFG_DRIVERS_HDF_INPUT=y LOSCFG_DRIVERS_HDF_TP_5P5_GT911=y LOSCFG_DRIVERS_HDF_SENSOR=y LOSCFG_DRIVERS_HDF_STORAGE=y +LOSCFG_DRIVERS_HDF_VIBRATOR=y +LOSCFG_DRIVERS_HDF_VIBRATOR_LINEAR=y LOSCFG_DRIVERS_SD=y LOSCFG_DRIVERS_EMMC=y LOSCFG_DRIVERS_HIEVENT=y diff --git a/tools/build/config/hispark_taurus_clang_release_tee.config b/tools/build/config/hispark_taurus_clang_release_tee.config index dc2a5de8..f5600194 100644 --- a/tools/build/config/hispark_taurus_clang_release_tee.config +++ b/tools/build/config/hispark_taurus_clang_release_tee.config @@ -38,6 +38,8 @@ LOSCFG_DRIVERS_HDF_INPUT=y LOSCFG_DRIVERS_HDF_TP_5P5_GT911=y LOSCFG_DRIVERS_HDF_SENSOR=y LOSCFG_DRIVERS_HDF_STORAGE=y +LOSCFG_DRIVERS_HDF_VIBRATOR=y +LOSCFG_DRIVERS_HDF_VIBRATOR_LINEAR=y LOSCFG_DRIVERS_SD=y LOSCFG_DRIVERS_EMMC=y LOSCFG_DRIVERS_TZDRIVER=y diff --git a/tools/build/config/hispark_taurus_release.config b/tools/build/config/hispark_taurus_release.config index 83d0d4f0..8b510ac2 100644 --- a/tools/build/config/hispark_taurus_release.config +++ b/tools/build/config/hispark_taurus_release.config @@ -9,7 +9,6 @@ LOSCFG_KERNEL_VDSO=y LOSCFG_FS_VFS_BLOCK_DEVICE=y LOSCFG_FS_FAT_VIRTUAL_PARTITION=y LOSCFG_ENABLE_OOM_LOOP_TASK=y -# LOSCFG_ENABLE_MAGICKEY is not set LOSCFG_DRIVERS_USB_HOST_XHCI=y LOSCFG_DRIVERS_USB_ETHERNET=y LOSCFG_DRIVERS_USB_WIRELESS=y diff --git a/tools/build/config/hispark_taurus_release_tee.config b/tools/build/config/hispark_taurus_release_tee.config index 46a2d492..f5b6eba8 100644 --- a/tools/build/config/hispark_taurus_release_tee.config +++ b/tools/build/config/hispark_taurus_release_tee.config @@ -10,7 +10,6 @@ LOSCFG_KERNEL_VDSO=y LOSCFG_FS_VFS_BLOCK_DEVICE=y LOSCFG_FS_FAT_VIRTUAL_PARTITION=y LOSCFG_ENABLE_OOM_LOOP_TASK=y -# LOSCFG_ENABLE_MAGICKEY is not set LOSCFG_DRIVERS_USB_HOST_XHCI=y LOSCFG_DRIVERS_USB_ETHERNET=y LOSCFG_DRIVERS_USB_WIRELESS=y diff --git a/tools/build/config/ipcamera_hi3516dv300_liteos_release.config b/tools/build/config/ipcamera_hi3516dv300_liteos_release.config index c62d4cb8..f0c14d2b 100644 --- a/tools/build/config/ipcamera_hi3516dv300_liteos_release.config +++ b/tools/build/config/ipcamera_hi3516dv300_liteos_release.config @@ -9,7 +9,6 @@ LOSCFG_FS_VFS_BLOCK_DEVICE=y LOSCFG_FS_FAT_VIRTUAL_PARTITION=y LOSCFG_NET_LWIP_SACK_2_0=y LOSCFG_ENABLE_OOM_LOOP_TASK=y -# LOSCFG_ENABLE_MAGICKEY is not set LOSCFG_DRIVERS_USB_HOST_XHCI=y LOSCFG_DRIVERS_USB_ETHERNET=y LOSCFG_DRIVERS_USB_WIRELESS=y diff --git a/tools/build/config/ipcamera_hi3516dv300_liteos_release_tee.config b/tools/build/config/ipcamera_hi3516dv300_liteos_release_tee.config index c62d4cb8..f0c14d2b 100644 --- a/tools/build/config/ipcamera_hi3516dv300_liteos_release_tee.config +++ b/tools/build/config/ipcamera_hi3516dv300_liteos_release_tee.config @@ -9,7 +9,6 @@ LOSCFG_FS_VFS_BLOCK_DEVICE=y LOSCFG_FS_FAT_VIRTUAL_PARTITION=y LOSCFG_NET_LWIP_SACK_2_0=y LOSCFG_ENABLE_OOM_LOOP_TASK=y -# LOSCFG_ENABLE_MAGICKEY is not set LOSCFG_DRIVERS_USB_HOST_XHCI=y LOSCFG_DRIVERS_USB_ETHERNET=y LOSCFG_DRIVERS_USB_WIRELESS=y diff --git a/tools/build/config/ipcamera_hi3518ev300_liteos_release.config b/tools/build/config/ipcamera_hi3518ev300_liteos_release.config index f323e791..805febf4 100644 --- a/tools/build/config/ipcamera_hi3518ev300_liteos_release.config +++ b/tools/build/config/ipcamera_hi3518ev300_liteos_release.config @@ -8,7 +8,6 @@ LOSCFG_FS_FAT_CACHE_SYNC_THREAD=y LOSCFG_FS_FAT_VIRTUAL_PARTITION=y LOSCFG_NET_LWIP_SACK_2_0=y LOSCFG_ENABLE_OOM_LOOP_TASK=y -# LOSCFG_ENABLE_MAGICKEY is not set LOSCFG_DRIVERS_USB_HOST_XHCI=y LOSCFG_DRIVERS_USB_ETHERNET=y LOSCFG_DRIVERS_USB_WIRELESS=y diff --git a/tools/build/config/qemu_arm_virt_mini.config b/tools/build/config/mini_qemu_liteos_a_clang_release.config similarity index 94% rename from tools/build/config/qemu_arm_virt_mini.config rename to tools/build/config/mini_qemu_liteos_a_clang_release.config index 1300f151..6670fbb1 100644 --- a/tools/build/config/qemu_arm_virt_mini.config +++ b/tools/build/config/mini_qemu_liteos_a_clang_release.config @@ -2,6 +2,7 @@ LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7=y LOSCFG_BOARD_CONFIG_PATH="device/qemu/arm_virt/liteos_a/config/board" # LOSCFG_HRTIMER_ENABLE is not set # LOSCFG_IRQ_USE_STANDALONE_STACK is not set +# LOSCFG_BLACKBOX is not set # LOSCFG_KERNEL_MMU is not set # LOSCFG_KERNEL_EXTKERNEL is not set # LOSCFG_BASE_CORE_HILOG is not set diff --git a/tools/build/config/qemu_arm_virt_debug_shell.config b/tools/build/config/qemu_arm_virt_debug_shell.config index d22f8fd8..0efa46b2 100644 --- a/tools/build/config/qemu_arm_virt_debug_shell.config +++ b/tools/build/config/qemu_arm_virt_debug_shell.config @@ -2,8 +2,10 @@ LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7=y LOSCFG_BOARD_CONFIG_PATH="device/qemu/arm_virt/liteos_a/config/board" # LOSCFG_HRTIMER_ENABLE is not set # LOSCFG_KERNEL_CPPSUPPORT is not set -# LOSCFG_FS_FAT is not set -LOSCFG_ENABLE_MAGICKEY=y +LOSCFG_FS_FAT=y +LOSCFG_FS_FAT_DISK=y +LOSCFG_FS_FAT_VIRTUAL_PARTITION=y +LOSCFG_FS_VFS_BLOCK_DEVICE=y LOSCFG_DEBUG_VERSION=y # LOSCFG_SHELL_LK is not set LOSCFG_USER_INIT_DEBUG=y diff --git a/tools/build/mk/liteos_tables_ldflags.mk b/tools/build/mk/liteos_tables_ldflags.mk index dd670571..eed3a4b9 100644 --- a/tools/build/mk/liteos_tables_ldflags.mk +++ b/tools/build/mk/liteos_tables_ldflags.mk @@ -135,7 +135,10 @@ LITEOS_TABLES_KERNEL_INIT_LDFLAGS := \ -uOsCpupGuardCreator \ -uOsMpInit \ -uOsResourceFreeTaskCreate \ - -uOsSystemInit + -uOsSystemInit \ + -uOsBBoxDriverInit \ + -uOsBBoxSystemAdapterInit \ + -uOsHiDumperDriverInit LITEOS_TABLES_DRIVER_LDFLAGS := \ -ui2c_init \ diff --git a/tools/build/mk/los_config.mk b/tools/build/mk/los_config.mk index cc97cdfe..840f64b2 100644 --- a/tools/build/mk/los_config.mk +++ b/tools/build/mk/los_config.mk @@ -27,7 +27,8 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --include $(LITEOSTOPDIR)/.config +CONFIG_FILE ?= $(LITEOSTOPDIR)/.config +-include $(CONFIG_FILE) ifeq ($(LOSCFG_COMPILER_HIMIX_32), y) CROSS_COMPILE := arm-linux-ohoseabi- else ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) @@ -121,8 +122,8 @@ CXX_PATH = $(LITEOSTOPDIR)/lib/cxxstl JFFS_PATH = $(LITEOSTOPDIR)/fs/jffs2 LITEOS_SCRIPTPATH ?= $(LITEOSTOPDIR)/tools/scripts LITEOS_LIB_BIGODIR = $(OUT)/lib/obj -LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h -LOSCFG_ENTRY_SRC = $(LITEOSTOPDIR)/kernel/common/los_config.c +LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h +LOSCFG_ENTRY_SRC = $(LITEOSTOPDIR)/platform/los_config.c ### include variable MODULE = $(MK_PATH)/module.mk @@ -158,7 +159,7 @@ include $(LITEOSTOPDIR)/platform/bsp.mk ifeq ($(LOSCFG_PLATFORM_ROOTFS), y) LITEOS_BASELIB += -lrootfs - LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common + LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/rootfs endif ifeq ($(LOSCFG_PLATFORM_PATCHFS), y) @@ -185,12 +186,6 @@ ifeq ($(LOSCFG_KERNEL_CPUP), y) LITEOS_CPUP_INCLUDE := -I $(LITEOSTOPDIR)/kernel/extended/cpup endif -ifeq ($(LOSCFG_KERNEL_SCHED_STATISTICS), y) - LITEOS_CMACRO += -DLOSCFG_KERNEL_SCHED_STATISTICS=1 -else - LITEOS_CMACRO += -DLOSCFG_KERNEL_SCHED_STATISTICS=0 -endif - ifeq ($(LOSCFG_KERNEL_DYNLOAD), y) LITEOS_BASELIB += -ldynload LIB_SUBDIRS += kernel/extended/dynload @@ -204,9 +199,11 @@ ifeq ($(LOSCFG_KERNEL_VDSO), y) LITEOS_VDSO_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/vdso/include endif +ifeq ($(LOSCFG_KERNEL_TRACE), y) LITEOS_BASELIB += -ltrace LIB_SUBDIRS += kernel/extended/trace LITEOS_TRACE_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/trace +endif ifeq ($(LOSCFG_KERNEL_LITEIPC), y) LITEOS_BASELIB += -lliteipc @@ -447,6 +444,16 @@ ifeq ($(LOSCFG_BASE_CORE_HILOG), y) LITEOS_HILOG_INCLUDE += -I $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog LITEOS_CMACRO += -DLOSCFG_BASE_CORE_HILOG endif +ifeq ($(LOSCFG_BLACKBOX), y) + LITEOS_BASELIB += -lblackbox + LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/blackbox + LITEOS_BLACKBOX_INCLUDE += -I $(LITEOSTOPDIR)/kernel/common/blackbox +endif +ifeq ($(LOSCFG_HIDUMPER), y) + LITEOS_BASELIB += -lhidumper + LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/hidumper + LITEOS_HIDUMPER_INCLUDE += -I $(LITEOSTOPDIR)/kernel/common/hidumper +endif ############################## Dfx Option End ####################################### ############################# Tools && Debug Option Begin ############################## @@ -643,7 +650,9 @@ LITEOS_DRIVERS_INCLUDE := $(LITEOS_CELLWISE_INCLUDE) $(LITEOS_GPIO_INCLUDE $(LITEOS_DRIVERS_HDF_INCLUDE) $(LITEOS_TZDRIVER_INCLUDE) \ $(LITEOS_HIEVENT_INCLUDE) $(LITEOS_DEV_MEM_INCLUDE) \ $(LITEOS_DEV_QUICKSTART_INCLUDE) -LITEOS_DFX_INCLUDE := $(LITEOS_HILOG_INCLUDE) +LITEOS_DFX_INCLUDE := $(LITEOS_HILOG_INCLUDE) \ + $(LITEOS_BLACKBOX_INCLUDE) \ + $(LITEOS_HIDUMPER_INCLUDE) LITEOS_SECURITY_INCLUDE := $(LITEOS_SECURITY_CAP_INC) $(LITEOS_SECURITY_VID_INC) LOSCFG_TOOLS_DEBUG_INCLUDE := $(LITEOS_SHELL_INCLUDE) $(LITEOS_UART_INCLUDE) \ @@ -672,7 +681,7 @@ LITEOS_COPTS_EXTRA_INTERWORK := $(LITEOS_COPTS_EXTRA) endif # kernel configuration macros -LITEOS_CMACRO += -imacros $(LITEOS_MENUCONFIG_H) +LITEOS_CMACRO += -imacros "$(LITEOS_MENUCONFIG_H)" ifneq ($(LOSCFG_COMPILER_CLANG_LLVM), y) LITEOS_LD_OPTS += -nostartfiles @@ -695,7 +704,8 @@ endif # temporary LITEOS_PLATFORM_INCLUDE += \ -I $(LITEOSTOPDIR)/kernel/base/include \ - -I $(LITEOSTOPDIR)/kernel/extended/include + -I $(LITEOSTOPDIR)/kernel/extended/cpup \ + -I $(LITEOSTOPDIR)/kernel/extended/trace LITEOS_CXXINCLUDE += \ $(LITEOS_NET_INCLUDE) \ diff --git a/tools/menuconfig/conf b/tools/menuconfig/conf deleted file mode 100755 index 6f76e9d2..00000000 Binary files a/tools/menuconfig/conf and /dev/null differ diff --git a/tools/menuconfig/mconf b/tools/menuconfig/mconf deleted file mode 100755 index 92c695e0..00000000 Binary files a/tools/menuconfig/mconf and /dev/null differ diff --git a/tools/scripts/make_rootfs/rootfsdir.sh b/tools/scripts/make_rootfs/rootfsdir.sh index ed3f690a..a7c571e4 100755 --- a/tools/scripts/make_rootfs/rootfsdir.sh +++ b/tools/scripts/make_rootfs/rootfsdir.sh @@ -30,21 +30,30 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. set -e -BIN_DIR=$1 -LIB_DIR=$2 -ROOTFS_DIR=$3 -OUT_DIR=$4 +OUT=$1 +ROOTFS_DIR=$2 +OUT_DIR=$3 +BIN_DIR=${OUT}/bin +LIB_DIR=${OUT}/musl +ETC_DIR=${OUT}/etc +NEED_COPYTO_OUTDIR=(shell toybox mksh tftp) + mkdir -p ${ROOTFS_DIR}/bin ${ROOTFS_DIR}/lib ${ROOTFS_DIR}/usr/bin ${ROOTFS_DIR}/usr/lib ${ROOTFS_DIR}/etc \ ${ROOTFS_DIR}/app ${ROOTFS_DIR}/data ${ROOTFS_DIR}/proc ${ROOTFS_DIR}/dev ${ROOTFS_DIR}/data/system ${ROOTFS_DIR}/data/system/param \ -${ROOTFS_DIR}/system ${ROOTFS_DIR}/system/internal ${ROOTFS_DIR}/system/external ${OUT_DIR}/bin ${OUT_DIR}/libs +${ROOTFS_DIR}/system ${ROOTFS_DIR}/system/internal ${ROOTFS_DIR}/system/external ${OUT_DIR}/bin ${OUT_DIR}/libs ${OUT_DIR}/etc if [ -d "${BIN_DIR}" ] && [ "$(ls -A "${BIN_DIR}")" != "" ]; then cp -f ${BIN_DIR}/* ${ROOTFS_DIR}/bin - if [ -e ${BIN_DIR}/shell ] && [ "${BIN_DIR}/shell" != "${OUT_DIR}/bin/shell" ]; then - cp -f ${BIN_DIR}/shell ${OUT_DIR}/bin/shell - fi - if [ -e ${BIN_DIR}/tftp ] && [ "${BIN_DIR}/tftp" != "${OUT_DIR}/bin/tftp" ]; then - cp -f ${BIN_DIR}/tftp ${OUT_DIR}/bin/tftp - fi + for el in ${NEED_COPYTO_OUTDIR[@]} + do + if [ -e ${BIN_DIR}/$el ] && [ "${BIN_DIR}/$el" != "${OUT_DIR}/bin/$el" ]; then + cp -f ${BIN_DIR}/$el ${OUT_DIR}/bin/$el + fi + done fi cp -f ${LIB_DIR}/* ${ROOTFS_DIR}/lib cp -f ${LIB_DIR}/* ${OUT_DIR}/libs + +if [ -e ${ETC_DIR} ]; then +cp -f ${ETC_DIR}/.mkshrc ${ROOTFS_DIR}/etc +cp -f ${ETC_DIR}/.mkshrc ${OUT_DIR}/etc +fi