summaryrefslogtreecommitdiff
path: root/src/persistence_client_library_custom_loader.c
diff options
context:
space:
mode:
authorihuerner <ihuerner@b9707d8c-442e-47db-affb-152dabb2260b>2012-10-15 09:07:50 +0000
committerihuerner <ihuerner@b9707d8c-442e-47db-affb-152dabb2260b>2012-10-15 09:07:50 +0000
commitcaedd57d02b5922376db6b7b9c32aef927158287 (patch)
tree96b342a44098a03d7a2d63f54816c4d52b8b5f82 /src/persistence_client_library_custom_loader.c
parent2c0f7bd744873bbc674b7bc37744497a513c47b8 (diff)
downloadpersistence-client-library-caedd57d02b5922376db6b7b9c32aef927158287.tar.gz
Updated client library with version 0.1.5 (rev. 1665), for changes see change log
Diffstat (limited to 'src/persistence_client_library_custom_loader.c')
-rw-r--r--src/persistence_client_library_custom_loader.c68
1 files changed, 54 insertions, 14 deletions
diff --git a/src/persistence_client_library_custom_loader.c b/src/persistence_client_library_custom_loader.c
index ef6de9d..d619968 100644
--- a/src/persistence_client_library_custom_loader.c
+++ b/src/persistence_client_library_custom_loader.c
@@ -170,7 +170,7 @@ int get_custom_libraries()
}
else
{
- return -1; // out of array bounds
+ return EPERS_OUTOFBOUNDS; // out of array bounds
}
// get the library name
@@ -190,7 +190,7 @@ int get_custom_libraries()
}
else
{
- rval = -1;
+ rval = EPERS_OUTOFBOUNDS;
break;
}
}
@@ -225,16 +225,19 @@ int get_custom_libraries()
}
else
{
+ rval = EPERS_CONFIGMAPFAILED;
printf("load config file error - mapping of file failed");
}
}
else
{
+ rval = EPERS_CONFIGNOTAVAILABLE;
printf("load config file error - no file with plugins available -> filename: %s | error: %s \n", filename, strerror(errno) );
}
}
else
{
+ rval = EPERS_CONFIGNOSTAT;
printf("load config file error - can't stat config file: %s | %s \n", filename, strerror(errno));
}
return rval;
@@ -260,49 +263,56 @@ int load_custom_library(PersistenceCustomLibs_e customLib, Pers_custom_functs_s
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
}
// custom_plugin_delete_data
*(void **) (&customFuncts->custom_plugin_delete_data) = dlsym(handle, "plugin_delete_data");
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
}
// custom_plugin_get_data
*(void **) (&customFuncts->custom_plugin_get_data_handle) = dlsym(handle, "plugin_get_data_handle");
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
}
// custom_plugin_get_data
*(void **) (&customFuncts->custom_plugin_get_data) = dlsym(handle, "plugin_get_data");
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
}
// custom_plugin_init
*(void **) (&customFuncts->custom_plugin_init) = dlsym(handle, "plugin_init");
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
+ }
+ // custom_plugin_deinit
+ *(void **) (&customFuncts->custom_plugin_deinit) = dlsym(handle, "plugin_deinit");
+ if ((error = dlerror()) != NULL)
+ {
+ printf("load_custom_library - error: %s\n", error);
+ return EPERS_NOPLUGINFCNT;
}
// custom_plugin_open
*(void **) (&customFuncts->custom_plugin_open) = dlsym(handle, "plugin_open");
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
}
// custom_plugin_set_data
*(void **) (&customFuncts->custom_plugin_set_data_handle) = dlsym(handle, "plugin_set_data");
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
}
// custom_plugin_set_data
*(void **) (&customFuncts->custom_plugin_set_data) = dlsym(handle, "plugin_set_data");
@@ -310,19 +320,49 @@ int load_custom_library(PersistenceCustomLibs_e customLib, Pers_custom_functs_s
{
printf("load_custom_library - error: %s\n", error);
return -1;
- }
+ }
+ // custom_plugin_get_size_handle
+ *(void **) (&customFuncts->custom_plugin_get_size_handle) = dlsym(handle, "plugin_get_size_handle");
+ if ((error = dlerror()) != NULL)
+ {
+ printf("load_custom_library - error: %s\n", error);
+ return -1;
+ }
+ // custom_plugin_get_size
+ *(void **) (&customFuncts->custom_plugin_get_size) = dlsym(handle, "plugin_get_size");
+ if ((error = dlerror()) != NULL)
+ {
+ printf("load_custom_library - error: %s\n", error);
+ return -1;
+ }
+ // create backup
+ *(void **) (&customFuncts->custom_plugin_backup_create) = dlsym(handle, "plugin_backup_create");
+ if ((error = dlerror()) != NULL)
+ {
+ printf("load_custom_library - error: %s\n", error);
+ return -1;
+ }
+ // restore backup
+ *(void **) (&customFuncts->custom_plugin_backup_restore) = dlsym(handle, "plugin_backup_restore");
+ if ((error = dlerror()) != NULL)
+ {
+ printf("load_custom_library - error: %s\n", error);
+ return -1;
+ }
+
+
// custom_plugin_get_status_notification_clbk
*(void **) (&customFuncts->custom_plugin_get_status_notification_clbk) = dlsym(handle, "plugin_get_status_notification_clbk");
if ((error = dlerror()) != NULL)
{
printf("load_custom_library - error: %s\n", error);
- return -1;
+ return EPERS_NOPLUGINFCNT;
}
}
else
{
printf("load_custom_library - error: %s\n", dlerror());
- rval = -1;
+ rval = EPERS_DLOPENERROR;
}
}
@@ -338,10 +378,10 @@ int load_all_custom_libraries()
for(i=0; i<gNumOfCustomLibraries; i++)
{
- if( load_custom_library(i, &gPersCustomFuncs[i] ) == -1)
+ rval = load_custom_library(i, &gPersCustomFuncs[i]);
+ if( rval < 0)
{
// printf("load_all_custom_libraries - error loading library number [%d] \n", i);
- rval = -1;
break;
}
}