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
This commit is contained in:
Pirama Arumuga Nainar 2019-02-06 15:16:35 -08:00
parent 584f3fd35f
commit f85d4216fd
1 changed files with 17 additions and 20 deletions

View File

@ -50,7 +50,7 @@ enum lmk_cmd {
typedef int LMKD_CTRL_PACKET[CTRL_PACKET_MAX_SIZE / sizeof(int)]; typedef int LMKD_CTRL_PACKET[CTRL_PACKET_MAX_SIZE / sizeof(int)];
/* Get LMKD packet command */ /* 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]); return (enum lmk_cmd)ntohl(pack[0]);
} }
@ -64,8 +64,8 @@ struct lmk_target {
* For LMK_TARGET packet get target_idx-th payload. * For LMK_TARGET packet get target_idx-th payload.
* Warning: no checks performed, caller should ensure valid parameters. * Warning: no checks performed, caller should ensure valid parameters.
*/ */
inline void lmkd_pack_get_target(LMKD_CTRL_PACKET packet, static inline void lmkd_pack_get_target(LMKD_CTRL_PACKET packet, int target_idx,
int target_idx, struct lmk_target *target) { struct lmk_target* target) {
target->minfree = ntohl(packet[target_idx * 2 + 1]); target->minfree = ntohl(packet[target_idx * 2 + 1]);
target->oom_adj_score = ntohl(packet[target_idx * 2 + 2]); 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. * Prepare LMK_TARGET packet and return packet size in bytes.
* Warning: no checks performed, caller should ensure valid parameters. * Warning: no checks performed, caller should ensure valid parameters.
*/ */
inline size_t lmkd_pack_set_target(LMKD_CTRL_PACKET packet, static inline size_t lmkd_pack_set_target(LMKD_CTRL_PACKET packet, struct lmk_target* targets,
struct lmk_target *targets,
size_t target_cnt) { size_t target_cnt) {
int idx = 0; int idx = 0;
packet[idx++] = htonl(LMK_TARGET); packet[idx++] = htonl(LMK_TARGET);
@ -99,8 +98,7 @@ struct lmk_procprio {
* For LMK_PROCPRIO packet get its payload. * For LMK_PROCPRIO packet get its payload.
* Warning: no checks performed, caller should ensure valid parameters. * Warning: no checks performed, caller should ensure valid parameters.
*/ */
inline void lmkd_pack_get_procprio(LMKD_CTRL_PACKET packet, static inline void lmkd_pack_get_procprio(LMKD_CTRL_PACKET packet, struct lmk_procprio* params) {
struct lmk_procprio *params) {
params->pid = (pid_t)ntohl(packet[1]); params->pid = (pid_t)ntohl(packet[1]);
params->uid = (uid_t)ntohl(packet[2]); params->uid = (uid_t)ntohl(packet[2]);
params->oomadj = ntohl(packet[3]); 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. * Prepare LMK_PROCPRIO packet and return packet size in bytes.
* Warning: no checks performed, caller should ensure valid parameters. * Warning: no checks performed, caller should ensure valid parameters.
*/ */
inline size_t lmkd_pack_set_procprio(LMKD_CTRL_PACKET packet, static inline size_t lmkd_pack_set_procprio(LMKD_CTRL_PACKET packet, struct lmk_procprio* params) {
struct lmk_procprio *params) {
packet[0] = htonl(LMK_PROCPRIO); packet[0] = htonl(LMK_PROCPRIO);
packet[1] = htonl(params->pid); packet[1] = htonl(params->pid);
packet[2] = htonl(params->uid); packet[2] = htonl(params->uid);
@ -128,7 +125,7 @@ struct lmk_procremove {
* For LMK_PROCREMOVE packet get its payload. * For LMK_PROCREMOVE packet get its payload.
* Warning: no checks performed, caller should ensure valid parameters. * 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) { struct lmk_procremove* params) {
params->pid = (pid_t)ntohl(packet[1]); 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. * Prepare LMK_PROCREMOVE packet and return packet size in bytes.
* Warning: no checks performed, caller should ensure valid parameters. * 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) { struct lmk_procprio* params) {
packet[0] = htonl(LMK_PROCREMOVE); packet[0] = htonl(LMK_PROCREMOVE);
packet[1] = htonl(params->pid); 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. * Prepare LMK_PROCPURGE packet and return packet size in bytes.
* Warning: no checks performed, caller should ensure valid parameters. * 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); packet[0] = htonl(LMK_PROCPURGE);
return sizeof(int); return sizeof(int);
} }
@ -163,7 +160,7 @@ struct lmk_getkillcnt {
* For LMK_GETKILLCNT packet get its payload. * For LMK_GETKILLCNT packet get its payload.
* Warning: no checks performed, caller should ensure valid parameters. * 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) { struct lmk_getkillcnt* params) {
params->min_oomadj = ntohl(packet[1]); params->min_oomadj = ntohl(packet[1]);
params->max_oomadj = ntohl(packet[2]); 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. * Prepare LMK_GETKILLCNT packet and return packet size in bytes.
* Warning: no checks performed, caller should ensure valid parameters. * 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) { struct lmk_getkillcnt* params) {
packet[0] = htonl(LMK_GETKILLCNT); packet[0] = htonl(LMK_GETKILLCNT);
packet[1] = htonl(params->min_oomadj); 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. * Prepare LMK_GETKILLCNT reply packet and return packet size in bytes.
* Warning: no checks performed, caller should ensure valid parameters. * 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[0] = htonl(LMK_GETKILLCNT);
packet[1] = htonl(kill_cnt); packet[1] = htonl(kill_cnt);
return 2 * sizeof(int); return 2 * sizeof(int);