Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 425e238e authored by Pirama Arumuga Nainar's avatar Pirama Arumuga Nainar
Browse files

Make inlines static

Bug: http://b/116873221

If not, building with coverage (and -O0) is broken since Clang does not
inline these functions, and does not emit a definition because they are
not static or extern.

Test: Build with coverage (-O0)

Change-Id: I2880119834f764164a1aac10b696e76a2b462b71
parent 5bccd33e
Loading
Loading
Loading
Loading
+17 −20
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ enum lmk_cmd {
typedef int LMKD_CTRL_PACKET[CTRL_PACKET_MAX_SIZE / sizeof(int)];

/* Get LMKD packet command */
inline enum lmk_cmd lmkd_pack_get_cmd(LMKD_CTRL_PACKET pack) {
static inline enum lmk_cmd lmkd_pack_get_cmd(LMKD_CTRL_PACKET pack) {
    return (enum lmk_cmd)ntohl(pack[0]);
}

@@ -64,8 +64,8 @@ struct lmk_target {
 * For LMK_TARGET packet get target_idx-th payload.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline void lmkd_pack_get_target(LMKD_CTRL_PACKET packet,
                                 int target_idx, struct lmk_target *target) {
static inline void lmkd_pack_get_target(LMKD_CTRL_PACKET packet, int target_idx,
                                        struct lmk_target* target) {
    target->minfree = ntohl(packet[target_idx * 2 + 1]);
    target->oom_adj_score = ntohl(packet[target_idx * 2 + 2]);
}
@@ -74,8 +74,7 @@ inline void lmkd_pack_get_target(LMKD_CTRL_PACKET packet,
 * Prepare LMK_TARGET packet and return packet size in bytes.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline size_t lmkd_pack_set_target(LMKD_CTRL_PACKET packet,
                                   struct lmk_target *targets,
static inline size_t lmkd_pack_set_target(LMKD_CTRL_PACKET packet, struct lmk_target* targets,
                                          size_t target_cnt) {
    int idx = 0;
    packet[idx++] = htonl(LMK_TARGET);
@@ -99,8 +98,7 @@ struct lmk_procprio {
 * For LMK_PROCPRIO packet get its payload.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline void lmkd_pack_get_procprio(LMKD_CTRL_PACKET packet,
                                   struct lmk_procprio *params) {
static inline void lmkd_pack_get_procprio(LMKD_CTRL_PACKET packet, struct lmk_procprio* params) {
    params->pid = (pid_t)ntohl(packet[1]);
    params->uid = (uid_t)ntohl(packet[2]);
    params->oomadj = ntohl(packet[3]);
@@ -110,8 +108,7 @@ inline void lmkd_pack_get_procprio(LMKD_CTRL_PACKET packet,
 * Prepare LMK_PROCPRIO packet and return packet size in bytes.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline size_t lmkd_pack_set_procprio(LMKD_CTRL_PACKET packet,
                                   struct lmk_procprio *params) {
static inline size_t lmkd_pack_set_procprio(LMKD_CTRL_PACKET packet, struct lmk_procprio* params) {
    packet[0] = htonl(LMK_PROCPRIO);
    packet[1] = htonl(params->pid);
    packet[2] = htonl(params->uid);
@@ -128,7 +125,7 @@ struct lmk_procremove {
 * For LMK_PROCREMOVE packet get its payload.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline void lmkd_pack_get_procremove(LMKD_CTRL_PACKET packet,
static inline void lmkd_pack_get_procremove(LMKD_CTRL_PACKET packet,
                                            struct lmk_procremove* params) {
    params->pid = (pid_t)ntohl(packet[1]);
}
@@ -137,7 +134,7 @@ inline void lmkd_pack_get_procremove(LMKD_CTRL_PACKET packet,
 * Prepare LMK_PROCREMOVE packet and return packet size in bytes.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline size_t lmkd_pack_set_procremove(LMKD_CTRL_PACKET packet,
static inline size_t lmkd_pack_set_procremove(LMKD_CTRL_PACKET packet,
                                              struct lmk_procprio* params) {
    packet[0] = htonl(LMK_PROCREMOVE);
    packet[1] = htonl(params->pid);
@@ -148,7 +145,7 @@ inline size_t lmkd_pack_set_procremove(LMKD_CTRL_PACKET packet,
 * Prepare LMK_PROCPURGE packet and return packet size in bytes.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline size_t lmkd_pack_set_procpurge(LMKD_CTRL_PACKET packet) {
static inline size_t lmkd_pack_set_procpurge(LMKD_CTRL_PACKET packet) {
    packet[0] = htonl(LMK_PROCPURGE);
    return sizeof(int);
}
@@ -163,7 +160,7 @@ struct lmk_getkillcnt {
 * For LMK_GETKILLCNT packet get its payload.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline void lmkd_pack_get_getkillcnt(LMKD_CTRL_PACKET packet,
static inline void lmkd_pack_get_getkillcnt(LMKD_CTRL_PACKET packet,
                                            struct lmk_getkillcnt* params) {
    params->min_oomadj = ntohl(packet[1]);
    params->max_oomadj = ntohl(packet[2]);
@@ -173,7 +170,7 @@ inline void lmkd_pack_get_getkillcnt(LMKD_CTRL_PACKET packet,
 * Prepare LMK_GETKILLCNT packet and return packet size in bytes.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline size_t lmkd_pack_set_getkillcnt(LMKD_CTRL_PACKET packet,
static inline size_t lmkd_pack_set_getkillcnt(LMKD_CTRL_PACKET packet,
                                              struct lmk_getkillcnt* params) {
    packet[0] = htonl(LMK_GETKILLCNT);
    packet[1] = htonl(params->min_oomadj);
@@ -185,7 +182,7 @@ inline size_t lmkd_pack_set_getkillcnt(LMKD_CTRL_PACKET packet,
 * Prepare LMK_GETKILLCNT reply packet and return packet size in bytes.
 * Warning: no checks performed, caller should ensure valid parameters.
 */
inline size_t lmkd_pack_set_getkillcnt_repl(LMKD_CTRL_PACKET packet, int kill_cnt) {
static inline size_t lmkd_pack_set_getkillcnt_repl(LMKD_CTRL_PACKET packet, int kill_cnt) {
    packet[0] = htonl(LMK_GETKILLCNT);
    packet[1] = htonl(kill_cnt);
    return 2 * sizeof(int);