plugin-api: resourced: Move common struct and enum from *.h to *-interface.h 83/298283/2
authorUnsung Lee <unsung.lee@samsung.com>
Tue, 5 Sep 2023 01:41:26 +0000 (10:41 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 6 Sep 2023 23:59:14 +0000 (23:59 +0000)
Move common struct and enum, referened by both resourced and resourced backend,
from syscommon-plugin-resourced-memory-lmk.h
to syscommon-plugin-resourced-memory-lmk-interface.h for consistency.

*.h can be referenced only by resourced. On the other hand, *-interface.h can
be referenced by both side. Therefore, common struct and enum should be
defined in *-interface.h.

Change-Id: I0529e21da6688eeebb9a0583521dc69c2e400f2c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h
src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h
src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c

index a07f0c4..2d3d746 100644 (file)
 extern "C" {
 #endif
 
+enum syscommon_resourced_memory_lmk_oom_level {
+       OOM_LEVEL_BACKGROUND_LEAST_RECENTLY_USED,
+       OOM_LEVEL_BACKGROUND_MOST_RECENTLY_USED,
+       OOM_LEVEL_FOREGROUND,
+       OOM_LEVEL_FOREGROUND_AND_PROC,
+       OOM_LEVEL_ALL,
+};
+
+struct task_info {
+       /*
+        * Mostly, there are not multiple processes with the same pgid.
+        * So, for the frequent case, we use pid variable to avoid
+        * allocating arrays.
+        */
+       pid_t pid;
+       GArray *pids;
+       pid_t pgid;
+       /* oom_score_adj is smae as /proc/<pid>/oom_score_adj */
+       int oom_score_adj;
+       /*
+        * oom_score_lru is same as oom_score_adj or adjusted by
+        * proc_app_info lru_state for apps that are marked as favourite.
+        *
+        * oom_score_lru is the main value used in comparison for LMK.
+        */
+       int oom_score_lru;
+       int size;
+       /**
+        * proc_app_info_oom_killed and proc_app_info_flags
+        * are not used if task is not an app.
+        * Especially, proc_app_info_oom_killed is NULL when this task
+        * is not an app.
+        */
+       bool *proc_app_info_oom_killed;
+       int proc_app_info_flags;
+
+       /**
+        * TODO: A process can have more than one window,
+        * and an app can have more than one process. Therefore,
+        * a task_info can have more than one window.
+        */
+       int window_pid;
+       int x;
+       int y;
+       int z;
+       int w;
+       int h;
+       int layer;
+       int opaque;
+       int visibility;
+       bool is_transformed;
+       bool alpha;
+       bool is_focused;
+       bool is_mapped;
+};
+
 typedef struct _syscommon_plugin_backend_resourced_memory_lmk_funcs {
        int (*get_kill_candidates)(GArray *candidates,
                                GArray *task_info_app_array,
index d3d5b67..b2ac1b0 100644 (file)
 #include <glib.h>
 #include <stdbool.h>
 
+#include "syscommon-plugin-resourced-memory-lmk-interface.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-enum syscommon_resourced_memory_lmk_oom_level {
-       OOM_LEVEL_BACKGROUND_LEAST_RECENTLY_USED,
-       OOM_LEVEL_BACKGROUND_MOST_RECENTLY_USED,
-       OOM_LEVEL_FOREGROUND,
-       OOM_LEVEL_FOREGROUND_AND_PROC,
-       OOM_LEVEL_ALL,
-};
-
-struct task_info {
-       /*
-        * Mostly, there are not multiple processes with the same pgid.
-        * So, for the frequent case, we use pid variable to avoid
-        * allocating arrays.
-        */
-       pid_t pid;
-       GArray *pids;
-       pid_t pgid;
-       /* oom_score_adj is smae as /proc/<pid>/oom_score_adj */
-       int oom_score_adj;
-       /*
-        * oom_score_lru is same as oom_score_adj or adjusted by
-        * proc_app_info lru_state for apps that are marked as favourite.
-        *
-        * oom_score_lru is the main value used in comparison for LMK.
-        */
-       int oom_score_lru;
-       int size;
-       /**
-        * proc_app_info_oom_killed and proc_app_info_flags
-        * are not used if task is not an app.
-        * Especially, proc_app_info_oom_killed is NULL when this task
-        * is not an app.
-        */
-       bool *proc_app_info_oom_killed;
-       int proc_app_info_flags;
-
-       /**
-        * TODO: A process can have more than one window,
-        * and an app can have more than one process. Therefore,
-        * a task_info can have more than one window.
-        */
-       int window_pid;
-       int x;
-       int y;
-       int z;
-       int w;
-       int h;
-       int layer;
-       int opaque;
-       int visibility;
-       bool is_transformed;
-       bool alpha;
-       bool is_focused;
-       bool is_mapped;
-};
-
 /**
  * @brief Get the backend data of resourced-memory-lmk module
  * @return @c 0 on success, otherwise a negative error value
index 0d97201..6ccb8b2 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <system/syscommon-plugin-common.h>
 #include <system/syscommon-plugin-resourced-memory-lmk.h>
-#include <system/syscommon-plugin-resourced-memory-lmk-interface.h>
 
 #ifndef EXPORT
 #define EXPORT __attribute__((visibility("default")))