From 3f3d24ca486f0042158ed81935ca0303d90482ac Mon Sep 17 00:00:00 2001 From: Vinayak Katoch Date: Tue, 18 Mar 2025 16:45:35 +0530 Subject: [PATCH 1/5] Remove vendor-specific DSP path definitions and fallback logic Remove VENDOR_DSP_LOCATION and VENDOR_DOM_LOCATION macro definitions and update DSP_SEARCH_PATH to exclude vendor-specific paths. Remove vendor path fallback logic from open_shell() function and update related comments in apps_std_imp.c to reflect simplified path handling. Signed-off-by: Vinayak Katoch --- inc/apps_std_internal.h | 9 +-------- src/apps_std_imp.c | 4 ++-- src/fastrpc_apps_user.c | 32 ++++---------------------------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/inc/apps_std_internal.h b/inc/apps_std_internal.h index 74d7ae63..6e02cb31 100644 --- a/inc/apps_std_internal.h +++ b/inc/apps_std_internal.h @@ -39,16 +39,9 @@ #endif #endif /* ENABLE_UPSTREAM_DRIVER_INTERFACE */ -#ifndef VENDOR_DSP_LOCATION -#define VENDOR_DSP_LOCATION "/vendor/dsp/" -#endif -#ifndef VENDOR_DOM_LOCATION -#define VENDOR_DOM_LOCATION "/vendor/dsp/xdsp/" -#endif - // Search path used by fastRPC to search skel library, .debugconfig and .farf files #ifndef DSP_SEARCH_PATH -#define DSP_SEARCH_PATH ";/usr/lib/rfsa/adsp;/vendor/lib/rfsa/adsp;/vendor/dsp/;/usr/lib/dsp/;" +#define DSP_SEARCH_PATH ";/usr/lib/rfsa/adsp;/usr/lib/dsp/;" #endif // Search path used by fastRPC for acdb path diff --git a/src/apps_std_imp.c b/src/apps_std_imp.c index 3458d8c4..348227a5 100644 --- a/src/apps_std_imp.c +++ b/src/apps_std_imp.c @@ -1088,7 +1088,7 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)( } FREEIF(absName); - // fallback: If not found in domain path /vendor/dsp/adsp try in /vendor/dsp + // fallback to open the file without domain absNameLen = strlen(dirName) + strlen(name) + 2; VERIFYC(NULL != (absName = (char *)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY); @@ -1223,7 +1223,7 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env_fd)( } FREEIF(absName); - // fallback: If not found in domain path /vendor/dsp/adsp try in /vendor/dsp + // fallback to open the file without domain absNameLen = strlen(dirName) + strlen(name) + 2; VERIFYC(NULL != (absName = (char *)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY); diff --git a/src/fastrpc_apps_user.c b/src/fastrpc_apps_user.c index 81fef0ab..1963c084 100644 --- a/src/fastrpc_apps_user.c +++ b/src/fastrpc_apps_user.c @@ -83,8 +83,6 @@ #define DSP_MOUNT_LOCATION "/usr/lib/dsp/" #define DSP_DOM_LOCATION "/usr/lib/dsp/xdspn" #endif -#define VENDOR_DSP_LOCATION "/vendor/dsp/" -#define VENDOR_DOM_LOCATION "/vendor/dsp/xdsp/" #ifdef LE_ENABLE #define PROPERTY_VALUE_MAX \ @@ -3480,28 +3478,6 @@ static int open_shell(int domain_id, apps_std_FILE *fh, int unsigned_shell) { strlcat(absName, shell_absName, absNameLen); nErr = apps_std_fopen(absName, "r", fh); } - if (nErr) { - absNameLen = strlen(VENDOR_DSP_LOCATION) + shell_absNameLen + 1; - VERIFYC(NULL != - (absName = (char *)realloc(absName, sizeof(char) * absNameLen)), - AEE_ENOMEMORY); - strlcpy(absName, VENDOR_DSP_LOCATION, absNameLen); - strlcat(absName, shell_absName, absNameLen); - - nErr = apps_std_fopen(absName, "r", fh); - if (nErr) { - absNameLen = strlen(VENDOR_DOM_LOCATION) + shell_absNameLen + 1; - VERIFYC(NULL != (absName = - (char *)realloc(absName, sizeof(char) * absNameLen)), - AEE_ENOMEMORY); - strlcpy(absName, VENDOR_DSP_LOCATION, absNameLen); - strlcat(absName, SUBSYSTEM_NAME[domain], absNameLen); - strlcat(absName, "/", absNameLen); - strlcat(absName, shell_absName, absNameLen); - - nErr = apps_std_fopen(absName, "r", fh); - } - } if (!nErr) FARF(RUNTIME_RPC_HIGH, "Successfully opened %s, domain %d", absName, domain); bail: @@ -3523,10 +3499,10 @@ static int open_shell(int domain_id, apps_std_FILE *fh, int unsigned_shell) { *fh = -1; } else { FARF(ERROR, - "Error 0x%x: %s failed for domain %d search paths used are %s, %s, " - "%s (errno %s)\n", - nErr, __func__, domain, DSP_MOUNT_LOCATION, VENDOR_DSP_LOCATION, - VENDOR_DOM_LOCATION, strerror(errno)); + "Error 0x%x: %s failed for domain %d search paths used are %s, " + "%s/%s (errno %s)\n", + nErr, __func__, domain, DSP_MOUNT_LOCATION, DSP_MOUNT_LOCATION, + SUBSYSTEM_NAME[domain], strerror(errno)); } } return nErr; From b1d98fe91fb6291e053e27fc08eee1ab81079a52 Mon Sep 17 00:00:00 2001 From: Vinayak Katoch Date: Fri, 25 Apr 2025 12:09:52 +0530 Subject: [PATCH 2/5] Remove Android reference from fastrpc_apps_user.h header guards Change header guard macros from FASTRPC_ANDROID_USER_H to FASTRPC_USER_H to remove Android-specific naming and make the header more generic for cross-platform usage. Signed-off-by: Vinayak Katoch --- inc/fastrpc_apps_user.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/fastrpc_apps_user.h b/inc/fastrpc_apps_user.h index 1cab47ae..a522e883 100644 --- a/inc/fastrpc_apps_user.h +++ b/inc/fastrpc_apps_user.h @@ -1,8 +1,8 @@ // Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. // SPDX-License-Identifier: BSD-3-Clause -#ifndef FASTRPC_ANDROID_USER_H -#define FASTRPC_ANDROID_USER_H +#ifndef FASTRPC_USER_H +#define FASTRPC_USER_H #include #include @@ -134,4 +134,4 @@ int get_unsigned_pd_attribute(uint32_t domain, int *unsigned_module); */ int is_userspace_allocation_supported(); -#endif //FASTRPC_ANDROID_USER_H +#endif //FASTRPC_USER_H From e7ff063ff8a40766b09b058ecefca93fa2f0f4bb Mon Sep 17 00:00:00 2001 From: Vinayak Katoch Date: Fri, 25 Apr 2025 12:17:41 +0530 Subject: [PATCH 3/5] Rename listener_android to listener and update all references Rename listener_android.h to listener.h and listener_android.c to listener.c to remove Android-specific naming. Update all function names from listener_android_* to listener_* pattern. Update header guards, includes, Makefile entries, platform library dependencies, and all function calls throughout the codebase to maintain compilation compatibility. Signed-off-by: Vinayak Katoch --- inc/Makefile.am | 2 +- inc/{listener_android.h => listener.h} | 12 ++++++------ src/Makefile.am | 2 +- src/fastrpc_apps_user.c | 16 ++++++++-------- src/{listener_android.c => listener.c} | 18 +++++++++--------- src/pl_list.c | 4 ++-- 6 files changed, 27 insertions(+), 27 deletions(-) rename inc/{listener_android.h => listener.h} (79%) rename src/{listener_android.c => listener.c} (97%) diff --git a/inc/Makefile.am b/inc/Makefile.am index 24f281f3..e84e35ef 100644 --- a/inc/Makefile.am +++ b/inc/Makefile.am @@ -53,7 +53,7 @@ noinst_HEADERS = \ fastrpc_procbuf.h \ fastrpc_process_attributes.h \ fastrpc_trace.h \ - listener_android.h \ + listener.h \ listener_buf.h \ log_config.h \ mod_table.h \ diff --git a/inc/listener_android.h b/inc/listener.h similarity index 79% rename from inc/listener_android.h rename to inc/listener.h index 2cf229c8..8ae82752 100644 --- a/inc/listener_android.h +++ b/inc/listener.h @@ -1,8 +1,8 @@ // Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. // SPDX-License-Identifier: BSD-3-Clause -#ifndef LISTENER_ANDROID_H -#define LISTENER_ANDROID_H +#ifndef LISTENER_H +#define LISTENER_H #include #include @@ -22,18 +22,18 @@ /* * API to initialize globals and internal data structures used in listener modules */ -int listener_android_init(void); +int listener_init(void); /* * API to de-initialize globals and internal data structures used in listener modules */ -void listener_android_deinit(void); +void listener_deinit(void); /* * API to initialize domain specific data strcutures used in listener modules */ -int listener_android_domain_init(int domain, int update_requested, sem_t *r_sem); +int listener_domain_init(int domain, int update_requested, sem_t *r_sem); /* * API to de-initialize domain specific data strcutures used in listener modules */ -void listener_android_domain_deinit(int domain); +void listener_domain_deinit(int domain); #endif diff --git a/src/Makefile.am b/src/Makefile.am index 7c28c49a..7b0e0e9c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,7 +19,7 @@ LIBDSPRPC_SOURCES = \ dspsignal.c \ dspqueue/dspqueue_cpu.c \ dspqueue/dspqueue_rpc_stub.c \ - listener_android.c \ + listener.c \ apps_std_imp.c \ apps_mem_imp.c \ apps_mem_skel.c \ diff --git a/src/fastrpc_apps_user.c b/src/fastrpc_apps_user.c index 1963c084..0abf9233 100644 --- a/src/fastrpc_apps_user.c +++ b/src/fastrpc_apps_user.c @@ -64,7 +64,7 @@ #include "fastrpc_perf.h" #include "fastrpc_pm.h" #include "fastrpc_procbuf.h" -#include "listener_android.h" +#include "listener.h" #include "log_config.h" #include "platform_libs.h" #include "remotectl.h" @@ -1612,7 +1612,7 @@ int remote_handle64_invoke_async(remote_handle64 local, return nErr; } -int listener_android_geteventfd(int domain, int *fd); +int listener_geteventfd(int domain, int *fd); int remote_handle_open_domain(int domain, const char *name, remote_handle *ph, uint64_t *t_spawn, uint64_t *t_load) { char dlerrstr[255]; @@ -1635,7 +1635,7 @@ int remote_handle_open_domain(int domain, const char *name, remote_handle *ph, if (!strncmp(name, ITRANSPORT_PREFIX "geteventfd", strlen(ITRANSPORT_PREFIX "geteventfd"))) { FARF(RUNTIME_RPC_HIGH, "getting event fd"); - return listener_android_geteventfd(domain, (int *)ph); + return listener_geteventfd(domain, (int *)ph); } if (!strncmp(name, ITRANSPORT_PREFIX "attachguestos", strlen(ITRANSPORT_PREFIX "attachguestos"))) { @@ -3151,7 +3151,7 @@ PL_DEP(fastrpc_apps_user); PL_DEP(gpls); PL_DEP(apps_std); PL_DEP(rpcmem); -PL_DEP(listener_android); +PL_DEP(listener); PL_DEP(fastrpc_async); static int attach_guestos(int domain) { @@ -3201,7 +3201,7 @@ static void domain_deinit(int domain) { pthread_mutex_unlock(&hlist[domain].mut); dspsignal_domain_deinit(domain); - listener_android_domain_deinit(domain); + listener_domain_deinit(domain); hlist[domain].first_revrpc_done = 0; pthread_mutex_lock(&hlist[domain].async_init_deinit_mut); fastrpc_async_domain_deinit(domain); @@ -4032,7 +4032,7 @@ static int domain_init(int domain, int *dev) { hlist[domain].state = FASTRPC_DOMAIN_STATE_INIT; hlist[domain].ref = 0; pthread_mutex_unlock(&hlist[domain].mut); - VERIFY(AEE_SUCCESS == (nErr = listener_android_domain_init( + VERIFY(AEE_SUCCESS == (nErr = listener_domain_init( domain, hlist[domain].th_params.update_requested, &hlist[domain].th_params.r_sem))); bail: @@ -4078,7 +4078,7 @@ static void fastrpc_apps_user_deinit(void) { pthread_mutex_destroy(&hlist[i].init); pthread_mutex_destroy(&hlist[i].async_init_deinit_mut); } - listener_android_deinit(); + listener_deinit(); free(hlist); hlist = NULL; } @@ -4176,7 +4176,7 @@ static int fastrpc_apps_user_init(void) { pthread_mutex_init(&hlist[i].init, 0); pthread_mutex_init(&hlist[i].async_init_deinit_mut, 0); } - listener_android_init(); + listener_init(); VERIFY(AEE_SUCCESS == (nErr = pthread_key_create(&tlsKey, exit_thread))); VERIFY(AEE_SUCCESS == (nErr = PL_INIT(apps_std))); GenCrc32Tab(POLY32, crc_table); diff --git a/src/listener_android.c b/src/listener.c similarity index 97% rename from src/listener_android.c rename to src/listener.c index 712945ce..d86ea888 100644 --- a/src/listener_android.c +++ b/src/listener.c @@ -378,13 +378,13 @@ static void *listener_start_thread(void *arg) { return (void *)(uintptr_t)nErr; } -void listener_android_deinit(void) { +void listener_deinit(void) { HASH_TABLE_CLEANUP(listener_config); PL_DEINIT(mod_table); PL_DEINIT(apps_std); } -int listener_android_init(void) { +int listener_init(void) { int nErr = 0; HASH_TABLE_INIT(listener_config); @@ -401,13 +401,13 @@ int listener_android_init(void) { "adspmsgd_apps", adspmsgd_apps_skel_invoke))); bail: if (nErr != AEE_SUCCESS) { - listener_android_deinit(); + listener_deinit(); VERIFY_EPRINTF("Error %x: fastrpc listener initialization error", nErr); } return nErr; } -void listener_android_domain_deinit(int domain) { +void listener_domain_deinit(int domain) { listener_config *me = NULL; GET_HASH_NODE(listener_config, domain, me); @@ -429,7 +429,7 @@ void listener_android_domain_deinit(int domain) { } } -int listener_android_domain_init(int domain, int update_requested, +int listener_domain_init(int domain, int update_requested, sem_t *r_sem) { listener_config *me = NULL; int nErr = AEE_SUCCESS; @@ -464,7 +464,7 @@ int listener_android_domain_init(int domain, int update_requested, if (nErr != AEE_SUCCESS) { VERIFY_EPRINTF("Error 0x%x: %s failed for domain %d\n", nErr, __func__, domain); - listener_android_domain_deinit(domain); + listener_domain_deinit(domain); } return nErr; } @@ -474,7 +474,7 @@ int close_reverse_handle(remote_handle64 h, char *dlerr, int dlerrorLen, return apps_remotectl_close((uint32_t)h, dlerr, dlerrorLen, dlErr); } -int listener_android_geteventfd(int domain, int *fd) { +int listener_geteventfd(int domain, int *fd) { listener_config *me = NULL; int nErr = 0; @@ -484,11 +484,11 @@ int listener_android_geteventfd(int domain, int *fd) { *fd = me->eventfd; bail: if (nErr != AEE_SUCCESS) { - VERIFY_EPRINTF("Error %x: listener android getevent file descriptor failed " + VERIFY_EPRINTF("Error %x: listener getevent file descriptor failed " "for domain %d\n", nErr, domain); } return nErr; } -PL_DEFINE(listener_android, listener_android_init, listener_android_deinit) +PL_DEFINE(listener, listener_init, listener_deinit) diff --git a/src/pl_list.c b/src/pl_list.c index 97a404a8..d9c1662a 100644 --- a/src/pl_list.c +++ b/src/pl_list.c @@ -4,7 +4,7 @@ #include "platform_libs.h" PL_DEP(gpls) -PL_DEP(listener_android) +PL_DEP(listener) struct platform_lib *(*pl_list[])(void) = {PL_ENTRY(gpls), - PL_ENTRY(listener_android), 0}; + PL_ENTRY(listener), 0}; From f83c16dc31b0841050fd750a16fa410bb9c3a21f Mon Sep 17 00:00:00 2001 From: Vinayak Katoch Date: Fri, 25 Apr 2025 12:28:52 +0530 Subject: [PATCH 4/5] Clean up unused code, TODO comments, and Android references Remove unused convert_level_to_android_priority() function, TODO comments referencing Android-specific code, and Android include statements. Update AEE_EINVHANDLE comment to remove vendor-specific reference and clean up conditional compilation blocks for Android platforms. Signed-off-by: Vinayak Katoch --- inc/AEEStdErr.h | 2 +- inc/fastrpc_trace.h | 3 --- src/adspmsgd_printf.c | 21 --------------------- src/apps_std_imp.c | 9 +-------- src/fastrpc_apps_user.c | 9 --------- src/fastrpc_mem.c | 9 --------- 6 files changed, 2 insertions(+), 51 deletions(-) diff --git a/inc/AEEStdErr.h b/inc/AEEStdErr.h index 8b7d5ff0..1f022aeb 100644 --- a/inc/AEEStdErr.h +++ b/inc/AEEStdErr.h @@ -84,7 +84,7 @@ #define AEE_EINVALIDITEM (AEE_EOFFSET + 0x02A) ///< Current item is invalid, it can be a switch case or a pointer to memory #define AEE_ENOTALLOWED (AEE_EOFFSET + 0x02B) ///< Not allowed to perform the ///< operation -#define AEE_EINVHANDLE (AEE_EOFFSET + 0x02C) ///< Invalid handle - adding here as its defined in vendor AEEStdErr.h - needed to check valid handle in stub.c +#define AEE_EINVHANDLE (AEE_EOFFSET + 0x02C) ///< Invalid handle - needed to check valid handle in stub.c #define AEE_EOUTOFHANDLES (AEE_EOFFSET + 0x02D) ///< Out of handles (Handle list is already full) //Hole here #define AEE_ENOMORE (AEE_EOFFSET + 0x02F) ///< No more items available -- diff --git a/inc/fastrpc_trace.h b/inc/fastrpc_trace.h index 0f8246b9..e6f0ac6f 100644 --- a/inc/fastrpc_trace.h +++ b/inc/fastrpc_trace.h @@ -4,9 +4,6 @@ #ifndef FASTRPC_TRACE_H #define FASTRPC_TRACE_H -#if ((defined _ANDROID) || (defined ANDROID)) || (defined DISABLE_ATRACE) && !defined(LE_ENABLE) -//TODO: Bharath #include "cutils/trace.h" //for systrace support -#endif #include "HAP_farf.h" //for systrace support diff --git a/src/adspmsgd_printf.c b/src/adspmsgd_printf.c index 787d9c1c..4f734b8a 100644 --- a/src/adspmsgd_printf.c +++ b/src/adspmsgd_printf.c @@ -20,27 +20,6 @@ typedef struct __attribute__((packed)) { char file[LOG_FILENAME_SIZE]; } LogNode; -#if 0 -static inline android_LogPriority convert_level_to_android_priority( - enum adspmsgd_apps_Level level) -{ - switch (level) { - case LOW: - return LOW; - case MEDIUM: - return MEDIUM; - case HIGH: - return HIGH; - case ERROR: - return ERROR; - case FATAL: - return FATAL; - default: - return 0; - } -} -#endif - int adspmsgd_apps_log(const unsigned char *log_message_buffer, int log_message_bufferLen) { LogNode *logMessage = (LogNode *)log_message_buffer; diff --git a/src/apps_std_imp.c b/src/apps_std_imp.c index 348227a5..762bd830 100644 --- a/src/apps_std_imp.c +++ b/src/apps_std_imp.c @@ -1157,14 +1157,7 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env_fd)( VERIFYC(NULL != delim, AEE_EBADPARM); VERIFYC(NULL != name, AEE_EBADPARM); VERIFYC(NULL != envvarname, AEE_EBADPARM); -#if 0 //TODO: Bharath - char *tempName = name; - tempName += 2; - if (tempName[0] == '\0') { - nErr = AEE_EBADPARM; - goto bail; - } -#endif + FASTRPC_ATRACE_BEGIN_L("%s for %s in %s mode from path in environment " "variable %s delimited with %s", __func__, name, mode, envvarname, delim); diff --git a/src/fastrpc_apps_user.c b/src/fastrpc_apps_user.c index 0abf9233..9a42f15f 100644 --- a/src/fastrpc_apps_user.c +++ b/src/fastrpc_apps_user.c @@ -84,16 +84,7 @@ #define DSP_DOM_LOCATION "/usr/lib/dsp/xdspn" #endif -#ifdef LE_ENABLE -#define PROPERTY_VALUE_MAX \ - 92 // as this macro is defined in cutils for Android platforms, defined - // explicitly for LE platform -#elif (defined _ANDROID) || (defined ANDROID) -/// TODO: Bharath #include "cutils/properties.h" #define PROPERTY_VALUE_MAX 92 -#else -#define PROPERTY_VALUE_MAX 92 -#endif #ifndef _WIN32 #include diff --git a/src/fastrpc_mem.c b/src/fastrpc_mem.c index 8f62fc25..33282420 100644 --- a/src/fastrpc_mem.c +++ b/src/fastrpc_mem.c @@ -41,16 +41,7 @@ #include "shared.h" #include "verify.h" -#ifdef LE_ENABLE -#define PROPERTY_VALUE_MAX \ - 92 // as this macro is defined in cutils for Android platforms, defined - // explicitly for LE platform -#elif (defined _ANDROID) || (defined ANDROID) -// TODO: Bharath #include "cutils/properties.h" #define PROPERTY_VALUE_MAX 92 -#else -#define PROPERTY_VALUE_MAX 92 -#endif #ifndef _WIN32 #include From e26a06880355b909339359999146fc5392994062 Mon Sep 17 00:00:00 2001 From: Vinayak Katoch Date: Fri, 25 Apr 2025 13:22:40 +0530 Subject: [PATCH 5/5] Remove Android property system and build type dependencies Remove Android-specific property arrays (ANDROIDP_DEBUG_VAR_NAME and ANDROID_DEBUG_VAR_NAME) and simplify property handling functions to use only environment variables. Remove FASTRPC_BUILD_TYPE enum value and "ro.debuggable" property reference. Eliminate Android conditional compilation blocks and build type checks in logging initialization. Signed-off-by: Vinayak Katoch --- inc/fastrpc_common.h | 1 - src/fastrpc_apps_user.c | 72 ++--------------------------------------- src/fastrpc_log.c | 18 ++--------- 3 files changed, 4 insertions(+), 87 deletions(-) diff --git a/inc/fastrpc_common.h b/inc/fastrpc_common.h index 1d52afec..5c2fd181 100644 --- a/inc/fastrpc_common.h +++ b/inc/fastrpc_common.h @@ -126,7 +126,6 @@ FASTRPC_ENABLE_SYSTRACE = 6, //to enable tracing using Systrace FASTRPC_DEBUG_PDDUMP = 7, // to enable pd dump debug data collection on rooted device for signed/unsigned pd FASTRPC_PROCESS_ATTRS_PERSISTENT = 8, // to set proc attr as persistent - FASTRPC_BUILD_TYPE = 9 // Fetch build type of firmware image. It gives the details if its debug or prod build }fastrpc_properties; /** diff --git a/src/fastrpc_apps_user.c b/src/fastrpc_apps_user.c index 9a42f15f..d199f52e 100644 --- a/src/fastrpc_apps_user.c +++ b/src/fastrpc_apps_user.c @@ -225,28 +225,7 @@ const char *ENV_DEBUG_VAR_NAME[] = {"FASTRPC_PROCESS_ATTRS", "FASTRPC_PERF_FREQ", "FASTRPC_DEBUG_SYSTRACE", "FASTRPC_DEBUG_PDDUMP", - "FASTRPC_PROCESS_ATTRS_PERSISTENT", - "ro.debuggable"}; -const char *ANDROIDP_DEBUG_VAR_NAME[] = {"vendor.fastrpc.process.attrs", - "vendor.fastrpc.debug.trace", - "vendor.fastrpc.debug.testsig", - "vendor.fastrpc.perf.kernel", - "vendor.fastrpc.perf.adsp", - "vendor.fastrpc.perf.freq", - "vendor.fastrpc.debug.systrace", - "vendor.fastrpc.debug.pddump", - "persist.vendor.fastrpc.process.attrs", - "ro.build.type"}; -const char *ANDROID_DEBUG_VAR_NAME[] = {"fastrpc.process.attrs", - "fastrpc.debug.trace", - "fastrpc.debug.testsig", - "fastrpc.perf.kernel", - "fastrpc.perf.adsp", - "fastrpc.perf.freq", - "fastrpc.debug.systrace", - "fastrpc.debug.pddump", - "persist.fastrpc.process.attrs", - "ro.build.type"}; + "FASTRPC_PROCESS_ATTRS_PERSISTENT"}; const char *SUBSYSTEM_NAME[] = {"adsp", "mdsp", "sdsp", "cdsp", "cdsp1", "gdsp0", "gdsp1", "reserved"}; @@ -260,10 +239,6 @@ static const size_t invoke_end_trace_strlen = sizeof(INVOKE_END_TRACE_STR) - 1; int NO_ENV_DEBUG_VAR_NAME_ARRAY_ELEMENTS = sizeof(ENV_DEBUG_VAR_NAME) / sizeof(char *); -int NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS = - sizeof(ANDROIDP_DEBUG_VAR_NAME) / sizeof(char *); -int NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS = - sizeof(ANDROID_DEBUG_VAR_NAME) / sizeof(char *); /* Shell prefix for signed and unsigned */ const char *const SIGNED_SHELL = "fastrpc_shell_"; @@ -485,29 +460,8 @@ int fastrpc_get_property_int(fastrpc_properties UserPropKey, int defValue) { const char *env = getenv(ENV_DEBUG_VAR_NAME[UserPropKey]); if (env != 0) return (int)atoi(env); -#if !defined(LE_ENABLE) // Android platform -#if !defined(SYSTEM_RPC_LIBRARY) // vendor library - if (((int)UserPropKey > NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) { - FARF( - ERROR, - "%s: Index %d out-of-bound for ANDROIDP_DEBUG_VAR_NAME array of len %d", - __func__, UserPropKey, NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS); - return defValue; - } - return (int)property_get_int32(ANDROIDP_DEBUG_VAR_NAME[UserPropKey], - defValue); -#else // system library - if (((int)UserPropKey > NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) { - FARF(ERROR, - "%s: Index %d out-of-bound for ANDROID_DEBUG_VAR_NAME array of len %d", - __func__, UserPropKey, NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS); - return defValue; - } - return (int)property_get_int32(ANDROID_DEBUG_VAR_NAME[UserPropKey], defValue); -#endif -#else // non-Android platforms + return defValue; -#endif } int fastrpc_get_property_string(fastrpc_properties UserPropKey, char *value, char *defValue) { @@ -524,34 +478,12 @@ int fastrpc_get_property_string(fastrpc_properties UserPropKey, char *value, value[PROPERTY_VALUE_MAX - 1] = '\0'; return strlen(env); } -#if !defined(LE_ENABLE) // Android platform -#if !defined(SYSTEM_RPC_LIBRARY) // vendor library - if (((int)UserPropKey > NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) { - FARF( - ERROR, - "%s: Index %d out-of-bound for ANDROIDP_DEBUG_VAR_NAME array of len %d", - __func__, UserPropKey, NO_ANDROIDP_DEBUG_VAR_NAME_ARRAY_ELEMENTS); - return len; - } - return property_get(ANDROIDP_DEBUG_VAR_NAME[UserPropKey], (int *)value, - (int *)defValue); -#else // system library - if (((int)UserPropKey > NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS)) { - FARF(ERROR, - "%s: Index %d out-of-bound for ANDROID_DEBUG_VAR_NAME array of len %d", - __func__, UserPropKey, NO_ANDROID_DEBUG_VAR_NAME_ARRAY_ELEMENTS); - return len; - } - return property_get(ANDROID_DEBUG_VAR_NAME[UserPropKey], value, defValue); -#endif -#else // non-Android platforms if (defValue != NULL) { strncpy(value, defValue, PROPERTY_VALUE_MAX - 1); value[PROPERTY_VALUE_MAX - 1] = '\0'; return strlen(defValue); } return len; -#endif } /* diff --git a/src/fastrpc_log.c b/src/fastrpc_log.c index de773f4d..95c18179 100644 --- a/src/fastrpc_log.c +++ b/src/fastrpc_log.c @@ -279,28 +279,14 @@ void HAP_debug(const char *msg, int level, const char *filename, int line) { } void fastrpc_log_init() { - bool debug_build_type = false; int nErr = AEE_SUCCESS, fd = -1; char build_type[PROPERTY_VALUE_MAX]; char *logfilename; pthread_mutex_init(&persist_buf.mut, 0); pthread_mutex_lock(&persist_buf.mut); - /* - * Get build type by reading the target properties, - * if buuid type is eng or userdebug allocate 1 MB persist buf. - */ - if (fastrpc_get_property_string(FASTRPC_BUILD_TYPE, build_type, NULL)) { -#if !defined(LE_ENABLE) - if (!strncmp(build_type, "eng", PROPERTY_VALUE_MAX) || - !strncmp(build_type, "userdebug", PROPERTY_VALUE_MAX)) - debug_build_type = true; -#else - if (atoi(build_type)) - debug_build_type = true; -#endif - } - if (persist_buf.buf == NULL && debug_build_type) { + + if (persist_buf.buf == NULL) { /* Create a debug buffer to append DEBUG FARF level message. */ persist_buf.buf = (char *)rpcmem_alloc_internal( RPCMEM_HEAP_ID_SYSTEM, RPCMEM_DEFAULT_FLAGS | RPCMEM_TRY_MAP_STATIC,