summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2014-06-30 14:23:20 +0200
committerIngo Huerner <ingo.huerner@xse.de>2014-06-30 14:23:20 +0200
commit02366a34b1995d9085e70343124f207096e59e7a (patch)
treee02b7f567558e27ebb28b42570e7e2806515e08d
parente80d06d26005c2ad166711e592e1c70bad1d2048 (diff)
downloadpersistence-client-library-02366a34b1995d9085e70343124f207096e59e7a.tar.gz
Removed global variables for notifications; use now pipe instead of eventfd for mainloop comminication
-rw-r--r--src/persistence_client_library.c6
-rw-r--r--src/persistence_client_library_data_organization.c10
-rw-r--r--src/persistence_client_library_data_organization.h19
-rw-r--r--src/persistence_client_library_db_access.c32
-rw-r--r--src/persistence_client_library_dbus_cmd.c40
-rw-r--r--src/persistence_client_library_dbus_cmd.h6
-rw-r--r--src/persistence_client_library_dbus_service.c71
-rw-r--r--src/persistence_client_library_dbus_service.h19
-rw-r--r--src/persistence_client_library_lc_interface.c26
-rw-r--r--src/persistence_client_library_pas_interface.c26
10 files changed, 146 insertions, 109 deletions
diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c
index f3d5cd4..0336a77 100644
--- a/src/persistence_client_library.c
+++ b/src/persistence_client_library.c
@@ -162,6 +162,10 @@ int pclDeinitLibrary(void)
if(gPclInitialized == PCLinitialized)
{
int* retval;
+ tMainLoopData data;
+ data.message.cmd = (uint32_t)CMD_QUIT;
+ data.message.string[0] = '\0'; // no string parameter, set to 0
+
DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("pclDeinitLibrary -> D E I N I T client library - "), DLT_STRING(gAppId),
DLT_STRING("- init counter: "), DLT_INT(gPclInitialized));
@@ -201,7 +205,7 @@ int pclDeinitLibrary(void)
bContinue = 0;
// send quit command to dbus mainloop
- deliverToMainloop_NM(CMD_QUIT, 0, 0);
+ deliverToMainloop_NM(&data);
// wait until the dbus mainloop has ended
pthread_join(gMainLoopThread, (void**)&retval);
diff --git a/src/persistence_client_library_data_organization.c b/src/persistence_client_library_data_organization.c
index c4332df..83ecaec 100644
--- a/src/persistence_client_library_data_organization.c
+++ b/src/persistence_client_library_data_organization.c
@@ -77,16 +77,6 @@ const char* gChangeSignal = "PersistenceResChange";
const char* gDeleteSignal = "PersistenceResDelete";
const char* gCreateSignal = "PersistenceResCreate";
-
-char gNotifykey[DbKeyMaxLen] = { [0 ... DbKeyMaxLen-1] = 0};
-
-unsigned int gNotifyLdbid = 0;
-unsigned int gNotifyUserNo = 0;
-unsigned int gNotifySeatNo = 0;
-pclNotifyStatus_e gNotifyReason = 0;
-PersNotifyRegPolicy_e gNotifyPolicy = 0;
-
-
int gTimeoutMs = 5000;
int gDbusPendingRvalue = 0;
diff --git a/src/persistence_client_library_data_organization.h b/src/persistence_client_library_data_organization.h
index fd96d00..5b22ae4 100644
--- a/src/persistence_client_library_data_organization.h
+++ b/src/persistence_client_library_data_organization.h
@@ -210,25 +210,6 @@ extern const char* gDeleteSignal;
/// create signal string
extern const char* gCreateSignal;
-
-/**
- * Global notification variables, will be used to pass
- * the notification information into the mainloop.
- */
-/// notification key string
-extern char gNotifykey[DbKeyMaxLen];
-/// notification lbid
-extern unsigned int gNotifyLdbid;
-/// notification user number
-extern unsigned int gNotifyUserNo;
-/// notification seat number
-extern unsigned int gNotifySeatNo;
-/// notification reason (created, changed, deleted)
-extern pclNotifyStatus_e gNotifyReason;
-/// notification policy (register or unregister)
-extern PersNotifyRegPolicy_e gNotifyPolicy;
-
-
// dbus timeout (5 seconds)
extern int gTimeoutMs;
diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c
index eee6a17..e8a5d63 100644
--- a/src/persistence_client_library_db_access.c
+++ b/src/persistence_client_library_db_access.c
@@ -716,13 +716,18 @@ int persistence_notify_on_change(const char* key, unsigned int ldbid, unsigned i
{
int rval = 0;
+ tMainLoopData data;
+
+ data.message.cmd = (uint32_t)CMD_REG_NOTIFY_SIGNAL;
+ data.message.params[0] = ldbid;
+ data.message.params[1] = user_no;
+ data.message.params[2] = seat_no;
+ data.message.params[3] = regPolicy;
+
+ snprintf(data.message.string, DbKeyMaxLen, "%s", key);
+
if(regPolicy < Notify_lastEntry)
{
- snprintf(gNotifykey, DbKeyMaxLen, "%s", key);
- gNotifyLdbid = ldbid; // to do: pass correct ==> JUST TESTING!!!!
- gNotifyUserNo = user_no;
- gNotifySeatNo = seat_no;
- gNotifyReason = regPolicy;
if(regPolicy == Notify_register)
{
@@ -735,7 +740,7 @@ int persistence_notify_on_change(const char* key, unsigned int ldbid, unsigned i
gChangeNotifyCallback = NULL;
}
- if(-1 == deliverToMainloop(CMD_REG_NOTIFY_SIGNAL, 0, 0))
+ if(-1 == deliverToMainloop(&data))
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("persistence_notify_on_change => failed to write to pipe"), DLT_INT(errno));
rval = -1;
@@ -759,14 +764,17 @@ int pers_send_Notification_Signal(const char* key, PersistenceDbContext_s* conte
int rval = 1;
if(reason < pclNotifyStatus_lastEntry)
{
- snprintf(gNotifykey, DbKeyMaxLen, "%s", key);
+ tMainLoopData data;
+
+ data.message.cmd = (uint32_t)CMD_SEND_NOTIFY_SIGNAL;
+ data.message.params[0] = context->ldbid;
+ data.message.params[1] = context->user_no;
+ data.message.params[2] = context->seat_no;
+ data.message.params[3] = reason;
- gNotifyLdbid = context->ldbid; // to do: pass correct ==> JUST TESTING!!!!
- gNotifyUserNo = context->user_no;
- gNotifySeatNo = context->seat_no;
- gNotifyReason = reason;
+ snprintf(data.message.string, DbKeyMaxLen, "%s", key);
- if(-1 == deliverToMainloop(CMD_SEND_NOTIFY_SIGNAL, 0,0) )
+ if(-1 == deliverToMainloop(&data) )
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_send_Notification_Signal => failed to write to pipe"), DLT_INT(errno));
rval = EPERS_NOTIFY_SIG;
diff --git a/src/persistence_client_library_dbus_cmd.c b/src/persistence_client_library_dbus_cmd.c
index a68a961..a380685 100644
--- a/src/persistence_client_library_dbus_cmd.c
+++ b/src/persistence_client_library_dbus_cmd.c
@@ -33,7 +33,8 @@ void msg_pending_func(DBusPendingCall *call, void *data);
-void process_reg_notification_signal(DBusConnection* conn)
+void process_reg_notification_signal(DBusConnection* conn, unsigned int notifyLdbid, unsigned int notifyUserNo,
+ unsigned int notifySeatNo, unsigned int notifyPolicy, const char* notifyKey)
{
char ruleChanged[DbusMatchRuleSize] = {[0 ... DbusMatchRuleSize-1] = 0};
char ruleDeleted[DbusMatchRuleSize] = {[0 ... DbusMatchRuleSize-1] = 0};
@@ -42,26 +43,26 @@ void process_reg_notification_signal(DBusConnection* conn)
// add match for c h a n g e
snprintf(ruleChanged, DbusMatchRuleSize,
"type='signal',interface='org.genivi.persistence.adminconsumer',member='PersistenceResChange',path='/org/genivi/persistence/adminconsumer',arg0='%s',arg1='%u',arg2='%u',arg3='%u'",
- gNotifykey, gNotifyLdbid, gNotifyUserNo, gNotifySeatNo);
+ notifyKey, notifyLdbid, notifyUserNo, notifySeatNo);
// add match for d e l e t e
snprintf(ruleDeleted, DbusMatchRuleSize,
"type='signal',interface='org.genivi.persistence.adminconsumer',member='PersistenceResDelete',path='/org/genivi/persistence/adminconsumer',arg0='%s',arg1='%u',arg2='%u',arg3='%u'",
- gNotifykey, gNotifyLdbid, gNotifyUserNo, gNotifySeatNo);
+ notifyKey, notifyLdbid, notifyUserNo, notifySeatNo);
// add match for c r e a t e
snprintf(ruleCreated, DbusMatchRuleSize,
"type='signal',interface='org.genivi.persistence.adminconsumer',member='PersistenceResCreate',path='/org/genivi/persistence/adminconsumer',arg0='%s',arg1='%u',arg2='%u',arg3='%u'",
- gNotifykey, gNotifyLdbid, gNotifyUserNo, gNotifySeatNo);
+ notifyKey, notifyLdbid, notifyUserNo, notifySeatNo);
- if(gNotifyPolicy == Notify_register)
+ if(notifyPolicy == Notify_register)
{
dbus_bus_add_match(conn, ruleChanged, NULL);
dbus_bus_add_match(conn, ruleDeleted, NULL);
dbus_bus_add_match(conn, ruleCreated, NULL);
DLT_LOG(gPclDLTContext, DLT_LOG_VERBOSE, DLT_STRING("Registered for change notifications:"), DLT_STRING(ruleChanged));
}
- else if(gNotifyPolicy == Notify_unregister)
+ else if(notifyPolicy == Notify_unregister)
{
dbus_bus_remove_match(conn, ruleChanged, NULL);
dbus_bus_remove_match(conn, ruleDeleted, NULL);
@@ -74,11 +75,12 @@ void process_reg_notification_signal(DBusConnection* conn)
-void process_send_notification_signal(DBusConnection* conn)
+void process_send_notification_signal(DBusConnection* conn, unsigned int notifyLdbid, unsigned int notifyUserNo,
+ unsigned int notifySeatNo, unsigned int notifyReason, const char* notifyKey)
{
dbus_bool_t ret;
DBusMessage* message;
- const char* notifyReason = NULL;
+ const char* notifyReasonString = NULL;
char ldbidArray[DbusSubMatchSize] = {[0 ... DbusSubMatchSize-1] = 0};
char userArray[DbusSubMatchSize] = {[0 ... DbusSubMatchSize-1] = 0};
@@ -86,37 +88,37 @@ void process_send_notification_signal(DBusConnection* conn)
char* pldbidArra = ldbidArray;
char* puserArray = userArray;
char* pseatArray = seatArray;
- char* pnotifyKey = gNotifykey;
+ char* pnotifyKey = (char*)notifyKey;
- switch(gNotifyReason)
+ switch(notifyReason)
{
case pclNotifyStatus_deleted:
- notifyReason = gDeleteSignal;
+ notifyReasonString = gDeleteSignal;
break;
case pclNotifyStatus_created:
- notifyReason = gCreateSignal;
+ notifyReasonString = gCreateSignal;
break;
case pclNotifyStatus_changed:
- notifyReason = gChangeSignal;
+ notifyReasonString = gChangeSignal;
break;
default:
- notifyReason = NULL;
+ notifyReasonString = NULL;
break;
}
- if(notifyReason != NULL)
+ if(notifyReasonString != NULL)
{
// dbus_bus_add_match is used for the notification mechanism,
// and this works only for type DBUS_TYPE_STRING as message arguments
// this is the reason to use string instead of integer types directly
- snprintf(ldbidArray, DbusSubMatchSize, "%u", gNotifyLdbid);
- snprintf(userArray, DbusSubMatchSize, "%u", gNotifyUserNo);
- snprintf(seatArray, DbusSubMatchSize, "%u", gNotifySeatNo);
+ snprintf(ldbidArray, DbusSubMatchSize, "%u", notifyLdbid);
+ snprintf(userArray, DbusSubMatchSize, "%u", notifyUserNo);
+ snprintf(seatArray, DbusSubMatchSize, "%u", notifySeatNo);
//printf("process_send_Notification_Signal => key: %s | lbid: %d | gUserNo: %d | gSeatNo: %d | gReason: %d \n", gNotifykey, gLdbid, gUserNo, gSeatNo, gReason);
message = dbus_message_new_signal("/org/genivi/persistence/adminconsumer", // const char *path,
"org.genivi.persistence.adminconsumer", // const char *interface,
- notifyReason); // const char *name
+ notifyReasonString); // const char *name
ret = dbus_message_append_args(message, DBUS_TYPE_STRING, &pnotifyKey,
DBUS_TYPE_STRING, &pldbidArra,
diff --git a/src/persistence_client_library_dbus_cmd.h b/src/persistence_client_library_dbus_cmd.h
index 529de33..9e15b9b 100644
--- a/src/persistence_client_library_dbus_cmd.h
+++ b/src/persistence_client_library_dbus_cmd.h
@@ -36,7 +36,8 @@ void process_prepare_shutdown(int complete);
*
* @param conn the dbus connection
*/
-void process_send_notification_signal(DBusConnection* conn);
+void process_send_notification_signal(DBusConnection* conn, unsigned int notifyLdbid, unsigned int notifyUserNo,
+ unsigned int notifySeatNo, unsigned int notifyReason, const char* notifyKey);
/**
@@ -44,7 +45,8 @@ void process_send_notification_signal(DBusConnection* conn);
*
* @param conn the dbus connection
*/
-void process_reg_notification_signal(DBusConnection* conn);
+void process_reg_notification_signal(DBusConnection* conn, unsigned int notifyLdbid, unsigned int notifyUserNo,
+ unsigned int notifySeatNo, unsigned int notifyPolicy, const char* notifyKey);
void process_send_lifecycle_request(DBusConnection* conn, unsigned int requestId, unsigned int status);
diff --git a/src/persistence_client_library_dbus_service.c b/src/persistence_client_library_dbus_service.c
index baa1906..29dd912 100644
--- a/src/persistence_client_library_dbus_service.c
+++ b/src/persistence_client_library_dbus_service.c
@@ -45,8 +45,8 @@ pthread_cond_t gMainLoopCond = PTHREAD_COND_INITIALIZER;
pthread_t gMainLoopThread;
-int gEfds; // communication channel int dbus mainloop
-
+//int gEfds; // communication channel int dbus mainloop
+int gPipeFd[2] = {0}; // communication channel int dbus mainloop
typedef enum EDBusObjectType
{
@@ -506,7 +506,8 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
else if (NULL != conn)
{
dbus_connection_set_exit_on_disconnect(conn, FALSE);
- if (-1 == (gEfds = eventfd(0, 0)))
+ //if (-1 == (gEfds = eventfd(0, 0)))
+ if (-1 == (pipe(gPipeFd)))
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => eventfd() failed w/ errno:"), DLT_INT(errno) );
}
@@ -516,7 +517,8 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
memset(&gPollInfo, 0 , sizeof(gPollInfo));
gPollInfo.nfds = 1;
- gPollInfo.fds[0].fd = gEfds;
+ //gPollInfo.fds[0].fd = gEfds;
+ gPollInfo.fds[0].fd = gPipeFd[0];
gPollInfo.fds[0].events = POLLIN;
dbus_bus_add_match(conn, "type='signal',interface='org.genivi.persistence.admin',member='PersistenceModeChanged',path='/org/genivi/persistence/admin'", &err);
@@ -578,14 +580,15 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
}
bContinue = TRUE;
}
- else if (gPollInfo.fds[i].fd == gEfds)
+ //else if (gPollInfo.fds[i].fd == gEfds)
+ else if (gPollInfo.fds[i].fd == gPipeFd[0])
{
/* internal command */
if (0!=(gPollInfo.fds[i].revents & POLLIN))
{
- uint16_t buf[64];
+ tMainLoopData readData;
bContinue = TRUE;
- while ((-1==(ret = read(gPollInfo.fds[i].fd, buf, 64)))&&(EINTR == errno));
+ while ((-1==(ret = read(gPollInfo.fds[i].fd, readData.payload, 128)))&&(EINTR == errno));
if(ret < 0)
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => read() failed"), DLT_STRING(strerror(errno)) );
@@ -593,44 +596,38 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
else
{
pthread_mutex_lock(&gMainCondMtx);
- switch (buf[0])
+ //printf("--- *** --- Receive => mainloop => cmd: %d | string: %s | size: %d\n\n", readData.message.cmd, readData.message.string, ret);
+ switch (readData.message.cmd)
{
case CMD_PAS_BLOCK_AND_WRITE_BACK:
- process_block_and_write_data_back((buf[2]), buf[1]);
- process_send_pas_request(conn, (buf[2]), buf[1]);
+ process_block_and_write_data_back(readData.message.params[1] /*requestID*/, readData.message.params[0] /*status*/);
+ process_send_pas_request(conn, readData.message.params[1] /*request*/, readData.message.params[0] /*status*/);
break;
case CMD_LC_PREPARE_SHUTDOWN:
process_prepare_shutdown(Shutdown_Full);
- process_send_lifecycle_request(conn, (buf[2]), buf[1]);
+ process_send_lifecycle_request(conn, readData.message.params[1] /*requestID*/, readData.message.params[0] /*status*/);
break;
case CMD_SEND_NOTIFY_SIGNAL:
- process_send_notification_signal(conn);
+ process_send_notification_signal(conn, readData.message.params[0] /*ldbid*/, readData.message.params[1], /*user*/
+ readData.message.params[2] /*seat*/, readData.message.params[3], /*reason*/
+ readData.message.string);
break;
case CMD_REG_NOTIFY_SIGNAL:
- process_reg_notification_signal(conn);
+ process_reg_notification_signal(conn, readData.message.params[0] /*ldbid*/, readData.message.params[1], /*user*/
+ readData.message.params[2] /*seat*/, readData.message.params[3], /*,policy*/
+ readData.message.string);
break;
case CMD_SEND_PAS_REGISTER:
- process_send_pas_register(conn, (buf[1]), buf[2]);
+ process_send_pas_register(conn, readData.message.params[0] /*regType*/, readData.message.params[1] /*notifyFlag*/);
break;
case CMD_SEND_LC_REGISTER:
- process_send_lifecycle_register(conn, (buf[1]), buf[2]);
+ process_send_lifecycle_register(conn, readData.message.params[0] /*regType*/, readData.message.params[1] /*mode*/);
break;
case CMD_QUIT:
bContinue = 0;
break;
-
- // ******************************************************
- /*
- case CMD_SEND_LC_REQUEST: // remove
- process_send_lifecycle_request(conn, (buf[2]), buf[1]);
- break;
- case CMD_SEND_PAS_REQUEST: /// remove
- process_send_pas_request(conn, (buf[2]), buf[1]);
- break;
- */
- // ******************************************************
default:
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => command not handled"), DLT_INT(buf[0]) );
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => command not handled"), DLT_INT(readData.message.cmd) );
break;
}
pthread_cond_signal(&gMainLoopCond);
@@ -672,7 +669,9 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
dbus_connection_unregister_object_path(conn, "/org/genivi/NodeStateManager/LifeCycleConsumer");
dbus_connection_unregister_object_path(conn, "/");
}
- close(gEfds);
+ //close(gEfds);
+ close(gPipeFd[0]);
+ close(gPipeFd[1]);
}
dbus_connection_close(conn);
dbus_connection_unref(conn);
@@ -686,16 +685,15 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
-int deliverToMainloop(tCmd mainloopCmd, unsigned int param1, unsigned int param2)
+int deliverToMainloop(tMainLoopData* payload)
{
int rval = 0;
pthread_mutex_lock(&gDeliverpMtx);
-
pthread_mutex_lock(&gMainCondMtx);
- deliverToMainloop_NM(mainloopCmd, param1, param2);
+ deliverToMainloop_NM(payload);
pthread_cond_wait(&gMainLoopCond, &gMainCondMtx);
pthread_mutex_unlock(&gMainCondMtx);
@@ -706,14 +704,15 @@ int deliverToMainloop(tCmd mainloopCmd, unsigned int param1, unsigned int param2
return rval;
}
-int deliverToMainloop_NM(tCmd mainloopCmd, unsigned int param1, unsigned int param2)
+int deliverToMainloop_NM(tMainLoopData* payload)
{
- int rval = 0;
- uint64_t cmd;
+ int rval = 0, length = 128;
+
+ //length = sizeof(payload->message) + strlen(payload->message.string) + 1; // TODO calculate the correct length of the message
- cmd = ( ((uint64_t)param2 << 32) | ((uint64_t)param1 << 16) | mainloopCmd);
+ //printf("--- *** --- Send => deliverToMainloop_NM => %d: | String: %s | size: %d\n", payload->message.cmd, payload->message.string, length);
- if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+ if(-1 == write(gPipeFd[1], payload->payload, length))
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deliverToMainloop => failed to write to pipe"), DLT_INT(errno));
rval = -1;
diff --git a/src/persistence_client_library_dbus_service.h b/src/persistence_client_library_dbus_service.h
index db0572f..f03a494 100644
--- a/src/persistence_client_library_dbus_service.h
+++ b/src/persistence_client_library_dbus_service.h
@@ -25,6 +25,8 @@
#include <sys/eventfd.h>
#include <sys/timerfd.h>
+#include "persistence_client_library_data_organization.h"
+
/// mutex to make sure main loop is running
extern pthread_mutex_t gDbusInitializedMtx;
extern pthread_cond_t gDbusInitializedCond;
@@ -47,14 +49,23 @@ typedef enum ECmd
CMD_LC_PREPARE_SHUTDOWN, /// command to prepare shutdown
CMD_SEND_NOTIFY_SIGNAL, /// command send changed notification signal
CMD_REG_NOTIFY_SIGNAL, /// command send register/unregister command
- //CMD_SEND_PAS_REQUEST, /// command send admin request
CMD_SEND_PAS_REGISTER, /// command send admin register/unregister
- //CMD_SEND_LC_REQUEST, /// command send lifecycle request
CMD_SEND_LC_REGISTER, /// command send lifecycle register/unregister
CMD_QUIT /// quit command
} tCmd;
+/// command data union definition
+typedef union MainLoopData{
+ struct {
+ uint32_t cmd; /// dbus mainloop command
+ uint32_t params[4]; /// unsignet int parameters
+ char string[DbKeyMaxLen]; /// char parameter
+ } message;
+ char payload[128];
+} tMainLoopData;
+
+
/// pipe file descriptors
extern int gEfds;
@@ -82,10 +93,10 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
int setup_dbus_mainloop(void);
-int deliverToMainloop(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
+int deliverToMainloop(tMainLoopData* payload);
-int deliverToMainloop_NM(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
+int deliverToMainloop_NM(tMainLoopData* payload);
#endif /* PERSISTENCE_CLIENT_LIBRARY_DBUS_SERVICE_H_ */
diff --git a/src/persistence_client_library_lc_interface.c b/src/persistence_client_library_lc_interface.c
index dbdefde..45920f7 100644
--- a/src/persistence_client_library_lc_interface.c
+++ b/src/persistence_client_library_lc_interface.c
@@ -44,7 +44,13 @@ int check_lc_request(unsigned int request, unsigned int requestID)
{
case NsmShutdownNormal:
{
- if(-1 == deliverToMainloop_NM(CMD_LC_PREPARE_SHUTDOWN, request, requestID) )
+ tMainLoopData data;
+ data.message.cmd = (uint32_t)CMD_LC_PREPARE_SHUTDOWN;
+ data.message.params[0] = request;
+ data.message.params[1] = requestID;
+ data.message.string[0] = '\0'; // no string parameter, set to 0
+
+ if(-1 == deliverToMainloop_NM(&data) )
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("check_lc_request => failed to write to pipe"), DLT_INT(errno));
rval = NsmErrorStatus_Fail;
@@ -148,13 +154,27 @@ DBusHandlerResult checkLifecycleMsg(DBusConnection * connection, DBusMessage * m
int register_lifecycle(int shutdownMode)
{
- return deliverToMainloop(CMD_SEND_LC_REGISTER, 1, shutdownMode);
+ tMainLoopData data;
+
+ data.message.cmd = (uint32_t)CMD_SEND_LC_REGISTER;
+ data.message.params[0] = 1;
+ data.message.params[1] = shutdownMode;
+ data.message.string[0] = '\0'; // no string parameter, set to 0
+
+ return deliverToMainloop(&data);
}
int unregister_lifecycle(int shutdownMode)
{
- return deliverToMainloop(CMD_SEND_LC_REGISTER, 0, shutdownMode);
+ tMainLoopData data;
+
+ data.message.cmd = (uint32_t)CMD_SEND_LC_REGISTER;
+ data.message.params[0] = 0;
+ data.message.params[1] = shutdownMode;
+ data.message.string[0] = '\0'; // no string parameter, set to 0
+
+ return deliverToMainloop(&data);
}
diff --git a/src/persistence_client_library_pas_interface.c b/src/persistence_client_library_pas_interface.c
index 820ff64..89ce225 100644
--- a/src/persistence_client_library_pas_interface.c
+++ b/src/persistence_client_library_pas_interface.c
@@ -53,8 +53,15 @@ int check_pas_request(unsigned int request, unsigned int requestID)
{
case (PasMsg_Block|PasMsg_WriteBack):
{
+ tMainLoopData data;
+
+ data.message.cmd = (uint32_t)CMD_PAS_BLOCK_AND_WRITE_BACK;
+ data.message.params[0] = request;
+ data.message.params[1] = requestID;
+ data.message.string[0] = '\0'; // no string parameter, set to 0
+
DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("PCL: check_pas_request; case PasMsg_Block o. PasMsg_WriteBack"));
- if(-1 == deliverToMainloop_NM(CMD_PAS_BLOCK_AND_WRITE_BACK, request, requestID))
+ if(-1 == deliverToMainloop_NM(&data))
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("write failed w/ errno "), DLT_INT(errno), DLT_STRING(strerror(errno)));
rval = PasErrorStatus_FAIL;
@@ -226,7 +233,14 @@ int register_pers_admin_service(void)
{
int rval = 0;
- if(-1 == deliverToMainloop(CMD_SEND_PAS_REGISTER, 1, (PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock)))
+ tMainLoopData data;
+
+ data.message.cmd = (uint32_t)CMD_SEND_PAS_REGISTER;
+ data.message.params[0] = 1;
+ data.message.params[1] = (PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock);
+ data.message.string[0] = '\0'; // no string parameter, set to 0
+
+ if(-1 == deliverToMainloop(&data))
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("register_pers_admin_service => failed to write to pipe"), DLT_INT(errno));
rval = -1;
@@ -245,7 +259,13 @@ int unregister_pers_admin_service(void)
{
int rval = 0;
- if(-1 == deliverToMainloop(CMD_SEND_PAS_REGISTER, 0, (PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock)))
+ tMainLoopData data;
+ data.message.cmd = (uint32_t)CMD_SEND_PAS_REGISTER;
+ data.message.params[0] = 0;
+ data.message.params[1] = (PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock);
+ data.message.string[0] = '\0'; // no string parameter, set to 0
+
+ if(-1 == deliverToMainloop(&data))
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("unregister_pers_admin_service => failed to write to pipe"), DLT_INT(errno));
rval = -1;