mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2025-01-19 19:03:47 +08:00
Adding version check for plugins.
This commit is contained in:
parent
3f009ea6df
commit
bf6a4a5774
@ -171,4 +171,4 @@ static void audio_exit(void)
|
||||
dbus_connection_unref(connection);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("audio", audio_init, audio_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("audio", VERSION, audio_init, audio_exit)
|
||||
|
@ -82,4 +82,4 @@ static void input_exit(void)
|
||||
dbus_connection_unref(connection);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("input", input_init, input_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("input", VERSION, input_init, input_exit)
|
||||
|
@ -55,4 +55,4 @@ static void network_exit(void)
|
||||
dbus_connection_unref(connection);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("network", network_init, network_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("network", VERSION, network_init, network_exit)
|
||||
|
@ -163,4 +163,4 @@ static void echo_exit(void)
|
||||
btd_unregister_adapter_driver(&echo_server);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("echo", echo_init, echo_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("echo", VERSION, echo_init, echo_exit)
|
||||
|
@ -158,4 +158,4 @@ static void hal_exit(void)
|
||||
btd_unregister_adapter_driver(&hal_driver);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("hal", hal_init, hal_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("hal", VERSION, hal_init, hal_exit)
|
||||
|
@ -123,4 +123,4 @@ static void netlink_exit(void)
|
||||
nl_handle_destroy(handle);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("netlink", netlink_init, netlink_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("netlink", VERSION, netlink_init, netlink_exit)
|
||||
|
@ -859,4 +859,4 @@ static void service_exit(void)
|
||||
dbus_connection_unref(connection);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("service", service_init, service_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("service", VERSION, service_init, service_exit)
|
||||
|
@ -39,4 +39,4 @@ static void storage_exit(void)
|
||||
{
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("storage", storage_init, storage_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("storage", VERSION, storage_init, storage_exit)
|
||||
|
@ -55,4 +55,4 @@ static void serial_exit(void)
|
||||
dbus_connection_unref(connection);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("serial", serial_init, serial_exit)
|
||||
BLUETOOTH_PLUGIN_DEFINE("serial", VERSION, serial_init, serial_exit)
|
||||
|
@ -695,7 +695,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
umask(0077);
|
||||
|
||||
start_logging("bluetoothd", "Bluetooth daemon");
|
||||
start_logging("bluetoothd", "Bluetooth daemon %s", VERSION);
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_flags = SA_NOCLDSTOP;
|
||||
|
@ -53,6 +53,11 @@ static gboolean add_plugin(void *handle, struct bluetooth_plugin_desc *desc)
|
||||
if (desc->init == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (g_str_equal(desc->version, VERSION) == FALSE) {
|
||||
DBG("version mismatch for %s", desc->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
plugin = g_try_new0(struct bluetooth_plugin, 1);
|
||||
if (plugin == NULL)
|
||||
return FALSE;
|
||||
|
@ -23,13 +23,14 @@
|
||||
|
||||
struct bluetooth_plugin_desc {
|
||||
const char *name;
|
||||
const char *version;
|
||||
int (*init) (void);
|
||||
void (*exit) (void);
|
||||
};
|
||||
|
||||
#define BLUETOOTH_PLUGIN_DEFINE(name,init,exit) \
|
||||
#define BLUETOOTH_PLUGIN_DEFINE(name,version,init,exit) \
|
||||
extern struct bluetooth_plugin_desc bluetooth_plugin_desc \
|
||||
__attribute__ ((visibility("default"))); \
|
||||
struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
|
||||
name, init, exit \
|
||||
name, version, init, exit \
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user