diff options
author | Ingo Huerner <ingo.huerner@xse.de> | 2013-05-03 09:15:10 +0200 |
---|---|---|
committer | Ingo Huerner <ingo.huerner@xse.de> | 2013-05-03 09:15:10 +0200 |
commit | d4955ce50d9e3742103e21d9377b3567399aa9ef (patch) | |
tree | 9fdd19162fe3f8ccfd414a160f5e2bfa3f048faf /src/persistence_client_library_key.c | |
parent | 20075d4a4ab86720f0c11dca55726847db61898f (diff) | |
download | persistence-client-library-d4955ce50d9e3742103e21d9377b3567399aa9ef.tar.gz |
Added dlt messages; removed setting of comipler flags in configure.ac
Diffstat (limited to 'src/persistence_client_library_key.c')
-rw-r--r-- | src/persistence_client_library_key.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/persistence_client_library_key.c b/src/persistence_client_library_key.c index 0256173..43352ec 100644 --- a/src/persistence_client_library_key.c +++ b/src/persistence_client_library_key.c @@ -43,6 +43,8 @@ int pclKeyHandleOpen(unsigned int ldbid, const char* resource_id, unsigned int u char dbKey[DbKeyMaxLen]; // database key char dbPath[DbPathMaxLen]; // database location + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyHandleOpen: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); + memset(dbKey, 0, DbKeyMaxLen); memset(dbPath, 0, DbPathMaxLen); @@ -91,12 +93,14 @@ int pclKeyHandleOpen(unsigned int ldbid, const char* resource_id, unsigned int u else { printf("pclKeyHandleOpen: error - handleId out of bounds [%d]\n", handle); + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclKeyHandleOpen: error - handleId out of bounds:"), DLT_INT(handle)); } } } else { printf("pclKeyHandleOpen: error - no database context or resource is not a key \n"); + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclKeyHandleOpen: error - no database context or resource is not a key ")); } @@ -109,6 +113,10 @@ int pclKeyHandleClose(int key_handle) { int rval = 0; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyHandleClose: "), + // DLT_INT(gKeyHandleArray[key_handle].info.context.ldbid), DLT_STRING(gKeyHandleArray[key_handle].resourceID) ); + + if(key_handle < MaxPersHandle) { if(PersistenceStorage_custom == gKeyHandleArray[key_handle].info.configKey.storage ) @@ -148,6 +156,9 @@ int pclKeyHandleGetSize(int key_handle) { int size = 0; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyHandleGetSize: "), + // DLT_INT(gKeyHandleArray[key_handle].info.context.ldbid), DLT_STRING(gKeyHandleArray[key_handle].resourceID) ); + if(key_handle < MaxPersHandle) { if(PersistenceStorage_custom == gKeyHandleArray[key_handle].info.configKey.storage) @@ -178,6 +189,10 @@ int pclKeyHandleGetSize(int key_handle) int pclKeyHandleReadData(int key_handle, unsigned char* buffer, int buffer_size) { int size = 0; + + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyHandleReadData: "), + // DLT_INT(gKeyHandleArray[key_handle].info.context.ldbid), DLT_STRING(gKeyHandleArray[key_handle].resourceID) ); + if(key_handle < MaxPersHandle) { if(PersistenceStorage_custom == gKeyHandleArray[key_handle].info.configKey.storage) @@ -209,6 +224,9 @@ int pclKeyHandleRegisterNotifyOnChange(int key_handle, pclChangeNotifyCallback_t { int rval = -1; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyHandleRegisterNotifyOnChange: "), + // DLT_INT(gKeyHandleArray[key_handle].info.context.ldbid), DLT_STRING(gKeyHandleArray[key_handle].resourceID) ); + if(key_handle < MaxPersHandle) { rval = pclKeyRegisterNotifyOnChange(gKeyHandleArray[key_handle].info.context.ldbid, @@ -226,6 +244,9 @@ int pclKeyHandleWriteData(int key_handle, unsigned char* buffer, int buffer_size { int size = 0; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyHandleWriteData: "), + // DLT_INT(gKeyHandleArray[key_handle].info.context.ldbid), DLT_STRING(gKeyHandleArray[key_handle].resourceID) ); + if(AccessNoLock != isAccessLocked() ) // check if access to persistent data is locked { if(buffer_size <= gMaxKeyValDataSize) // check data size @@ -259,6 +280,7 @@ int pclKeyHandleWriteData(int key_handle, unsigned char* buffer, int buffer_size else { printf("pclKeyHandleWriteData: error - buffer_size to big, limit is [%d] bytes\n", gMaxKeyValDataSize); + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclKeyHandleWriteData: error - buffer_size to big, limit is [bytes]:"), DLT_INT(gMaxKeyValDataSize)); } } else @@ -283,6 +305,8 @@ int pclKeyDelete(unsigned int ldbid, const char* resource_id, unsigned int user_ { int rval = 0; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyDelete: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); + if(AccessNoLock != isAccessLocked() ) // check if access to persistent data is locked { PersistenceInfo_s dbContext; @@ -339,6 +363,8 @@ int pclKeyGetSize(unsigned int ldbid, const char* resource_id, unsigned int user dbContext.context.seat_no = seat_no; dbContext.context.user_no = user_no; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyGetSize: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); + // get database context: database path and database key data_size = get_db_context(&dbContext, resource_id, ResIsNoFile, dbKey, dbPath); if( (data_size >= 0) @@ -370,6 +396,8 @@ int pclKeyReadData(unsigned int ldbid, const char* resource_id, unsigned int use { int data_size = 0; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyReadData: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); + if(AccessNoLock != isAccessLocked() ) // check if access to persistent data is locked { PersistenceInfo_s dbContext; @@ -403,6 +431,7 @@ int pclKeyReadData(unsigned int ldbid, const char* resource_id, unsigned int use else { printf("pclKeyReadData - error - no database context or resource is not a key\n"); + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclKeyReadData - error - no database context or resource is not a key")); } } else @@ -420,6 +449,8 @@ int pclKeyWriteData(unsigned int ldbid, const char* resource_id, unsigned int us { int data_size = 0; + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyWriteData: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); + if(AccessNoLock != isAccessLocked() ) // check if access to persistent data is locked { if(buffer_size <= gMaxKeyValDataSize) // check data size @@ -460,12 +491,14 @@ int pclKeyWriteData(unsigned int ldbid, const char* resource_id, unsigned int us else { printf("pclKeyWriteData: error - no database context or resource is not a key\n"); + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclKeyWriteData - error - no database context or resource is not a key")); } } else { data_size = EPERS_BUFLIMIT; printf("pclKeyWriteData: error - buffer_size to big, limit is [%d] bytes\n", gMaxKeyValDataSize); + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclKeyWriteData: error - buffer_size to big, limit is [bytes]:"), DLT_INT(gMaxKeyValDataSize)); } } else @@ -489,6 +522,8 @@ int pclKeyRegisterNotifyOnChange(unsigned int ldbid, const char* resource_id, un memset(dbKey, 0, DbKeyMaxLen); memset(dbPath, 0, DbPathMaxLen); + //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyRegisterNotifyOnChange: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); + dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; dbContext.context.user_no = user_no; @@ -505,6 +540,7 @@ int pclKeyRegisterNotifyOnChange(unsigned int ldbid, const char* resource_id, un else { printf("pclKeyRegisterNotifyOnChange: error - resource is not a shared resource or resource is not a key\n"); + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclKeyRegisterNotifyOnChange: error - resource is not a shared resource or resource is not a key")); rval = EPERS_RES_NO_KEY; } |