From: kibak.yoon Date: Fri, 1 Apr 2016 12:48:54 +0000 (+0900) Subject: sensor-hal-tm1: rename sensor_logs.h to sensor_log.h X-Git-Tag: submit/tizen/20210607.085043~27^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=786950f13d277f06da7af4455ad8327955885f11;p=platform%2Fhal%2Fbackend%2Ftm1%2Fsensor-tm1.git sensor-hal-tm1: rename sensor_logs.h to sensor_log.h Change-Id: Ibfab695dec5c07dd7d4b01062ac8ea572dea21ad Signed-off-by: kibak.yoon --- diff --git a/src/accel/accel.cpp b/src/accel/accel.cpp index cc856b4..97b1db5 100644 --- a/src/accel/accel.cpp +++ b/src/accel/accel.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "accel.h" diff --git a/src/create.cpp b/src/create.cpp index 33f54fc..6ed9bbd 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -16,7 +16,7 @@ */ #include -#include +#include #include #include "accel/accel.h" diff --git a/src/proxi/proxi.cpp b/src/proxi/proxi.cpp index 819a5b6..8a8ce64 100644 --- a/src/proxi/proxi.cpp +++ b/src/proxi/proxi.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "proxi.h" diff --git a/src/sensor_log.h b/src/sensor_log.h new file mode 100644 index 0000000..395abb1 --- /dev/null +++ b/src/sensor_log.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics 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 _SENSOR_LOG_H_ +#define _SENSOR_LOG_H_ + +#include + +#if !defined(NAME_MAX) +#define NAME_MAX 256 +#endif + +#define SENSOR_TYPE_SHIFT 16 + +enum sf_log_type { + SF_LOG_PRINT_FILE = 1, + SF_LOG_SYSLOG = 2, + SF_LOG_DLOG = 3, +}; + +enum sf_priority_type { + SF_LOG_ERR = 1, + SF_LOG_DBG = 2, + SF_LOG_INFO = 3, + SF_LOG_WARN = 4, +}; + +#define MICROSECONDS(tv) ((tv.tv_sec * 1000000ll) + tv.tv_usec) + +//for new log system - dlog +#ifdef LOG_TAG + #undef LOG_TAG +#endif +#define LOG_TAG "SENSOR" + +#ifdef _DEBUG +#define DBG SLOGD +#else +#define DBG(...) do{} while(0) +#endif + +#define ERR SLOGE +#define WARN SLOGW +#define INFO SLOGI +#define _E ERR +#define _W WARN +#define _I INFO +#define _D DBG + +#define _ERRNO(errno, tag, fmt, arg...) do { \ + char buf[1024]; \ + char *error = strerror_r(errno, buf, 1024); \ + if (!error) { \ + _E("Failed to strerror_r()"); \ + break; \ + } \ + tag(fmt" (%s[%d])", ##arg, error, errno); \ + } while (0) + +#if defined(_DEBUG) +# define warn_if(expr, fmt, arg...) do { \ + if(expr) { \ + DBG("(%s) -> " fmt, #expr, ##arg); \ + } \ + } while (0) +# define ret_if(expr) do { \ + if(expr) { \ + DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ + return; \ + } \ + } while (0) +# define retv_if(expr, val) do { \ + if(expr) { \ + DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ + return (val); \ + } \ + } while (0) +# define retm_if(expr, fmt, arg...) do { \ + if(expr) { \ + ERR(fmt, ##arg); \ + DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ + return; \ + } \ + } while (0) +# define retvm_if(expr, val, fmt, arg...) do { \ + if(expr) { \ + ERR(fmt, ##arg); \ + DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ + return (val); \ + } \ + } while (0) + +#else +# define warn_if(expr, fmt, arg...) do { \ + if(expr) { \ + ERR(fmt, ##arg); \ + } \ + } while (0) +# define ret_if(expr) do { \ + if(expr) { \ + return; \ + } \ + } while (0) +# define retv_if(expr, val) do { \ + if(expr) { \ + return (val); \ + } \ + } while (0) +# define retm_if(expr, fmt, arg...) do { \ + if(expr) { \ + ERR(fmt, ##arg); \ + return; \ + } \ + } while (0) +# define retvm_if(expr, val, fmt, arg...) do { \ + if(expr) { \ + ERR(fmt, ##arg); \ + return (val); \ + } \ + } while (0) + +#endif + +#endif /* _SENSOR_LOG_H_ */ diff --git a/src/sensor_logs.h b/src/sensor_logs.h deleted file mode 100644 index 395abb1..0000000 --- a/src/sensor_logs.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics 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 _SENSOR_LOG_H_ -#define _SENSOR_LOG_H_ - -#include - -#if !defined(NAME_MAX) -#define NAME_MAX 256 -#endif - -#define SENSOR_TYPE_SHIFT 16 - -enum sf_log_type { - SF_LOG_PRINT_FILE = 1, - SF_LOG_SYSLOG = 2, - SF_LOG_DLOG = 3, -}; - -enum sf_priority_type { - SF_LOG_ERR = 1, - SF_LOG_DBG = 2, - SF_LOG_INFO = 3, - SF_LOG_WARN = 4, -}; - -#define MICROSECONDS(tv) ((tv.tv_sec * 1000000ll) + tv.tv_usec) - -//for new log system - dlog -#ifdef LOG_TAG - #undef LOG_TAG -#endif -#define LOG_TAG "SENSOR" - -#ifdef _DEBUG -#define DBG SLOGD -#else -#define DBG(...) do{} while(0) -#endif - -#define ERR SLOGE -#define WARN SLOGW -#define INFO SLOGI -#define _E ERR -#define _W WARN -#define _I INFO -#define _D DBG - -#define _ERRNO(errno, tag, fmt, arg...) do { \ - char buf[1024]; \ - char *error = strerror_r(errno, buf, 1024); \ - if (!error) { \ - _E("Failed to strerror_r()"); \ - break; \ - } \ - tag(fmt" (%s[%d])", ##arg, error, errno); \ - } while (0) - -#if defined(_DEBUG) -# define warn_if(expr, fmt, arg...) do { \ - if(expr) { \ - DBG("(%s) -> " fmt, #expr, ##arg); \ - } \ - } while (0) -# define ret_if(expr) do { \ - if(expr) { \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return; \ - } \ - } while (0) -# define retv_if(expr, val) do { \ - if(expr) { \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return (val); \ - } \ - } while (0) -# define retm_if(expr, fmt, arg...) do { \ - if(expr) { \ - ERR(fmt, ##arg); \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return; \ - } \ - } while (0) -# define retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ - ERR(fmt, ##arg); \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return (val); \ - } \ - } while (0) - -#else -# define warn_if(expr, fmt, arg...) do { \ - if(expr) { \ - ERR(fmt, ##arg); \ - } \ - } while (0) -# define ret_if(expr) do { \ - if(expr) { \ - return; \ - } \ - } while (0) -# define retv_if(expr, val) do { \ - if(expr) { \ - return (val); \ - } \ - } while (0) -# define retm_if(expr, fmt, arg...) do { \ - if(expr) { \ - ERR(fmt, ##arg); \ - return; \ - } \ - } while (0) -# define retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ - ERR(fmt, ##arg); \ - return (val); \ - } \ - } while (0) - -#endif - -#endif /* _SENSOR_LOG_H_ */ diff --git a/src/sensorhub/dbus_util.cpp b/src/sensorhub/dbus_util.cpp index adeaf57..c617090 100644 --- a/src/sensorhub/dbus_util.cpp +++ b/src/sensorhub/dbus_util.cpp @@ -16,7 +16,7 @@ */ #include -#include +#include #include "dbus_util.h" void init_dbus(void) diff --git a/src/sensorhub/sensorhub.cpp b/src/sensorhub/sensorhub.cpp index f9b335d..fe63177 100644 --- a/src/sensorhub/sensorhub.cpp +++ b/src/sensorhub/sensorhub.cpp @@ -16,7 +16,7 @@ */ #include -#include +#include #include "sensorhub.h" #include "sensorhub_controller.h" diff --git a/src/sensorhub/sensorhub_controller.cpp b/src/sensorhub/sensorhub_controller.cpp index 9d7b7fb..d8ee72a 100644 --- a/src/sensorhub/sensorhub_controller.cpp +++ b/src/sensorhub/sensorhub_controller.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include "sensorhub_controller.h" diff --git a/src/sensorhub/sensorhub_manager.h b/src/sensorhub/sensorhub_manager.h index 8d3a38f..6ee16a2 100644 --- a/src/sensorhub/sensorhub_manager.h +++ b/src/sensorhub/sensorhub_manager.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "sensorhub_controller.h" #include "sensorhub_sensor.h" diff --git a/src/sensorhub/sensorhub_sensor.cpp b/src/sensorhub/sensorhub_sensor.cpp index 56656b5..528f4c6 100644 --- a/src/sensorhub/sensorhub_sensor.cpp +++ b/src/sensorhub/sensorhub_sensor.cpp @@ -15,7 +15,7 @@ * */ -#include +#include #include #include "sensorhub_controller.h" #include "sensorhub_sensor.h" diff --git a/src/sensorhub/system_state.cpp b/src/sensorhub/system_state.cpp index 70703d2..5fdce86 100644 --- a/src/sensorhub/system_state.cpp +++ b/src/sensorhub/system_state.cpp @@ -15,7 +15,7 @@ * */ -#include +#include #include "dbus_util.h" #include "system_state.h" diff --git a/src/sensorhub/wristup.cpp b/src/sensorhub/wristup.cpp index 346f807..fcbecac 100644 --- a/src/sensorhub/wristup.cpp +++ b/src/sensorhub/wristup.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include "sensorhub_manager.h" #include "system_state.h" diff --git a/src/util.cpp b/src/util.cpp index 9c0dbd3..df01a1e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include using std::ifstream; using std::ofstream;