pass: Make include directory containing the exported header files 35/168335/1
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 26 Jan 2018 00:57:48 +0000 (09:57 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 26 Jan 2018 01:15:37 +0000 (10:15 +0900)
Existing *.[ch] files uses the following type in order to include
the header file which is located in the outside directory. But it is
not proper method for including the header file.
- #include "core/*.h:

Make 'include' directory containing the all exported header files
and move the exported header files under 'include/' as following:
- src/core/*.h   -> include/pass/log.h
- src/shared/*.h -> include/pass/*.h
- src/hal/hal.h  -> include/pass/hal/hal.h

Change-Id: I68f6ad4c711b50a1d48bee3785d5657a8b58c963
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
32 files changed:
CMakeLists.txt
include/pass/common.h [new file with mode: 0644]
include/pass/config-parser.h [new file with mode: 0644]
include/pass/device-notifier.h [new file with mode: 0644]
include/pass/devices.h [new file with mode: 0644]
include/pass/gdbus-util.h [new file with mode: 0644]
include/pass/hal/hal.h [new file with mode: 0644]
include/pass/log.h [new file with mode: 0644]
src/core/common.c
src/core/common.h [deleted file]
src/core/config-parser.c
src/core/config-parser.h [deleted file]
src/core/device-notifier.c
src/core/device-notifier.h [deleted file]
src/core/devices.c
src/core/devices.h [deleted file]
src/core/gdbus-util.c
src/core/gdbus-util.h [deleted file]
src/core/main.c
src/hal/CMakeLists.txt
src/hal/hal.c
src/hal/hal.h [deleted file]
src/pass/pass-gov.c
src/pass/pass-hal.c
src/pass/pass-hal.h
src/pass/pass-parser.c
src/pass/pass-pmqos.c
src/pass/pass.c
src/pass/pass.h
src/pmqos/pmqos-parser.c
src/pmqos/pmqos.c
src/shared/log.h [deleted file]

index 048523b9960be726f5ae8f334ed6f59516644f79..1b6053fc21d102c386f7df194a2fec64fc0b0c17 100644 (file)
@@ -87,8 +87,7 @@ SET(SRCS
 
 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
diff --git a/include/pass/common.h b/include/pass/common.h
new file mode 100644 (file)
index 0000000..46c7490
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * 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__ */
diff --git a/include/pass/config-parser.h b/include/pass/config-parser.h
new file mode 100644 (file)
index 0000000..32a0d9b
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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
diff --git a/include/pass/device-notifier.h b/include/pass/device-notifier.h
new file mode 100644 (file)
index 0000000..77c571f
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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__ */
diff --git a/include/pass/devices.h b/include/pass/devices.h
new file mode 100644 (file)
index 0000000..38bad23
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * 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
diff --git a/include/pass/gdbus-util.h b/include/pass/gdbus-util.h
new file mode 100644 (file)
index 0000000..306e859
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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__ */
diff --git a/include/pass/hal/hal.h b/include/pass/hal/hal.h
new file mode 100644 (file)
index 0000000..b9e2699
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * 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_ */
diff --git a/include/pass/log.h b/include/pass/log.h
new file mode 100644 (file)
index 0000000..d170161
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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
index b75a016fe31619b1f1870d0e1f07e66e559f6416..a0ee779a3b65675698e7b089c00bd97857457af4 100644 (file)
@@ -34,9 +34,8 @@
 #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
 
diff --git a/src/core/common.h b/src/core/common.h
deleted file mode 100644 (file)
index 46c7490..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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__ */
index d0e26326dfd5a3eac8bfcf26dbdd0b9054924362..b13a5b29268cc11d40ca434e5ecf6ab795dc45a1 100644 (file)
@@ -20,9 +20,8 @@
 #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
diff --git a/src/core/config-parser.h b/src/core/config-parser.h
deleted file mode 100644 (file)
index 32a0d9b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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
index 4a03ead31cf39cc317bdc1eb42d7360d7760411d..2c6e99baf8666d9dddccd4b30057ba10fe4ec978 100644 (file)
 
 #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
 
diff --git a/src/core/device-notifier.h b/src/core/device-notifier.h
deleted file mode 100644 (file)
index 77c571f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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__ */
index 46ca4681f79ef1aa65a3f5bdfcf420e6504fdabe..42e193cdcb5e9ffcb70680e610cab2b84fe0d719 100644 (file)
 #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",
diff --git a/src/core/devices.h b/src/core/devices.h
deleted file mode 100644 (file)
index 38bad23..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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
index 0702dc24123d5aeab4443fb1af913046d1898de2..42d21b83749b590c601bf6913aa33f4ab293d5a4 100644 (file)
@@ -19,8 +19,8 @@
 #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;
 
diff --git a/src/core/gdbus-util.h b/src/core/gdbus-util.h
deleted file mode 100644 (file)
index 306e859..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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__ */
index 9b56d8c47dd84cabdfc7c662d8f8d1037b79ddd4..a3c2542747ebd5c0f446192022136a1d1ee40114 100644 (file)
 #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"
 
index ade815905fe465bf1093e09e6ec1fc3f278d5820..c0f1fbcad6a4ed217e71369fb22e44a4f4bdc0a8 100755 (executable)
@@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(pass-hal-devel C)
 
 SET(HAL_HEADERS
-       hal.h
+       ../../include/pass/hal/hal.h
        hal-log.h
 )
 
index 2f65a71e060987af315ca8e391a3d259251503b0..beadab57dc0fcd6cf9a1a6a91dbeb893673bdda2 100644 (file)
@@ -24,7 +24,8 @@
 #include <errno.h>
 #include <linux/limits.h>
 
-#include "hal.h"
+#include <pass/hal/hal.h>
+
 #include "hal-log.h"
 
 #ifndef EXPORT
diff --git a/src/hal/hal.h b/src/hal/hal.h
deleted file mode 100644 (file)
index b9e2699..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 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_ */
index 19febfdbfac3762845225d542c1ec447f2ec7151..66012206492e03681cbc787657d71869b7ae9a89 100644 (file)
 #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 {
index 48d1e33388622dbb3760041eab76c5873fbaeb16..0d91fcc0cb1ea939d26a36bfa5a8126b1bd1702d 100644 (file)
 #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)
 {
index 172b0a42658a0a28c23cc2bb201ec36c6b7e88e6..8d1fd6fdb8920030670453ce75dcc2b316562e4d 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef __PASS_HAL__
 #define __PASS_HAL__
 
-#include "hal/hal.h"
+#include <pass/hal/hal.h>
 
 /***
  * Functions for all H/W resources
index 12e6ce74c86be8b1647a039230361500f311e179..57a08cc5b9fa81d3ce0cf2e88143146481148048 100644 (file)
 #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
index 22668b276b1f28a036725c0abc1918db830eb5e9..64606f0fe2f02822862203e580f10d0df47b8cf1 100644 (file)
 #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                                                  *
index 9cf90d201f1a9be4a77242faf9c6b818349ae667..c85d440d8ca12f0ddda6515a11c34aa8db49f15c 100644 (file)
 #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
index c5959fd7b54accbfc6649a197c4cfa5c2d89740f..adaffcde52b6eaec33c905b34e495880175f469e 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <glib.h>
 
-#include "shared/log.h"
+#include <pass/log.h>
 
 #define BUFF_MAX               255
 
index 6d6b83c98abbd26a82a7b5834e1ab6ff3323e251..8352f08083062923c49b304eb2dd1342499fda03 100644 (file)
@@ -24,8 +24,8 @@
 #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"
 
index 78854ddea79fcf3c47f4d0e467f91d9c4b64387d..88d19abd97adf03bccb2520f3f2cc65d6c314ced 100644 (file)
 #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"
 
diff --git a/src/shared/log.h b/src/shared/log.h
deleted file mode 100644 (file)
index d170161..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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