diff mbox series

[Bluez,21/62] emulator: Inclusive language in naming

Message ID 20210813201256.Bluez.21.Idde74d908204ede645812e49623e367d27c50e58@changeid
State New
Headers show
Series Inclusive language changes | expand

Commit Message

Archie Pusaka Aug. 13, 2021, 12:18 p.m. UTC
From: Archie Pusaka <apusaka@chromium.org>

"central" is preferred, as reflected in the BT core spec 5.3.
---

 android/tester-main.c |  2 +-
 emulator/hciemu.c     | 21 +++++++++++----------
 emulator/hciemu.h     | 12 ++++++------
 tools/l2cap-tester.c  | 16 ++++++++--------
 tools/mgmt-tester.c   | 20 ++++++++++----------
 tools/rfcomm-tester.c |  4 ++--
 tools/sco-tester.c    |  2 +-
 tools/smp-tester.c    |  6 +++---
 8 files changed, 42 insertions(+), 41 deletions(-)
diff mbox series

Patch

diff --git a/android/tester-main.c b/android/tester-main.c
index 2bfa770bb5..ff5ecdf834 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -2786,7 +2786,7 @@  void emu_remote_connect_hci_action(void)
 	struct step *step = g_new0(struct step, 1);
 	const uint8_t *master_addr;
 
-	master_addr = hciemu_get_master_bdaddr(data->hciemu);
+	master_addr = hciemu_get_central_bdaddr(data->hciemu);
 
 	tester_print("Trying to connect hci");
 
diff --git a/emulator/hciemu.c b/emulator/hciemu.c
index a3ec44243c..402d689d3c 100644
--- a/emulator/hciemu.c
+++ b/emulator/hciemu.c
@@ -84,7 +84,7 @@  static void run_command_hook(void *data, void *user_data)
 					run_data->len, hook->user_data);
 }
 
-static void master_command_callback(uint16_t opcode,
+static void central_command_callback(uint16_t opcode,
 				const void *data, uint8_t len,
 				btdev_callback callback, void *user_data)
 {
@@ -230,7 +230,7 @@  static bool create_vhci(struct hciemu *hciemu)
 	if (!btdev)
 		return false;
 
-	btdev_set_command_handler(btdev, master_command_callback, hciemu);
+	btdev_set_command_handler(btdev, central_command_callback, hciemu);
 
 	fd = open("/dev/vhci", O_RDWR | O_NONBLOCK | O_CLOEXEC);
 	if (fd < 0) {
@@ -462,7 +462,7 @@  static void bthost_debug(const char *str, void *user_data)
 					"bthost: %s", str);
 }
 
-static void btdev_master_debug(const char *str, void *user_data)
+static void btdev_central_debug(const char *str, void *user_data)
 {
 	struct hciemu *hciemu = user_data;
 
@@ -500,7 +500,7 @@  bool hciemu_set_debug(struct hciemu *hciemu, hciemu_debug_func_t callback,
 	hciemu->debug_destroy = destroy;
 	hciemu->debug_data = user_data;
 
-	btdev_set_debug(hciemu->dev, btdev_master_debug, hciemu, NULL);
+	btdev_set_debug(hciemu->dev, btdev_central_debug, hciemu, NULL);
 
 	queue_foreach(hciemu->clients, hciemu_client_set_debug, hciemu);
 
@@ -528,7 +528,7 @@  uint8_t *hciemu_get_features(struct hciemu *hciemu)
 	return btdev_get_features(hciemu->dev);
 }
 
-const uint8_t *hciemu_get_master_bdaddr(struct hciemu *hciemu)
+const uint8_t *hciemu_get_central_bdaddr(struct hciemu *hciemu)
 {
 	if (!hciemu || !hciemu->dev)
 		return NULL;
@@ -556,7 +556,7 @@  const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu)
 	return hciemu_client_bdaddr(client);
 }
 
-uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu)
+uint8_t hciemu_get_central_scan_enable(struct hciemu *hciemu)
 {
 	if (!hciemu || !hciemu->dev)
 		return 0;
@@ -564,7 +564,7 @@  uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu)
 	return btdev_get_scan_enable(hciemu->dev);
 }
 
-uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu)
+uint8_t hciemu_get_central_le_scan_enable(struct hciemu *hciemu)
 {
 	if (!hciemu || !hciemu->dev)
 		return 0;
@@ -572,7 +572,8 @@  uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu)
 	return btdev_get_le_scan_enable(hciemu->dev);
 }
 
-void hciemu_set_master_le_states(struct hciemu *hciemu, const uint8_t *le_states)
+void hciemu_set_central_le_states(struct hciemu *hciemu,
+						const uint8_t *le_states)
 {
 	if (!hciemu || !hciemu->dev)
 		return;
@@ -580,7 +581,7 @@  void hciemu_set_master_le_states(struct hciemu *hciemu, const uint8_t *le_states
 	btdev_set_le_states(hciemu->dev, le_states);
 }
 
-bool hciemu_add_master_post_command_hook(struct hciemu *hciemu,
+bool hciemu_add_central_post_command_hook(struct hciemu *hciemu,
 			hciemu_command_func_t function, void *user_data)
 {
 	struct hciemu_command_hook *hook;
@@ -603,7 +604,7 @@  bool hciemu_add_master_post_command_hook(struct hciemu *hciemu,
 	return true;
 }
 
-bool hciemu_clear_master_post_command_hooks(struct hciemu *hciemu)
+bool hciemu_clear_central_post_command_hooks(struct hciemu *hciemu)
 {
 	if (!hciemu)
 		return false;
diff --git a/emulator/hciemu.h b/emulator/hciemu.h
index 8bf2d070ea..3d3d93b4b0 100644
--- a/emulator/hciemu.h
+++ b/emulator/hciemu.h
@@ -50,14 +50,14 @@  struct bthost *hciemu_client_get_host(struct hciemu *hciemu);
 const char *hciemu_get_address(struct hciemu *hciemu);
 uint8_t *hciemu_get_features(struct hciemu *hciemu);
 
-const uint8_t *hciemu_get_master_bdaddr(struct hciemu *hciemu);
+const uint8_t *hciemu_get_central_bdaddr(struct hciemu *hciemu);
 const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu);
 
-uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu);
+uint8_t hciemu_get_central_scan_enable(struct hciemu *hciemu);
 
-uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu);
+uint8_t hciemu_get_central_le_scan_enable(struct hciemu *hciemu);
 
-void hciemu_set_master_le_states(struct hciemu *hciemu,
+void hciemu_set_central_le_states(struct hciemu *hciemu,
 						const uint8_t *le_states);
 
 typedef void (*hciemu_command_func_t)(uint16_t opcode, const void *data,
@@ -66,10 +66,10 @@  typedef void (*hciemu_command_func_t)(uint16_t opcode, const void *data,
 typedef bool (*hciemu_hook_func_t)(const void *data, uint16_t len,
 							void *user_data);
 
-bool hciemu_add_master_post_command_hook(struct hciemu *hciemu,
+bool hciemu_add_central_post_command_hook(struct hciemu *hciemu,
 			hciemu_command_func_t function, void *user_data);
 
-bool hciemu_clear_master_post_command_hooks(struct hciemu *hciemu);
+bool hciemu_clear_central_post_command_hooks(struct hciemu *hciemu);
 
 int hciemu_add_hook(struct hciemu *hciemu, enum hciemu_hook_type type,
 				uint16_t opcode, hciemu_hook_func_t function,
diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index 11d549f22a..169a989f54 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -1116,7 +1116,7 @@  static int create_l2cap_sock(struct test_data *data, uint16_t psm,
 		return err;
 	}
 
-	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
+	master_bdaddr = hciemu_get_central_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
 		close(sk);
@@ -1301,7 +1301,7 @@  static void test_connect(const void *test_data)
 	}
 
 	if (l2data->direct_advertising)
-		hciemu_add_master_post_command_hook(data->hciemu,
+		hciemu_add_central_post_command_hook(data->hciemu,
 						direct_adv_cmd_complete, NULL);
 
 	sk = create_l2cap_sock(data, 0, l2data->cid, l2data->sec_level,
@@ -1419,7 +1419,7 @@  static gboolean test_close_socket_1_part_3(gpointer arg)
 		return FALSE;
 	}
 
-	if (hciemu_get_master_le_scan_enable(data->hciemu)) {
+	if (hciemu_get_central_le_scan_enable(data->hciemu)) {
 		tester_print("Delayed check whether scann is off failed");
 		tester_test_failed();
 		return FALSE;
@@ -1440,7 +1440,7 @@  static gboolean test_close_socket_1_part_2(gpointer args)
 	 * was added to kernel whitelist, and scan was started. We
 	 * should be still scanning.
 	 */
-	if (!hciemu_get_master_le_scan_enable(data->hciemu)) {
+	if (!hciemu_get_central_le_scan_enable(data->hciemu)) {
 		tester_print("Error - should be still scanning");
 		tester_test_failed();
 		return FALSE;
@@ -1467,7 +1467,7 @@  static gboolean test_close_socket_2_part_3(gpointer arg)
 	int err;
 
 	/* Scan should be already over, we're trying to create connection */
-	if (hciemu_get_master_le_scan_enable(data->hciemu)) {
+	if (hciemu_get_central_le_scan_enable(data->hciemu)) {
 		tester_print("Error - should no longer scan");
 		tester_test_failed();
 		return FALSE;
@@ -1563,7 +1563,7 @@  static void test_close_socket(const void *test_data)
 	const struct l2cap_data *l2data = data->test_data;
 	const uint8_t *client_bdaddr;
 
-	hciemu_add_master_post_command_hook(data->hciemu,
+	hciemu_add_central_post_command_hook(data->hciemu,
 					test_close_socket_router, data);
 
 	if (l2data->client_bdaddr != NULL)
@@ -1668,7 +1668,7 @@  static void test_connect_2(const void *test_data)
 	test_2_connect_cb_cnt = 0;
 	test_scan_enable_counter = 0;
 
-	hciemu_add_master_post_command_hook(data->hciemu,
+	hciemu_add_central_post_command_hook(data->hciemu,
 				test_connect_2_router, data);
 
 	if (l2data->server_psm) {
@@ -1869,7 +1869,7 @@  static void test_server(const void *test_data)
 		tester_print("Listening for connections");
 	}
 
-	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
+	master_bdaddr = hciemu_get_central_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
 		tester_test_failed();
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 26d78360d7..30db2b2179 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -365,7 +365,7 @@  static void read_index_list_callback(uint8_t status, uint16_t length,
 		hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL);
 
 	if (test && test->setup_le_states)
-		hciemu_set_master_le_states(data->hciemu, test->le_states);
+		hciemu_set_central_le_states(data->hciemu, test->le_states);
 }
 
 static void test_pre_setup(const void *test_data)
@@ -7098,7 +7098,7 @@  static void command_setup_hci_callback(uint16_t opcode, const void *param,
 		return;
 	}
 
-	hciemu_clear_master_post_command_hooks(data->hciemu);
+	hciemu_clear_central_post_command_hooks(data->hciemu);
 	test_setup_condition_complete(data);
 }
 
@@ -7164,7 +7164,7 @@  static void setup_command_generic(const void *test_data)
 		tester_print("Registering setup expected HCI command callback");
 		tester_print("Setup expected HCI command 0x%04x",
 					 test->setup_expect_hci_command);
-		hciemu_add_master_post_command_hook(data->hciemu,
+		hciemu_add_central_post_command_hook(data->hciemu,
 					command_setup_hci_callback, data);
 		test_add_setup_condition(data);
 	}
@@ -9487,7 +9487,7 @@  static void setup_ll_privacy_device(const void *test_data)
 
 	tester_print("Setup expected HCI command 0x%04x",
 					 test->setup_expect_hci_command);
-	hciemu_add_master_post_command_hook(data->hciemu,
+	hciemu_add_central_post_command_hook(data->hciemu,
 					command_setup_hci_callback, data);
 	test_add_setup_condition(data);
 
@@ -9644,7 +9644,7 @@  static void test_command_generic(const void *test_data)
 
 	if (test->expect_hci_command) {
 		tester_print("Registering HCI command callback");
-		hciemu_add_master_post_command_hook(data->hciemu,
+		hciemu_add_central_post_command_hook(data->hciemu,
 						command_hci_callback, data);
 		test_add_condition(data);
 	}
@@ -9678,13 +9678,13 @@  static void check_scan(void *user_data)
 {
 	struct test_data *data = tester_get_data();
 
-	if (hciemu_get_master_le_scan_enable(data->hciemu)) {
+	if (hciemu_get_central_le_scan_enable(data->hciemu)) {
 		tester_warn("LE scan still enabled");
 		tester_test_failed();
 		return;
 	}
 
-	if (hciemu_get_master_scan_enable(data->hciemu)) {
+	if (hciemu_get_central_scan_enable(data->hciemu)) {
 		tester_warn("BR/EDR scan still enabled");
 		tester_test_failed();
 		return;
@@ -9775,7 +9775,7 @@  static void test_pairing_acceptor(const void *test_data)
 		test_add_condition(data);
 	}
 
-	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
+	master_bdaddr = hciemu_get_central_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
 		tester_test_failed();
@@ -9840,7 +9840,7 @@  static void test_command_generic_connect(const void *test_data)
 	data->mgmt_alt_ev_id = id;
 	test_add_condition(data);
 
-	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
+	master_bdaddr = hciemu_get_central_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
 		tester_test_failed();
@@ -9919,7 +9919,7 @@  static void add_device_callback(uint8_t status, uint16_t len, const void *param,
 	if (test->client_enable_adv)
 		return;
 
-	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
+	master_bdaddr = hciemu_get_central_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
 		tester_test_failed();
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index 9bae5b9d54..78b08663bd 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -542,7 +542,7 @@  static void test_connect(const void *test_data)
 	bthost_add_rfcomm_server(bthost, cli->server_channel,
 						rfcomm_connect_cb, NULL);
 
-	master_addr = hciemu_get_master_bdaddr(data->hciemu);
+	master_addr = hciemu_get_central_bdaddr(data->hciemu);
 	client_addr = hciemu_get_client_bdaddr(data->hciemu);
 
 	sk = create_rfcomm_sock((bdaddr_t *) master_addr, 0);
@@ -680,7 +680,7 @@  static void test_server(const void *test_data)
 	GIOChannel *io;
 	int sk;
 
-	master_addr = hciemu_get_master_bdaddr(data->hciemu);
+	master_addr = hciemu_get_central_bdaddr(data->hciemu);
 
 	sk = create_rfcomm_sock((bdaddr_t *) master_addr, srv->server_channel);
 	if (sk < 0) {
diff --git a/tools/sco-tester.c b/tools/sco-tester.c
index 2b8dc0d4a8..7c83aee195 100644
--- a/tools/sco-tester.c
+++ b/tools/sco-tester.c
@@ -426,7 +426,7 @@  static int create_sco_sock(struct test_data *data)
 		return err;
 	}
 
-	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
+	master_bdaddr = hciemu_get_central_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
 		return -ENODEV;
diff --git a/tools/smp-tester.c b/tools/smp-tester.c
index 644c451c29..b075c5df8a 100644
--- a/tools/smp-tester.c
+++ b/tools/smp-tester.c
@@ -767,7 +767,7 @@  static void init_bdaddr(struct test_data *data)
 {
 	const uint8_t *master_bdaddr, *client_bdaddr;
 
-	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
+	master_bdaddr = hciemu_get_central_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
 		tester_test_failed();
@@ -808,7 +808,7 @@  static void test_client(const void *test_data)
 
 	if (smp->expect_hci_command) {
 		tester_print("Registering HCI command callback");
-		hciemu_add_master_post_command_hook(data->hciemu,
+		hciemu_add_central_post_command_hook(data->hciemu,
 						command_hci_callback, data);
 		test_add_condition(data);
 	}
@@ -889,7 +889,7 @@  static void test_server(const void *test_data)
 
 	if (smp->expect_hci_command) {
 		tester_print("Registering HCI command callback");
-		hciemu_add_master_post_command_hook(data->hciemu,
+		hciemu_add_central_post_command_hook(data->hciemu,
 						command_hci_callback, data);
 		test_add_condition(data);
 	}