INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/pass)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/hal)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
SET(PKG_MODULES
vconf
--- /dev/null
+/*
+ * PASS
+ *
+ * Copyright (c) 2017 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 __CORE_COMMON_H__
+#define __CORE_COMMON_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <error.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
+
+/*
+ * One byte digit has 3 position in decimal representation
+ * 2 - 5
+ * 4 - 10
+ * 8 - 20
+ * >8 - compile time error
+ * plus 1 null termination byte
+ * plus 1 for negative prefix
+ */
+#define MAX_DEC_SIZE(type) \
+ (2 + (sizeof(type) <= 1 ? 3 : \
+ sizeof(type) <= 2 ? 5 : \
+ sizeof(type) <= 4 ? 10 : \
+ sizeof(type) <= 8 ? 20 : \
+ sizeof(int[-2*(sizeof(type) > 8)])))
+
+#ifndef __CONSTRUCTOR__
+#define __CONSTRUCTOR__ __attribute__ ((constructor))
+#endif
+
+#ifndef __DESTRUCTOR__
+#define __DESTRUCTOR__ __attribute__ ((destructor))
+#endif
+
+#ifndef __WEAK__
+#define __WEAK__ __attribute__ ((weak))
+#endif
+
+#ifndef max
+#define max(a, b) \
+ __extension__ ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ _a > _b ? _a : _b; \
+ })
+#endif
+
+#ifndef min
+#define min(a, b) \
+ __extension__ ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ _a < _b ? _a : _b; \
+ })
+#endif
+
+#ifndef clamp
+#define clamp(x, low, high) \
+ __extension__ ({ \
+ typeof(x) _x = (x); \
+ typeof(low) _low = (low); \
+ typeof(high) _high = (high); \
+ ((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
+ })
+#endif
+
+#ifndef SEC_TO_MSEC
+#define SEC_TO_MSEC(x) ((x)*1000)
+#endif
+#ifndef MSEC_TO_USEC
+#define MSEC_TO_USEC(x) ((unsigned int)(x)*1000)
+#endif
+#ifndef NSEC_TO_MSEC
+#define NSEC_TO_MSEC(x) ((double)x/1000000)
+#endif
+#ifndef USEC_TO_MSEC
+#define USEC_TO_MSEC(x) ((double)x/1000)
+#endif
+
+#define NANO_SECOND_MULTIPLIER 1000000 /* 1ms = 1,000,000 nsec */
+
+#ifndef safe_free
+#define safe_free(x) safe_free_memory((void**)&(x))
+#endif
+
+static inline void safe_free_memory(void** mem)
+{
+ if (mem && *mem) {
+ free(*mem);
+ *mem = NULL;
+ }
+}
+
+#define ret_value_if(expr, val) do { \
+ if (expr) { \
+ _E("(%s)", #expr); \
+ return (val); \
+ } \
+} while (0)
+
+#define ret_value_msg_if(expr, val, fmt, arg...) do { \
+ if (expr) { \
+ _E(fmt, ##arg); \
+ return val; \
+ } \
+} while (0)
+
+#define ret_msg_if(expr, fmt, arg...) do { \
+ if (expr) { \
+ _E(fmt, ##arg); \
+ return; \
+ } \
+} while (0)
+
+FILE * open_proc_oom_score_adj_file(int pid, const char *mode);
+int get_exec_pid(const char *execpath);
+int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size);
+int is_vip(int pid);
+int remove_dir(const char *path, int del_dir);
+int sys_check_node(char *path);
+int sys_get_int(char *fname, int *val);
+int sys_set_int(char *fname, int val);
+int sys_get_str(char *fname, char *str);
+int sys_set_str(char *fname, char *val);
+int terminate_process(const char *partition, bool force);
+int mount_check(const char* path);
+void print_time(const char *prefix);
+int get_privilege(pid_t pid, char *name, size_t len);
+
+#endif /* __CORE_COMMON_H__ */
--- /dev/null
+/*
+ * PASS
+ *
+ * Copyright (c) 2017 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 __CONFIG_PARSER_H__
+#define __CONFIG_PARSER_H__
+
+#define MATCH(a, b) (!strncmp(a, b, strlen(a)))
+#define SET_CONF(a, b) (a = (b > 0.0 ? b : a))
+
+struct parse_result {
+ char *section;
+ char *name;
+ char *value;
+};
+
+/**
+ * @brief Parse config file and call callback\n
+ * @param[in] file_name conf file.
+ * @param[in] cb cb is called when conf file is parsed line by line.
+ * @param[in] user_data user data is passed to cb.
+ * @return 0 on success, negative if failed
+ */
+int config_parse(const char *file_name, int cb(struct parse_result *result,
+ void *user_data), void *user_data);
+
+#endif
--- /dev/null
+/*
+ * PASS
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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 __DEVICE_NOTIFIER_H__
+#define __DEVICE_NOTIFIER_H__
+
+#include <stdbool.h>
+
+enum device_notifier_type {
+ DEVICE_NOTIFIER_BOOTING_DONE,
+ DEVICE_NOTIFIER_PMQOS,
+ DEVICE_NOTIFIER_POWEROFF,
+ DEVICE_NOTIFIER_MAX,
+};
+
+struct device_notifier {
+ bool is_used;
+ enum device_notifier_type status;
+ int (*func)(void *data, void *user_data);
+ void *user_data;
+};
+
+/*
+ * This is for internal callback method.
+ */
+int register_notifier(enum device_notifier_type status,
+ int (*func)(void *data, void *user_data), void *user_data);
+int unregister_notifier(enum device_notifier_type status,
+ int (*func)(void *data, void *user_data), void *user_data);
+void device_notify(enum device_notifier_type status, void *value);
+
+#endif /* __DEVICE_NOTIFIER_H__ */
--- /dev/null
+/*
+ * PASS
+ *
+ * Copyright (c) 2017 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 __DEVICES_H__
+#define __DEVICES_H__
+
+#include <errno.h>
+#include "common.h"
+
+enum device_priority {
+ DEVICE_PRIORITY_NORMAL = 0,
+ DEVICE_PRIORITY_HIGH,
+};
+
+enum device_flags {
+ NORMAL_MODE = 0x00000001,
+};
+
+struct device_ops {
+ enum device_priority priority;
+ char *name;
+ int (*probe) (void *data);
+ void (*init) (void *data);
+ void (*exit) (void *data);
+ int (*start) (enum device_flags flags);
+ int (*stop) (enum device_flags flags);
+ int (*status) (void);
+ int (*execute) (void *data);
+};
+
+enum device_ops_status {
+ DEVICE_OPS_STATUS_UNINIT,
+ DEVICE_OPS_STATUS_START,
+ DEVICE_OPS_STATUS_STOP,
+ DEVICE_OPS_STATUS_MAX,
+};
+
+void devices_init(void *data);
+void devices_exit(void *data);
+
+static inline int device_start(const struct device_ops *dev)
+{
+ if (dev && dev->start)
+ return dev->start(NORMAL_MODE);
+
+ return -EINVAL;
+}
+
+static inline int device_stop(const struct device_ops *dev)
+{
+ if (dev && dev->stop)
+ return dev->stop(NORMAL_MODE);
+
+ return -EINVAL;
+}
+
+static inline int device_exit(const struct device_ops *dev, void *data)
+{
+ if (dev && dev->exit) {
+ dev->exit(data);
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+static inline int device_execute(const struct device_ops *dev, void *data)
+{
+ if (dev && dev->execute)
+ return dev->execute(data);
+
+ return -EINVAL;
+}
+
+static inline int device_get_status(const struct device_ops *dev)
+{
+ if (dev && dev->status)
+ return dev->status();
+
+ return -EINVAL;
+}
+
+#define DEVICE_OPS_REGISTER(dev) \
+static void __CONSTRUCTOR__ module_init(void) \
+{ \
+ add_device(dev); \
+} \
+static void __DESTRUCTOR__ module_exit(void) \
+{ \
+ remove_device(dev); \
+}
+
+void add_device(const struct device_ops *dev);
+void remove_device(const struct device_ops *dev);
+
+const struct device_ops *find_device(const char *name);
+int check_default(const struct device_ops *dev);
+
+#define NOT_SUPPORT_OPS(dev) ((check_default(dev)) ? 1 : 0)
+
+#define FIND_DEVICE_INT(dev, name) do { \
+ if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \
+} while (0)
+
+#define FIND_DEVICE_VOID(dev, name) do { \
+ if (!dev) dev = find_device(name); if (check_default(dev)) return; \
+} while (0)
+
+#endif
--- /dev/null
+/*
+ * PASS (Power Aware System Service)
+ *
+ * Copyright (c) 2017 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 __GDBUS_UTIL_H__
+#define __GDBUS_UTIL_H__
+
+#include <gio/gio.h>
+#include <stdbool.h>
+
+#include "pass/pass-dbus-stub.h"
+#include "pmqos/pmqos-dbus-stub.h"
+
+#define SYSTEMD_DBUS_NAME "org.freedesktop.systemd1"
+#define SYSTEMD_DBUS_OBJECT_PATH "/org/freedesktop/systemd1"
+#define SYSTEMD_DBUS_IFACE_FOR_PROPS "org.freedesktop.DBus.Properties"
+#define SYSTEMD_DBUS_METHOD_GET_PROP "Get"
+#define SYSTEMD_DBUS_METHOD_GET_PROP_ARG_TYPE "(ss)"
+#define SYSTEMD_DBUS_METHOD_GET_PROP_RET_TYPE "(v)"
+#define SYSTEMD_DBUS_IFACE_MANAGER SYSTEMD_DBUS_NAME ".Manager"
+
+struct pass_gdbus_signal_info {
+ const gchar *handler;
+ GCallback cb;
+ gpointer cb_data;
+ gulong ret_id;
+};
+
+int pass_gdbus_register_systemd_startup_callback(GDBusSignalCallback cb,
+ gpointer user_data, guint *id);
+int pass_gdbus_unregister_systemd_startup_callback(guint id);
+int pass_gdbus_get_systemd_dbus_property_string(const char *iface,
+ const char *prop, const char **value);
+int pass_gdbus_export_interface(gpointer instance, const char *obj_path);
+int pass_gdbus_get_name(const char *name);
+int pass_gdbus_connect_signal(gpointer instance, int num_signals,
+ struct pass_gdbus_signal_info *signal_infos);
+void pass_gdbus_disconnect_signal(gpointer instance, int num_signals,
+ struct pass_gdbus_signal_info *signal_infos);
+SystemPassCore *pass_gdbus_get_instance_core(void);
+void pass_gdbus_put_instance_core(SystemPassCore **instance);
+SystemPassPmqos *pass_gdbus_get_instance_pmqos(void);
+void pass_gdbus_put_instance_pmqos(SystemPassPmqos **instance);
+int pass_gdbus_get_system_connection(void);
+void pass_gdbus_put_system_connection(void);
+#endif /* __GDBUS_UTIL_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2017 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 _PASS_HAL_H_
+#define _PASS_HAL_H_
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#define BUFF_MAX 255
+
+#define MAKE_4B_CODE_4(A, B, C, D) \
+ ((((A) & 0xff) << 24) | (((B) & 0xff) << 16) | \
+ (((C) & 0xff) << 8) | (((D) & 0xff)))
+#define MAKE_TAG_CONSTANT(A, B, C, D) MAKE_4B_CODE_4(A, B, C, D)
+
+#define HAL_INFO_TAG MAKE_TAG_CONSTANT('P', 'A', 'S', 'S')
+
+/* Symbolic name of the HAL info (PASS HAL Info) */
+#define HAL_INFO_SYM PassHalInfo
+
+#define PASS_RESOURCE_UNKNOWN 0
+#define PASS_RESOURCE_CPU_ID 1
+#define PASS_RESOURCE_BUS_ID 2
+#define PASS_RESOURCE_GPU_ID 3
+#define PASS_RESOURCE_MEMORY_ID 4
+#define PASS_RESOURCE_NONSTANDARD_ID 99
+
+#define PASS_RESOURCE_CPU_NAME "cpu"
+#define PASS_RESOURCE_BUS_NAME "bus"
+#define PASS_RESOURCE_GPU_NAME "gpu"
+#define PASS_RESOURCE_MEMORY_NAME "memory"
+#define PASS_RESOURCE_NONSTANDARD_NAME "nonstandard"
+
+/**
+ * Define the common structure
+ */
+
+struct pass_resource_common;
+
+/*
+ * pass_resource_info - Define the information structure for the resource.
+ *
+ * @magic : magic must be initialized to HAL_INFO_TAG
+ * @hal_version : HAL version
+ * @device_version: device version
+ * @id : device id, can have the following value.
+ * - PASS_RESOURCE_CPU_ID
+ * - PASS_RESOURCE_BUS_ID
+ * - PASS_RESOURCE_GPU_ID
+ * - PASS_RESOURCE_MEMORY_ID
+ * - PASS_RESOURCE_NONSTANDARD_ID
+ * @name : device name, can have the following value.
+ * - PASS_RESOURCE_CPU_NAME
+ * - PASS_RESOURCE_BUS_NAME
+ * - PASS_RESOURCE_GPU_NAME
+ * - PASS_RESOURCE_MEMORY_NAME
+ * - PASS_RESOURCE_NONSTANDARD_NAME
+ * @dso : module's dso
+ * @resourced[] : reserved for future use
+ * @open : function pointer to open device
+ * @close : function pointer to close device
+ */
+struct pass_resource_info {
+ uint32_t magic;
+ uint16_t hal_version;
+ uint16_t device_version;
+ const int id;
+ const char *name;
+ void *dso;
+ uint32_t reserved[8];
+
+ int (*open)(char *res_name, struct pass_resource_info *info,
+ struct pass_resource_common **common);
+ int (*close)(char *res_name, struct pass_resource_common *common);
+};
+
+struct pass_resource_common {
+ /* indicate to this device information structure */
+ struct pass_resource_info *info;
+};
+
+/*
+ * Define the ops (operations) structure which are used on specific resource.
+ */
+struct pass_resource_dvfs_ops {
+ /* Get and set the current governor. */
+ int (*get_curr_governor)(char *res_name, char *governor);
+ int (*set_curr_governor)(char *res_name, char *governor);
+
+ int (*get_avail_governor)(char *res_name, char **avail_governor);
+
+ /* Get the current frequency. */
+ int (*get_curr_freq)(char *res_name);
+
+ /* Get and set the minimum frequency. */
+ int (*get_min_freq)(char *res_name);
+ int (*set_min_freq)(char *res_name, int freq);
+
+ /* Get and set the maximum frequency. */
+ int (*get_max_freq)(char *res_name);
+ int (*set_max_freq)(char *res_name, int freq);
+
+ /* Get the minimum/maximum frequency which can be set to resource. */
+ int (*get_available_min_freq)(char *res_name);
+ int (*get_available_max_freq)(char *res_name);
+
+ /* Get and set the up_threshold to support boosting. */
+ int (*get_up_threshold)(char *res_name);
+ int (*set_up_threshold)(char *res_name, int up_threshold);
+
+ /* Get the load_table of each resource to estimate the system load. */
+ int (*get_load_table)(char *name, void *pass_cpu_load_table);
+};
+
+struct pass_resource_hotplug_ops {
+ /* Get and set the online status of resource. */
+ int (*get_online_state)(char *res_name, int cpu);
+ int (*set_online_state)(char *res_name, int cpu, int on);
+ /* Get and set the minimum number of online CPUs */
+ int (*get_online_min_num) (char *res_name);
+ int (*set_online_min_num) (char *res_name, int min_num);
+ /* Get and set the maximum number of online CPUs */
+ int (*get_online_max_num) (char *res_name);
+ int (*set_online_max_num) (char *res_name, int max_num);
+};
+
+struct pass_resource_tmu_ops {
+ /* Get the current temperature of resoruce. */
+ int (*get_temp)(char *res_thremal_name);
+
+ /* Get the policy of thermal management unit. */
+ int (*get_policy)(char *res_thermal_name, char *policy);
+};
+
+/*
+ * Define the resource structure for CPU H/W.
+ *
+ * @common : common resource structure.
+ * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling).
+ * @tmu : function lists for the TMU (Thermal Management Unit).
+ * @hotplug : function lists for the CPU on/off.
+ */
+struct pass_resource_cpu {
+ struct pass_resource_common common;
+
+ struct pass_resource_dvfs_ops dvfs;
+ struct pass_resource_tmu_ops tmu;
+ struct pass_resource_hotplug_ops hotplug;
+};
+
+/*
+ * Define the resource structure for Memory Bus H/W.
+ *
+ * @common : common resource structure.
+ * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling).
+ * @tmu : function lists for the TMU (Thermal Management Unit).
+ */
+struct pass_resource_bus {
+ struct pass_resource_common common;
+
+ struct pass_resource_dvfs_ops dvfs;
+ struct pass_resource_tmu_ops tmu;
+};
+
+/*
+ * Define the resource structure for GPU H/W.
+ *
+ * @common : common resource structure.
+ * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling).
+ * @tmu : function lists for the TMU (Thermal Management Unit).
+ */
+struct pass_resource_gpu {
+ struct pass_resource_common common;
+
+ struct pass_resource_dvfs_ops dvfs;
+ struct pass_resource_tmu_ops tmu;
+};
+
+/*
+ * Define the resource structure for Memory H/W.
+ *
+ * @common : common resource structure.
+ */
+struct pass_resource_memory {
+ struct pass_resource_common common;
+
+ /* Get and set the /sys/kernel/debug/fault_around_bytes */
+ int (*get_fault_around_bytes)(char *res_name);
+ int (*set_fault_around_bytes)(char *res_name, int fault_around_bytes);
+};
+
+/*
+ * Define the resource structure for nonstandard H/W.
+ *
+ * Following function is Deprecated. (Not recommended for use)
+ * @set_pmqos_data : function to bypass the scenario data to HAL.
+ *
+ * This structure indicates the nonstandard H/W which doesn't have
+ * the official supported framework (e.g., cpufreq, devfreq and so on)
+ * in Linux Kernel. But, the specific device might be controlled
+ * according to PMQoS scenario or other cases.
+ */
+struct pass_resource_nonstandard {
+ struct pass_resource_common common;
+
+ /*
+ * NOTE: It is not propper method. But PASS must need to keep
+ * the backwards compatibility, set the PMQoS's data from
+ * platform to hal. So, It is not recommended to use it.
+ *
+ * This function will be removed after finding the proper method.
+ */
+ int (*set_pmqos_data)(char *res_name, void *data);
+};
+
+int pass_get_hal_info(const char *id, const struct pass_resource_info **info);
+
+/**
+ * Structure define of HAL info module
+ *
+ * All HAL module should be use below define to make a specific
+ * structure for Tizen HAL. pass_get_resource_info function
+ * will load a pass_resource_data structure by using TizenHwInfo name
+ * at runtime. TizenHwInfo means Tizen Hardware Info.
+ */
+#define HAL_MODULE_STRUCTURE \
+ __attribute__ ((visibility("default"))) \
+ struct pass_resource_info HAL_INFO_SYM
+
+#endif /* _PASS_HAL_H_ */
--- /dev/null
+/*
+ * PASS (Power Aware System Service)
+ *
+ * Copyright (c) 2017 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 __LOG_H__
+#define __LOG_H__
+
+#include <dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#define LOG_TAG "PASS"
+#endif /* LOG_TAG */
+
+#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while (0)
+#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while (0)
+#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while (0)
+#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while (0)
+#endif
#include <poll.h>
#include <mntent.h>
-#include "shared/log.h"
-
-#include "common.h"
+#include <pass/log.h>
+#include <pass/common.h>
#define BUFF_MAX 255
+++ /dev/null
-/*
- * PASS
- *
- * Copyright (c) 2017 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 __CORE_COMMON_H__
-#define __CORE_COMMON_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <error.h>
-#include <stdbool.h>
-#include <unistd.h>
-
-#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
-
-/*
- * One byte digit has 3 position in decimal representation
- * 2 - 5
- * 4 - 10
- * 8 - 20
- * >8 - compile time error
- * plus 1 null termination byte
- * plus 1 for negative prefix
- */
-#define MAX_DEC_SIZE(type) \
- (2 + (sizeof(type) <= 1 ? 3 : \
- sizeof(type) <= 2 ? 5 : \
- sizeof(type) <= 4 ? 10 : \
- sizeof(type) <= 8 ? 20 : \
- sizeof(int[-2*(sizeof(type) > 8)])))
-
-#ifndef __CONSTRUCTOR__
-#define __CONSTRUCTOR__ __attribute__ ((constructor))
-#endif
-
-#ifndef __DESTRUCTOR__
-#define __DESTRUCTOR__ __attribute__ ((destructor))
-#endif
-
-#ifndef __WEAK__
-#define __WEAK__ __attribute__ ((weak))
-#endif
-
-#ifndef max
-#define max(a, b) \
- __extension__ ({ \
- typeof(a) _a = (a); \
- typeof(b) _b = (b); \
- _a > _b ? _a : _b; \
- })
-#endif
-
-#ifndef min
-#define min(a, b) \
- __extension__ ({ \
- typeof(a) _a = (a); \
- typeof(b) _b = (b); \
- _a < _b ? _a : _b; \
- })
-#endif
-
-#ifndef clamp
-#define clamp(x, low, high) \
- __extension__ ({ \
- typeof(x) _x = (x); \
- typeof(low) _low = (low); \
- typeof(high) _high = (high); \
- ((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
- })
-#endif
-
-#ifndef SEC_TO_MSEC
-#define SEC_TO_MSEC(x) ((x)*1000)
-#endif
-#ifndef MSEC_TO_USEC
-#define MSEC_TO_USEC(x) ((unsigned int)(x)*1000)
-#endif
-#ifndef NSEC_TO_MSEC
-#define NSEC_TO_MSEC(x) ((double)x/1000000)
-#endif
-#ifndef USEC_TO_MSEC
-#define USEC_TO_MSEC(x) ((double)x/1000)
-#endif
-
-#define NANO_SECOND_MULTIPLIER 1000000 /* 1ms = 1,000,000 nsec */
-
-#ifndef safe_free
-#define safe_free(x) safe_free_memory((void**)&(x))
-#endif
-
-static inline void safe_free_memory(void** mem)
-{
- if (mem && *mem) {
- free(*mem);
- *mem = NULL;
- }
-}
-
-#define ret_value_if(expr, val) do { \
- if (expr) { \
- _E("(%s)", #expr); \
- return (val); \
- } \
-} while (0)
-
-#define ret_value_msg_if(expr, val, fmt, arg...) do { \
- if (expr) { \
- _E(fmt, ##arg); \
- return val; \
- } \
-} while (0)
-
-#define ret_msg_if(expr, fmt, arg...) do { \
- if (expr) { \
- _E(fmt, ##arg); \
- return; \
- } \
-} while (0)
-
-FILE * open_proc_oom_score_adj_file(int pid, const char *mode);
-int get_exec_pid(const char *execpath);
-int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size);
-int is_vip(int pid);
-int remove_dir(const char *path, int del_dir);
-int sys_check_node(char *path);
-int sys_get_int(char *fname, int *val);
-int sys_set_int(char *fname, int val);
-int sys_get_str(char *fname, char *str);
-int sys_set_str(char *fname, char *val);
-int terminate_process(const char *partition, bool force);
-int mount_check(const char* path);
-void print_time(const char *prefix);
-int get_privilege(pid_t pid, char *name, size_t len);
-
-#endif /* __CORE_COMMON_H__ */
#include <string.h>
#include <errno.h>
-#include "shared/log.h"
-
-#include "config-parser.h"
+#include <pass/log.h>
+#include <pass/config-parser.h>
#define BUFF_MAX 255
#define MAX_SECTION 64
+++ /dev/null
-/*
- * PASS
- *
- * Copyright (c) 2017 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 __CONFIG_PARSER_H__
-#define __CONFIG_PARSER_H__
-
-#define MATCH(a, b) (!strncmp(a, b, strlen(a)))
-#define SET_CONF(a, b) (a = (b > 0.0 ? b : a))
-
-struct parse_result {
- char *section;
- char *name;
- char *value;
-};
-
-/**
- * @brief Parse config file and call callback\n
- * @param[in] file_name conf file.
- * @param[in] cb cb is called when conf file is parsed line by line.
- * @param[in] user_data user data is passed to cb.
- * @return 0 on success, negative if failed
- */
-int config_parse(const char *file_name, int cb(struct parse_result *result,
- void *user_data), void *user_data);
-
-#endif
#include <glib.h>
-#include "shared/log.h"
-
-#include "device-notifier.h"
-#include "common.h"
+#include <pass/common.h>
+#include <pass/device-notifier.h>
+#include <pass/log.h>
#define DEVICE_NOTIFIER_MAX_COUNT 255
+++ /dev/null
-/*
- * PASS
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * 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 __DEVICE_NOTIFIER_H__
-#define __DEVICE_NOTIFIER_H__
-
-#include <stdbool.h>
-
-enum device_notifier_type {
- DEVICE_NOTIFIER_BOOTING_DONE,
- DEVICE_NOTIFIER_PMQOS,
- DEVICE_NOTIFIER_POWEROFF,
- DEVICE_NOTIFIER_MAX,
-};
-
-struct device_notifier {
- bool is_used;
- enum device_notifier_type status;
- int (*func)(void *data, void *user_data);
- void *user_data;
-};
-
-/*
- * This is for internal callback method.
- */
-int register_notifier(enum device_notifier_type status,
- int (*func)(void *data, void *user_data), void *user_data);
-int unregister_notifier(enum device_notifier_type status,
- int (*func)(void *data, void *user_data), void *user_data);
-void device_notify(enum device_notifier_type status, void *value);
-
-#endif /* __DEVICE_NOTIFIER_H__ */
#include <glib.h>
#include <stdio.h>
-#include "shared/log.h"
-
-#include "common.h"
-#include "devices.h"
+#include <pass/common.h>
+#include <pass/devices.h>
+#include <pass/log.h>
static const struct device_ops default_ops = {
.name = "default-ops",
+++ /dev/null
-/*
- * PASS
- *
- * Copyright (c) 2017 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 __DEVICES_H__
-#define __DEVICES_H__
-
-#include <errno.h>
-#include "common.h"
-
-enum device_priority {
- DEVICE_PRIORITY_NORMAL = 0,
- DEVICE_PRIORITY_HIGH,
-};
-
-enum device_flags {
- NORMAL_MODE = 0x00000001,
-};
-
-struct device_ops {
- enum device_priority priority;
- char *name;
- int (*probe) (void *data);
- void (*init) (void *data);
- void (*exit) (void *data);
- int (*start) (enum device_flags flags);
- int (*stop) (enum device_flags flags);
- int (*status) (void);
- int (*execute) (void *data);
-};
-
-enum device_ops_status {
- DEVICE_OPS_STATUS_UNINIT,
- DEVICE_OPS_STATUS_START,
- DEVICE_OPS_STATUS_STOP,
- DEVICE_OPS_STATUS_MAX,
-};
-
-void devices_init(void *data);
-void devices_exit(void *data);
-
-static inline int device_start(const struct device_ops *dev)
-{
- if (dev && dev->start)
- return dev->start(NORMAL_MODE);
-
- return -EINVAL;
-}
-
-static inline int device_stop(const struct device_ops *dev)
-{
- if (dev && dev->stop)
- return dev->stop(NORMAL_MODE);
-
- return -EINVAL;
-}
-
-static inline int device_exit(const struct device_ops *dev, void *data)
-{
- if (dev && dev->exit) {
- dev->exit(data);
- return 0;
- }
-
- return -EINVAL;
-}
-
-static inline int device_execute(const struct device_ops *dev, void *data)
-{
- if (dev && dev->execute)
- return dev->execute(data);
-
- return -EINVAL;
-}
-
-static inline int device_get_status(const struct device_ops *dev)
-{
- if (dev && dev->status)
- return dev->status();
-
- return -EINVAL;
-}
-
-#define DEVICE_OPS_REGISTER(dev) \
-static void __CONSTRUCTOR__ module_init(void) \
-{ \
- add_device(dev); \
-} \
-static void __DESTRUCTOR__ module_exit(void) \
-{ \
- remove_device(dev); \
-}
-
-void add_device(const struct device_ops *dev);
-void remove_device(const struct device_ops *dev);
-
-const struct device_ops *find_device(const char *name);
-int check_default(const struct device_ops *dev);
-
-#define NOT_SUPPORT_OPS(dev) ((check_default(dev)) ? 1 : 0)
-
-#define FIND_DEVICE_INT(dev, name) do { \
- if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \
-} while (0)
-
-#define FIND_DEVICE_VOID(dev, name) do { \
- if (!dev) dev = find_device(name); if (check_default(dev)) return; \
-} while (0)
-
-#endif
#include <errno.h>
#include <stdbool.h>
-#include "gdbus-util.h"
-#include "shared/log.h"
+#include <pass/gdbus-util.h>
+#include <pass/log.h>
static GDBusConnection *g_dbus_sys_conn = NULL;
+++ /dev/null
-/*
- * PASS (Power Aware System Service)
- *
- * Copyright (c) 2017 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 __GDBUS_UTIL_H__
-#define __GDBUS_UTIL_H__
-
-#include <gio/gio.h>
-#include <stdbool.h>
-
-#include "pass/pass-dbus-stub.h"
-#include "pmqos/pmqos-dbus-stub.h"
-
-#define SYSTEMD_DBUS_NAME "org.freedesktop.systemd1"
-#define SYSTEMD_DBUS_OBJECT_PATH "/org/freedesktop/systemd1"
-#define SYSTEMD_DBUS_IFACE_FOR_PROPS "org.freedesktop.DBus.Properties"
-#define SYSTEMD_DBUS_METHOD_GET_PROP "Get"
-#define SYSTEMD_DBUS_METHOD_GET_PROP_ARG_TYPE "(ss)"
-#define SYSTEMD_DBUS_METHOD_GET_PROP_RET_TYPE "(v)"
-#define SYSTEMD_DBUS_IFACE_MANAGER SYSTEMD_DBUS_NAME ".Manager"
-
-struct pass_gdbus_signal_info {
- const gchar *handler;
- GCallback cb;
- gpointer cb_data;
- gulong ret_id;
-};
-
-int pass_gdbus_register_systemd_startup_callback(GDBusSignalCallback cb,
- gpointer user_data, guint *id);
-int pass_gdbus_unregister_systemd_startup_callback(guint id);
-int pass_gdbus_get_systemd_dbus_property_string(const char *iface,
- const char *prop, const char **value);
-int pass_gdbus_export_interface(gpointer instance, const char *obj_path);
-int pass_gdbus_get_name(const char *name);
-int pass_gdbus_connect_signal(gpointer instance, int num_signals,
- struct pass_gdbus_signal_info *signal_infos);
-void pass_gdbus_disconnect_signal(gpointer instance, int num_signals,
- struct pass_gdbus_signal_info *signal_infos);
-SystemPassCore *pass_gdbus_get_instance_core(void);
-void pass_gdbus_put_instance_core(SystemPassCore **instance);
-SystemPassPmqos *pass_gdbus_get_instance_pmqos(void);
-void pass_gdbus_put_instance_pmqos(SystemPassPmqos **instance);
-int pass_gdbus_get_system_connection(void);
-void pass_gdbus_put_system_connection(void);
-#endif /* __GDBUS_UTIL_H__ */
#include <gio/gio.h>
#include <sys/reboot.h>
-#include "shared/log.h"
-
-#include "common.h"
-#include "device-notifier.h"
-#include "devices.h"
-#include "gdbus-util.h"
+#include <pass/common.h>
+#include <pass/device-notifier.h>
+#include <pass/devices.h>
+#include <pass/gdbus-util.h>
+#include <pass/log.h>
#define PASS_DBUS_BUS_NAME "org.tizen.system.pass"
PROJECT(pass-hal-devel C)
SET(HAL_HEADERS
- hal.h
+ ../../include/pass/hal/hal.h
hal-log.h
)
#include <errno.h>
#include <linux/limits.h>
-#include "hal.h"
+#include <pass/hal/hal.h>
+
#include "hal-log.h"
#ifndef EXPORT
+++ /dev/null
-/*
- * Copyright (c) 2017 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 _PASS_HAL_H_
-#define _PASS_HAL_H_
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#define BUFF_MAX 255
-
-#define MAKE_4B_CODE_4(A, B, C, D) \
- ((((A) & 0xff) << 24) | (((B) & 0xff) << 16) | \
- (((C) & 0xff) << 8) | (((D) & 0xff)))
-#define MAKE_TAG_CONSTANT(A, B, C, D) MAKE_4B_CODE_4(A, B, C, D)
-
-#define HAL_INFO_TAG MAKE_TAG_CONSTANT('P', 'A', 'S', 'S')
-
-/* Symbolic name of the HAL info (PASS HAL Info) */
-#define HAL_INFO_SYM PassHalInfo
-
-#define PASS_RESOURCE_UNKNOWN 0
-#define PASS_RESOURCE_CPU_ID 1
-#define PASS_RESOURCE_BUS_ID 2
-#define PASS_RESOURCE_GPU_ID 3
-#define PASS_RESOURCE_MEMORY_ID 4
-#define PASS_RESOURCE_NONSTANDARD_ID 99
-
-#define PASS_RESOURCE_CPU_NAME "cpu"
-#define PASS_RESOURCE_BUS_NAME "bus"
-#define PASS_RESOURCE_GPU_NAME "gpu"
-#define PASS_RESOURCE_MEMORY_NAME "memory"
-#define PASS_RESOURCE_NONSTANDARD_NAME "nonstandard"
-
-/**
- * Define the common structure
- */
-
-struct pass_resource_common;
-
-/*
- * pass_resource_info - Define the information structure for the resource.
- *
- * @magic : magic must be initialized to HAL_INFO_TAG
- * @hal_version : HAL version
- * @device_version: device version
- * @id : device id, can have the following value.
- * - PASS_RESOURCE_CPU_ID
- * - PASS_RESOURCE_BUS_ID
- * - PASS_RESOURCE_GPU_ID
- * - PASS_RESOURCE_MEMORY_ID
- * - PASS_RESOURCE_NONSTANDARD_ID
- * @name : device name, can have the following value.
- * - PASS_RESOURCE_CPU_NAME
- * - PASS_RESOURCE_BUS_NAME
- * - PASS_RESOURCE_GPU_NAME
- * - PASS_RESOURCE_MEMORY_NAME
- * - PASS_RESOURCE_NONSTANDARD_NAME
- * @dso : module's dso
- * @resourced[] : reserved for future use
- * @open : function pointer to open device
- * @close : function pointer to close device
- */
-struct pass_resource_info {
- uint32_t magic;
- uint16_t hal_version;
- uint16_t device_version;
- const int id;
- const char *name;
- void *dso;
- uint32_t reserved[8];
-
- int (*open)(char *res_name, struct pass_resource_info *info,
- struct pass_resource_common **common);
- int (*close)(char *res_name, struct pass_resource_common *common);
-};
-
-struct pass_resource_common {
- /* indicate to this device information structure */
- struct pass_resource_info *info;
-};
-
-/*
- * Define the ops (operations) structure which are used on specific resource.
- */
-struct pass_resource_dvfs_ops {
- /* Get and set the current governor. */
- int (*get_curr_governor)(char *res_name, char *governor);
- int (*set_curr_governor)(char *res_name, char *governor);
-
- int (*get_avail_governor)(char *res_name, char **avail_governor);
-
- /* Get the current frequency. */
- int (*get_curr_freq)(char *res_name);
-
- /* Get and set the minimum frequency. */
- int (*get_min_freq)(char *res_name);
- int (*set_min_freq)(char *res_name, int freq);
-
- /* Get and set the maximum frequency. */
- int (*get_max_freq)(char *res_name);
- int (*set_max_freq)(char *res_name, int freq);
-
- /* Get the minimum/maximum frequency which can be set to resource. */
- int (*get_available_min_freq)(char *res_name);
- int (*get_available_max_freq)(char *res_name);
-
- /* Get and set the up_threshold to support boosting. */
- int (*get_up_threshold)(char *res_name);
- int (*set_up_threshold)(char *res_name, int up_threshold);
-
- /* Get the load_table of each resource to estimate the system load. */
- int (*get_load_table)(char *name, void *pass_cpu_load_table);
-};
-
-struct pass_resource_hotplug_ops {
- /* Get and set the online status of resource. */
- int (*get_online_state)(char *res_name, int cpu);
- int (*set_online_state)(char *res_name, int cpu, int on);
- /* Get and set the minimum number of online CPUs */
- int (*get_online_min_num) (char *res_name);
- int (*set_online_min_num) (char *res_name, int min_num);
- /* Get and set the maximum number of online CPUs */
- int (*get_online_max_num) (char *res_name);
- int (*set_online_max_num) (char *res_name, int max_num);
-};
-
-struct pass_resource_tmu_ops {
- /* Get the current temperature of resoruce. */
- int (*get_temp)(char *res_thremal_name);
-
- /* Get the policy of thermal management unit. */
- int (*get_policy)(char *res_thermal_name, char *policy);
-};
-
-/*
- * Define the resource structure for CPU H/W.
- *
- * @common : common resource structure.
- * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling).
- * @tmu : function lists for the TMU (Thermal Management Unit).
- * @hotplug : function lists for the CPU on/off.
- */
-struct pass_resource_cpu {
- struct pass_resource_common common;
-
- struct pass_resource_dvfs_ops dvfs;
- struct pass_resource_tmu_ops tmu;
- struct pass_resource_hotplug_ops hotplug;
-};
-
-/*
- * Define the resource structure for Memory Bus H/W.
- *
- * @common : common resource structure.
- * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling).
- * @tmu : function lists for the TMU (Thermal Management Unit).
- */
-struct pass_resource_bus {
- struct pass_resource_common common;
-
- struct pass_resource_dvfs_ops dvfs;
- struct pass_resource_tmu_ops tmu;
-};
-
-/*
- * Define the resource structure for GPU H/W.
- *
- * @common : common resource structure.
- * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling).
- * @tmu : function lists for the TMU (Thermal Management Unit).
- */
-struct pass_resource_gpu {
- struct pass_resource_common common;
-
- struct pass_resource_dvfs_ops dvfs;
- struct pass_resource_tmu_ops tmu;
-};
-
-/*
- * Define the resource structure for Memory H/W.
- *
- * @common : common resource structure.
- */
-struct pass_resource_memory {
- struct pass_resource_common common;
-
- /* Get and set the /sys/kernel/debug/fault_around_bytes */
- int (*get_fault_around_bytes)(char *res_name);
- int (*set_fault_around_bytes)(char *res_name, int fault_around_bytes);
-};
-
-/*
- * Define the resource structure for nonstandard H/W.
- *
- * Following function is Deprecated. (Not recommended for use)
- * @set_pmqos_data : function to bypass the scenario data to HAL.
- *
- * This structure indicates the nonstandard H/W which doesn't have
- * the official supported framework (e.g., cpufreq, devfreq and so on)
- * in Linux Kernel. But, the specific device might be controlled
- * according to PMQoS scenario or other cases.
- */
-struct pass_resource_nonstandard {
- struct pass_resource_common common;
-
- /*
- * NOTE: It is not propper method. But PASS must need to keep
- * the backwards compatibility, set the PMQoS's data from
- * platform to hal. So, It is not recommended to use it.
- *
- * This function will be removed after finding the proper method.
- */
- int (*set_pmqos_data)(char *res_name, void *data);
-};
-
-int pass_get_hal_info(const char *id, const struct pass_resource_info **info);
-
-/**
- * Structure define of HAL info module
- *
- * All HAL module should be use below define to make a specific
- * structure for Tizen HAL. pass_get_resource_info function
- * will load a pass_resource_data structure by using TizenHwInfo name
- * at runtime. TizenHwInfo means Tizen Hardware Info.
- */
-#define HAL_MODULE_STRUCTURE \
- __attribute__ ((visibility("default"))) \
- struct pass_resource_info HAL_INFO_SYM
-
-#endif /* _PASS_HAL_H_ */
#include <stdlib.h>
#include <sys/time.h>
+#include <pass/device-notifier.h>
+#include <pass/config-parser.h>
+
#include "pass.h"
#include "pass-gov.h"
#include "pass-pmqos.h"
#include "pass-hal.h"
#include "pass-rescon.h"
-#include "core/device-notifier.h"
-#include "core/config-parser.h"
-
#define PASS_CPU_STATS_MAX_COUNT 20
struct pass_governor {
#include <errno.h>
#include <fcntl.h>
+#include <pass/common.h>
+
#include "pass.h"
#include "pass-hal.h"
-#include "core/common.h"
-
static struct pass_resource_dvfs_ops *get_dvfs(struct pass_resource *res,
int res_type)
{
#ifndef __PASS_HAL__
#define __PASS_HAL__
-#include "hal/hal.h"
+#include <pass/hal/hal.h>
/***
* Functions for all H/W resources
#include <errno.h>
#include <fcntl.h>
-#include "pass.h"
+#include <pass/common.h>
+#include <pass/config-parser.h>
+#include <pass/hal/hal.h>
-#include "core/common.h"
-#include "core/config-parser.h"
-#include "hal/hal.h"
+#include "pass.h"
#define MAX_NUM 255
#define MIN_TIMEOUT_SEC 0.2
#include <stdlib.h>
#include <sys/time.h>
+#include <pass/device-notifier.h>
+#include <pass/config-parser.h>
+
#include "pass.h"
#include "pass-gov.h"
#include "pass-rescon.h"
-#include "core/device-notifier.h"
-#include "core/config-parser.h"
-
/****************************************************************************
* PASS Notifier *
* - DEVICE_NOTIFIER_PMQOS *
#include <stdio.h>
#include <stdlib.h>
+#include <pass/common.h>
+#include <pass/device-notifier.h>
+#include <pass/devices.h>
+#include <pass/gdbus-util.h>
+
#include "pass.h"
#include "pass-parser.h"
#include "pass-hal.h"
#include "pass-gov.h"
-#include "core/device-notifier.h"
-#include "core/devices.h"
-#include "core/common.h"
-#include "core/gdbus-util.h"
-
#define DBUS_CORE_I_START_HANDLER "handle_start"
#define DBUS_CORE_I_STOP_HANDLER "handle_stop"
#define DBUS_CORE_I_NUM_SIGNALS 2
#include <stdio.h>
#include <glib.h>
-#include "shared/log.h"
+#include <pass/log.h>
#define BUFF_MAX 255
#include <errno.h>
#include <string.h>
-#include "core/config-parser.h"
-#include "shared/log.h"
+#include <pass/log.h>
+#include <pass/config-parser.h>
#include "pmqos.h"
#include <stdio.h>
#include <limits.h>
-#include "core/gdbus-util.h"
-#include "core/devices.h"
-#include "core/common.h"
-#include "core/device-notifier.h"
-#include "shared/log.h"
+#include <pass/common.h>
+#include <pass/devices.h>
+#include <pass/device-notifier.h>
+#include <pass/gdbus-util.h>
+#include <pass/log.h>
#include "pmqos.h"
+++ /dev/null
-/*
- * PASS (Power Aware System Service)
- *
- * Copyright (c) 2017 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 __LOG_H__
-#define __LOG_H__
-
-#include <dlog.h>
-#ifdef LOG_TAG
-#undef LOG_TAG
-#define LOG_TAG "PASS"
-#endif /* LOG_TAG */
-
-#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while (0)
-#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while (0)
-#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while (0)
-#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while (0)
-#endif