diff --git a/services/include/init_jobs.h b/services/include/init_jobs.h new file mode 100755 index 0000000000000000000000000000000000000000..fb02d0146b8ee76cc7f0b2ea3bac6e3f8044f8bf --- /dev/null +++ b/services/include/init_jobs.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020-2021 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 BASE_STARTUP_INITLITE_JOBS_H +#define BASE_STARTUP_INITLITE_JOBS_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +#define MAX_JOB_NAME_LEN 64 + +// one job, could have many cmd lines +typedef struct { + char name[MAX_JOB_NAME_LEN + 1]; + CmdLines *cmdLines; +} Job; + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif // BASE_STARTUP_INITLITE_JOBS_H diff --git a/services/init/include/init_jobs.h b/services/init/include/init_jobs_internal.h similarity index 86% rename from services/init/include/init_jobs.h rename to services/init/include/init_jobs_internal.h index 682fffc3aa7faa0098edf158093cab5ca61443ff..f453aa9ab1320132c9d2363eb3066a32f76ad5c8 100755 --- a/services/init/include/init_jobs.h +++ b/services/init/include/init_jobs_internal.h @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef BASE_STARTUP_INITLITE_JOBS_H -#define BASE_STARTUP_INITLITE_JOBS_H +#ifndef BASE_STARTUP_INITLITE_JOBS_INTERNAL_H +#define BASE_STARTUP_INITLITE_JOBS_INTERNAL_H #include "cJSON.h" #include "init_cmds.h" @@ -52,4 +52,4 @@ void ReadConfig(void); #endif #endif -#endif // BASE_STARTUP_INITLITE_JOBS_H +#endif // BASE_STARTUP_INITLITE_JOBS_INTERNAL_H diff --git a/services/init/init_common_cmds.c b/services/init/init_common_cmds.c index 2bb25b9cf7f8484a7304fb98e5472096f246c18f..b82a09113938a1fa5bc215cd67ddab6b50863266 100755 --- a/services/init/init_common_cmds.c +++ b/services/init/init_common_cmds.c @@ -32,7 +32,7 @@ #include #include "init.h" -#include "init_jobs.h" +#include "init_jobs_internal.h" #include "init_log.h" #include "init_service_manager.h" #include "init_utils.h" diff --git a/services/init/init_config.c b/services/init/init_config.c index af59132789ade6db4d819cc453b4a83b5a2e668f..976a8268f1524de14d25d352475178f6015be116 100755 --- a/services/init/init_config.c +++ b/services/init/init_config.c @@ -13,7 +13,7 @@ * limitations under the License. */ #include "init.h" -#include "init_jobs.h" +#include "init_jobs_internal.h" #include "init_log.h" #include "init_service_manager.h" #include "init_utils.h" diff --git a/services/init/init_service_manager.c b/services/init/init_service_manager.c index ccdba93a76dc93ff7a405f4922d05e3c28d16605..be677f650e28f1c3ece2d98212881447d9cbd4f5 100755 --- a/services/init/init_service_manager.c +++ b/services/init/init_service_manager.c @@ -25,7 +25,7 @@ #include "cJSON.h" #include "init.h" -#include "init_jobs.h" +#include "init_jobs_internal.h" #include "init_log.h" #include "init_service_socket.h" #include "init_utils.h" diff --git a/services/init/lite/init.c b/services/init/lite/init.c index 2358100b20d0b7e4c3686959159912732d01a663..6f24941c41f4941513ad4264443df19c44690d6b 100755 --- a/services/init/lite/init.c +++ b/services/init/lite/init.c @@ -14,7 +14,7 @@ */ #include "init.h" #include "init_log.h" -#include "init_jobs.h" +#include "init_jobs_internal.h" #ifndef __LINUX__ #include "init_stage.h" #endif @@ -81,4 +81,4 @@ void SystemRun(void) // pause only returns -1, no need to process the return value. (void)pause(); } -} \ No newline at end of file +} diff --git a/services/init/lite/init_jobs.c b/services/init/lite/init_jobs.c index ab09c6a6cfb1b1890ea743a5518d3e63bbff3446..4b3f3a92f9ca479366dcb0d01949eafc745c3d9e 100755 --- a/services/init/lite/init_jobs.c +++ b/services/init/lite/init_jobs.c @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "init_jobs.h" +#include "init_jobs_internal.h" #include #include @@ -160,4 +160,4 @@ void ReleaseAllJobs(void) free(g_jobs); g_jobs = NULL; g_jobCnt = 0; -} \ No newline at end of file +} diff --git a/services/init/standard/init_cmds.c b/services/init/standard/init_cmds.c index c05d45db41eb1df7ad20d4ebb906ea91fd83f29e..60af29c769f438c8eec545b1c39b4f5150647678 100755 --- a/services/init/standard/init_cmds.c +++ b/services/init/standard/init_cmds.c @@ -34,7 +34,7 @@ #include #include "fs_manager/fs_manager.h" #include "init.h" -#include "init_jobs.h" +#include "init_jobs_internal.h" #include "init_log.h" #include "init_param.h" #include "init_service_manager.h" diff --git a/services/init/standard/init_jobs.c b/services/init/standard/init_jobs.c index 18d3ff127dbd42e52dfce8da1592877ca77b4ef4..ad601544ce9e3ccc8feaf7fe047990afe42cdc75 100755 --- a/services/init/standard/init_jobs.c +++ b/services/init/standard/init_jobs.c @@ -13,10 +13,10 @@ * limitations under the License. */ -#include "init_jobs.h" +#include "init_jobs_internal.h" #include "init_param.h" void ParseAllJobs(const cJSON *fileRoot) { ParseTriggerConfig(fileRoot); -} \ No newline at end of file +} diff --git a/services/test/unittest/common/cmd_func_test.cpp b/services/test/unittest/common/cmd_func_test.cpp index 41f81391408a879f3899da8c1b539d944fa2fd4b..e5c7218b43569e0626268293b39e4a38db246ea3 100755 --- a/services/test/unittest/common/cmd_func_test.cpp +++ b/services/test/unittest/common/cmd_func_test.cpp @@ -22,7 +22,7 @@ #include "cJSON.h" #include "init_cmds.h" -#include "init_jobs.h" +#include "init_jobs_internal.h" #include "init_service_manager.h" #include "securec.h" #include "gtest/gtest.h" diff --git a/services/test/unittest/param/trigger_unittest.cpp b/services/test/unittest/param/trigger_unittest.cpp index fe820355a143b7f7e2eadbbb2e201b0835b604d9..4d0a5046b3a76b50ba6805e92ac03eee53d08072 100755 --- a/services/test/unittest/param/trigger_unittest.cpp +++ b/services/test/unittest/param/trigger_unittest.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "init_jobs.h" +#include "init_jobs_internal.h" #include "init_param.h" #include "init_unittest.h" #include "init_utils.h" @@ -592,4 +592,4 @@ HWTEST_F(TriggerUnitTest, TestRunClient, TestSize.Level0) TriggerUnitTest test; int ret = test.TestRunClient(); EXPECT_EQ(ret, 0); -} \ No newline at end of file +}