summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-01-13 12:27:09 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-01-13 12:27:09 +0000
commitf711e58f8f635d0afcf3f02da83780bef83c4347 (patch)
tree456ccce2c738b8a9359ec7488eb74707fce339ff /hcid
parent6561ed8ccf7e8dd56fbaaaa16a7bc9635523e059 (diff)
Rename struct slist to GSList and slist_* to g_slist_*
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-adapter.c63
-rw-r--r--hcid/dbus-adapter.h15
-rw-r--r--hcid/dbus-common.c1
-rw-r--r--hcid/dbus-hci.c169
-rw-r--r--hcid/dbus-hci.h2
-rw-r--r--hcid/dbus-manager.c11
-rw-r--r--hcid/dbus-rfcomm.c43
-rw-r--r--hcid/dbus-sdp.c9
-rw-r--r--hcid/dbus-security.c70
-rw-r--r--hcid/dbus-security.h6
-rw-r--r--hcid/dbus-service.c61
-rw-r--r--hcid/dbus-service.h6
-rw-r--r--hcid/dbus-test.c31
-rw-r--r--hcid/security.c23
14 files changed, 250 insertions, 260 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index f27e2ccf..59d342b6 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -49,7 +49,6 @@
#include "textfile.h"
#include "oui.h"
-#include "list.h"
#include "dbus-common.h"
#include "dbus-hci.h"
#include "dbus-sdp.h"
@@ -177,7 +176,7 @@ static const char *toy_minor_cls[] = {
int pending_remote_name_cancel(struct adapter *adapter)
{
struct remote_dev_info *dev, match;
- struct slist *l;
+ GSList *l;
int dd, err = 0;
/* find the pending remote name request */
@@ -185,8 +184,8 @@ int pending_remote_name_cancel(struct adapter *adapter)
bacpy(&match.bdaddr, BDADDR_ANY);
match.name_status = NAME_REQUESTED;
- l = slist_find(adapter->found_devices, &match,
- (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(adapter->found_devices, &match,
+ (GCompareFunc) found_device_cmp);
if (!l) /* no pending request */
return 0;
@@ -202,8 +201,8 @@ int pending_remote_name_cancel(struct adapter *adapter)
}
/* free discovered devices list */
- slist_foreach(adapter->found_devices, (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
hci_close_dev(dd);
@@ -615,7 +614,7 @@ static DBusHandlerResult adapter_is_connected(DBusConnection *conn,
dbus_bool_t connected = FALSE;
struct adapter *adapter = data;
- struct slist *l = adapter->active_conn;
+ GSList *l = adapter->active_conn;
const char *peer_addr;
bdaddr_t peer_bdaddr;
@@ -630,7 +629,7 @@ static DBusHandlerResult adapter_is_connected(DBusConnection *conn,
str2ba(peer_addr, &peer_bdaddr);
- l = slist_find(l, &peer_bdaddr, active_conn_find_by_bdaddr);
+ l = g_slist_find_custom(l, &peer_bdaddr, active_conn_find_by_bdaddr);
if (l)
connected = TRUE;
@@ -651,7 +650,7 @@ static DBusHandlerResult adapter_list_connections(DBusConnection *conn,
DBusMessageIter iter;
DBusMessageIter array_iter;
struct adapter *adapter = data;
- struct slist *l = adapter->active_conn;
+ GSList *l = adapter->active_conn;
if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
return error_invalid_arguments(conn, msg);
@@ -1339,7 +1338,7 @@ static DBusHandlerResult adapter_get_remote_service_cls(DBusConnection *conn,
{
DBusMessage *reply;
DBusMessageIter iter, array_iter;
- struct slist *service_classes;
+ GSList *service_classes;
uint32_t class;
if (get_remote_class(conn, msg, data, &class) < 0)
@@ -1355,12 +1354,12 @@ static DBusHandlerResult adapter_get_remote_service_cls(DBusConnection *conn,
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
DBUS_TYPE_STRING_AS_STRING, &array_iter);
- slist_foreach(service_classes, (slist_func_t) append_class_string,
+ g_slist_foreach(service_classes, (GFunc) append_class_string,
&array_iter);
dbus_message_iter_close_container(&iter, &array_iter);
- slist_free(service_classes);
+ g_slist_free(service_classes);
return send_message_and_unref(conn, reply);
}
@@ -1731,7 +1730,7 @@ static DBusHandlerResult adapter_dc_remote_device(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct adapter *adapter = data;
- struct slist *l = adapter->active_conn;
+ GSList *l = adapter->active_conn;
const char *peer_addr;
bdaddr_t peer_bdaddr;
@@ -1750,7 +1749,7 @@ static DBusHandlerResult adapter_dc_remote_device(DBusConnection *conn,
str2ba(peer_addr, &peer_bdaddr);
- l = slist_find(l, &peer_bdaddr, active_conn_find_by_bdaddr);
+ l = g_slist_find_custom(l, &peer_bdaddr, active_conn_find_by_bdaddr);
if (!l)
return error_not_connected(conn, msg);
@@ -1963,7 +1962,7 @@ static DBusHandlerResult adapter_create_bonding(DBusConnection *conn,
if (adapter->bonding)
return error_bonding_in_progress(conn, msg);
- if (slist_find(adapter->pin_reqs, &peer_bdaddr, pin_req_cmp))
+ if (g_slist_find_custom(adapter->pin_reqs, &peer_bdaddr, pin_req_cmp))
return error_bonding_in_progress(conn, msg);
/* check if a link key already exists */
@@ -2005,7 +2004,7 @@ static DBusHandlerResult adapter_cancel_bonding(DBusConnection *conn,
DBusMessage *reply;
bdaddr_t peer_bdaddr;
const char *peer_addr;
- struct slist *l;
+ GSList *l;
if (!adapter->up)
return error_not_ready(conn, msg);
@@ -2029,7 +2028,7 @@ static DBusHandlerResult adapter_cancel_bonding(DBusConnection *conn,
adapter->bonding->cancel = 1;
- l = slist_find(adapter->pin_reqs, &peer_bdaddr, pin_req_cmp);
+ l = g_slist_find_custom(adapter->pin_reqs, &peer_bdaddr, pin_req_cmp);
if (l) {
struct pending_pin_info *pin_req = l->data;
@@ -2055,7 +2054,7 @@ static DBusHandlerResult adapter_cancel_bonding(DBusConnection *conn,
hci_close_dev(dd);
}
- adapter->pin_reqs = slist_remove(adapter->pin_reqs, pin_req);
+ adapter->pin_reqs = g_slist_remove(adapter->pin_reqs, pin_req);
free(pin_req);
}
@@ -2071,7 +2070,7 @@ static DBusHandlerResult adapter_remove_bonding(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct adapter *adapter = data;
- struct slist *l;
+ GSList *l;
DBusMessage *reply;
DBusMessage *signal;
char filename[PATH_MAX + 1];
@@ -2119,7 +2118,7 @@ static DBusHandlerResult adapter_remove_bonding(DBusConnection *conn,
hci_delete_stored_link_key(dd, &bdaddr, 0, 1000);
/* find the connection */
- l = slist_find(adapter->active_conn, &bdaddr,
+ l = g_slist_find_custom(adapter->active_conn, &bdaddr,
active_conn_find_by_bdaddr);
if (l) {
struct active_conn_info *con = l->data;
@@ -2587,7 +2586,7 @@ static DBusHandlerResult adapter_cancel_discovery(DBusConnection *conn,
}
struct remote_device_list_t {
- struct slist *list;
+ GSList *list;
time_t time;
};
@@ -2597,7 +2596,7 @@ static void list_remote_devices_do_append(char *key, char *value, void *data)
char *address;
struct tm date;
- if (slist_find(param->list, key, (cmp_func_t) strcasecmp))
+ if (g_slist_find_custom(param->list, key, (GCompareFunc) strcasecmp))
return;
if (param->time){
@@ -2610,7 +2609,7 @@ static void list_remote_devices_do_append(char *key, char *value, void *data)
if (!address)
return;
- param->list = slist_append(param->list, address);
+ param->list = g_slist_append(param->list, address);
}
static void remote_devices_do_append(void *data, void *user_data)
@@ -2653,10 +2652,10 @@ static DBusHandlerResult adapter_list_remote_devices(DBusConnection *conn,
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
DBUS_TYPE_STRING_AS_STRING, &array_iter);
- slist_foreach(param.list, remote_devices_do_append, &array_iter);
+ g_slist_foreach(param.list, remote_devices_do_append, &array_iter);
- slist_foreach(param.list, (slist_func_t) free, NULL);
- slist_free(param.list);
+ g_slist_foreach(param.list, (GFunc) free, NULL);
+ g_slist_free(param.list);
dbus_message_iter_close_container(&iter, &array_iter);
@@ -2700,10 +2699,10 @@ static DBusHandlerResult adapter_list_recent_remote_devices(DBusConnection *conn
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
DBUS_TYPE_STRING_AS_STRING, &array_iter);
- slist_foreach(param.list, remote_devices_do_append, &array_iter);
+ g_slist_foreach(param.list, remote_devices_do_append, &array_iter);
- slist_foreach(param.list, (slist_func_t) free, NULL);
- slist_free(param.list);
+ g_slist_foreach(param.list, (GFunc) free, NULL);
+ g_slist_free(param.list);
dbus_message_iter_close_container(&iter, &array_iter);
@@ -2764,17 +2763,17 @@ const char *minor_class_str(uint32_t class)
return "";
}
-struct slist *service_classes_str(uint32_t class)
+GSList *service_classes_str(uint32_t class)
{
uint8_t services = class >> 16;
- struct slist *l = NULL;
+ GSList *l = NULL;
int i;
for (i = 0; i < (sizeof(service_cls) / sizeof(*service_cls)); i++) {
if (!(services & (1 << i)))
continue;
- l = slist_append(l, (void *) service_cls[i]);
+ l = g_slist_append(l, (void *) service_cls[i]);
}
return l;
diff --git a/hcid/dbus-adapter.h b/hcid/dbus-adapter.h
index 288cc338..fa4e7422 100644
--- a/hcid/dbus-adapter.h
+++ b/hcid/dbus-adapter.h
@@ -25,7 +25,6 @@
#define __ADAPTER_H
#include <dbus/dbus.h>
-#include "list.h"
#include "glib-ectomy.h"
#define ADAPTER_INTERFACE "org.bluez.Adapter"
@@ -98,17 +97,17 @@ struct adapter {
int pinq_idle; /* tracks the idle time for periodic inquiry */
int discov_type; /* type requested */
int pdiscov_resolve_names; /* Resolve names when doing periodic discovery */
- struct slist *found_devices;
- struct slist *oor_devices; /* out of range device list */
+ GSList *found_devices;
+ GSList *oor_devices; /* out of range device list */
char *pdiscov_requestor; /* periodic discovery requestor unique name */
char *discov_requestor; /* discovery requestor unique name */
DBusMessage *discovery_cancel; /* discovery cancel message request */
- struct slist *passkey_agents;
- struct slist *auth_agents; /* Authorization agents */
+ GSList *passkey_agents;
+ GSList *auth_agents; /* Authorization agents */
bdaddr_t agents_disabled; /* temporarely disable agents for bda */
- struct slist *active_conn;
+ GSList *active_conn;
struct bonding_request_info *bonding;
- struct slist *pin_reqs;
+ GSList *pin_reqs;
struct pending_dc_info *pending_dc;
};
@@ -118,7 +117,7 @@ const char *major_class_str(uint32_t class);
const char *minor_class_str(uint32_t class);
-struct slist *service_classes_str(uint32_t class);
+GSList *service_classes_str(uint32_t class);
int pending_remote_name_cancel(struct adapter *adapter);
diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c
index d21327a9..bddef5dc 100644
--- a/hcid/dbus-common.c
+++ b/hcid/dbus-common.c
@@ -47,7 +47,6 @@
#include <dbus/dbus.h>
#include "hcid.h"
-#include "list.h"
#include "dbus.h"
#include "dbus-error.h"
#include "dbus-hci.h"
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index fc316620..c3184041 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -46,7 +46,6 @@
#include "hcid.h"
#include "dbus.h"
#include "textfile.h"
-#include "list.h"
#include "dbus-common.h"
#include "dbus-error.h"
#include "dbus-test.h"
@@ -105,18 +104,18 @@ int dev_rssi_cmp(struct remote_dev_info *d1, struct remote_dev_info *d2)
return rssi1 - rssi2;
}
-int found_device_add(struct slist **list, bdaddr_t *bdaddr, int8_t rssi,
+int found_device_add(GSList **list, bdaddr_t *bdaddr, int8_t rssi,
name_status_t name_status)
{
struct remote_dev_info *dev, match;
- struct slist *l;
+ GSList *l;
memset(&match, 0, sizeof(struct remote_dev_info));
bacpy(&match.bdaddr, bdaddr);
match.name_status = NAME_ANY;
/* ignore repeated entries */
- l = slist_find(*list, &match, (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(*list, &match, (GCompareFunc) found_device_cmp);
if (l) {
/* device found, update the attributes */
dev = l->data;
@@ -130,7 +129,7 @@ int found_device_add(struct slist **list, bdaddr_t *bdaddr, int8_t rssi,
if (name_status != NAME_NOT_REQUIRED)
dev->name_status = name_status;
- *list = slist_sort(*list, (cmp_func_t) dev_rssi_cmp);
+ *list = g_slist_sort(*list, (GCompareFunc) dev_rssi_cmp);
return -EALREADY;
}
@@ -144,25 +143,25 @@ int found_device_add(struct slist **list, bdaddr_t *bdaddr, int8_t rssi,
dev->rssi = rssi;
dev->name_status = name_status;
- *list = slist_insert_sorted(*list, dev, (cmp_func_t) dev_rssi_cmp);
+ *list = g_slist_insert_sorted(*list, dev, (GCompareFunc) dev_rssi_cmp);
return 0;
}
-static int found_device_remove(struct slist **list, bdaddr_t *bdaddr)
+static int found_device_remove(GSList **list, bdaddr_t *bdaddr)
{
struct remote_dev_info *dev, match;
- struct slist *l;
+ GSList *l;
memset(&match, 0, sizeof(struct remote_dev_info));
bacpy(&match.bdaddr, bdaddr);
- l = slist_find(*list, &match, (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(*list, &match, (GCompareFunc) found_device_cmp);
if (!l)
return -1;
dev = l->data;
- *list = slist_remove(*list, dev);
+ *list = g_slist_remove(*list, dev);
free(dev);
return 0;
@@ -187,7 +186,7 @@ static int active_conn_find_by_handle(const void *data, const void *user_data)
return -1;
}
-static int active_conn_append(struct slist **list, bdaddr_t *bdaddr,
+static int active_conn_append(GSList **list, bdaddr_t *bdaddr,
uint16_t handle)
{
struct active_conn_info *dev;
@@ -200,7 +199,7 @@ static int active_conn_append(struct slist **list, bdaddr_t *bdaddr,
bacpy(&dev->bdaddr, bdaddr);
dev->handle = handle;
- *list = slist_append(*list, dev);
+ *list = g_slist_append(*list, dev);
return 0;
}
@@ -447,30 +446,30 @@ int unregister_adapter_path(const char *path)
}
if (adapter->found_devices) {
- slist_foreach(adapter->found_devices,
- (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices,
+ (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
}
if (adapter->oor_devices) {
- slist_foreach(adapter->oor_devices,
- (slist_func_t) free, NULL);
- slist_free(adapter->oor_devices);
+ g_slist_foreach(adapter->oor_devices,
+ (GFunc) free, NULL);
+ g_slist_free(adapter->oor_devices);
adapter->oor_devices = NULL;
}
if (adapter->pin_reqs) {
- slist_foreach(adapter->pin_reqs,
- (slist_func_t) free, NULL);
- slist_free(adapter->pin_reqs);
+ g_slist_foreach(adapter->pin_reqs,
+ (GFunc) free, NULL);
+ g_slist_free(adapter->pin_reqs);
adapter->pin_reqs = NULL;
}
if (adapter->active_conn) {
- slist_foreach(adapter->active_conn,
- (slist_func_t) free, NULL);
- slist_free(adapter->active_conn);
+ g_slist_foreach(adapter->active_conn,
+ (GFunc) free, NULL);
+ g_slist_free(adapter->active_conn);
adapter->active_conn = NULL;
}
@@ -768,27 +767,27 @@ int hcid_dbus_stop_device(uint16_t id)
}
if (adapter->found_devices) {
- slist_foreach(adapter->found_devices, (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
}
if (adapter->oor_devices) {
- slist_foreach(adapter->oor_devices, (slist_func_t) free, NULL);
- slist_free(adapter->oor_devices);
+ g_slist_foreach(adapter->oor_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->oor_devices);
adapter->oor_devices = NULL;
}
if (adapter->pin_reqs) {
- slist_foreach(adapter->pin_reqs, (slist_func_t) free, NULL);
- slist_free(adapter->pin_reqs);
+ g_slist_foreach(adapter->pin_reqs, (GFunc) free, NULL);
+ g_slist_free(adapter->pin_reqs);
adapter->pin_reqs = NULL;
}
if (adapter->active_conn) {
- slist_foreach(adapter->active_conn, (slist_func_t) send_dc_signal, path);
- slist_foreach(adapter->active_conn, (slist_func_t) free, NULL);
- slist_free(adapter->active_conn);
+ g_slist_foreach(adapter->active_conn, (GFunc) send_dc_signal, path);
+ g_slist_foreach(adapter->active_conn, (GFunc) free, NULL);
+ g_slist_free(adapter->active_conn);
adapter->active_conn = NULL;
}
@@ -847,7 +846,7 @@ void hcid_dbus_pending_pin_req_add(bdaddr_t *sba, bdaddr_t *dba)
memset(info, 0, sizeof(struct pending_pin_info));
bacpy(&info->bdaddr, dba);
- adapter->pin_reqs = slist_append(adapter->pin_reqs, info);
+ adapter->pin_reqs = g_slist_append(adapter->pin_reqs, info);
if (adapter->bonding && !bacmp(dba, &adapter->bonding->bdaddr))
adapter->bonding->auth_active = 1;
@@ -895,7 +894,7 @@ void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer,
struct adapter *adapter;
DBusMessage *message;
char *local_addr, *peer_addr;
- struct slist *l;
+ GSList *l;
bdaddr_t tmp;
char path[MAX_PATH_LENGTH];
int id;
@@ -922,10 +921,10 @@ void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer,
cancel_passkey_agent_requests(adapter->passkey_agents, path,
peer);
- l = slist_find(adapter->pin_reqs, peer, pin_req_cmp);
+ l = g_slist_find_custom(adapter->pin_reqs, peer, pin_req_cmp);
if (l) {
void *d = l->data;
- adapter->pin_reqs = slist_remove(adapter->pin_reqs, l->data);
+ adapter->pin_reqs = g_slist_remove(adapter->pin_reqs, l->data);
free(d);
if (!status) {
@@ -1016,7 +1015,7 @@ int found_device_req_name(struct adapter *adapter)
evt_cmd_status rp;
remote_name_req_cp cp;
struct remote_dev_info match;
- struct slist *l;
+ GSList *l;
int dd, req_sent = 0;
/* get the next remote address */
@@ -1027,8 +1026,8 @@ int found_device_req_name(struct adapter *adapter)
bacpy(&match.bdaddr, BDADDR_ANY);
match.name_status = NAME_REQUIRED;
- l = slist_find(adapter->found_devices, &match,
- (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(adapter->found_devices, &match,
+ (GCompareFunc) found_device_cmp);
if (!l)
return -ENODATA;
@@ -1091,12 +1090,12 @@ int found_device_req_name(struct adapter *adapter)
/* if failed, request the next element */
/* remove the element from the list */
- adapter->found_devices = slist_remove(adapter->found_devices, dev);
+ adapter->found_devices = g_slist_remove(adapter->found_devices, dev);
free(dev);
/* get the next element */
- l = slist_find(adapter->found_devices, &match,
- (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(adapter->found_devices, &match,
+ (GCompareFunc) found_device_cmp);
} while (l);
@@ -1108,7 +1107,7 @@ int found_device_req_name(struct adapter *adapter)
return 0;
}
-static void send_out_of_range(const char *path, struct slist *l)
+static void send_out_of_range(const char *path, GSList *l)
{
DBusMessage *message;
const char *peer_addr;
@@ -1131,7 +1130,7 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local)
{
DBusMessage *message;
struct adapter *adapter;
- struct slist *l;
+ GSList *l;
char path[MAX_PATH_LENGTH];
char *local_addr;
struct remote_dev_info *dev;
@@ -1159,15 +1158,15 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local)
if (adapter->pdiscov_active && !adapter->discov_active) {
send_out_of_range(path, adapter->oor_devices);
- slist_foreach(adapter->oor_devices, (slist_func_t) free, NULL);
- slist_free(adapter->oor_devices);
+ g_slist_foreach(adapter->oor_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->oor_devices);
adapter->oor_devices = NULL;
l = adapter->found_devices;
while (l) {
dev = l->data;
baswap(&tmp, &dev->bdaddr);
- adapter->oor_devices = slist_append(adapter->oor_devices,
+ adapter->oor_devices = g_slist_append(adapter->oor_devices,
batostr(&tmp));
l = l->next;
}
@@ -1206,8 +1205,8 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local)
}
/* free discovered devices list */
- slist_foreach(adapter->found_devices, (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
if (adapter->discov_requestor) {
@@ -1310,13 +1309,13 @@ void hcid_dbus_periodic_inquiry_exit(bdaddr_t *local, uint8_t status)
adapter->discov_type &= ~(PERIODIC_INQUIRY | RESOLVE_NAME);
/* free discovered devices list */
- slist_foreach(adapter->found_devices, (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
/* free out of range devices list */
- slist_foreach(adapter->oor_devices, (slist_func_t) free, NULL);
- slist_free(adapter->oor_devices);
+ g_slist_foreach(adapter->oor_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->oor_devices);
adapter->oor_devices = NULL;
if (adapter->pdiscov_requestor) {
@@ -1372,7 +1371,7 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
DBusMessage *signal_name;
char path[MAX_PATH_LENGTH];
struct adapter *adapter;
- struct slist *l;
+ GSList *l;
struct remote_dev_info match;
char *local_addr, *peer_addr, *name, *tmp_name;
dbus_int16_t tmp_rssi = rssi;
@@ -1412,11 +1411,11 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
adapter->pinq_idle = 0;
/* Out of range list update */
- l = slist_find(adapter->oor_devices, peer_addr,
- (cmp_func_t) strcmp);
+ l = g_slist_find_custom(adapter->oor_devices, peer_addr,
+ (GCompareFunc) strcmp);
if (l) {
char *dev = l->data;
- adapter->oor_devices = slist_remove(adapter->oor_devices,
+ adapter->oor_devices = g_slist_remove(adapter->oor_devices,
dev);
free(dev);
}
@@ -1435,8 +1434,8 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
bacpy(&match.bdaddr, peer);
match.name_status = NAME_SENT;
/* if found: don't send the name again */
- l = slist_find(adapter->found_devices, &match,
- (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(adapter->found_devices, &match,
+ (GCompareFunc) found_device_cmp);
if (l)
goto done;
@@ -1569,8 +1568,8 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
goto done; /* skip if a new request has been sent */
/* free discovered devices list */
- slist_foreach(adapter->found_devices, (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
/*
@@ -1637,16 +1636,16 @@ void hcid_dbus_conn_complete(bdaddr_t *local, uint8_t status, uint16_t handle,
}
if (status) {
- struct slist *l;
+ GSList *l;
cancel_passkey_agent_requests(adapter->passkey_agents, path,
peer);
release_passkey_agents(adapter, peer);
- l = slist_find(adapter->pin_reqs, peer, pin_req_cmp);
+ l = g_slist_find_custom(adapter->pin_reqs, peer, pin_req_cmp);
if (l) {
struct pending_pin_req *p = l->data;
- adapter->pin_reqs = slist_remove(adapter->pin_reqs, p);
+ adapter->pin_reqs = g_slist_remove(adapter->pin_reqs, p);
free(p);
}
@@ -1677,7 +1676,7 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,
struct adapter *adapter;
struct active_conn_info *dev;
DBusMessage *message;
- struct slist *l;
+ GSList *l;
char *local_addr, *peer_addr = NULL;
bdaddr_t tmp;
int id;
@@ -1703,7 +1702,7 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,
goto failed;
}
- l = slist_find(adapter->active_conn, &handle,
+ l = g_slist_find_custom(adapter->active_conn, &handle,
active_conn_find_by_handle);
if (!l)
@@ -1721,10 +1720,10 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,
&dev->bdaddr);
release_passkey_agents(adapter, &dev->bdaddr);
- l = slist_find(adapter->pin_reqs, &dev->bdaddr, pin_req_cmp);
+ l = g_slist_find_custom(adapter->pin_reqs, &dev->bdaddr, pin_req_cmp);
if (l) {
struct pending_pin_req *p = l->data;
- adapter->pin_reqs = slist_remove(adapter->pin_reqs, p);
+ adapter->pin_reqs = g_slist_remove(adapter->pin_reqs, p);
free(p);
}
@@ -1772,7 +1771,7 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,
DBUS_TYPE_INVALID);
send_message_and_unref(connection, message);
- adapter->active_conn = slist_remove(adapter->active_conn, dev);
+ adapter->active_conn = g_slist_remove(adapter->active_conn, dev);
free(dev);
failed:
@@ -1970,7 +1969,7 @@ void hcid_dbus_pin_code_reply(bdaddr_t *local, void *ptr)
struct adapter *adapter;
char *local_addr;
ret_pin_code_req_reply *ret = ptr + EVT_CMD_COMPLETE_SIZE;
- struct slist *l;
+ GSList *l;
char path[MAX_PATH_LENGTH];
bdaddr_t tmp;
int id;
@@ -1990,7 +1989,7 @@ void hcid_dbus_pin_code_reply(bdaddr_t *local, void *ptr)
goto failed;
}
- l = slist_find(adapter->pin_reqs, &ret->bdaddr, pin_req_cmp);
+ l = g_slist_find_custom(adapter->pin_reqs, &ret->bdaddr, pin_req_cmp);
if (l) {
struct pending_pin_info *p = l->data;
p->replied = 1;
@@ -2003,7 +2002,7 @@ failed:
void create_bond_req_exit(const char *name, struct adapter *adapter)
{
char path[MAX_PATH_LENGTH];
- struct slist *l;
+ GSList *l;
snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, adapter->dev_id);
@@ -2014,7 +2013,7 @@ void create_bond_req_exit(const char *name, struct adapter *adapter)
&adapter->bonding->bdaddr);
release_passkey_agents(adapter, &adapter->bonding->bdaddr);
- l = slist_find(adapter->pin_reqs, &adapter->bonding->bdaddr,
+ l = g_slist_find_custom(adapter->pin_reqs, &adapter->bonding->bdaddr,
pin_req_cmp);
if (l) {
struct pending_pin_info *p = l->data;
@@ -2031,7 +2030,7 @@ void create_bond_req_exit(const char *name, struct adapter *adapter)
}
}
- adapter->pin_reqs = slist_remove(adapter->pin_reqs, p);
+ adapter->pin_reqs = g_slist_remove(adapter->pin_reqs, p);
free(p);
}
@@ -2110,7 +2109,7 @@ static int remote_name_cancel(int dd, bdaddr_t *dba, int to)
int cancel_discovery(struct adapter *adapter)
{
struct remote_dev_info *dev, match;
- struct slist *l;
+ GSList *l;
int dd, err = 0;
if (!adapter->discov_active)
@@ -2130,8 +2129,8 @@ int cancel_discovery(struct adapter *adapter)
bacpy(&match.bdaddr, BDADDR_ANY);
match.name_status = NAME_REQUESTED;
- l = slist_find(adapter->found_devices, &match,
- (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(adapter->found_devices, &match,
+ (GCompareFunc) found_device_cmp);
if (l) {
dev = l->data;
if (remote_name_cancel(dd, &dev->bdaddr, 1000) < 0) {
@@ -2154,8 +2153,8 @@ cleanup:
* Reset discov_requestor and discover_state in the remote name
* request event handler or in the inquiry complete handler.
*/
- slist_foreach(adapter->found_devices, (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
/* Disable name resolution for non D-Bus clients */
@@ -2204,7 +2203,7 @@ static int periodic_inquiry_exit(int dd, int to)
int cancel_periodic_discovery(struct adapter *adapter)
{
struct remote_dev_info *dev, match;
- struct slist *l;
+ GSList *l;
int dd, err = 0;
if (!adapter->pdiscov_active)
@@ -2220,8 +2219,8 @@ int cancel_periodic_discovery(struct adapter *adapter)
bacpy(&match.bdaddr, BDADDR_ANY);
match.name_status = NAME_REQUESTED;
- l = slist_find(adapter->found_devices, &match,
- (cmp_func_t) found_device_cmp);
+ l = g_slist_find_custom(adapter->found_devices, &match,
+ (GCompareFunc) found_device_cmp);
if (l) {
dev = l->data;
if (remote_name_cancel(dd, &dev->bdaddr, 1000) < 0) {
@@ -2246,8 +2245,8 @@ cleanup:
* Reset pdiscov_requestor and pdiscov_active is done when the
* cmd complete event for exit periodic inquiry mode cmd arrives.
*/
- slist_foreach(adapter->found_devices, (slist_func_t) free, NULL);
- slist_free(adapter->found_devices);
+ g_slist_foreach(adapter->found_devices, (GFunc) free, NULL);
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
return err;
diff --git a/hcid/dbus-hci.h b/hcid/dbus-hci.h
index 56572b35..a46051bf 100644
--- a/hcid/dbus-hci.h
+++ b/hcid/dbus-hci.h
@@ -70,7 +70,7 @@ void bonding_request_free(struct bonding_request_info *dev);
int pin_req_cmp(const void *p1, const void *p2);
int found_device_cmp(const struct remote_dev_info *d1,
const struct remote_dev_info *d2);
-int found_device_add(struct slist **list, bdaddr_t *bdaddr, int8_t rssi,
+int found_device_add(GSList **list, bdaddr_t *bdaddr, int8_t rssi,
name_status_t name_status);
int found_device_req_name(struct adapter *dbus_data);
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c
index 8af432a9..07fa035b 100644
--- a/hcid/dbus-manager.c
+++ b/hcid/dbus-manager.c
@@ -42,7 +42,6 @@
#include "hcid.h"
#include "dbus.h"
-#include "list.h"
#include "dbus-common.h"
#include "dbus-error.h"
#include "dbus-security.h"
@@ -454,7 +453,7 @@ static DBusHandlerResult add_service_record(DBusConnection *conn,
rec->handle = handle;
}
- agent->records = slist_append(agent->records, rec);
+ agent->records = g_slist_append(agent->records, rec);
dbus_message_append_args(reply,
DBUS_TYPE_UINT32, &rec->ext_handle,
@@ -555,7 +554,7 @@ static DBusHandlerResult add_service_record_xml(DBusConnection *conn,
rec->handle = handle;
}
- agent->records = slist_append(agent->records, rec);
+ agent->records = g_slist_append(agent->records, rec);
dbus_message_append_args(reply,
DBUS_TYPE_UINT32, &rec->ext_handle,
@@ -576,7 +575,7 @@ static DBusHandlerResult remove_service_record(DBusConnection *conn,
struct service_agent *agent;
struct binary_record *rec;
DBusMessage *reply;
- struct slist *l;
+ GSList *l;
const char *path;
uint32_t handle;
@@ -599,7 +598,7 @@ static DBusHandlerResult remove_service_record(DBusConnection *conn,
return error_not_authorized(conn, msg);
- l = slist_find(agent->records, &handle, (cmp_func_t) binary_record_cmp);
+ l = g_slist_find_custom(agent->records, &handle, (GCompareFunc) binary_record_cmp);
if (!l)
return error_record_does_not_exist(conn, msg);
@@ -608,7 +607,7 @@ static DBusHandlerResult remove_service_record(DBusConnection *conn,
return DBUS_HANDLER_RESULT_NEED_MEMORY;
rec = l->data;
- agent->records = slist_remove(agent->records, rec);
+ agent->records = g_slist_remove(agent->records, rec);
/* If the service agent is running: remove it from the from sdpd */
if (agent->running && rec->handle != 0xffffffff) {
diff --git a/hcid/dbus-rfcomm.c b/hcid/dbus-rfcomm.c
index d238669c..673df910 100644
--- a/hcid/dbus-rfcomm.c
+++ b/hcid/dbus-rfcomm.c
@@ -45,7 +45,6 @@
#include <dbus/dbus.h>
#include "hcid.h"
-#include "list.h"
#include "glib-ectomy.h"
#include "dbus.h"
#include "dbus-common.h"
@@ -87,9 +86,9 @@ struct pending_connect {
int ntries;
};
-static struct slist *pending_connects = NULL;
-static struct slist *connected_nodes = NULL;
-static struct slist *bound_nodes = NULL;
+static GSList *pending_connects = NULL;
+static GSList *connected_nodes = NULL;
+static GSList *bound_nodes = NULL;
static char *rfcomm_node_name_from_id(int16_t id, char *dev, size_t len)
{
@@ -110,9 +109,9 @@ static void rfcomm_node_free(struct rfcomm_node *node)
free(node);
}
-static struct rfcomm_node *find_node_by_name(struct slist *nodes, const char *name)
+static struct rfcomm_node *find_node_by_name(GSList *nodes, const char *name)
{
- struct slist *l;
+ GSList *l;
for (l = nodes; l != NULL; l = l->next) {
struct rfcomm_node *node = l->data;
@@ -126,7 +125,7 @@ static struct rfcomm_node *find_node_by_name(struct slist *nodes, const char *na
static struct pending_connect *find_pending_connect_by_channel(const char *bda,
uint8_t ch)
{
- struct slist *l;
+ GSList *l;
bdaddr_t dba;
str2ba(bda, &dba);
@@ -144,7 +143,7 @@ static struct pending_connect *find_pending_connect_by_channel(const char *bda,
static struct pending_connect *find_pending_connect_by_service(const char *bda,
const char *svc)
{
- struct slist *l;
+ GSList *l;
bdaddr_t dba;
str2ba(bda, &dba);
@@ -235,7 +234,7 @@ static void rfcomm_connect_req_exit(const char *name, void *data)
debug("Connect requestor %s exited. Releasing %s node",
name, node->name);
rfcomm_release(node, NULL);
- connected_nodes = slist_remove(connected_nodes, node);
+ connected_nodes = g_slist_remove(connected_nodes, node);
rfcomm_node_free(node);
}
@@ -245,7 +244,7 @@ static gboolean rfcomm_disconnect_cb(GIOChannel *io, GIOCondition cond,
debug("RFCOMM node %s was disconnected", node->name);
name_listener_remove(node->conn, node->owner,
rfcomm_connect_req_exit, node);
- connected_nodes = slist_remove(connected_nodes, node);
+ connected_nodes = g_slist_remove(connected_nodes, node);
rfcomm_node_free(node);
return FALSE;
}
@@ -289,7 +288,7 @@ static void rfcomm_connect_cb_devnode_opened(int fd, struct pending_connect *c,
send_message_and_unref(c->conn, reply);
- connected_nodes = slist_append(connected_nodes, node);
+ connected_nodes = g_slist_append(connected_nodes, node);
node->conn = dbus_connection_ref(c->conn);
name_listener_add(node->conn, node->owner,
@@ -304,7 +303,7 @@ failed:
if (reply)
dbus_message_unref(reply);
done:
- pending_connects = slist_remove(pending_connects, c);
+ pending_connects = g_slist_remove(pending_connects, c);
pending_connect_free(c);
}
@@ -339,7 +338,7 @@ failed:
rfcomm_release(node, NULL);
rfcomm_node_free(node);
- pending_connects = slist_remove(pending_connects, c);
+ pending_connects = g_slist_remove(pending_connects, c);
pending_connect_free(c);
return FALSE;
@@ -426,7 +425,7 @@ failed:
if (node)
rfcomm_node_free(node);
- pending_connects = slist_remove(pending_connects, c);
+ pending_connects = g_slist_remove(pending_connects, c);
pending_connect_free(c);
return FALSE;
@@ -497,7 +496,7 @@ static int rfcomm_connect(DBusConnection *conn, DBusMessage *msg, bdaddr_t *src,
debug("Connect in progress");
g_io_add_watch(c->io, G_IO_OUT, (GIOFunc) rfcomm_connect_cb, c);
- pending_connects = slist_append(pending_connects, c);
+ pending_connects = g_slist_append(pending_connects, c);
} else {
debug("Connect succeeded with first try");
(void) rfcomm_connect_cb(c->io, G_IO_OUT, c);
@@ -518,7 +517,7 @@ static void rfcomm_bind_req_exit(const char *name, void *data)
struct rfcomm_node *node = data;
debug("Bind requestor %s exited. Releasing %s node", name, node->name);
rfcomm_release(node, NULL);
- bound_nodes = slist_remove(bound_nodes, node);
+ bound_nodes = g_slist_remove(bound_nodes, node);
rfcomm_node_free(node);
}
@@ -564,7 +563,7 @@ static struct rfcomm_node *rfcomm_bind(bdaddr_t *src, const char *bda,
}
rfcomm_node_name_from_id(node->id, node->name, sizeof(node->name));
- bound_nodes = slist_append(bound_nodes, node);
+ bound_nodes = g_slist_append(bound_nodes, node);
node->conn = dbus_connection_ref(conn);
name_listener_add(node->conn, node->owner, rfcomm_bind_req_exit, node);
@@ -812,7 +811,7 @@ static DBusHandlerResult rfcomm_disconnect_req(DBusConnection *conn,
name_listener_remove(node->conn, node->owner,
rfcomm_connect_req_exit, node);
- connected_nodes = slist_remove(connected_nodes, node);
+ connected_nodes = g_slist_remove(connected_nodes, node);
rfcomm_node_free(node);
return send_message_and_unref(conn, reply);
@@ -875,7 +874,7 @@ failed:
if (reply)
dbus_message_unref(reply);
if (node) {
- bound_nodes = slist_remove(bound_nodes, node);
+ bound_nodes = g_slist_remove(bound_nodes, node);
rfcomm_release(node, NULL);
rfcomm_node_free(node);
}
@@ -965,7 +964,7 @@ need_memory:
if (reply)
dbus_message_unref(reply);
if (node) {
- bound_nodes = slist_remove(bound_nodes, node);
+ bound_nodes = g_slist_remove(bound_nodes, node);
rfcomm_release(node, NULL);
rfcomm_node_free(node);
}
@@ -1003,7 +1002,7 @@ static DBusHandlerResult rfcomm_release_req(DBusConnection *conn,
name_listener_remove(node->conn, node->owner,
rfcomm_bind_req_exit, node);
- bound_nodes = slist_remove(bound_nodes, node);
+ bound_nodes = g_slist_remove(bound_nodes, node);
rfcomm_node_free(node);
return send_message_and_unref(conn, reply);
@@ -1016,7 +1015,7 @@ static DBusHandlerResult rfcomm_list_bindings_req(DBusConnection *conn,
DBusMessage *reply;
DBusMessageIter iter, sub;
struct adapter *adapter = data;
- struct slist *l;
+ GSList *l;
hci_devba(adapter->dev_id, &bdaddr);
diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c
index 2e3d563a..781b7e52 100644
--- a/hcid/dbus-sdp.c
+++ b/hcid/dbus-sdp.c
@@ -46,7 +46,6 @@
#include <dbus/dbus.h>
-#include "list.h"
#include "dbus.h"
#include "hcid.h"
#include "textfile.h"
@@ -158,7 +157,7 @@ uint16_t sdp_str2svclass(const char *str)
}
/* list of remote and local service records */
-static struct slist *pending_connects = NULL;
+static GSList *pending_connects = NULL;
static struct pending_connect *pending_connect_new(DBusConnection *conn, DBusMessage *msg,
const char *dst, connect_cb_t *cb)
@@ -207,7 +206,7 @@ static void pending_connect_free(struct pending_connect *c)
static struct pending_connect *find_pending_connect(const char *dst)
{
- struct slist *l;
+ GSList *l;
for (l = pending_connects; l != NULL; l = l->next) {
struct pending_connect *pending = l->data;
@@ -634,7 +633,7 @@ failed:
g_io_channel_unref(chan);
done:
- pending_connects = slist_remove(pending_connects, c);
+ pending_connects = g_slist_remove(pending_connects, c);
pending_connect_free(c);
return FALSE;
@@ -671,7 +670,7 @@ static struct pending_connect *connect_request(DBusConnection *conn,
chan = g_io_channel_unix_new(sdp_get_socket(c->session));
g_io_add_watch(chan, G_IO_OUT, sdp_client_connect_cb, c);
- pending_connects = slist_append(pending_connects, c);
+ pending_connects = g_slist_append(pending_connects, c);
return c;
}
diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c
index 012114aa..522dda7d 100644
--- a/hcid/dbus-security.c
+++ b/hcid/dbus-security.c
@@ -57,7 +57,7 @@ static void send_cancel_request(struct pending_agent_request *req);
static void passkey_agent_free(struct passkey_agent *agent)
{
- struct slist *l;
+ GSList *l;
if (!agent)
return;
@@ -86,14 +86,14 @@ static void passkey_agent_free(struct passkey_agent *agent)
if (agent->conn)
dbus_connection_unref(agent->conn);
- slist_free(agent->pending_requests);
+ g_slist_free(agent->pending_requests);
free(agent);
}
static void agent_exited(const char *name, struct adapter *adapter)
{
- struct slist *cur, *next;
+ GSList *cur, *next;
debug("Passkey agent %s exited without calling Unregister", name);
@@ -107,7 +107,7 @@ static void agent_exited(const char *name, struct adapter *adapter)
agent->exited = 1;
- adapter->passkey_agents = slist_remove(adapter->passkey_agents, agent);
+ adapter->passkey_agents = g_slist_remove(adapter->passkey_agents, agent);
passkey_agent_free(agent);
}
}
@@ -119,7 +119,7 @@ static gboolean agent_timeout(struct passkey_agent *agent)
debug("Passkey Agent at %s, %s timed out", agent->name, agent->path);
if (adapter)
- adapter->passkey_agents = slist_remove(adapter->passkey_agents, agent);
+ adapter->passkey_agents = g_slist_remove(adapter->passkey_agents, agent);
agent->timeout = 0;
@@ -241,7 +241,7 @@ static DBusHandlerResult register_passkey_agent(DBusConnection *conn,
ref.addr = (char *) addr;
ref.path = (char *) path;
- if (slist_find(adapter->passkey_agents, &ref, (cmp_func_t) agent_cmp))
+ if (g_slist_find_custom(adapter->passkey_agents, &ref, (GCompareFunc) agent_cmp))
return error_passkey_agent_already_exists(conn, msg);
agent = passkey_agent_new(adapter, conn, ref.name, path, addr);
@@ -258,12 +258,12 @@ static DBusHandlerResult register_passkey_agent(DBusConnection *conn,
/* Only add a name listener if there isn't one already for this name */
ref.addr = NULL;
ref.path = NULL;
- if (!slist_find(adapter->passkey_agents, &ref, (cmp_func_t) agent_cmp))
+ if (!g_slist_find_custom(adapter->passkey_agents, &ref, (GCompareFunc) agent_cmp))
name_listener_add(conn, ref.name, (name_cb_t) agent_exited, adapter);
agent->timeout = g_timeout_add(AGENT_TIMEOUT, (GSourceFunc)agent_timeout, agent);
- adapter->passkey_agents = slist_append(adapter->passkey_agents, agent);
+ adapter->passkey_agents = g_slist_append(adapter->passkey_agents, agent);
return send_message_and_unref(conn, reply);
}
@@ -272,7 +272,7 @@ static DBusHandlerResult unregister_passkey_agent(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct adapter *adapter;
- struct slist *match;
+ GSList *match;
struct passkey_agent ref, *agent;
DBusMessage *reply;
const char *path, *addr;
@@ -296,7 +296,7 @@ static DBusHandlerResult unregister_passkey_agent(DBusConnection *conn,
ref.path = (char *) path;
ref.addr = (char *) addr;
- match = slist_find(adapter->passkey_agents, &ref, (cmp_func_t) agent_cmp);
+ match = g_slist_find_custom(adapter->passkey_agents, &ref, (GCompareFunc) agent_cmp);
if (!match)
return error_passkey_agent_does_not_exist(conn, msg);
@@ -305,7 +305,7 @@ static DBusHandlerResult unregister_passkey_agent(DBusConnection *conn,
name_listener_remove(agent->conn, agent->name,
(name_cb_t) agent_exited, adapter);
- adapter->passkey_agents = slist_remove(adapter->passkey_agents, agent);
+ adapter->passkey_agents = g_slist_remove(adapter->passkey_agents, agent);
agent->exited = 1;
passkey_agent_free(agent);
@@ -461,7 +461,7 @@ static void pend_auth_agent_req_cancel(struct pend_auth_agent_req *req)
static void auth_agent_cancel_requests(struct authorization_agent *agent)
{
- struct slist *l;
+ GSList *l;
for (l = agent->pending_requests; l != NULL; l = l->next) {
struct pend_auth_agent_req *req = l->data;
@@ -498,7 +498,7 @@ static void auth_agent_free(struct authorization_agent *agent)
free(agent->name);
free(agent->path);
dbus_connection_unref(agent->conn);
- slist_free(agent->pending_requests);
+ g_slist_free(agent->pending_requests);
free(agent);
}
@@ -697,7 +697,7 @@ reject:
done:
dbus_message_unref(reply);
- agent->pending_requests = slist_remove(agent->pending_requests, req);
+ agent->pending_requests = g_slist_remove(agent->pending_requests, req);
pend_auth_agent_req_free(req);
}
@@ -759,7 +759,7 @@ static DBusHandlerResult call_auth_agent(DBusMessage *msg,
dbus_pending_call_set_notify(req->call,
auth_agent_req_reply, req, NULL);
- agent->pending_requests = slist_append(agent->pending_requests, req);
+ agent->pending_requests = g_slist_append(agent->pending_requests, req);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -769,7 +769,7 @@ static DBusHandlerResult authorize_service(DBusConnection *conn,
{
const char *service_path, *adapter_path, *address, *action;
struct service_agent *sagent;
- struct slist *l;
+ GSList *l;
if (!hcid_dbus_use_experimental())
return error_unknown_method(conn, msg);
@@ -796,7 +796,7 @@ static DBusHandlerResult authorize_service(DBusConnection *conn,
return error_rejected(conn, msg);
/* Check it is a trusted device */
- l = slist_find(sagent->trusted_devices, address, (cmp_func_t) strcasecmp);
+ l = g_slist_find_custom(sagent->trusted_devices, address, (GCompareFunc) strcasecmp);
if (l)
return send_message_and_unref(conn,
dbus_message_new_method_return(msg));
@@ -817,7 +817,7 @@ static DBusHandlerResult auth_agent_send_cancel(DBusMessage *msg,
{
struct pend_auth_agent_req *req = NULL;
DBusMessage *message;
- struct slist *l;
+ GSList *l;
for (l = agent->pending_requests; l != NULL; l = l->next) {
req = l->data;
@@ -1021,7 +1021,7 @@ done:
if (message)
dbus_message_unref(message);
- agent->pending_requests = slist_remove(agent->pending_requests, req);
+ agent->pending_requests = g_slist_remove(agent->pending_requests, req);
dbus_pending_call_cancel(req->call);
if (req->call)
dbus_pending_call_unref(req->call);
@@ -1029,7 +1029,7 @@ done:
free(req);
if (agent != default_agent) {
- agent->adapter->passkey_agents = slist_remove(agent->adapter->passkey_agents,
+ agent->adapter->passkey_agents = g_slist_remove(agent->adapter->passkey_agents,
agent);
passkey_agent_free(agent);
}
@@ -1068,7 +1068,7 @@ static int call_passkey_agent(DBusConnection *conn,
dbus_pending_call_set_notify(req->call, passkey_agent_reply, req, NULL);
- agent->pending_requests = slist_append(agent->pending_requests, req);
+ agent->pending_requests = g_slist_append(agent->pending_requests, req);
return 0;
@@ -1088,7 +1088,7 @@ int handle_passkey_request(DBusConnection *conn, int dev, const char *path,
{
struct passkey_agent *agent = default_agent;
struct adapter *adapter = NULL;
- struct slist *l;
+ GSList *l;
char addr[18];
void *data;
@@ -1106,7 +1106,7 @@ int handle_passkey_request(DBusConnection *conn, int dev, const char *path,
for (l = adapter->passkey_agents; l != NULL; l = l->next) {
struct passkey_agent *a = l->data;
- if (a != default_agent && slist_length(a->pending_requests) >= 1)
+ if (a != default_agent && g_slist_length(a->pending_requests) >= 1)
continue;
if (!strcmp(a->addr, addr)) {
agent = a;
@@ -1203,7 +1203,7 @@ done:
if (message)
dbus_message_unref(message);
- agent->pending_requests = slist_remove(agent->pending_requests, req);
+ agent->pending_requests = g_slist_remove(agent->pending_requests, req);
dbus_pending_call_cancel(req->call);
if (req->call)
dbus_pending_call_unref(req->call);
@@ -1213,7 +1213,7 @@ done:
free(req);
if (agent != default_agent) {
- agent->adapter->passkey_agents = slist_remove(agent->adapter->passkey_agents,
+ agent->adapter->passkey_agents = g_slist_remove(agent->adapter->passkey_agents,
agent);
passkey_agent_free(agent);
}
@@ -1255,7 +1255,7 @@ static int call_confirm_agent(DBusConnection *conn,
dbus_pending_call_set_notify(req->call, confirm_agent_reply, req, NULL);
- agent->pending_requests = slist_append(agent->pending_requests, req);
+ agent->pending_requests = g_slist_append(agent->pending_requests, req);
return 0;
@@ -1277,7 +1277,7 @@ int handle_confirm_request(DBusConnection *conn, int dev, const char *path,
{
struct passkey_agent *agent = default_agent;
struct adapter *adapter = NULL;
- struct slist *l;
+ GSList *l;
char addr[18];
void *data;
@@ -1295,7 +1295,7 @@ int handle_confirm_request(DBusConnection *conn, int dev, const char *path,
for (l = adapter->passkey_agents; l != NULL; l = l->next) {
struct passkey_agent *a = l->data;
- if (a != default_agent && slist_length(a->pending_requests) >= 1)
+ if (a != default_agent && g_slist_length(a->pending_requests) >= 1)
continue;
if (!strcmp(a->addr, addr)) {
agent = a;
@@ -1366,7 +1366,7 @@ static void release_agent(struct passkey_agent *agent)
/* Only remove the name listener if there are no more agents for this name */
memset(&ref, 0, sizeof(ref));
ref.name = agent->name;
- if (!slist_find(agent->adapter->passkey_agents, &ref, (cmp_func_t) agent_cmp))
+ if (!g_slist_find_custom(agent->adapter->passkey_agents, &ref, (GCompareFunc) agent_cmp))
name_listener_remove(agent->conn, ref.name,
(name_cb_t) agent_exited, agent->adapter);
}
@@ -1395,7 +1395,7 @@ void release_default_auth_agent(void)
void release_passkey_agents(struct adapter *adapter, bdaddr_t *bda)
{
- struct slist *l, *next;
+ GSList *l, *next;
for (l = adapter->passkey_agents; l != NULL; l = next) {
struct passkey_agent *agent = l->data;
@@ -1408,15 +1408,15 @@ void release_passkey_agents(struct adapter *adapter, bdaddr_t *bda)
continue;
}
- adapter->passkey_agents = slist_remove(adapter->passkey_agents, agent);
+ adapter->passkey_agents = g_slist_remove(adapter->passkey_agents, agent);
passkey_agent_free(agent);
}
}
-void cancel_passkey_agent_requests(struct slist *agents, const char *path,
+void cancel_passkey_agent_requests(GSList *agents, const char *path,
bdaddr_t *addr)
{
- struct slist *l, *next;
+ GSList *l, *next;
/* First check the default agent */
for (l = default_agent ? default_agent->pending_requests : NULL; l != NULL; l = next) {
@@ -1424,7 +1424,7 @@ void cancel_passkey_agent_requests(struct slist *agents, const char *path,
next = l->next;
if (!strcmp(path, req->path) && (!addr || !bacmp(addr, &req->bda))) {
send_cancel_request(req);
- default_agent->pending_requests = slist_remove(default_agent->pending_requests,
+ default_agent->pending_requests = g_slist_remove(default_agent->pending_requests,
req);
}
}
@@ -1438,7 +1438,7 @@ void cancel_passkey_agent_requests(struct slist *agents, const char *path,
next = l->next;
if (!strcmp(path, req->path) && (!addr || !bacmp(addr, &req->bda))) {
send_cancel_request(req);
- agent->pending_requests = slist_remove(agent->pending_requests, req);
+ agent->pending_requests = g_slist_remove(agent->pending_requests, req);
}
}
}
diff --git a/hcid/dbus-security.h b/hcid/dbus-security.h
index 2096437a..d0f0fe07 100644
--- a/hcid/dbus-security.h
+++ b/hcid/dbus-security.h
@@ -32,7 +32,7 @@ struct passkey_agent {
char *addr;
char *name;
char *path;
- struct slist *pending_requests;
+ GSList *pending_requests;
int exited;
guint timeout;
};
@@ -52,7 +52,7 @@ struct authorization_agent {
DBusConnection *conn;
char *name;
char *path;
- struct slist *pending_requests;
+ GSList *pending_requests;
};
struct pend_auth_agent_req {
@@ -79,6 +79,6 @@ void release_default_auth_agent(void);
void release_passkey_agents(struct adapter *adapter, bdaddr_t *bda);
-void cancel_passkey_agent_requests(struct slist *agents, const char *path, bdaddr_t *dba);
+void cancel_passkey_agent_requests(GSList *agents, const char *path, bdaddr_t *dba);
#endif /* __BLUEZ_DBUS_SECURITY_H */
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c
index 103c8a4b..625a1c32 100644
--- a/hcid/dbus-service.c
+++ b/hcid/dbus-service.c
@@ -34,14 +34,13 @@
#include "hcid.h"
#include "dbus.h"
-#include "list.h"
#include "dbus-common.h"
#include "dbus-error.h"
#include "dbus-manager.h"
#include "dbus-service.h"
#include "dbus-hci.h"
-static struct slist *services = NULL;
+static GSList *services = NULL;
struct binary_record *binary_record_new()
{
@@ -156,13 +155,13 @@ static void service_agent_free(struct service_agent *agent)
free(agent->description);
if (agent->trusted_devices) {
- slist_foreach(agent->trusted_devices, (slist_func_t) free, NULL);
- slist_free(agent->trusted_devices);
+ g_slist_foreach(agent->trusted_devices, (GFunc) free, NULL);
+ g_slist_free(agent->trusted_devices);
}
if (agent->records) {
- slist_foreach(agent->records, (slist_func_t) binary_record_free, NULL);
- slist_free(agent->records);
+ g_slist_foreach(agent->records, (GFunc) binary_record_free, NULL);
+ g_slist_free(agent->records);
}
free(agent);
@@ -205,7 +204,7 @@ mem_fail:
return NULL;
}
-int register_agent_records(struct slist *lrecords)
+int register_agent_records(GSList *lrecords)
{
while (lrecords) {
struct binary_record *rec = lrecords->data;
@@ -227,7 +226,7 @@ int register_agent_records(struct slist *lrecords)
return 0;
}
-static int unregister_agent_records(struct slist *lrecords)
+static int unregister_agent_records(GSList *lrecords)
{
while (lrecords) {
struct binary_record *rec = lrecords->data;
@@ -252,7 +251,7 @@ static void service_agent_exit(const char *name, void *data)
{
DBusConnection *conn = data;
DBusMessage *message;
- struct slist *l, *lremove = NULL;
+ GSList *l, *lremove = NULL;
struct service_agent *agent;
const char *path;
@@ -281,12 +280,12 @@ static void service_agent_exit(const char *name, void *data)
DBUS_TYPE_INVALID);
send_message_and_unref(conn, message);
- lremove = slist_append(lremove, l->data);
- services = slist_remove(services, l->data);
+ lremove = g_slist_append(lremove, l->data);
+ services = g_slist_remove(services, l->data);
}
- slist_foreach(lremove, (slist_func_t) free, NULL);
- slist_free(lremove);
+ g_slist_foreach(lremove, (GFunc) free, NULL);
+ g_slist_free(lremove);
}
static void forward_reply(DBusPendingCall *call, void *udata)
@@ -560,7 +559,7 @@ static DBusHandlerResult set_trusted(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct service_agent *agent = data;
- struct slist *l;
+ GSList *l;
DBusMessage *reply;
const char *address;
@@ -572,7 +571,7 @@ static DBusHandlerResult set_trusted(DBusConnection *conn,
if (check_address(address) < 0)
return error_invalid_arguments(conn, msg);
- l = slist_find(agent->trusted_devices, address, (cmp_func_t) strcasecmp);
+ l = g_slist_find_custom(agent->trusted_devices, address, (GCompareFunc) strcasecmp);
if (l)
return error_trusted_device_already_exists(conn, msg);
@@ -580,7 +579,7 @@ static DBusHandlerResult set_trusted(DBusConnection *conn,
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- agent->trusted_devices = slist_append(agent->trusted_devices, strdup(address));
+ agent->trusted_devices = g_slist_append(agent->trusted_devices, strdup(address));
return send_message_and_unref(conn, reply);
}
@@ -589,7 +588,7 @@ static DBusHandlerResult is_trusted(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct service_agent *agent = data;
- struct slist *l;
+ GSList *l;
DBusMessage *reply;
const char *address;
dbus_bool_t trusted;
@@ -599,7 +598,7 @@ static DBusHandlerResult is_trusted(DBusConnection *conn,
DBUS_TYPE_INVALID))
return error_invalid_arguments(conn, msg);
- l = slist_find(agent->trusted_devices, address, (cmp_func_t) strcasecmp);
+ l = g_slist_find_custom(agent->trusted_devices, address, (GCompareFunc) strcasecmp);
trusted = (l? TRUE : FALSE);
reply = dbus_message_new_method_return(msg);
@@ -617,7 +616,7 @@ static DBusHandlerResult remove_trust(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct service_agent *agent = data;
- struct slist *l;
+ GSList *l;
DBusMessage *reply;
const char *address;
void *paddress;
@@ -627,7 +626,7 @@ static DBusHandlerResult remove_trust(DBusConnection *conn,
DBUS_TYPE_INVALID))
return error_invalid_arguments(conn, msg);
- l = slist_find(agent->trusted_devices, address, (cmp_func_t) strcasecmp);
+ l = g_slist_find_custom(agent->trusted_devices, address, (GCompareFunc) strcasecmp);
if (!l)
return error_trusted_device_does_not_exists(conn, msg);
@@ -636,7 +635,7 @@ static DBusHandlerResult remove_trust(DBusConnection *conn,
return DBUS_HANDLER_RESULT_NEED_MEMORY;
paddress = l->data;
- agent->trusted_devices = slist_remove(agent->trusted_devices, l->data);
+ agent->trusted_devices = g_slist_remove(agent->trusted_devices, l->data);
free(paddress);
return send_message_and_unref(conn, reply);
@@ -718,7 +717,7 @@ int register_service_agent(DBusConnection *conn, const char *sender,
const char *path, const char *name, const char *description)
{
struct service_agent *agent;
- struct slist *l;
+ GSList *l;
debug("Registering service object: %s", path);
@@ -727,7 +726,7 @@ int register_service_agent(DBusConnection *conn, const char *sender,
if (!agent)
return -ENOMEM;
- l = slist_find(services, path, (cmp_func_t) strcmp);
+ l = g_slist_find_custom(services, path, (GCompareFunc) strcmp);
if (l)
return -EADDRNOTAVAIL;
@@ -736,7 +735,7 @@ int register_service_agent(DBusConnection *conn, const char *sender,
return -ENOMEM;
}
- services = slist_append(services, strdup(path));
+ services = g_slist_append(services, strdup(path));
name_listener_add(conn, sender, (name_cb_t) service_agent_exit, conn);
@@ -746,7 +745,7 @@ int register_service_agent(DBusConnection *conn, const char *sender,
int unregister_service_agent(DBusConnection *conn, const char *sender, const char *path)
{
struct service_agent *agent;
- struct slist *l;
+ GSList *l;
debug("Unregistering service object: %s", path);
@@ -766,10 +765,10 @@ int unregister_service_agent(DBusConnection *conn, const char *sender, const cha
name_listener_remove(conn, sender, (name_cb_t) service_agent_exit, conn);
- l = slist_find(services, path, (cmp_func_t) strcmp);
+ l = g_slist_find_custom(services, path, (GCompareFunc) strcmp);
if (l) {
void *p = l->data;
- services = slist_remove(services, l->data);
+ services = g_slist_remove(services, l->data);
free(p);
}
@@ -791,7 +790,7 @@ void send_release(DBusConnection *conn, const char *id, const char *path)
void release_service_agents(DBusConnection *conn)
{
- struct slist *l = services;
+ GSList *l = services;
struct service_agent *agent;
const char *path;
@@ -814,14 +813,14 @@ void release_service_agents(DBusConnection *conn)
dbus_connection_unregister_object_path(conn, path);
}
- slist_foreach(services, (slist_func_t) free, NULL);
- slist_free(services);
+ g_slist_foreach(services, (GFunc) free, NULL);
+ g_slist_free(services);
services = NULL;
}
void append_available_services(DBusMessageIter *array_iter)
{
- struct slist *l = services;
+ GSList *l = services;
const char *path;
while (l) {
diff --git a/hcid/dbus-service.h b/hcid/dbus-service.h
index f96f2aa7..5fdf6b9a 100644
--- a/hcid/dbus-service.h
+++ b/hcid/dbus-service.h
@@ -33,8 +33,8 @@ struct service_agent {
char *name;
char *description;
int running;
- struct slist *trusted_devices;
- struct slist *records; /* list of binary records */
+ GSList *trusted_devices;
+ GSList *records; /* list of binary records */
};
struct service_call {
@@ -61,7 +61,7 @@ int unregister_service_agent(DBusConnection *conn, const char *sender,
void release_service_agents(DBusConnection *conn);
void append_available_services(DBusMessageIter *iter);
-int register_agent_records(struct slist *lrecords);
+int register_agent_records(GSList *lrecords);
struct service_call *service_call_new(DBusConnection *conn, DBusMessage *msg,
struct service_agent *agent);
diff --git a/hcid/dbus-test.c b/hcid/dbus-test.c
index 988fd5f0..407d4f1a 100644
--- a/hcid/dbus-test.c
+++ b/hcid/dbus-test.c
@@ -34,7 +34,6 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
-#include "list.h"
#include "hcid.h"
#include "dbus.h"
#include "dbus-common.h"
@@ -77,7 +76,7 @@ struct audit {
uint32_t mask;
};
-static struct slist *audits = NULL;
+static GSList *audits = NULL;
static gboolean l2raw_connect_complete(GIOChannel *io, GIOCondition cond,
struct audit *audit);
@@ -140,7 +139,7 @@ static void send_audit_status(struct audit *audit, const char *name)
static void audit_requestor_exited(const char *name, struct audit *audit)
{
debug("AuditRemoteDevice requestor %s exited", name);
- audits = slist_remove(audits, audit);
+ audits = g_slist_remove(audits, audit);
if (audit->io) {
struct adapter *adapter = NULL;
@@ -169,7 +168,7 @@ int audit_addr_cmp(const void *a, const void *b)
static gboolean audit_in_progress(void)
{
- struct slist *l;
+ GSList *l;
for (l = audits; l != NULL; l = l->next) {
struct audit *audit = l->data;
@@ -187,7 +186,7 @@ static gboolean l2raw_input_timer(struct audit *audit)
send_audit_status(audit, "AuditRemoteDeviceComplete");
g_io_channel_close(audit->io);
- audits = slist_remove(audits, audit);
+ audits = g_slist_remove(audits, audit);
name_listener_remove(audit->conn, audit->requestor,
(name_cb_t) audit_requestor_exited, audit);
audit_free(audit);
@@ -332,7 +331,7 @@ failed:
g_io_channel_close(io);
g_io_channel_unref(io);
- audits = slist_remove(audits, audit);
+ audits = g_slist_remove(audits, audit);
name_listener_remove(audit->conn, audit->requestor,
(name_cb_t) audit_requestor_exited, audit);
@@ -408,7 +407,7 @@ failed:
g_io_channel_close(io);
g_io_channel_unref(io);
- audits = slist_remove(audits, audit);
+ audits = g_slist_remove(audits, audit);
name_listener_remove(audit->conn, audit->requestor,
(name_cb_t) audit_requestor_exited, audit);
audit_free(audit);
@@ -448,7 +447,7 @@ static DBusHandlerResult audit_remote_device(DBusConnection *conn,
if (adapter->bonding)
return error_bonding_in_progress(conn, msg);
- if (slist_find(adapter->pin_reqs, &peer, pin_req_cmp))
+ if (g_slist_find_custom(adapter->pin_reqs, &peer, pin_req_cmp))
return error_bonding_in_progress(conn, msg);
if (!read_l2cap_info(&local, &peer, NULL, NULL, NULL, NULL))
@@ -459,7 +458,7 @@ static DBusHandlerResult audit_remote_device(DBusConnection *conn,
return DBUS_HANDLER_RESULT_NEED_MEMORY;
/* Just return if an audit for the same device is already queued */
- if (slist_find(audits, &peer, audit_addr_cmp))
+ if (g_slist_find_custom(audits, &peer, audit_addr_cmp))
return send_message_and_unref(conn, reply);
if (adapter->discov_active || (adapter->pdiscov_active && !adapter->pinq_idle))
@@ -494,7 +493,7 @@ static DBusHandlerResult audit_remote_device(DBusConnection *conn,
name_listener_add(conn, dbus_message_get_sender(msg),
(name_cb_t) audit_requestor_exited, audit);
- audits = slist_append(audits, audit);
+ audits = g_slist_append(audits, audit);
return send_message_and_unref(conn, reply);
}
@@ -507,7 +506,7 @@ static DBusHandlerResult cancel_audit_remote_device(DBusConnection *conn,
DBusError err;
const char *address;
bdaddr_t peer, local;
- struct slist *l;
+ GSList *l;
struct audit *audit;
dbus_error_init(&err);
@@ -526,7 +525,7 @@ static DBusHandlerResult cancel_audit_remote_device(DBusConnection *conn,
str2ba(address, &peer);
str2ba(adapter->address, &local);
- l = slist_find(audits, &peer, audit_addr_cmp);
+ l = g_slist_find_custom(audits, &peer, audit_addr_cmp);
if (!l)
return error_not_in_progress(conn, msg, "Audit not in progress");
@@ -547,7 +546,7 @@ static DBusHandlerResult cancel_audit_remote_device(DBusConnection *conn,
if (audit->timeout)
g_timeout_remove(audit->timeout);
- audits = slist_remove(audits, audit);
+ audits = g_slist_remove(audits, audit);
name_listener_remove(audit->conn, audit->requestor,
(name_cb_t) audit_requestor_exited, audit);
audit_free(audit);
@@ -669,7 +668,7 @@ DBusHandlerResult handle_test_method(DBusConnection *conn, DBusMessage *msg, voi
void process_audits_list(const char *adapter_path)
{
- struct slist *l, *next;
+ GSList *l, *next;
for (l = audits; l != NULL; l = next) {
struct adapter *adapter;
@@ -692,7 +691,7 @@ void process_audits_list(const char *adapter_path)
(void *) &adapter);
if (!adapter) {
- audits = slist_remove(audits, audit);
+ audits = g_slist_remove(audits, audit);
name_listener_remove(audit->conn, audit->requestor,
(name_cb_t) audit_requestor_exited, audit);
audit_free(audit);
@@ -706,7 +705,7 @@ void process_audits_list(const char *adapter_path)
sk = l2raw_connect(adapter->address, &audit->peer);
if (sk < 0) {
send_audit_status(audit, "AuditRemoteDeviceFailed");
- audits = slist_remove(audits, audit);
+ audits = g_slist_remove(audits, audit);
name_listener_remove(audit->conn, audit->requestor,
(name_cb_t) audit_requestor_exited, audit);
audit_free(audit);
diff --git a/hcid/security.c b/hcid/security.c
index 2bf4ce1d..2e416f09 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -50,7 +50,6 @@
#include "hcid.h"
#include "textfile.h"
-#include "list.h"
#include "dbus-hci.h"
struct g_io_info {
@@ -63,7 +62,7 @@ static struct g_io_info io_data[HCI_MAX_DEV];
static int pairing = HCID_PAIRING_MULTI;
-static struct slist *hci_req_queue = NULL;
+static GSList *hci_req_queue = NULL;
struct hci_req_data *hci_req_data_new(int dev_id, const bdaddr_t *dba, uint16_t ogf, uint16_t ocf, int event, const void *cparam, int clen)
{
@@ -111,7 +110,7 @@ static void hci_req_queue_process(int dev_id)
dd = hci_open_dev(dev_id);
do {
struct hci_req_data *data;
- struct slist *l = slist_find(hci_req_queue, &dev_id, hci_req_find_by_devid);
+ GSList *l = g_slist_find_custom(hci_req_queue, &dev_id, hci_req_find_by_devid);
if (!l)
break;
@@ -121,7 +120,7 @@ static void hci_req_queue_process(int dev_id)
ret_val = hci_send_cmd(dd, data->ogf, data->ocf, data->clen, data->cparam);
if (ret_val < 0) {
- hci_req_queue = slist_remove(hci_req_queue, data);
+ hci_req_queue = g_slist_remove(hci_req_queue, data);
free(data->cparam);
free(data);
}
@@ -133,13 +132,13 @@ static void hci_req_queue_process(int dev_id)
void hci_req_queue_append(struct hci_req_data *data)
{
- struct slist *l;
+ GSList *l;
struct hci_req_data *match;
- hci_req_queue = slist_append(hci_req_queue, data);
+ hci_req_queue = g_slist_append(hci_req_queue, data);
- l = slist_find(hci_req_queue, &data->dev_id, hci_req_find_by_devid);
+ l = g_slist_find_custom(hci_req_queue, &data->dev_id, hci_req_find_by_devid);
match = l->data;
if (match->status == REQ_SENT)
@@ -150,7 +149,7 @@ void hci_req_queue_append(struct hci_req_data *data)
void hci_req_queue_remove(int dev_id, bdaddr_t *dba)
{
- struct slist *cur, *next;
+ GSList *cur, *next;
struct hci_req_data *req;
for (cur = hci_req_queue; cur != NULL; cur = next) {
@@ -159,7 +158,7 @@ void hci_req_queue_remove(int dev_id, bdaddr_t *dba)
if ((req->dev_id != dev_id) || (bacmp(&req->dba, dba)))
continue;
- hci_req_queue = slist_remove(hci_req_queue, req);
+ hci_req_queue = g_slist_remove(hci_req_queue, req);
free(req->cparam);
free(req);
}
@@ -168,13 +167,13 @@ void hci_req_queue_remove(int dev_id, bdaddr_t *dba)
static void check_pending_hci_req(int dev_id, int event)
{
struct hci_req_data *data;
- struct slist *l;
+ GSList *l;
if (!hci_req_queue)
return;
/* find the first element(pending)*/
- l = slist_find(hci_req_queue, &dev_id, hci_req_find_by_devid);
+ l = g_slist_find_custom(hci_req_queue, &dev_id, hci_req_find_by_devid);
if (!l)
return;
@@ -187,7 +186,7 @@ static void check_pending_hci_req(int dev_id, int event)
return;
/* remove the confirmed cmd */
- hci_req_queue = slist_remove(hci_req_queue, data);
+ hci_req_queue = g_slist_remove(hci_req_queue, data);
free(data->cparam);
free(data);
}