]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: return dataplane provider plugin handle 3597/head
authorMark Stapp <mjs@voltanet.io>
Thu, 10 Jan 2019 18:50:33 +0000 (13:50 -0500)
committerMark Stapp <mjs@voltanet.io>
Fri, 11 Jan 2019 13:23:39 +0000 (08:23 -0500)
When a dataplane provider/plugin registers, return the new
handle/object - that's needed to use some provider apis
later on.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/zebra_dplane.c
zebra/zebra_dplane.h

index 79e9e7edad8e605662f660d1fe64b2e189000da6..c7713c85f9d47ce13bfab39fac7803fd52532156 100644 (file)
@@ -991,7 +991,8 @@ int dplane_provider_register(const char *name,
                             int (*fp)(struct zebra_dplane_provider *),
                             int (*fini_fp)(struct zebra_dplane_provider *,
                                            bool early),
-                            void *data)
+                            void *data,
+                            struct zebra_dplane_provider **prov_p)
 {
        int ret = 0;
        struct zebra_dplane_provider *p, *last;
@@ -1055,6 +1056,9 @@ int dplane_provider_register(const char *name,
                           p->dp_name, p->dp_id, p->dp_priority);
 
 done:
+       if (prov_p)
+               *prov_p = p;
+
        return ret;
 }
 
@@ -1349,7 +1353,7 @@ static void dplane_provider_init(void)
                                       DPLANE_PROV_FLAGS_DEFAULT,
                                       kernel_dplane_process_func,
                                       NULL,
-                                      NULL);
+                                      NULL, NULL);
 
        if (ret != AOK)
                zlog_err("Unable to register kernel dplane provider: %d",
@@ -1362,7 +1366,7 @@ static void dplane_provider_init(void)
                                       DPLANE_PROV_FLAGS_DEFAULT,
                                       test_dplane_process_func,
                                       test_dplane_shutdown_func,
-                                      NULL /* data */);
+                                      NULL /* data */, NULL);
 
        if (ret != AOK)
                zlog_err("Unable to register test dplane provider: %d",
index 1d23ef0f82d33f6228d26b05548d6946723295a4..1c053b85bfeb0f2d4db03a228134a833f189fb44 100644 (file)
@@ -258,7 +258,8 @@ enum dplane_provider_prio {
 
 
 /* Provider registration: ordering or priority value, callbacks, and optional
- * opaque data value.
+ * opaque data value. If 'prov_p', return the newly-allocated provider object
+ * on success.
  */
 
 /* Providers offer an entry-point for incoming work, called in the context of
@@ -279,7 +280,8 @@ int dplane_provider_register(const char *name,
                             int (*fp)(struct zebra_dplane_provider *),
                             int (*fini_fp)(struct zebra_dplane_provider *,
                                            bool early),
-                            void *data);
+                            void *data,
+                            struct zebra_dplane_provider **prov_p);
 
 /* Accessors for provider attributes */
 const char *dplane_provider_get_name(const struct zebra_dplane_provider *prov);