• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef BSHELL_UTILS_
17 #define BSHELL_UTILS_
18 #include <memory.h>
19 #include <stdint.h>
20 #include <stdio.h>
21 
22 #include "init_log.h"
23 #include "securec.h"
24 
25 #define BSH_LOG_FILE "begetctrl.log"
26 #define BSH_LABEL "SHELL"
27 #define BSH_LOGI(fmt, ...) STARTUP_LOGI(BSH_LOG_FILE, BSH_LABEL, fmt, ##__VA_ARGS__)
28 #define BSH_LOGE(fmt, ...) STARTUP_LOGE(BSH_LOG_FILE, BSH_LABEL, fmt, ##__VA_ARGS__)
29 #define BSH_LOGV(fmt, ...) STARTUP_LOGV(BSH_LOG_FILE, BSH_LABEL, fmt, ##__VA_ARGS__)
30 
31 #define BSH_CHECK(ret, exper, ...) \
32     if (!(ret)) { \
33         BSH_LOGE(__VA_ARGS__); \
34         exper; \
35     }
36 #define BSH_ONLY_CHECK(ret, exper, ...) \
37     if (!(ret)) { \
38         exper; \
39     }
40 #endif