From 0ce535ecb2bb58079513ccbd1fe086409c77beb8 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Thu, 11 Jun 2020 13:23:06 -0700
Subject: [PATCH] adapter: Rename watch_client to discovery_client

watch term is quite vague so this replace it with discovery which is
what is used for the filter as well.

Conflict:NA
Reference:https://github.com/bluez/bluez/commit/0ce535ecb2bb58079513ccbd1fe086409c77beb8
---
 src/adapter.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 972d887..160f199 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -182,7 +182,7 @@ struct discovery_filter {
 	bool discoverable;
 };
 
-struct watch_client {
+struct discovery_client {
 	struct btd_adapter *adapter;
 	DBusMessage *msg;
 	char *owner;
@@ -1474,7 +1474,7 @@ static void start_discovery_complete(uint8_t status, uint16_t length,
 					const void *param, void *user_data)
 {
 	struct btd_adapter *adapter = user_data;
-	struct watch_client *client;
+	struct discovery_client *client;
 	const struct mgmt_cp_start_discovery *rp = param;
 	DBusMessage *reply;
 
@@ -1851,8 +1851,8 @@ static void discovery_cleanup(struct btd_adapter *adapter)
 
 static void discovery_free(void *user_data)
 {
-	struct watch_client *client = user_data;
 
+	struct discovery_client *client = user_data;
 	if (client->watch)
 		g_dbus_remove_watch(dbus_conn, client->watch);
 
@@ -1882,7 +1882,7 @@ static bool set_discovery_discoverable(struct btd_adapter *adapter, bool enable)
 	return set_discoverable(adapter, enable, 0);
 }
 
-static void discovery_remove(struct watch_client *client, bool exit)
+static void discovery_remove(struct discovery_client *client, bool exit)
 {
 	struct btd_adapter *adapter = client->adapter;
 
@@ -1913,7 +1913,7 @@ static void discovery_remove(struct watch_client *client, bool exit)
 static void stop_discovery_complete(uint8_t status, uint16_t length,
 					const void *param, void *user_data)
 {
-	struct watch_client *client = user_data;
+	struct discovery_client *client = user_data;
 	struct btd_adapter *adapter = client->adapter;
 	DBusMessage *reply;
 
@@ -1949,7 +1949,7 @@ done:
 
 static int compare_sender(gconstpointer a, gconstpointer b)
 {
-	const struct watch_client *client = a;
+	const struct discovery_client *client = a;
 	const char *sender = b;
 
 	return g_strcmp0(client->owner, sender);
@@ -1982,7 +1982,7 @@ static int merge_discovery_filters(struct btd_adapter *adapter, int *rssi,
 	bool has_filtered_discovery = false;
 
 	for (l = adapter->discovery_list; l != NULL; l = g_slist_next(l)) {
-		struct watch_client *client = l->data;
+		struct discovery_client *client = l->data;
 		struct discovery_filter *item = client->discovery_filter;
 
 		if (!item) {
@@ -2149,7 +2149,7 @@ static int update_discovery_filter(struct btd_adapter *adapter)
 	}
 
 	for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
-		struct watch_client *client = l->data;
+		struct discovery_client *client = l->data;
 
 		if (!client->discovery_filter)
 			continue;
@@ -2179,7 +2179,7 @@ static int update_discovery_filter(struct btd_adapter *adapter)
 	return -EINPROGRESS;
 }
 
-static int discovery_stop(struct watch_client *client, bool exit)
+static int discovery_stop(struct discovery_client *client, bool exit)
 {
 	struct btd_adapter *adapter = client->adapter;
 	struct mgmt_cp_stop_discovery cp;
@@ -2220,7 +2220,7 @@ static int discovery_stop(struct watch_client *client, bool exit)
 
 static void discovery_disconnect(DBusConnection *conn, void *user_data)
 {
-	struct watch_client *client = user_data;
+	struct discovery_client *client = user_data;
 
 	DBG("owner %s", client->owner);
 
@@ -2233,7 +2233,7 @@ static void discovery_disconnect(DBusConnection *conn, void *user_data)
  */
 static bool get_discovery_client(struct btd_adapter *adapter,
 						const char *owner,
-						struct watch_client **client)
+						struct discovery_client **client)
 {
 	GSList *list = g_slist_find_custom(adapter->discovery_list, owner,
 								compare_sender);
@@ -2258,7 +2258,7 @@ static DBusMessage *start_discovery(DBusConnection *conn,
 {
 	struct btd_adapter *adapter = user_data;
 	const char *sender = dbus_message_get_sender(msg);
-	struct watch_client *client;
+	struct discovery_client *client;
 	bool is_discovering;
 	int err;
 
@@ -2292,7 +2292,7 @@ static DBusMessage *start_discovery(DBusConnection *conn,
 		goto done;
 	}
 
-	client = g_new0(struct watch_client, 1);
+	client = g_new0(struct discovery_client, 1);
 
 	client->adapter = adapter;
 	client->owner = g_strdup(sender);
@@ -2556,7 +2556,7 @@ static DBusMessage *set_discovery_filter(DBusConnection *conn,
 					DBusMessage *msg, void *user_data)
 {
 	struct btd_adapter *adapter = user_data;
-	struct watch_client *client;
+	struct discovery_client *client;
 	struct discovery_filter *discovery_filter;
 	const char *sender = dbus_message_get_sender(msg);
 	bool is_discovering;
@@ -2593,7 +2593,7 @@ static DBusMessage *set_discovery_filter(DBusConnection *conn,
 		DBG("successfully cleared pre-set filter");
 	} else if (discovery_filter) {
 		/* Client pre-setting his filter for first time */
-		client = g_new0(struct watch_client, 1);
+		client = g_new0(struct discovery_client, 1);
 		client->adapter = adapter;
 		client->owner = g_strdup(sender);
 		client->discovery_filter = discovery_filter;
@@ -2614,7 +2614,7 @@ static DBusMessage *stop_discovery(DBusConnection *conn,
 {
 	struct btd_adapter *adapter = user_data;
 	const char *sender = dbus_message_get_sender(msg);
-	struct watch_client *client;
+	struct discovery_client *client;
 	GSList *list;
 	int err;
 
@@ -6109,7 +6109,7 @@ static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
 
 	for (l = discovery_filter; l != NULL && got_match != true;
 							l = g_slist_next(l)) {
-		struct watch_client *client = l->data;
+		struct discovery_client *client = l->data;
 		struct discovery_filter *item = client->discovery_filter;
 
 		/*
@@ -6157,7 +6157,7 @@ static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
 
 static void filter_duplicate_data(void *data, void *user_data)
 {
-	struct watch_client *client = data;
+	struct discovery_client *client = data;
 	bool *duplicate = user_data;
 
 	if (*duplicate || !client->discovery_filter)
@@ -6187,7 +6187,7 @@ static bool device_is_discoverable(struct btd_adapter *adapter,
 
 	/* Do a prefix match for both address and name if pattern is set */
 	for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
-		struct watch_client *client = l->data;
+		struct discovery_client *client = l->data;
 		struct discovery_filter *filter = client->discovery_filter;
 		size_t pattern_len;
 
-- 
2.27.0

