X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-binder.git;a=blobdiff_plain;f=src%2Fafb-api-so-vdyn.c;h=c5aa1db73692c8d7c20e975efae57c7ac9e8edf3;hp=300aa13048dd798697e23d7c9242e20a40dc2ff4;hb=65353dce81a629e042800bb7b86fcd869a76727e;hpb=24d000c2290126abf88204089d132229d63f9a05 diff --git a/src/afb-api-so-vdyn.c b/src/afb-api-so-vdyn.c index 300aa130..c5aa1db7 100644 --- a/src/afb-api-so-vdyn.c +++ b/src/afb-api-so-vdyn.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017, 2018 "IoT.bzh" + * Copyright (C) 2015-2020 "IoT.bzh" * Author José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,11 +15,17 @@ * limitations under the License. */ +#if WITH_LEGACY_BINDING_VDYN && WITH_DYNAMIC_BINDING + #define _GNU_SOURCE #include #include +#define AFB_BINDING_VERSION 0 +#include + +#include "afb-api-so-v3.h" #include "afb-api-so-vdyn.h" #include "afb-export.h" #include "verbose.h" @@ -29,19 +35,15 @@ */ static const char afb_api_so_vdyn_entry[] = "afbBindingVdyn"; -/* - * Description of a binding - */ -static int vdyn_preinit(void *closure, struct afb_dynapi *dynapi) +static int preinit(void *closure, struct afb_api_x3 *api) { - int (*entry)(struct afb_dynapi*) = closure; - return entry(dynapi); + int (*entry)(struct afb_api_x3*) = closure; + return entry(api); } -int afb_api_so_vdyn_add(const char *path, void *handle, struct afb_apiset *apiset) +int afb_api_so_vdyn_add(const char *path, void *handle, struct afb_apiset *declare_set, struct afb_apiset * call_set) { - int rc; - int (*entry)(void*, struct afb_dynapi*); + int (*entry)(struct afb_api_x3*); struct afb_export *export; entry = dlsym(handle, afb_api_so_vdyn_entry); @@ -50,15 +52,14 @@ int afb_api_so_vdyn_add(const char *path, void *handle, struct afb_apiset *apise INFO("binding [%s] looks like an AFB binding Vdyn", path); - export = afb_export_create_vdyn(apiset, path, NULL); + export = afb_export_create_none_for_path(declare_set, call_set, path, preinit, entry); if (!export) { - ERROR("can't create export for %s", path); + INFO("binding [%s] creation failed", path); return -1; } - INFO("binding [%s] calling dynamic initialisation %s", path, afb_api_so_vdyn_entry); - rc = afb_export_preinit_vdyn(export, vdyn_preinit, entry); - afb_export_destroy(export); - return rc < 0 ? rc : 1; + return 1; } +#endif +