On 2016-12-30 10:09, Christophe Milard wrote:
> The shared objects listed in the ODP configuration files are
> loaded at init time. The odp configuration file list the
> shared objects to be loaded as shown in the following example:
> module = {
> modules = ["enumerator1.so", "driver1.so"];
> };
>
> Signed-off-by: Christophe Milard <[email protected]>
> ---
> configure.ac | 4 +--
> platform/linux-generic/drv_driver.c | 41
> +++++++++++++++++++++++++++
> platform/linux-generic/include/odp_internal.h | 3 ++
> platform/linux-generic/m4/configure.m4 | 1 +
> platform/linux-generic/m4/odp_drivers.m4 | 11 +++++++
> platform/linux-generic/odp_init.c | 7 +++++
> 6 files changed, 65 insertions(+), 2 deletions(-)
> create mode 100644 platform/linux-generic/m4/odp_drivers.m4
>
> diff --git a/configure.ac b/configure.ac
> index 3a20959..e2b4f9d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -55,7 +55,7 @@ AC_PROG_MAKE_SET
>
> AM_PROG_AR
> #Use libtool
> -LT_INIT([])
> +LT_INIT([dlopen])
> AC_SUBST([LIBTOOL_DEPS])
> AM_PROG_LIBTOOL
>
> @@ -66,7 +66,7 @@ AC_CHECK_FUNCS([bzero clock_gettime gethostbyname
> getpagesize gettimeofday memse
>
> # Checks for header files.
> AC_HEADER_RESOLV
> -AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h
> netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h
> sys/time.h unistd.h])
> +AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h
> netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h
> sys/time.h unistd.h dlfcn.h])
Alphabetic order
>
> # Checks for typedefs, structures, and compiler characteristics.
> AC_HEADER_STDBOOL
> diff --git a/platform/linux-generic/drv_driver.c
> b/platform/linux-generic/drv_driver.c
> index b3ec5af..29d9c47 100644
> --- a/platform/linux-generic/drv_driver.c
> +++ b/platform/linux-generic/drv_driver.c
> @@ -9,6 +9,8 @@
> #include <odp/api/debug.h>
> #include <odp_debug_internal.h>
> #include <odp/drv/driver.h>
> +#include <libconfig.h>
> +#include <dlfcn.h>
Alphabetic order?
>
> int odpdrv_enumr_class_register(odpdrv_enumr_class_t *enumr_class)
> {
> @@ -41,3 +43,42 @@ int odpdrv_driver_register(odpdrv_driver_t *driver)
>
> return 0;
> }
> +
+static int load_modules(void)
load_modules vs. load_drivers?
If we want to load other modules except the "driver" module maybe we
need to move this code to a generic file?
> +{
> + const config_setting_t *modules_section;
> + const char *drv_name;
and change this to module_name
> + int i;
> + config_t *cf;
> + int drv_count;
and module_count
Cheers,
Anders