diff options
author | Ingo Huerner <ingo_huerner@mentor.com> | 2017-03-30 10:41:36 +0200 |
---|---|---|
committer | Ingo Huerner <ingo_huerner@mentor.com> | 2017-03-30 10:41:36 +0200 |
commit | dabd117ee5728dfbe3ac3d3dd312cfded0da6048 (patch) | |
tree | 4c3016ae672d6929b22ecd4cb5987e8380335350 | |
parent | 40d76047857da753851ac7906b77a6b120f353bd (diff) | |
download | persistence-client-library-dabd117ee5728dfbe3ac3d3dd312cfded0da6048.tar.gz |
Added configure switch --enable-fsync to use fsync instead fdatasync.
Added more dlt logs for dbus communication.
-rw-r--r-- | configure.ac | 44 | ||||
-rw-r--r-- | src/persistence_client_library.c | 8 | ||||
-rw-r--r-- | src/persistence_client_library_dbus_cmd.c | 17 | ||||
-rw-r--r-- | src/persistence_client_library_file.c | 6 | ||||
-rw-r--r-- | src/persistence_client_library_lc_interface.c | 2 | ||||
-rw-r--r-- | src/persistence_client_library_pas_interface.c | 2 |
6 files changed, 48 insertions, 31 deletions
diff --git a/configure.ac b/configure.ac index af74151..a17d775 100644 --- a/configure.ac +++ b/configure.ac @@ -148,29 +148,6 @@ fi ###################################################################### -# enable tracing ########### -#AC_ARG_ENABLE([xstrace], -# [AS_HELP_STRING([--enable-xstrace],[Enable xstrace])], -# [use_xstrace=$enableval], -# [use_xstrace="no"]) -# -#AM_CONDITIONAL([USE_XSTRACE_PERS], [test x"$use_xstrace" = "no"]) -# -#if test "$use_xstrace" != "yes" -a "$use_xstrace" != "no"; then -# AC_MSG_ERROR([Invalid tracing check mode specified: $use_xstrace. Only "yes" or "no" is valid]) -#else -# AC_MSG_NOTICE([Use tracing: $use_xstrace]) - -# if test "$use_xstrace" = "yes"; then -# AC_CHECK_HEADERS([xsm_user.h]) -# AC_DEFINE_UNQUOTED([USE_XSTRACE_PERS], [1], [tracing enabled]) -# else -# AC_DEFINE_UNQUOTED([USE_XSTRACE_PERS], [0], [tracing disabled]) -# fi -#fi -###################################################################### - - # enable persistence application security check ########### AC_ARG_ENABLE([appcheck], [AS_HELP_STRING([--enable-appcheck],[Enable application security check])], @@ -190,6 +167,7 @@ else fi ###################################################################### + AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debugging, default: no]), @@ -201,6 +179,26 @@ esac], [debug=false]) AM_CONDITIONAL(DEBUG, test x"$debug" = x"true") +###################################################################### + +# enable to use fsync instead of fdatasync for write through ######### +AC_ARG_ENABLE([fsync], + [AS_HELP_STRING([--enable-fsync],[Enable fsync instead of fdatasync])], + [use_fsync=$enableval], + [use_fsync="no"]) + +AM_CONDITIONAL([USE_FSYNC], [test x"$use_fsync" = "no"]) + +if test "$use_fsync" != "yes" -a "$use_fsync" != "no"; then + AC_MSG_ERROR([Invalid fsync check check: $use_fsync. Only "yes" or "no" is valid]) +else + AC_MSG_NOTICE([Use fsync: $use_fsync]) + + if test "$use_fsync" = "yes"; then + AC_DEFINE_UNQUOTED([USE_FSYNC], [1], [fsync is anabled]) + fi +fi +###################################################################### AC_CONFIG_FILES([Makefile diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c index f64a5bd..e3c0f6e 100644 --- a/src/persistence_client_library.c +++ b/src/persistence_client_library.c @@ -282,8 +282,14 @@ static int private_pclInitLibrary(const char* appName, int shutdownMode) gIsNodeStateManager = 1; } +#if USE_FSYNC + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("Using fsync version")); +#else + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("Using datasync version (DEFAULT)")); +#endif + #if USE_FILECACHE - DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("Using the filecache!!!")); + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("Using the filecache")); pfcInitCache(appName); #endif diff --git a/src/persistence_client_library_dbus_cmd.c b/src/persistence_client_library_dbus_cmd.c index 7c881df..7a1b417 100644 --- a/src/persistence_client_library_dbus_cmd.c +++ b/src/persistence_client_library_dbus_cmd.c @@ -271,9 +271,10 @@ void process_send_pas_request(DBusConnection* conn, unsigned int requestID, int dbus_message_append_args(message, DBUS_TYPE_UINT32, &requestID, DBUS_TYPE_INT32, &status, DBUS_TYPE_INVALID); + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("sendPasRequest - pas_request"), DLT_UINT(requestID), DLT_INT(status) ); if(!dbus_connection_send(conn, message, 0)) { - DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendLcmReg - Access denied"), DLT_STRING(error.message) ); + DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendPasRequest - Access denied"), DLT_STRING(error.message) ); } dbus_connection_flush(conn); @@ -281,12 +282,12 @@ void process_send_pas_request(DBusConnection* conn, unsigned int requestID, int } else { - DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendLcmReg - Inval msg") ); + DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendPasRequest - Inval msg") ); } } else { - DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendLcmReg - Inval con") ); + DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendPasRequest - Inval con") ); } } @@ -300,8 +301,6 @@ void process_send_pas_register(DBusConnection* conn, int regType, int notificati char* method = NULL; - DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("sendPasReg - Type:"), DLT_INT(regType) ); - if(regType == 0) method = "UnRegisterPersAdminNotification"; else if(regType == 1) @@ -311,6 +310,8 @@ void process_send_pas_register(DBusConnection* conn, int regType, int notificati { const char* busName = dbus_bus_get_unique_name(conn); + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("sendPasRegister - Type:"), DLT_INT(regType), DLT_STRING(busName) ); + if(busName != NULL) { DBusMessage* message = dbus_message_new_method_call(gDbusPersAdminInterface, // destination @@ -364,8 +365,6 @@ void process_send_lifecycle_register(DBusConnection* conn, int regType, int shut char* method = NULL; - DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("sendLcmReg - Type:"), DLT_INT(regType) ); - if(regType == 1) method = "RegisterShutdownClient"; else if(regType == 0) @@ -375,6 +374,8 @@ void process_send_lifecycle_register(DBusConnection* conn, int regType, int shut { const char* busName = dbus_bus_get_unique_name(conn); + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("sendLcmRegister - Type:"), DLT_INT(regType), DLT_STRING(busName) ); + DBusMessage* message = dbus_message_new_method_call(gDbusLcConsDest, // destination gDbusLcCons, // path gDbusLcInterface, // interface @@ -431,6 +432,7 @@ void process_send_lifecycle_request(DBusConnection* conn, unsigned int requestId dbus_message_append_args(message, DBUS_TYPE_INT32, &requestId, DBUS_TYPE_INT32, &status, DBUS_TYPE_INVALID); + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("sendLcmRequest: "), DLT_UINT(requestId), DLT_UINT(status) ); if(!dbus_connection_send(conn, message, 0)) { DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendLcmRequest - Access denied"), DLT_STRING(error.message) ); @@ -464,6 +466,7 @@ void msg_pending_func(DBusPendingCall *call, void *data) pthread_mutex_lock(&gDbusPendingRegMtx); + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("msgPendFunc - steal_reply: ")); message = dbus_pending_call_steal_reply(call); if(dbus_set_error_from_message(&err, message)) diff --git a/src/persistence_client_library_file.c b/src/persistence_client_library_file.c index d73e066..714bd08 100644 --- a/src/persistence_client_library_file.c +++ b/src/persistence_client_library_file.c @@ -804,8 +804,14 @@ int pclFileWriteData(int fd, const void * buffer, int buffer_size) size = (int)write(fd, buffer, (size_t)buffer_size); if(get_file_cache_status(fd) == 1) { +#if USE_FSYNC if(fsync(fd) == -1) +#else + if(fdatasync(fd) == -1) +#endif + { DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("fileWriteData - Failed fsync ==>!"), DLT_STRING(strerror(errno))); + } } #endif } diff --git a/src/persistence_client_library_lc_interface.c b/src/persistence_client_library_lc_interface.c index af9ddfa..8b2265e 100644 --- a/src/persistence_client_library_lc_interface.c +++ b/src/persistence_client_library_lc_interface.c @@ -92,6 +92,8 @@ int msg_lifecycleRequest(DBusConnection *connection, DBusMessage *message) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("msg_lifecycleRequest"), DLT_UINT(request), DLT_UINT(requestID) ); + msgReturn = check_lc_request(request, requestID); reply = dbus_message_new_method_return(message); diff --git a/src/persistence_client_library_pas_interface.c b/src/persistence_client_library_pas_interface.c index cda4e01..85b2735 100644 --- a/src/persistence_client_library_pas_interface.c +++ b/src/persistence_client_library_pas_interface.c @@ -122,6 +122,8 @@ DBusHandlerResult msg_persAdminRequest(DBusConnection *connection, DBusMessage * return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } + + DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("msg_persAdminRequest"), DLT_INT(request), DLT_INT(requestID) ); errorReturn = check_pas_request((unsigned int)request, (unsigned int)requestID); reply = dbus_message_new_method_return(message); |