4 * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Yongjin Kim <youth.kim@samsung.com>
7 * Jinhyeong Ahn <jinh.ahn@samsung.com>
8 * Jiwon Kim <jiwon177.kim@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 #ifndef __TIZEN_CONVERGENCE_SAL_INTERNAL_H__
25 #define __TIZEN_CONVERGENCE_SAL_INTERNAL_H__
34 #define API __attribute__ ((visibility("default")))
36 #define LOG_TAG "SERVICE_ADAPTOR"
38 #define DLOG(prio, fmt, arg...) \
39 do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
42 #if defined(_SERVICE_ADAPTOR_IPC_SERVER)
43 #define IPC_ROLE "[SERVER]"
44 #elif defined(_SERVICE_ADAPTOR_IPC_CLIENT)
45 #define IPC_ROLE "[CLIENT]"
47 #define IPC_ROLE "[LIB]"
50 #define INFO(fmt, arg...) SLOGI(IPC_ROLE" "fmt, ##arg)
51 #define ERR(fmt, arg...) SLOGE(IPC_ROLE" "fmt, ##arg)
52 #define DBG(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
53 #define WARN(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
54 #define VERBOSE(fmt, arg...) SLOGV(IPC_ROLE" "fmt, ##arg)
56 #ifdef SERVICE_ADAPTOR_DEBUGGING
58 #define SAL_FN_CALL DBG(">>>>>>>> called")
59 #define SAL_FN_END DBG("<<<<<<<< ended")
61 #define SAL_DBG(fmt, arg...) DBG(fmt, ##arg)
62 #define SAL_WARN(fmt, arg...) WARN(fmt, ##arg)
63 #define SAL_ERR(fmt, arg...) ERR(fmt, ##arg)
64 #define SAL_INFO(fmt, arg...) INFO(fmt, ##arg)
65 #define SAL_VERBOSE(fmt, arg...) VERBOSE(fmt, ##arg)
67 #else /* SERVICE_ADAPTOR_DEBUGGING */
71 #define SAL_DBG(fmt, arg...)
72 #define SAL_WARN(fmt, arg...)
73 #define SAL_ERR(fmt, arg...) ERR(fmt, ##arg)
74 #define SAL_INFO(fmt, arg...)
75 #define SAL_VERBOSE(fmt, arg...)
77 #endif /* SERVICE_ADAPTOR_DEBUGGING */
79 #define WARN_IF(expr, fmt, arg...) do { \
81 SAL_WARN(fmt, ##arg); \
84 #define RET_IF(expr) do { \
86 SAL_ERR("(%s)", #expr); \
90 #define RETV_IF(expr, val) do { \
92 SAL_ERR("(%s)", #expr); \
96 #define RETM_IF(expr, fmt, arg...) do { \
98 SAL_ERR(fmt, ##arg); \
102 #define RETVM_IF(expr, val, fmt, arg...) do { \
104 SAL_ERR(fmt, ##arg); \
108 #define TRYM_IF(expr, fmt, arg...) do { \
110 SAL_ERR(fmt, ##arg); \
114 #define TRYVM_IF(expr, val, fmt, arg...) do { \
116 SAL_ERR(fmt, ##arg); \
123 #define SAL_FREE(ptr) do { \
129 #endif /* __TIZEN_CONVERGENCE_SAL_INTERNAL_H__ */