Skip to content

Commit 66cba44

Browse files
author
Vinayak Katoch
committed
Remove Android-specific code and update listener header in
fastrpc_apps_user.c Signed-off-by: Vinayak Katoch <[email protected]>
1 parent 3c7dcab commit 66cba44

File tree

1 file changed

+14
-114
lines changed

1 file changed

+14
-114
lines changed

src/fastrpc_apps_user.c

Lines changed: 14 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
#include "fastrpc_perf.h"
6565
#include "fastrpc_pm.h"
6666
#include "fastrpc_procbuf.h"
67-
#include "listener_android.h"
67+
#include "listener.h"
6868
#include "log_config.h"
6969
#include "platform_libs.h"
7070
#include "remotectl.h"
@@ -86,19 +86,8 @@
8686
#define DSP_MOUNT_LOCATION "/usr/lib/dsp/"
8787
#define DSP_DOM_LOCATION "/usr/lib/dsp/xdspn"
8888
#endif
89-
#define VENDOR_DSP_LOCATION "/vendor/dsp/"
90-
#define VENDOR_DOM_LOCATION "/vendor/dsp/xdsp/"
91-
92-
#ifdef LE_ENABLE
93-
#define PROPERTY_VALUE_MAX \
94-
92 // as this macro is defined in cutils for Android platforms, defined
95-
// explicitly for LE platform
96-
#elif (defined _ANDROID) || (defined ANDROID)
97-
/// TODO: Bharath #include "cutils/properties.h"
98-
#define PROPERTY_VALUE_MAX 92
99-
#else
89+
10090
#define PROPERTY_VALUE_MAX 92
101-
#endif
10291

10392
#ifndef _WIN32
10493
#include <poll.h>
@@ -241,26 +230,6 @@ const char *ENV_DEBUG_VAR_NAME[] = {"FASTRPC_PROCESS_ATTRS",
241230
"FASTRPC_DEBUG_PDDUMP",
242231
"FASTRPC_PROCESS_ATTRS_PERSISTENT",
243232
"ro.debuggable"};
244-
const char *ANDROIDP_DEBUG_VAR_NAME[] = {"vendor.fastrpc.process.attrs",
245-
"vendor.fastrpc.debug.trace",
246-
"vendor.fastrpc.debug.testsig",
247-
"vendor.fastrpc.perf.kernel",
248-
"vendor.fastrpc.perf.adsp",
249-
"vendor.fastrpc.perf.freq",
250-
"vendor.fastrpc.debug.systrace",
251-
"vendor.fastrpc.debug.pddump",
252-
"persist.vendor.fastrpc.process.attrs",
253-
"ro.build.type"};
254-
const char *ANDROID_DEBUG_VAR_NAME[] = {"fastrpc.process.attrs",
255-
"fastrpc.debug.trace",
256-
"fastrpc.debug.testsig",
257-
"fastrpc.perf.kernel",
258-
"fastrpc.perf.adsp",
259-
"fastrpc.perf.freq",
260-
"fastrpc.debug.systrace",
261-
"fastrpc.debug.pddump",
262-
"persist.fastrpc.process.attrs",
263-
"ro.build.type"};
264233

265234
const char *SUBSYSTEM_NAME[] = {"adsp", "mdsp", "sdsp", "cdsp", "cdsp1", "reserved", "reserved", "reserved"};
266235

@@ -274,10 +243,6 @@ static const size_t invoke_end_trace_strlen = sizeof(INVOKE_END_TRACE_STR) - 1;
274243

275244
int NO_ENV_DEBUG_VAR_NAME_ARRAY_ELEMENTS =
276245
sizeof(ENV_DEBUG_VAR_NAME) / sizeof(char *);
277-
int NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS =
278-
sizeof(ANDROIDP_DEBUG_VAR_NAME) / sizeof(char *);
279-
int NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS =
280-
sizeof(ANDROID_DEBUG_VAR_NAME) / sizeof(char *);
281246

