In nnstreamer ini, add new option to enable/disable symbolic link.
Add internal function to check a library is available with symlink option.
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
{
gboolean loaded; /**< TRUE if loaded at least once */
gboolean enable_envvar; /**< TRUE to parse env variables */
+ gboolean enable_symlink; /**< TRUE to allow symbolic link file */
gchar *conffile; /**< Location of conf file. */
if (!g_file_test (fullpath, G_FILE_TEST_IS_REGULAR))
return FALSE;
/* ignore symbol link file */
- if (g_file_test (fullpath, G_FILE_TEST_IS_SYMLINK))
+ if (!conf.enable_symlink && g_file_test (fullpath, G_FILE_TEST_IS_SYMLINK))
return FALSE;
/** @todo how to validate with nnsconf type. */
return TRUE;
conf.enable_envvar = _parse_bool_string (value, FALSE);
g_free (value);
+ value = g_key_file_get_string (key_file, "common", "enable_symlink", NULL);
+ conf.enable_symlink = _parse_bool_string (value, FALSE);
+ g_free (value);
+
conf.pathFILTERS[1] =
g_key_file_get_string (key_file, "filter", "filters", NULL);
conf.pathDECODERS[1] =
}
/**
+ * @brief Public function to validate sub-plugin library is available.
+ */
+gboolean
+nnsconf_validate_file (nnsconf_type_path type, const gchar * fullpath)
+{
+ nnsconf_loadconf (FALSE);
+
+ return _validate_file (type, fullpath);
+}
+
+/**
* @brief Get sub-plugin's name prefix.
* @param[in] type The type (FILTERS/DECODERS/CUSTOM_FILTERS)
* @return Predefined prefix string for given type.
nnsconf_get_fullpath (const gchar * subpluginname, nnsconf_type_path type);
/**
+ * @brief Public function to validate sub-plugin library is available.
+ * @param[in] type The type (FILTERS/DECODERS/CUSTOM_FILTERS)
+ * @param[in] fullpath The full path to the file.
+ * @return True if the file is regular and can be added to the list.
+ */
+extern gboolean
+nnsconf_validate_file (nnsconf_type_path type, const gchar * fullpath);
+
+/**
* @brief Get sub-plugin's name prefix.
* @param[in] type The type (FILTERS/DECODERS/CUSTOM_FILTERS)
* @return Predefined prefix string for given type.
/* Search and register if found with the conf */
const gchar *fullpath = nnsconf_get_fullpath (name, type);
- /**
- * @todo Consider to add option to open symbolic link file and version-specified library name.
- */
- if (fullpath == NULL || g_file_test (fullpath, G_FILE_TEST_IS_SYMLINK))
+ if (!nnsconf_validate_file (type, fullpath))
goto error; /* No Such Thing !!! */
G_UNLOCK (splock);
#include "tensor_filter_custom.h"
#include "nnstreamer_plugin_api_filter.h"
+#include "nnstreamer_conf.h"
void init_filter_custom (void) __attribute__ ((constructor));
void fini_filter_custom (void) __attribute__ ((destructor));
return -1;
}
- /**
- * @todo Consider to add option to open symbolic link file and version-specified library name.
- */
- if (g_file_test (prop->model_file, G_FILE_TEST_IS_SYMLINK)) {
- /* symbolic link */
+ if (!nnsconf_validate_file (NNSCONF_PATH_CUSTOM_FILTERS, prop->model_file)) {
+ /* Cannot load the library */
return -1;
}
nnstreamer_test_conf.merge_from(nnstreamer_conf)
nnstreamer_test_conf.set('ENABLE_ENV_VAR', true)
+ nnstreamer_test_conf.set('ENABLE_SYMBOLIC_LINK', false)
nnstreamer_test_conf.set('TF_MEM_OPTMZ', false)
# meson 0.50 supports install argument in configure_file()
nnstreamer_install_conf.merge_from(nnstreamer_conf)
nnstreamer_install_conf.set('ENABLE_ENV_VAR', get_option('enable-env-var'))
+nnstreamer_install_conf.set('ENABLE_SYMBOLIC_LINK', get_option('enable-symbolic-link'))
nnstreamer_install_conf.set('TF_MEM_OPTMZ', get_option('enable-tensorflow-mem-optmz'))
# Install .ini
option('disable-video-support', type: 'boolean', value: false)
option('disable-audio-support', type: 'boolean', value: false)
option('enable-env-var', type: 'boolean', value: true)
+option('enable-symbolic-link', type: 'boolean', value: true)
option('enable-tizen-capi', type: 'boolean', value: false)
option('enable-python', type: 'boolean', value: true)
# Please be informed that, configured ini file should be in RO partition for the release binary.
[common]
enable_envvar=@ENABLE_ENV_VAR@
+enable_symlink=@ENABLE_SYMBOLIC_LINK@
[filter]
filters=@SUBPLUGIN_INSTALL_PREFIX@/filters/
enable_tf=false
%endif
-meson --buildtype=plain --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} --bindir=%{nnstexampledir} --includedir=%{_includedir} -Dinstall-example=true -Denable-tensorflow=${enable_tf} %{api} -Denable-env-var=false build
+meson --buildtype=plain --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} --bindir=%{nnstexampledir} --includedir=%{_includedir} -Dinstall-example=true -Denable-tensorflow=${enable_tf} %{api} -Denable-env-var=false -Denable-symbolic-link=false build
ninja -C build %{?_smp_mflags}