#include "persistence_client_library_custom_loader.h"
#include "persistence_client_library.h"
#include "persistence_client_library_backup_filelist.h"
+#include "../include_protected/persistence_client_library_db_access.h"
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
+#include <sys/sendfile.h>
/// structure definition for a key value item
int pclRecoverFromBackup(int backupFd, const char* original)
{
int handle = 0;
- int readSize = 0;
- char buffer[RDRWBufferSize];
handle = open(original, O_TRUNC | O_RDWR);
if(handle != -1)
{
int dstFd = 0, csfd = 0;
int readSize = -1;
- char buffer[RDRWBufferSize];
if(access(dstPath, F_OK) != 0)
{
*/
+#include "../include_protected/persistence_client_library_rc_table.h"
+
/**
* @brief Read the blacklist configuration file
*
inline int pclBackupNeeded(const char* path);
+/**
+ * @brief translate persistence permission into POSIX file open permissions
+ *
+ * @param
+ *
+ * @return
+ */
+int pclGetPosixPermission(PersistencePermission_e permission);
+
+
+
+/**
+ * @brief create the file and the given path
+ *
+ * @param
+ *
+ * @return
+ */
+int pclCreateFileAndPath(const char* path);
+
+
#endif /* PERS_BACKUP_BLACKLIST_H */
#include "../include_protected/persistence_client_library_rc_table.h"
#include "persistence_client_library_custom_loader.h"
#include "persistence_client_library_itzam_errors.h"
+#include "persistence_client_library_prct_access.h"
#include "persistence_client_library_dbus_service.h"
// function prototype
int pers_send_Notification_Signal(const char* key, PersistenceDbContext_s* context, unsigned int reason);
-int pers_get_default_data(char* dbPath, char* key, char* buffer, unsigned int buffer_size);
+int pers_get_default_data(char* dbPath, char* key, unsigned char* buffer, unsigned int buffer_size);
{
itzam_btree* btree = NULL;
int keyFound = 0;
- itzam_state state = ITZAM_FAILED;
btree = pers_db_open(info, dbPath);
if(btree != NULL)
-int pers_get_default_data(char* dbPath, char* key, char* buffer, unsigned int buffer_size)
+int pers_get_default_data(char* dbPath, char* key, unsigned char* buffer, unsigned int buffer_size)
{
int keyFound = 0;
int read_size = 0;
#include "persistence_client_library_itzam_errors.h"
#include "persistence_client_library_custom_loader.h"
#include "persistence_client_library_prct_access.h"
+#include "persistence_client_library_pas_interface.h"
#include "../include_protected/persistence_client_library_data_organization.h"
#include "../include_protected/persistence_client_library_db_access.h"
#include <itzam.h>
+#include <dlfcn.h>
// function prototype
{
DBusError error;
dbus_error_init (&error);
- int rval = 0;
DBusMessage* message = dbus_message_new_method_call("org.genivi.persistence.admin", // destination
"/org/genivi/persistence/admin", // path
if(!dbus_connection_send(conn, message, 0))
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) );
- rval = -1;
}
dbus_connection_flush(conn);
void process_send_lifecycle_register(DBusConnection* conn, int regType, int shutdownMode)
{
- int rval = 0;
-
DBusError error;
dbus_error_init (&error);
if(!dbus_connection_send(conn, message, 0))
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) );
- rval = -1;
}
dbus_connection_flush(conn);
dbus_message_unref(message);
void process_send_lifecycle_request(DBusConnection* conn, int requestId, int status)
{
- int rval = 0;
DBusError error;
dbus_error_init (&error);
if(!dbus_connection_send(conn, message, 0))
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => Access denied"), DLT_STRING(error.message) );
- rval = -1;
}
dbus_connection_flush(conn);
else
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => ERROR: Invalid message"));
- rval = -1;
}
}
else
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => ERROR: connection isn NULL"));
- rval = -1;
}
}
#include "persistence_client_library_dbus_service.h"
#include "persistence_client_library_lc_interface.h"
#include "persistence_client_library_pas_interface.h"
+#include "persistence_client_library_dbus_cmd.h"
#include "../include_protected/persistence_client_library_data_organization.h"
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "persistence_client_library_custom_loader.h"
+// function declaration
+int handleRegNotifyOnChange(int key_handle, pclChangeNotifyCallback_t callback, PersNotifyRegPolicy_e regPolicy);
+int regNotifyOnChange(unsigned int ldbid, const char* resource_id, unsigned int user_no, unsigned int seat_no,
+ pclChangeNotifyCallback_t callback, PersNotifyRegPolicy_e regPolicy);
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// function with handle
/// pointer to resource table database
-itzam_btree gResource_table[PrctDbTableSize] = {0};
+itzam_btree gResource_table[PrctDbTableSize] = {{0}};
/// array to hold the information of database is already open
int gResourceOpen[PrctDbTableSize] = {0};
X_TEST_REPORT_DESCRIPTION("Test of data handle");
X_TEST_REPORT_TYPE(GOOD);
- int handle1 = 0, handle2 = 0, size = 0;
+ int handle1 = 0, handle2 = 0;
int handleArray[4] = {0};
int ret = 0;
unsigned char buffer[READ_SIZE] = {0};
handleArray[3] = pclFileOpen(0xFF, "media/mediaDB_write_04.db", 1, 1);
x_fail_unless(handle1 != -1, "Could not open file ==> /media/mediaDB_write_04.db");
- size = pclFileReadData(handleArray[0], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[0], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_01.db",
strlen("/user/1/seat/1/media/mediaDB_write_01.db"))
== 0, "Buffer not correctly read => mediaDB_write_01.db");
- size = pclFileReadData(handleArray[1], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[1], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_02.db",
strlen("/user/1/seat/1/media/mediaDB_write_02.db"))
== 0, "Buffer not correctly read => mediaDB_write_02.db");
- size = pclFileReadData(handleArray[2], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[2], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_03.db",
strlen("/user/1/seat/1/media/mediaDB_write_03.db"))
== 0, "Buffer not correctly read => mediaDB_write_03.db");
- size = pclFileReadData(handleArray[3], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[3], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_04.db",
strlen("/user/1/seat/1/media/mediaDB_write_04.db"))
== 0, "Buffer not correctly read => mediaDB_write_04.db");
START_TEST(test_InitDeinit)
{
- int ret = 0, i = 0;
+ int i = 0;
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
for(i=0; i< 3; i++)
{
// initialize and deinitialize 1. time
- ret = pclInitLibrary(gTheAppId, shutdownReg);
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
pclDeinitLibrary();
// initialize and deinitialize 2. time
- ret = pclInitLibrary(gTheAppId, shutdownReg);
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
pclDeinitLibrary();
// initialize and deinitialize 3. time
- ret = pclInitLibrary(gTheAppId, shutdownReg);
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
pclDeinitLibrary();
}
}
{
int nr_failed = 0,
nr_run = 0,
- fail = 0,
i = 0;
+ //int fail = 0;
TestResult** tResult;
tResult = srunner_results(sr);
for(i = 0; i< nr_run; i++)
{
- fail = tr_rtype(tResult[i]); // get status of each test
+ (void)tr_rtype(tResult[i]); // get status of each test
+ //fail = tr_rtype(tResult[i]); // get status of each test
//printf("[%d] Fail: %d \n", i, fail);
}