linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archie Pusaka <apusaka@google.com>
To: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: CrosBT Upstreaming <chromeos-bluetooth-upstreaming@chromium.org>,
	Archie Pusaka <apusaka@chromium.org>
Subject: [Bluez PATCH 55/62] tools/mesh: Inclusive language changes
Date: Fri, 13 Aug 2021 20:18:40 +0800	[thread overview]
Message-ID: <20210813201256.Bluez.55.Iede911f7b1a507e2f37bbd0926b2fa0fdde9cdfa@changeid> (raw)
In-Reply-To: <20210813121848.3686029-1-apusaka@google.com>

From: Archie Pusaka <apusaka@chromium.org>

"reject list" is preferred, as reflected in
https://specificationrefs.bluetooth.com/language-mapping/Appropriate_Language_Mapping_Table.pdf
---

 tools/mesh-cfgclient.c |  4 ++--
 tools/mesh/mesh-db.c   | 28 +++++++++++-----------
 tools/mesh/mesh-db.h   |  4 ++--
 tools/mesh/remote.c    | 53 +++++++++++++++++++++---------------------
 tools/mesh/remote.h    |  5 ++--
 5 files changed, 45 insertions(+), 49 deletions(-)

diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c
index a4a6f21ab8..70553c95c8 100644
--- a/tools/mesh-cfgclient.c
+++ b/tools/mesh-cfgclient.c
@@ -720,7 +720,7 @@ static void attach_node_reply(struct l_dbus_proxy *proxy,
 							ivi != iv_index) {
 		iv_index = ivi;
 		mesh_db_set_iv_index(ivi);
-		remote_clear_blacklisted_addresses(ivi);
+		remote_clear_rejected_addresses(ivi);
 	}
 
 	return;
@@ -1858,7 +1858,7 @@ static void property_changed(struct l_dbus_proxy *proxy, const char *name,
 
 			iv_index = ivi;
 			mesh_db_set_iv_index(ivi);
-			remote_clear_blacklisted_addresses(ivi);
+			remote_clear_rejected_addresses(ivi);
 		}
 	}
 }
diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
index 46f0c60751..6779bb8403 100644
--- a/tools/mesh/mesh-db.c
+++ b/tools/mesh/mesh-db.c
@@ -1246,7 +1246,7 @@ bool mesh_db_set_iv_index(uint32_t ivi)
 	return save_config();
 }
 
-static int get_blacklisted_by_iv_index(json_object *jarray, uint32_t iv_index)
+static int get_rejected_by_iv_index(json_object *jarray, uint32_t iv_index)
 {
 	int i, cnt;
 
@@ -1268,12 +1268,12 @@ static int get_blacklisted_by_iv_index(json_object *jarray, uint32_t iv_index)
 	return -1;
 }
 
-static bool load_blacklisted(json_object *jobj)
+static bool load_rejected_addresses(json_object *jobj)
 {
 	json_object *jarray;
 	int i, cnt;
 
-	json_object_object_get_ex(jobj, "blacklistedAddresses", &jarray);
+	json_object_object_get_ex(jobj, "rejectedAddresses", &jarray);
 	if (!jarray || json_object_get_type(jarray) != json_type_array)
 		return true;
 
@@ -1304,15 +1304,14 @@ static bool load_blacklisted(json_object *jobj)
 			if (sscanf(str, "%04hx", &unicast) != 1)
 				return false;
 
-			remote_add_blacklisted_address(unicast, iv_index,
-								false);
+			remote_add_rejected_address(unicast, iv_index, false);
 		}
 	}
 
 	return true;
 }
 
