return 1;
}
-void external_free_plugin_names(char **tab, int count)
+static void free_plugin_names(char **tab, int count)
{
for (int i = 0; i < count; ++i)
free(tab[i]);
free(tab);
}
-char **external_get_plugin_names(size_t *plugin_count)
+static char **get_plugin_names(size_t *plugin_count)
{
char **tab = NULL;
struct dirent **entries = NULL;
tab[0] = strdup(EXTERNAL_SYSTEM_INFO);
if (!tab[0]) {
_E("strdup failed for alloc plugin path " EXTERNAL_SYSTEM_INFO ", stop listing");
- external_free_plugin_names(tab, 0);
+ free_plugin_names(tab, 0);
tab = NULL;
goto out_free_entries;
}
for (int ei = 0, ti = 1; ei < count; ++ei, ++ti)
if (asprintf(&tab[ti], EXTERNAL_PLUGINS_DIR "/%s", entries[ei]->d_name) < 0) {
_E("asprintf failed for alloc plugin path (" EXTERNAL_PLUGINS_DIR "/%s), stop listing", entries[ei]->d_name);
- external_free_plugin_names(tab, ti);
+ free_plugin_names(tab, ti);
tab = NULL;
goto out_free_entries;
}
return tab;
}
-void *external_open_plugin(const char *so_path, const system_info_external_plugin_interface **plugin)
+static void *open_plugin(const char *so_path, const system_info_external_plugin_interface **plugin)
{
if (!plugin)
return NULL;
return NULL;
}
-int external_get_plugin_value(const char *so_path, const char *tag, const char *key,
+static int get_plugin_value(const char *so_path, const char *tag, const char *key,
const char *type, char **val)
{
int ret;
char buf[BUF_MAX];
const system_info_external_plugin_interface *plugin = NULL;
- void *handle = external_open_plugin(so_path, &plugin);
+ void *handle = open_plugin(so_path, &plugin);
if (!handle)
return SYSTEM_INFO_ERROR_IO_ERROR;
size_t plugin_count = 0;
int ret = SYSTEM_INFO_ERROR_IO_ERROR;
- char **tab = external_get_plugin_names(&plugin_count);
+ char **tab = get_plugin_names(&plugin_count);
for (size_t i = 0; i < plugin_count && ret != SYSTEM_INFO_ERROR_NONE; ++i)
- ret = external_get_plugin_value(tab[i], tag, key, type, val);
+ ret = get_plugin_value(tab[i], tag, key, type, val);
- external_free_plugin_names(tab, plugin_count);
+ free_plugin_names(tab, plugin_count);
if (ret != SYSTEM_INFO_ERROR_NONE)
_E("Key value (%s) not obtained by any plugin.", key);
return ret;
}
-int external_get_plugin_type(const char *so_path, const char *tag, const char *key,
+static int get_plugin_type(const char *so_path, const char *tag, const char *key,
const char *type, char **val)
{
int ret;
char buf[BUF_MAX];
const system_info_external_plugin_interface *plugin = NULL;
- void *handle = external_open_plugin(so_path, &plugin);
+ void *handle = open_plugin(so_path, &plugin);
if (!handle)
return SYSTEM_INFO_ERROR_IO_ERROR;
size_t plugin_count = 0;
int ret = SYSTEM_INFO_ERROR_IO_ERROR;
- char **tab = external_get_plugin_names(&plugin_count);
+ char **tab = get_plugin_names(&plugin_count);
for (size_t i = 0; i < plugin_count && ret != SYSTEM_INFO_ERROR_NONE; ++i)
- ret = external_get_plugin_type(tab[i], tag, key, NULL, type);
+ ret = get_plugin_type(tab[i], tag, key, NULL, type);
- external_free_plugin_names(tab, plugin_count);
+ free_plugin_names(tab, plugin_count);
if (ret != SYSTEM_INFO_ERROR_NONE)
_E("Key type (%s) not obtained by any plugin.", key);