mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-25 08:02:38 +01:00
client: Add INTERFACE_TYPE
This commit is contained in:
parent
6c2eae6999
commit
ef394579b0
@ -24,6 +24,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <ell/ell.h>
|
#include <ell/ell.h>
|
||||||
|
|
||||||
#include "dbus-proxy.h"
|
#include "dbus-proxy.h"
|
||||||
@ -421,8 +422,13 @@ void proxy_interface_type_unregister(
|
|||||||
l_queue_remove(proxy_interface_types, (void *) interface_type);
|
l_queue_remove(proxy_interface_types, (void *) interface_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern struct interface_type_desc __start___interface[];
|
||||||
|
extern struct interface_type_desc __stop___interface[];
|
||||||
|
|
||||||
bool dbus_proxy_init(void)
|
bool dbus_proxy_init(void)
|
||||||
{
|
{
|
||||||
|
struct interface_type_desc *desc;
|
||||||
|
|
||||||
if (dbus)
|
if (dbus)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -433,6 +439,16 @@ bool dbus_proxy_init(void)
|
|||||||
proxy_interface_types = l_queue_new();
|
proxy_interface_types = l_queue_new();
|
||||||
proxy_interfaces = l_queue_new();
|
proxy_interfaces = l_queue_new();
|
||||||
|
|
||||||
|
if (__start___interface == NULL || __stop___interface == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (desc = __start___interface; desc < __stop___interface; desc++) {
|
||||||
|
if (!desc->init)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
desc->init();
|
||||||
|
}
|
||||||
|
|
||||||
l_dbus_set_disconnect_handler(dbus, dbus_disconnect_callback, NULL,
|
l_dbus_set_disconnect_handler(dbus, dbus_disconnect_callback, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -445,6 +461,18 @@ bool dbus_proxy_init(void)
|
|||||||
|
|
||||||
bool dbus_proxy_exit(void)
|
bool dbus_proxy_exit(void)
|
||||||
{
|
{
|
||||||
|
struct interface_type_desc *desc;
|
||||||
|
|
||||||
|
if (__start___interface == NULL || __stop___interface == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (desc = __start___interface; desc < __stop___interface; desc++) {
|
||||||
|
if (!desc->exit)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
desc->exit();
|
||||||
|
}
|
||||||
|
|
||||||
l_queue_destroy(proxy_interface_types, NULL);
|
l_queue_destroy(proxy_interface_types, NULL);
|
||||||
proxy_interface_types = NULL;
|
proxy_interface_types = NULL;
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
struct proxy_interface;
|
struct proxy_interface;
|
||||||
|
|
||||||
#define IWD_ADAPTER_INTERFACE "net.connman.iwd.Adapter"
|
#define IWD_ADAPTER_INTERFACE "net.connman.iwd.Adapter"
|
||||||
@ -57,5 +59,17 @@ void proxy_interface_type_register(
|
|||||||
void proxy_interface_type_unregister(
|
void proxy_interface_type_unregister(
|
||||||
const struct proxy_interface_type *interface_type);
|
const struct proxy_interface_type *interface_type);
|
||||||
|
|
||||||
|
struct interface_type_desc {
|
||||||
|
const char *interface;
|
||||||
|
int (*init)(void);
|
||||||
|
void (*exit)(void);
|
||||||
|
} __attribute__((aligned(8)));
|
||||||
|
|
||||||
|
#define INTERFACE_TYPE(interface, init, exit) \
|
||||||
|
static struct interface_type_desc __interface_type_ ## interface\
|
||||||
|
__attribute__((used, section("__interface"), aligned(8))) = {\
|
||||||
|
#interface, init, exit \
|
||||||
|
}; \
|
||||||
|
|
||||||
bool dbus_proxy_init(void);
|
bool dbus_proxy_init(void);
|
||||||
bool dbus_proxy_exit(void);
|
bool dbus_proxy_exit(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user