3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 22:42:37 +01:00

client: Get rid of dbus_proxy bind/unbind

This commit is contained in:
Denis Kenzior 2018-09-14 03:38:15 -05:00
parent 48870d0911
commit 904d65ce79
3 changed files with 0 additions and 188 deletions

View File

@ -433,26 +433,6 @@ struct l_queue *proxy_interface_find_all(const char *interface,
return match;
}
static struct l_queue *proxy_interface_find_by_path(const char *path)
{
const struct l_queue_entry *entry;
struct l_queue *match = NULL;
for (entry = l_queue_get_entries(proxy_interfaces); entry;
entry = entry->next) {
struct proxy_interface *proxy = entry->data;
if (!strcmp(proxy->path, path)) {
if (!match)
match = l_queue_new();
l_queue_push_tail(match, proxy);
}
}
return match;
}
bool proxy_interface_is_same(const struct proxy_interface *a,
const struct proxy_interface *b)
{
@ -489,83 +469,6 @@ static void properties_changed_callback(struct l_dbus_message *message,
interface_update_properties(proxy, &changed, &invalidated);
}
static void proxy_interface_bind_dependencies(const char *path)
{
const struct l_queue_entry *entry;
const struct l_queue_entry *inner_entry;
struct l_queue *match = proxy_interface_find_by_path(path);
if (l_queue_length(match) < 2)
goto done;
for (entry = l_queue_get_entries(match); entry; entry = entry->next) {
struct proxy_interface *proxy = entry->data;
if (!proxy->type->ops || !proxy->type->ops->bind_interface)
continue;
for (inner_entry = l_queue_get_entries(match); inner_entry;
inner_entry = inner_entry->next) {
char *error;
struct proxy_interface *dependency = inner_entry->data;
if (!strcmp(proxy->type->interface,
dependency->type->interface))
continue;
if (proxy->type->ops->bind_interface(proxy,
dependency))
continue;
error = l_strdup_printf("Interface %s does not support "
"dependency %s\n",
proxy->type->interface,
dependency->type->interface);
display_error(error);
l_free(error);
}
}
done:
l_queue_destroy(match, NULL);
}
static void proxy_interface_unbind_dependencies(
const struct proxy_interface *proxy)
{
const struct l_queue_entry *entry;
struct l_queue *match = proxy_interface_find_by_path(proxy->path);
if (l_queue_length(match) < 2)
goto done;
for (entry = l_queue_get_entries(match); entry; entry = entry->next) {
struct proxy_interface *dependency = entry->data;
char *error;
if (!strcmp(proxy->type->interface,
dependency->type->interface))
continue;
if (!dependency->type->ops ||
!dependency->type->ops->unbind_interface)
continue;
if (dependency->type->ops->unbind_interface(dependency, proxy))
continue;
error = l_strdup_printf("Interface %s does not support "
"dependency %s\n",
dependency->type->interface,
proxy->type->interface);
display_error(error);
l_free(error);
}
done:
l_queue_destroy(match, NULL);
}
static bool is_ignorable(const char *interface)
{
size_t i;
@ -631,8 +534,6 @@ static void proxy_interface_create(const char *path,
l_queue_push_tail(proxy_interfaces, proxy);
}
proxy_interface_bind_dependencies(path);
}
static void proxy_interface_destroy(void *data)
@ -752,8 +653,6 @@ static void interfaces_removed_callback(struct l_dbus_message *message,
if (!proxy)
continue;
proxy_interface_unbind_dependencies(proxy);
l_queue_remove(proxy_interfaces, proxy);
proxy_interface_destroy(proxy);

View File

@ -49,10 +49,6 @@ struct proxy_interface_property {
struct proxy_interface_type_ops {
void *(*create)(void);
void (*destroy)(void *data);
bool (*bind_interface)(const struct proxy_interface *proxy,
const struct proxy_interface *dependency);
bool (*unbind_interface)(const struct proxy_interface *proxy,
const struct proxy_interface *dependency);
const char *(*identity)(void *data);
void (*display)(const char *margin, const void *data);
};

View File

@ -43,9 +43,6 @@ struct device {
char *mode;
const struct proxy_interface *adapter;
const struct proxy_interface *connected_network;
const struct proxy_interface *wsc;
const struct proxy_interface *ap;
const struct proxy_interface *ad_hoc;
};
static struct proxy_interface *default_device;
@ -440,67 +437,10 @@ static void device_destroy(void *data)
device->adapter = NULL;
device->connected_network = NULL;
device->wsc = NULL;
l_free(device);
}
static bool device_bind_interface(const struct proxy_interface *proxy,
const struct proxy_interface *dependency)
{
const char *interface = proxy_interface_get_interface(dependency);
if (!strcmp(interface, IWD_WSC_INTERFACE)) {
struct device *device = proxy_interface_get_data(proxy);
device->wsc = dependency;
return true;
} else if (!strcmp(interface, IWD_ACCESS_POINT_INTERFACE)) {
struct device *device = proxy_interface_get_data(proxy);
device->ap = dependency;
return true;
} else if (!strcmp(interface, IWD_AD_HOC_INTERFACE)) {
struct device *device = proxy_interface_get_data(proxy);
device->ad_hoc = dependency;
return true;
}
return false;
}
static bool device_unbind_interface(const struct proxy_interface *proxy,
const struct proxy_interface *dependency)
{
const char *interface = proxy_interface_get_interface(dependency);
if (!strcmp(interface, IWD_WSC_INTERFACE)) {
struct device *device = proxy_interface_get_data(proxy);
device->wsc = NULL;
return true;
} else if (!strcmp(interface, IWD_ACCESS_POINT_INTERFACE)) {
struct device *device = proxy_interface_get_data(proxy);
device->ap = NULL;
return true;
} else if (!strcmp(interface, IWD_AD_HOC_INTERFACE)) {
struct device *device = proxy_interface_get_data(proxy);
device->ad_hoc = NULL;
return true;
}
return false;
}
static void display_device_inline(const char *margin, const void *data)
{
const struct device *device = data;
@ -530,8 +470,6 @@ static const char *device_identity(void *data)
static const struct proxy_interface_type_ops device_ops = {
.create = device_create,
.destroy = device_destroy,
.bind_interface = device_bind_interface,
.unbind_interface = device_unbind_interface,
.identity = device_identity,
.display = display_device_inline,
};
@ -558,27 +496,6 @@ static bool match_by_partial_name(const void *a, const void *b)
return !strncmp(device->name, text, strlen(text));
}
static bool match_by_partial_name_and_wsc(const void *a, const void *b)
{
const struct device *device = a;
return match_by_partial_name(a, b) && device->wsc ? true : false;
}
static bool match_by_partial_name_and_ap(const void *a, const void *b)
{
const struct device *device = a;
return match_by_partial_name(a, b) && device->ap ? true : false;
}
static bool match_by_partial_name_and_ad_hoc(const void *a, const void *b)
{
const struct device *device = a;
return match_by_partial_name(a, b) && device->ad_hoc ? true : false;
}
static bool match_all(const void *a, const void *b)
{
return true;