-bool mesh_db_add_blacklisted_addr(uint16_t unicast, uint32_t iv_index)
+bool mesh_db_add_rejected_addr(uint16_t unicast, uint32_t iv_index)
 {
 	json_object *jarray, *jobj, *jaddrs, *jstring;
 	int idx;
@@ -1321,14 +1320,13 @@ bool mesh_db_add_blacklisted_addr(uint16_t unicast, uint32_t iv_index)
 	if (!cfg || !cfg->jcfg)
 		return false;
 
-	json_object_object_get_ex(cfg->jcfg, "blacklistedAddresses", &jarray);
+	json_object_object_get_ex(cfg->jcfg, "rejectedAddresses", &jarray);
 	if (!jarray) {
 		jarray = json_object_new_array();
-		json_object_object_add(cfg->jcfg, "blacklistedAddresses",
-									jarray);
+		json_object_object_add(cfg->jcfg, "rejectedAddresses", jarray);
 	}
 
-	idx = get_blacklisted_by_iv_index(jarray, iv_index);
+	idx = get_rejected_by_iv_index(jarray, iv_index);
 
 	if (idx < 0) {
 		jobj = json_object_new_object();
@@ -1362,7 +1360,7 @@ fail:
 	return false;
 }
 
-bool mesh_db_clear_blacklisted(uint32_t iv_index)
+bool mesh_db_clear_rejected(uint32_t iv_index)
 {
 	json_object *jarray;
 	int idx;
@@ -1370,11 +1368,11 @@ bool mesh_db_clear_blacklisted(uint32_t iv_index)
 	if (!cfg || !cfg->jcfg)
 		return false;
 
-	json_object_object_get_ex(cfg->jcfg, "blacklistedAddresses", &jarray);
+	json_object_object_get_ex(cfg->jcfg, "rejectedAddresses", &jarray);
 	if (!jarray || json_object_get_type(jarray) != json_type_array)
 		return false;
 
-	idx = get_blacklisted_by_iv_index(jarray, iv_index);
+	idx = get_rejected_by_iv_index(jarray, iv_index);
 	if (idx < 0)
 		return true;
 
@@ -1437,7 +1435,7 @@ bool mesh_db_create(const char *fname, const uint8_t token[8],
 	if (!jarray)
 		goto fail;
 
-	json_object_object_add(jcfg, "blacklistedAddresses", jarray);
+	json_object_object_add(jcfg, "rejectedAddresses", jarray);
 
 	write_int(jcfg, "ivIndex", 0);
 
@@ -1504,7 +1502,7 @@ bool mesh_db_load(const char *fname)
 
 	load_remotes(jcfg);
 
-	load_blacklisted(jcfg);
+	load_rejected_addresses(jcfg);
 
 	return true;
 fail:
diff --git a/tools/mesh/mesh-db.h b/tools/mesh/mesh-db.h
index d1d734bf3e..22518c6189 100644
--- a/tools/mesh/mesh-db.h
+++ b/tools/mesh/mesh-db.h
@@ -49,5 +49,5 @@ bool mesh_db_node_model_binding_del(uint16_t unicast, uint8_t ele, bool vendor,
 					uint32_t mod_id, uint16_t app_idx);
 struct l_queue *mesh_db_load_groups(void);
 bool mesh_db_add_group(struct mesh_group *grp);
-bool mesh_db_add_blacklisted_addr(uint16_t unicast, uint32_t iv_index);
-bool mesh_db_clear_blacklisted(uint32_t iv_index);
+bool mesh_db_add_rejected_addr(uint16_t unicast, uint32_t iv_index);
+bool mesh_db_clear_rejected(uint32_t iv_index);
diff --git a/tools/mesh/remote.c b/tools/mesh/remote.c
index 9b265bee49..e60a3681d0 100644
--- a/tools/mesh/remote.c
+++ b/tools/mesh/remote.c
@@ -34,13 +34,13 @@ struct remote_node {
 	uint8_t num_ele;
 };
 
-struct blacklisted_addr {
+struct rejected_addr {
 	uint32_t iv_index;
 	uint16_t unicast;
 };
 
 static struct l_queue *nodes;
-static struct l_queue *blacklisted;
+static struct l_queue *reject_list;
 
 static bool key_present(struct l_queue *keys, uint16_t app_idx)
 {
@@ -124,7 +124,7 @@ uint8_t remote_del_node(uint16_t unicast)
 
 	for (i = 0; i < num_ele; ++i) {
 		l_queue_destroy(rmt->els[i], NULL);
-		remote_add_blacklisted_address(unicast + i, iv_index, true);
+		remote_add_rejected_address(unicast + i, iv_index, true);
 	}
 
 	l_free(rmt->els);
@@ -333,9 +333,9 @@ static void print_node(void *rmt, void *user_data)
 		print_element(node->els[i], i);
 }
 
-static bool match_black_addr(const void *a, const void *b)
+static bool match_rejected_addr(const void *a, const void *b)
 {
-	const struct blacklisted_addr *addr = a;
+	const struct rejected_addr *addr = a;
 	uint16_t unicast = L_PTR_TO_UINT(b);
 
 	return addr->unicast == unicast;
@@ -348,11 +348,11 @@ static uint16_t get_next_addr(uint16_t high, uint16_t addr,
 		int i = 0;
 
 		for (i = 0; i < ele_cnt; i++) {
-			struct blacklisted_addr *black;
+			struct rejected_addr *reject;
 
-			black = l_queue_find(blacklisted, match_black_addr,
+			reject = l_queue_find(reject_list, match_rejected_addr,
 						L_UINT_TO_PTR(addr + i));
-			if (!black)
+			if (!reject)
 				break;
 		}
 
@@ -367,10 +367,10 @@ static uint16_t get_next_addr(uint16_t high, uint16_t addr,
 
 static bool check_iv_index(const void *a, const void *b)
 {
-	const struct blacklisted_addr *black_addr = a;
+	const struct rejected_addr *reject = a;
 	uint32_t iv_index = L_PTR_TO_UINT(b);
 
-	return (abs_diff(iv_index, black_addr->iv_index) > 2);
+	return (abs_diff(iv_index, reject->iv_index) > 2);
 }
 
 void remote_print_node(uint16_t addr)
@@ -435,36 +435,35 @@ uint16_t remote_get_next_unicast(uint16_t low, uint16_t high, uint8_t ele_cnt)
 	return addr;
 }
 
-void remote_add_blacklisted_address(uint16_t addr, uint32_t iv_index,
-								bool save)
+void remote_add_rejected_address(uint16_t addr, uint32_t iv_index, bool save)
 {
-	struct blacklisted_addr *black_addr;
+	struct rejected_addr *reject;
 
-	if (!blacklisted)
-		blacklisted = l_queue_new();
+	if (!reject_list)
+		reject_list = l_queue_new();
 
-	black_addr = l_new(struct blacklisted_addr, 1);
-	black_addr->unicast = addr;
-	black_addr->iv_index = iv_index;
+	reject = l_new(struct rejected_addr, 1);
+	reject->unicast = addr;
+	reject->iv_index = iv_index;
 
-	l_queue_push_tail(blacklisted, black_addr);
+	l_queue_push_tail(reject_list, reject);
 
 	if (save)
-		mesh_db_add_blacklisted_addr(addr, iv_index);
+		mesh_db_add_rejected_addr(addr, iv_index);
 }
 
-void remote_clear_blacklisted_addresses(uint32_t iv_index)
+void remote_clear_rejected_addresses(uint32_t iv_index)
 {
-	struct blacklisted_addr *black_addr;
+	struct rejected_addr *reject;
 
-	black_addr = l_queue_remove_if(blacklisted, check_iv_index,
+	reject = l_queue_remove_if(reject_list, check_iv_index,
 						L_UINT_TO_PTR(iv_index));
 
-	while (black_addr) {
-		l_free(black_addr);
-		black_addr = l_queue_remove_if(blacklisted, check_iv_index,
+	while (reject) {
+		l_free(reject);
+		reject = l_queue_remove_if(reject_list, check_iv_index,
 						L_UINT_TO_PTR(iv_index));
 	}
 
-	mesh_db_clear_blacklisted(iv_index);
+	mesh_db_clear_rejected(iv_index);
 }
diff --git a/tools/mesh/remote.h b/tools/mesh/remote.h
index bb4fb11917..8ecb097ae4 100644
--- a/tools/mesh/remote.h
+++ b/tools/mesh/remote.h
@@ -13,9 +13,8 @@ bool remote_add_node(const uint8_t uuid[16], uint16_t unicast,
 uint8_t remote_del_node(uint16_t unicast);
 bool remote_set_model(uint16_t unicast, uint8_t ele_idx, uint32_t mod_id,
 								bool vendor);
-void remote_add_blacklisted_address(uint16_t addr, uint32_t iv_index,
-								bool save);
-void remote_clear_blacklisted_addresses(uint32_t iv_index);
+void remote_add_rejected_address(uint16_t addr, uint32_t iv_index, bool save);
+void remote_clear_rejected_addresses(uint32_t iv_index);
 uint16_t remote_get_next_unicast(uint16_t low, uint16_t high, uint8_t ele_cnt);
 bool remote_add_net_key(uint16_t addr, uint16_t net_idx);
 bool remote_del_net_key(uint16_t addr, uint16_t net_idx);
-- 
2.33.0.rc1.237.g0d66db33f3-goog


  parent reply	other threads:[~2021-08-13 12:22 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 12:17 [Bluez PATCH 00/62] Inclusive language changes Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 01/62] lib: Inclusive language in HCI commands and events Archie Pusaka
2021-08-13 12:49   ` Inclusive language changes bluez.test.bot
2021-08-13 19:26   ` [Bluez PATCH 01/62] lib: Inclusive language in HCI commands and events Marcel Holtmann
2021-08-13 21:47     ` Luiz Augusto von Dentz
2021-08-16 15:59       ` Marcel Holtmann
2021-08-13 12:17 ` [Bluez PATCH 02/62] lib: Inclusive language in consts and strings Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 03/62] tools/hciconfig: Inclusive language update Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 04/62] core: Inclusive language for l2cap Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 05/62] core: Inclusive language for rfcomm Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 06/62] lib: Inclusive language for filtering devices Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 07/62] lib/mgmt: Inclusive language for LTK Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 08/62] doc/mgmt: Inclusive language update Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 09/62] btio: Inclusive language changes Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 10/62] shared/ad: " Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 11/62] shared/hfp: " Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 12/62] monitor: Inclusive language in struct member Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 13/62] monitor: Inclusive language in SMP related things Archie Pusaka
2021-08-13 12:17 ` [Bluez PATCH 14/62] monitor: Inclusive language in LE states Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 15/62] monitor: Inclusive language in LL feature Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 16/62] monitor: Inclusive language in link key transaction Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 17/62] monitor: Inclusive language in peripheral broadcast Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 18/62] monitor: Inclusive language in peripheral page response timeout Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 19/62] monitor: Inclusive language in consts and strings Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 20/62] monitor: Inclusive language in filtering devices Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 21/62] emulator: Inclusive language in naming Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 22/62] emulator: Inclusive language in strings Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 23/62] emulator: Inclusive language in filtering device Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 24/62] tools: Inclusive language in referring the central address Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 25/62] tools/parser/hci: Inclusive language changes Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 26/62] tools/parser/smp: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 27/62] tools/3dsp: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 28/62] tools/mgmt-tester: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 29/62] tools/bdaddr: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 30/62] tools/hciconfig: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 31/62] tools/meshctl: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 32/62] tools/mgmt-tester: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 33/62] tools/parser: Inclusive language in struct member Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 34/62] tools/parser/lmp: Inclusive language changes Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 35/62] tools/parser/avdtp: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 36/62] tools/parser/csr: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 37/62] tools/btpclientctl: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 38/62] tools/l2cap-tester: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 39/62] tools/hci-tester: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 40/62] tools/btiotest: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 41/62] tools/hcitool: Inclusive language changes, central peripheral Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 42/62] tools/hcitool: Inclusive language changes, accept list Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 43/62] tools/l2test: Inclusive language changes Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 44/62] tools/rctest: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 45/62] tools/rfcomm: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 46/62] plugins/sixaxis: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 47/62] profiles/audio: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 48/62] profiles/health: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 49/62] sdp: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 50/62] adapter: Inclusive language for central and peripheral Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 51/62] adapter: Inclusive language for storing LTK Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 52/62] adapter: Inclusive language for device filtering Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 53/62] client: Inclusive language changes Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 54/62] mesh: " Archie Pusaka
2021-08-13 12:18 ` Archie Pusaka [this message]
2021-08-13 12:18 ` [Bluez PATCH 56/62] tools/mesh-gatt: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 57/62] unit/mesh: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 58/62] doc/mesh: " Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 59/62] android: Inclusive language for volume control Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 60/62] android: Inclusive language for describing relation Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 61/62] android: Inclusive language for filtering devices Archie Pusaka
2021-08-13 12:18 ` [Bluez PATCH 62/62] android: Inclusive language in storing LTK Archie Pusaka
2021-08-13 21:42 ` [Bluez PATCH 00/62] Inclusive language changes Luiz Augusto von Dentz
2021-08-14  5:22   ` Archie Pusaka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210813201256.Bluez.55.Iede911f7b1a507e2f37bbd0926b2fa0fdde9cdfa@changeid \
    --to=apusaka@google.com \
    --cc=apusaka@chromium.org \
    --cc=chromeos-bluetooth-upstreaming@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).