282247
/* Shell prefix for signed and unsigned */
283248
const char *const SIGNED_SHELL = "fastrpc_shell_";
@@ -505,29 +470,8 @@ int fastrpc_get_property_int(fastrpc_properties UserPropKey, int defValue) {
505470
const char *env = getenv(ENV_DEBUG_VAR_NAME[UserPropKey]);
506471
if (env != 0)
507472
return (int)atoi(env);
508-
#if !defined(LE_ENABLE) // Android platform
509-
#if !defined(SYSTEM_RPC_LIBRARY) // vendor library
510-
if (((int)UserPropKey > NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) {
511-
FARF(
512-
ERROR,
513-
"%s: Index %d out-of-bound for ANDROIDP_DEBUG_VAR_NAME array of len %d",
514-
__func__, UserPropKey, NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS);
515-
return defValue;
516-
}
517-
return (int)property_get_int32(ANDROIDP_DEBUG_VAR_NAME[UserPropKey],
518-
defValue);
519-
#else // system library
520-
if (((int)UserPropKey > NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) {
521-
FARF(ERROR,
522-
"%s: Index %d out-of-bound for ANDROID_DEBUG_VAR_NAME array of len %d",
523-
__func__, UserPropKey, NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS);
524-
return defValue;
525-
}
526-
return (int)property_get_int32(ANDROID_DEBUG_VAR_NAME[UserPropKey], defValue);
527-
#endif
528-
#else // non-Android platforms
473+
529474
return defValue;
530-
#endif
531475
}
532476
int fastrpc_get_property_string(fastrpc_properties UserPropKey, char *value,
533477
char *defValue) {
@@ -544,33 +488,11 @@ int fastrpc_get_property_string(fastrpc_properties UserPropKey, char *value,
544488
std_memscpy(value, PROPERTY_VALUE_MAX, env, len + 1);
545489
return len;
546490
}
547-
#if !defined(LE_ENABLE) // Android platform
548-
#if !defined(SYSTEM_RPC_LIBRARY) // vendor library
549-
if (((int)UserPropKey > NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) {
550-
FARF(
551-
ERROR,
552-
"%s: Index %d out-of-bound for ANDROIDP_DEBUG_VAR_NAME array of len %d",
553-
__func__, UserPropKey, NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS);
554-
return len;
555-
}
556-
return property_get(ANDROIDP_DEBUG_VAR_NAME[UserPropKey], (int *)value,
557-
(int *)defValue);
558-
#else // system library
559-
if (((int)UserPropKey > NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) {
560-
FARF(ERROR,
561-
"%s: Index %d out-of-bound for ANDROID_DEBUG_VAR_NAME array of len %d",
562-
__func__, UserPropKey, NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS);
563-
return len;
564-
}
565-
return property_get(ANDROID_DEBUG_VAR_NAME[UserPropKey], value, defValue);
566-
#endif
567-
#else // non-Android platforms
568491
if (defValue != NULL) {
569492
len = strlen(defValue);
570493
std_memscpy(value, PROPERTY_VALUE_MAX, defValue, len + 1);
571494
}
572495
return len;
573-
#endif
574496
}
575497

576498
/*
@@ -1611,7 +1533,7 @@ int remote_handle64_invoke_async(remote_handle64 local,
16111533
return nErr;
16121534
}
16131535

1614-
int listener_android_geteventfd(int domain, int *fd);
1536+
int listener_geteventfd(int domain, int *fd);
16151537
int remote_handle_open_domain(int domain, const char *name, remote_handle *ph,
16161538
uint64_t *t_spawn, uint64_t *t_load) {
16171539
char dlerrstr[255];
@@ -1634,7 +1556,7 @@ int remote_handle_open_domain(int domain, const char *name, remote_handle *ph,
16341556
if (!std_strncmp(name, ITRANSPORT_PREFIX "geteventfd",
16351557
std_strlen(ITRANSPORT_PREFIX "geteventfd"))) {
16361558
FARF(RUNTIME_RPC_HIGH, "getting event fd");
1637-
return listener_android_geteventfd(domain, (int *)ph);
1559+
return listener_geteventfd(domain, (int *)ph);
16381560
}
16391561
if (!std_strncmp(name, ITRANSPORT_PREFIX "attachguestos",
16401562
std_strlen(ITRANSPORT_PREFIX "attachguestos"))) {
@@ -3143,7 +3065,7 @@ PL_DEP(fastrpc_apps_user);
31433065
PL_DEP(gpls);
31443066
PL_DEP(apps_std);
31453067
PL_DEP(rpcmem);
3146-
PL_DEP(listener_android);
3068+
PL_DEP(listener);
31473069
PL_DEP(fastrpc_async);
31483070

31493071
static int attach_guestos(int domain) {
@@ -3191,7 +3113,7 @@ static void domain_deinit(int domain) {
31913113
pthread_mutex_unlock(&hlist[domain].mut);
31923114

31933115
dspsignal_domain_deinit(domain);
3194-
listener_android_domain_deinit(domain);
3116+
listener_domain_deinit(domain);
31953117
hlist[domain].first_revrpc_done = 0;
31963118
pthread_mutex_lock(&hlist[domain].async_init_deinit_mut);
31973119
fastrpc_async_domain_deinit(domain);
@@ -3507,28 +3429,6 @@ static int open_shell(int domain_id, apps_std_FILE *fh, int unsigned_shell) {
35073429
std_strlcat(absName, shell_absName, absNameLen);
35083430
nErr = apps_std_fopen(absName, "r", fh);
35093431
}
3510-
if (nErr) {
3511-
absNameLen = std_strlen(VENDOR_DSP_LOCATION) + shell_absNameLen + 1;
3512-
VERIFYC(NULL !=
3513-
(absName = (char *)realloc(absName, sizeof(char) * absNameLen)),
3514-
AEE_ENOMEMORY);
3515-
std_strlcpy(absName, VENDOR_DSP_LOCATION, absNameLen);
3516-
std_strlcat(absName, shell_absName, absNameLen);
3517-
3518-
nErr = apps_std_fopen(absName, "r", fh);
3519-
if (nErr) {
3520-
absNameLen = std_strlen(VENDOR_DOM_LOCATION) + shell_absNameLen + 1;
3521-
VERIFYC(NULL != (absName =
3522-
(char *)realloc(absName, sizeof(char) * absNameLen)),
3523-
AEE_ENOMEMORY);
3524-
std_strlcpy(absName, VENDOR_DSP_LOCATION, absNameLen);
3525-
std_strlcat(absName, SUBSYSTEM_NAME[domain], absNameLen);
3526-
std_strlcat(absName, "/", absNameLen);
3527-
std_strlcat(absName, shell_absName, absNameLen);
3528-
3529-
nErr = apps_std_fopen(absName, "r", fh);
3530-
}
3531-
}
35323432
if (!nErr)
35333433
FARF(ALWAYS, "Successfully opened %s, domain %d", absName, domain);
35343434
bail:
@@ -3550,10 +3450,10 @@ static int open_shell(int domain_id, apps_std_FILE *fh, int unsigned_shell) {
35503450
*fh = -1;
35513451
} else {
35523452
FARF(ERROR,
3553-
"Error 0x%x: %s failed for domain %d search paths used are %s, %s, "
3554-
"%s (errno %s)\n",
3555-
nErr, __func__, domain, DSP_MOUNT_LOCATION, VENDOR_DSP_LOCATION,
3556-
VENDOR_DOM_LOCATION, strerror(errno));
3453+
"Error 0x%x: %s failed for domain %d search paths used are %s, "
3454+
"%s/%s (errno %s)\n",
3455+
nErr, __func__, domain, DSP_MOUNT_LOCATION, DSP_MOUNT_LOCATION,
3456+
SUBSYSTEM_NAME[domain], strerror(errno));
35573457
}
35583458
}
35593459
return nErr;
@@ -4082,7 +3982,7 @@ static int domain_init(int domain, int *dev) {
40823982
hlist[domain].state = FASTRPC_DOMAIN_STATE_INIT;
40833983
hlist[domain].ref = 0;
40843984
pthread_mutex_unlock(&hlist[domain].mut);
4085-
VERIFY(AEE_SUCCESS == (nErr = listener_android_domain_init(
3985+
VERIFY(AEE_SUCCESS == (nErr = listener_domain_init(
40863986
domain, hlist[domain].th_params.update_requested,
40873987
&hlist[domain].th_params.r_sem)));
40883988
bail:
@@ -4128,7 +4028,7 @@ static void fastrpc_apps_user_deinit(void) {
41284028
pthread_mutex_destroy(&hlist[i].init);
41294029
pthread_mutex_destroy(&hlist[i].async_init_deinit_mut);
41304030
}
4131-
listener_android_deinit();
4031+
listener_deinit();
41324032
free(hlist);
41334033
hlist = NULL;
41344034
}
@@ -4236,7 +4136,7 @@ static int fastrpc_apps_user_init(void) {
42364136
pthread_mutex_init(&hlist[i].init, 0);
42374137
pthread_mutex_init(&hlist[i].async_init_deinit_mut, 0);
42384138
}
4239-
listener_android_init();
4139+
listener_init();
42404140
VERIFY(AEE_SUCCESS == (nErr = pthread_key_create(&tlsKey, exit_thread)));
42414141
VERIFY(AEE_SUCCESS == (nErr = PL_INIT(apps_std)));
42424142
GenCrc32Tab(POLY32, crc_table);

0 commit comments

Comments
 (0)