summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2015-01-13 11:40:31 +0100
committerIngo Huerner <ingo.huerner@xse.de>2015-01-13 11:40:31 +0100
commit69ea94b69ca160e6f92a1abf99ff0a5397c3c998 (patch)
tree6860e559abc74b3e01245e74ca98a1d07d755abc
parente026de7ddd7ef60abb5213f046db20cf7dffcb51 (diff)
downloadpersistence-client-library-69ea94b69ca160e6f92a1abf99ff0a5397c3c998.tar.gz
Fixed findings after GENIVI source code review: PRIO 1 issues
-rw-r--r--src/persistence_client_library.c16
-rw-r--r--src/persistence_client_library_dbus_service.c9
-rw-r--r--src/persistence_client_library_dbus_service.h24
3 files changed, 17 insertions, 32 deletions
diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c
index 174c081..8be2554 100644
--- a/src/persistence_client_library.c
+++ b/src/persistence_client_library.c
@@ -279,7 +279,7 @@ int pclDeinitLibrary(void)
static int private_pclDeinitLibrary(void)
{
- int i = 0, rval = 1;
+ int rval = 1;
#if USE_XSTRACE_PERS
xsm_send_user_event("%s - %d\n", __FUNCTION__, __LINE__);
@@ -306,20 +306,6 @@ static int private_pclDeinitLibrary(void)
}
#endif
- // unload custom client libraries
- for(i=0; i<PersCustomLib_LastEntry; i++)
- {
- if(gPersCustomFuncs[i].custom_plugin_deinit != NULL)
- {
- // deinitialize plugin
- gPersCustomFuncs[i].custom_plugin_deinit();
- // close library handle
- dlclose(gPersCustomFuncs[i].handle);
-
- invalidate_custom_plugin(i);
- }
- }
-
process_prepare_shutdown(Shutdown_Full); // close all db's and fd's and block access
// send quit command to dbus mainloop
diff --git a/src/persistence_client_library_dbus_service.c b/src/persistence_client_library_dbus_service.c
index d87e606..0f1d801 100644
--- a/src/persistence_client_library_dbus_service.c
+++ b/src/persistence_client_library_dbus_service.c
@@ -97,8 +97,6 @@ typedef struct SPollInfo
/// polling information
static tPollInfo gPollInfo; /// polling information
-int bContinue = 0; /// indicator if dbus mainloop shall continue
-
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
@@ -260,15 +258,15 @@ static void unregisterObjectPathFallback(DBusConnection *connection, void *user
void* run_mainloop(void* dataPtr)
{
// persistence admin message
- static const struct DBusObjectPathVTable vtablePersAdmin
+ const struct DBusObjectPathVTable vtablePersAdmin
= {unregisterMessageHandler, checkPersAdminMsg, NULL, NULL, NULL, NULL};
// lifecycle message
- static const struct DBusObjectPathVTable vtableLifecycle
+ const struct DBusObjectPathVTable vtableLifecycle
= {unregisterMessageHandler, checkLifecycleMsg, NULL, NULL, NULL, NULL};
// fallback
- static const struct DBusObjectPathVTable vtableFallback
+ const struct DBusObjectPathVTable vtableFallback
= {unregisterObjectPathFallback, handleObjectPathMessageFallback, NULL, NULL, NULL, NULL};
// setup the dbus
@@ -537,6 +535,7 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
else
{
int ret;
+ int bContinue = 0; /// indicator if dbus mainloop shall continue
memset(&gPollInfo, 0 , sizeof(gPollInfo));
gPollInfo.nfds = 1;
diff --git a/src/persistence_client_library_dbus_service.h b/src/persistence_client_library_dbus_service.h
index cc40b58..3bebf57 100644
--- a/src/persistence_client_library_dbus_service.h
+++ b/src/persistence_client_library_dbus_service.h
@@ -53,29 +53,29 @@ typedef enum ECmd
typedef union MainLoopData_u_{
/// message structure
- struct {
+ struct message_ {
/// dbus mainloop command
uint32_t cmd;
/// unsigned int parameters
uint32_t params[4];
/// string parameter
char string[DbKeyMaxLen];
- } message;
+ }message;
/// the message payload
- char payload[128];
+ char payload[sizeof(struct message_)];
} MainLoopData_u;
-/// mutex to make sure main loop is running
-extern pthread_mutex_t gDbusInitializedMtx;
-/// dbus init conditional variable
-extern pthread_cond_t gDbusInitializedCond;
-/// dbus pending mutex
-extern pthread_mutex_t gDbusPendingRegMtx;
-/// dbus mainloop conditional variable
-extern pthread_mutex_t gMainCondMtx;
-/// dbus mainloop mutex
+/// mutex to make sure main loop is running => visibility "hidden" to prevent the use outside the library
+extern pthread_mutex_t gDbusInitializedMtx __attribute__ ((visibility ("hidden")));
+/// dbus init conditional variable => visibility "hidden" to prevent the use outside the library
+extern pthread_cond_t gDbusInitializedCond __attribute__ ((visibility ("hidden")));
+/// dbus pending mutex => visibility "hidden" to prevent the use outside the library
+extern pthread_mutex_t gDbusPendingRegMtx __attribute__ ((visibility ("hidden")));
+/// dbus mainloop conditional variable => visibility "hidden" to prevent the use outside the library
+extern pthread_mutex_t gMainCondMtx __attribute__ ((visibility ("hidden")));
+/// dbus mainloop mutex => visibility "hidden" to prevent the use outside the library
extern pthread_t gMainLoopThread;
/// lifecycle consumer interface dbus name