From 55d8b6f63baf5a79cfb8f74862a1586a1ad8da6d Mon Sep 17 00:00:00 2001 From: zhoushilin Date: Mon, 13 Jun 2022 14:50:02 +0800 Subject: [PATCH] delete os_dump Signed-off-by: zhoushilin --- BUILD.gn | 5 +-- README.md | 15 ------- README_zh.md | 15 ------- memory/bundle.json | 2 +- os_dump/BUILD.gn | 49 ---------------------- os_dump/bundle.json | 41 ------------------- os_dump/dump_syspara.c | 92 ------------------------------------------ os_dump/dump_syspara.h | 26 ------------ os_dump/os_dump.c | 89 ---------------------------------------- 9 files changed, 2 insertions(+), 332 deletions(-) delete mode 100644 os_dump/BUILD.gn delete mode 100644 os_dump/bundle.json delete mode 100644 os_dump/dump_syspara.c delete mode 100644 os_dump/dump_syspara.h delete mode 100644 os_dump/os_dump.c diff --git a/BUILD.gn b/BUILD.gn index bdd7c78..fe8fe26 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -14,10 +14,7 @@ import("//build/lite/ndk/ndk.gni") group("utils") { - deps = [ - "os_dump:utils_os_dump", - "//foundation/distributeddatamgr/appdatamgr/frameworks/native/kv_store:kv_store", - ] + deps = [ "//foundation/distributeddatamgr/appdatamgr/frameworks/native/kv_store:kv_store" ] if (ohos_kernel_type == "liteos_m") { deps += [ "file:file" ] diff --git a/README.md b/README.md index 561b0ed..54a449b 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,6 @@ utils/native/lite/ # Root directory │ └── src # KV store source file ├── memory │ └── include # Memory pool management APIs -├── os_dump # System attribute dumping └── timer_task # Timer implementation ``` @@ -140,20 +139,6 @@ utils/native/lite/ # Root directory ``` -- **System attribute dumping** - - LiteOS Cortex-M kernel: Run the following command over the serial port to dump the current system parameters: - - ``` - AT+SYSPARA - ``` - - LiteOS Cortex-A kernel: Run the **os\_dump** command in the **bin** directory to dump the current system parameters: - - ``` - ./bin/os_dump syspara - ``` - ## Repositories Involved diff --git a/README_zh.md b/README_zh.md index 371470e..331af9b 100644 --- a/README_zh.md +++ b/README_zh.md @@ -84,7 +84,6 @@ utils/native/lite/ # 公共基础库根目录 │ └── src # KV存储源文件 ├── memory │ └── include # 内存池管理接口 -├── os_dump # Dump系统属性 └── timer_task # Timer实现 ``` @@ -140,20 +139,6 @@ utils/native/lite/ # 公共基础库根目录 ``` -- **dump系统属性** - - LiteOS-M内核:在串口执行如下命令,即可打印当前系统参数 - - ``` - AT+SYSPARA - ``` - - LiteOS-A内核:在bin路径下执行os\_dump,即可打印当前系统参数 - - ``` - ./bin/os_dump syspara - ``` - ## 涉及仓 diff --git a/memory/bundle.json b/memory/bundle.json index bdb272f..41c06cd 100644 --- a/memory/bundle.json +++ b/memory/bundle.json @@ -30,7 +30,7 @@ ] }, "build": { - "sub_component": [ "//utils/native/lite/os_dump:utils_os_dump" ], + "sub_component": [], "inner_kits": [], "test": [] } diff --git a/os_dump/BUILD.gn b/os_dump/BUILD.gn deleted file mode 100644 index 2a8d0f6..0000000 --- a/os_dump/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/lite/config/component/lite_component.gni") - -lite_component("utils_os_dump") { - features = [] - if (ohos_kernel_type == "liteos_a") { - features += [ ":os_dump" ] - } - if (ohos_kernel_type == "liteos_m") { - features += [ ":dump_static" ] - } -} - -if (ohos_kernel_type == "liteos_a") { - executable("os_dump") { - sources = [ - "dump_syspara.c", - "os_dump.c", - ] - include_dirs = [ - "./", - "//base/startup/syspara_lite/interfaces/kits", - ] - deps = [ "//base/startup/syspara_lite/frameworks/parameter/src:sysparam" ] - } -} - -if (ohos_kernel_type == "liteos_m") { - static_library("dump_static") { - sources = [ "dump_syspara.c" ] - include_dirs = [ - "//base/startup/syspara_lite/interfaces/kits", - "//base/iot_hardware/interfaces/kits/wifiiot_lite", - ] - deps = [ "//base/startup/syspara_lite/frameworks/parameter/src:sysparam" ] - } -} diff --git a/os_dump/bundle.json b/os_dump/bundle.json deleted file mode 100644 index 361eae8..0000000 --- a/os_dump/bundle.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@openharmony/os_dump", - "version": "3.1.0", - "license": "Apache License 2.0", - "description": "Providing commands for dumping system property.", - "publishAs": "code-segment", - "segment": { - "destPath": "utils/native/lite/os_dump" - }, - "dirs": {}, - "scripts": {}, - "author": {}, - "repository": "", - "component": { - "name": "os_dump", - "subsystem": "utils", - "features": [], - "adapted_system_type": [ - "mini", - "small" - ], - "rom": "3.7KB", - "ram": "~4.75KB", - "deps": { - "thrid_party": [ - "bounds_checking_function" - ], - "kernel_special": {}, - "board_special": {}, - "components": [ - "syspara_lite", - "iot_controller" - ] - }, - "build": { - "sub_component": [], - "inner_kits": [], - "test": [] - } - } -} diff --git a/os_dump/dump_syspara.c b/os_dump/dump_syspara.c deleted file mode 100644 index 539b1b2..0000000 --- a/os_dump/dump_syspara.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "dump_syspara.h" -#include -#include -#include "securec.h" -#include "parameter.h" -#if defined(__LITEOS_RISCV__) -#include "wifiiot_at.h" -#endif - -#define API_VERSION_LEN 10 - -static const char* GetSdkApiLevel(void) -{ - static char sdkApiVersion[API_VERSION_LEN] = {0}; - int sdkApi = GetSdkApiVersion(); - sprintf_s(sdkApiVersion, API_VERSION_LEN, "%d", sdkApi); - return (const char*)sdkApiVersion; -} - -static const char* GetFirstApiLevel(void) -{ - static char firstApiVersion[API_VERSION_LEN] = {0}; - int firstApi = GetFirstApiVersion(); - sprintf_s(firstApiVersion, API_VERSION_LEN, "%d", firstApi); - return (const char*)firstApiVersion; -} - -static const SysParaInfoItem SYSPARA_LIST[] = { - {"DeviceType", GetDeviceType}, - {"Manufacture", GetManufacture}, - {"Brand", GetBrand}, - {"MarketName", GetMarketName}, - {"ProductSeries", GetProductSeries}, - {"ProductModel", GetProductModel}, - {"SoftwareModel", GetSoftwareModel}, - {"HardwareModel", GetHardwareModel}, - {"Serial", GetSerial}, - {"OSFullName", GetOSFullName}, - {"DisplayVersion", GetDisplayVersion}, - {"BootloaderVersion", GetBootloaderVersion}, - {"GetSecurityPatchTag", GetSecurityPatchTag}, - {"AbiList", GetAbiList}, - {"SdkApiVersion", GetSdkApiLevel}, - {"FirstApiVersion", GetFirstApiLevel}, - {"IncrementalVersion", GetIncrementalVersion}, - {"VersionId", GetVersionId}, - {"BuildType", GetBuildType}, - {"BuildUser", GetBuildUser}, - {"BuildHost", GetBuildHost}, - {"BuildTime", GetBuildTime}, - {"BuildRootHash", GetBuildRootHash}, -}; - -int QuerySysparaCmd(void) -{ - int index = 0; - int dumpInfoItemNum = (sizeof(SYSPARA_LIST) / sizeof(SysParaInfoItem)); - const char *temp = NULL; - int (*pfnPrintf)(const char *format, ...) = NULL; -#if defined(__LITEOS_RISCV__) - pfnPrintf = &AtPrintf; -#else - pfnPrintf = &printf; -#endif - - pfnPrintf("Begin dump syspara\r\n"); - pfnPrintf("=======================\r\n"); - while (index < dumpInfoItemNum) { - temp = SYSPARA_LIST[index].getInfoValue(); - pfnPrintf("%s:%s\r\n", SYSPARA_LIST[index].infoName, temp); - index++; - } - pfnPrintf("=======================\r\n"); - pfnPrintf("End dump syspara\r\n"); - pfnPrintf = NULL; - return 0; -} diff --git a/os_dump/dump_syspara.h b/os_dump/dump_syspara.h deleted file mode 100644 index 528d49a..0000000 --- a/os_dump/dump_syspara.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef DUMP_SYSPARA_H -#define DUMP_SYSPARA_H - -typedef struct { - char *infoName; - const char *(*getInfoValue)(void); -} SysParaInfoItem; - -int QuerySysparaCmd(void); - -#endif diff --git a/os_dump/os_dump.c b/os_dump/os_dump.c deleted file mode 100644 index f2a40da..0000000 --- a/os_dump/os_dump.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include "dump_syspara.h" - -typedef struct { - char *serviceName; - int (*serviceHandler)(); -} ServiceItem; - -static const ServiceItem SERVICE_LIST[] = { - {"syspara", QuerySysparaCmd}, -}; - -static void Usage() -{ - printf("Usage:os_dump [--help | -l | SERVICE]\n" - " --help: shows this help\n" - " -l: only list services, do not dump them\n" - " SERVICE: dumps only service SERVICE\n"); -}; - -int main(int argc, char **argv) -{ - static struct option longOptions[] = { - {"help", no_argument, 0, 0}, - {0, 0, 0, 0} - }; - int serviceNum = (sizeof(SERVICE_LIST) / sizeof(ServiceItem)); - int c; - int optionIndex = 0; - if (optind == argc) { - Usage(); - return 0; - } - - optind = 1; - while (1) { - c = getopt_long(argc, argv, "l", longOptions, &optionIndex); - if (c == -1) { - break; - } - switch (c) { - case 0: - if (!strcmp(longOptions[optionIndex].name, "help")) { - Usage(); - } - break; - case 'l': - printf("OptionList:\n"); - for (int i = 0; i < serviceNum; i = i + 1) { - printf("%s\n", SERVICE_LIST[i].serviceName); - } - break; - default: - Usage(); - break; - } - } - - for (int i = optind; i < argc; i++) { - for (int j = 0; j < serviceNum; j++) { - if (!strcmp(argv[i], SERVICE_LIST[j].serviceName)) { - int ret = SERVICE_LIST[j].serviceHandler(); - return ret; - } - } - printf("Service %s not registered! Try os_dump --help\n", argv[i]); - break; - } - return 0; -} -- GitLab