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 50/62] adapter: Inclusive language for central and peripheral
Date: Fri, 13 Aug 2021 20:18:35 +0800 [thread overview]
Message-ID: <20210813201256.Bluez.50.I390a2e541f55decd24fbf5c87e2b6c92522518a0@changeid> (raw)
In-Reply-To: <20210813121848.3686029-1-apusaka@google.com>
From: Archie Pusaka <apusaka@chromium.org>
"central" and "peripheral" are the preferred terms, as reflected in
the BT core spec 5.3.
Also use "primary" to refer the global mgmt struct.
---
src/adapter.c | 93 ++++++++++++++++++++++++++-------------------------
1 file changed, 47 insertions(+), 46 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index a71ebd15c3..60712f01a0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -112,7 +112,7 @@ static bool powering_down = false;
static GSList *adapters = NULL;
-static struct mgmt *mgmt_master = NULL;
+static struct mgmt *mgmt_primary = NULL;
static uint8_t mgmt_version = 0;
static uint8_t mgmt_revision = 0;
@@ -134,7 +134,7 @@ struct smp_ltk_info {
bdaddr_t bdaddr;
uint8_t bdaddr_type;
uint8_t authenticated;
- bool master;
+ bool central;
uint8_t enc_size;
uint16_t ediv;
uint64_t rand;
@@ -3595,7 +3595,7 @@ static struct smp_ltk_info *get_ltk(GKeyFile *key_file, const char *peer,
{
struct smp_ltk_info *ltk = NULL;
GError *gerr = NULL;
- bool master;
+ bool central;
char *key;
char *rand = NULL;
@@ -3609,8 +3609,8 @@ static struct smp_ltk_info *get_ltk(GKeyFile *key_file, const char *peer,
ltk = g_new0(struct smp_ltk_info, 1);
- /* Default to assuming a master key */
- ltk->master = true;
+ /* Default to assuming a central key */
+ ltk->central = true;
str2ba(peer, <k->bdaddr);
ltk->bdaddr_type = peer_type;
@@ -3651,11 +3651,11 @@ static struct smp_ltk_info *get_ltk(GKeyFile *key_file, const char *peer,
NULL);
ltk->ediv = g_key_file_get_integer(key_file, group, "EDiv", NULL);
- master = g_key_file_get_boolean(key_file, group, "Master", &gerr);
+ central = g_key_file_get_boolean(key_file, group, "Master", &gerr);
if (gerr)
g_error_free(gerr);
else
- ltk->master = master;
+ ltk->central = central;
ltk->is_blocked = is_blocked_key(HCI_BLOCKED_KEY_TYPE_LTK,
ltk->val);
@@ -3675,7 +3675,7 @@ static struct smp_ltk_info *get_ltk_info(GKeyFile *key_file, const char *peer,
return get_ltk(key_file, peer, bdaddr_type, "LongTermKey");
}
-static struct smp_ltk_info *get_slave_ltk_info(GKeyFile *key_file,
+static struct smp_ltk_info *get_peripheral_ltk_info(GKeyFile *key_file,
const char *peer,
uint8_t bdaddr_type)
{
@@ -3685,7 +3685,7 @@ static struct smp_ltk_info *get_slave_ltk_info(GKeyFile *key_file,
ltk = get_ltk(key_file, peer, bdaddr_type, "SlaveLongTermKey");
if (ltk)
- ltk->master = false;
+ ltk->central = false;
return ltk;
}
@@ -4028,7 +4028,7 @@ static void load_ltks(struct btd_adapter *adapter, GSList *keys)
key->rand = cpu_to_le64(info->rand);
key->ediv = cpu_to_le16(info->ediv);
key->type = info->authenticated;
- key->central = info->master;
+ key->central = info->central;
key->enc_size = info->enc_size;
}
@@ -4487,7 +4487,7 @@ static void load_devices(struct btd_adapter *adapter)
GKeyFile *key_file;
struct link_key_info *key_info;
struct smp_ltk_info *ltk_info;
- struct smp_ltk_info *slave_ltk_info;
+ struct smp_ltk_info *peripheral_ltk_info;
GSList *list;
struct irk_info *irk_info;
struct conn_param *param;
@@ -4512,16 +4512,16 @@ static void load_devices(struct btd_adapter *adapter)
ltk_info = get_ltk_info(key_file, entry->d_name, bdaddr_type);
- slave_ltk_info = get_slave_ltk_info(key_file, entry->d_name,
- bdaddr_type);
+ peripheral_ltk_info = get_peripheral_ltk_info(key_file,
+ entry->d_name, bdaddr_type);
irk_info = get_irk_info(key_file, entry->d_name, bdaddr_type);
// If any key for the device is blocked, we discard all.
if ((key_info && key_info->is_blocked) ||
(ltk_info && ltk_info->is_blocked) ||
- (slave_ltk_info &&
- slave_ltk_info->is_blocked) ||
+ (peripheral_ltk_info &&
+ peripheral_ltk_info->is_blocked) ||
(irk_info && irk_info->is_blocked)) {
if (key_info) {
@@ -4534,9 +4534,9 @@ static void load_devices(struct btd_adapter *adapter)
ltk_info = NULL;
}
- if (slave_ltk_info) {
- g_free(slave_ltk_info);
- slave_ltk_info = NULL;
+ if (peripheral_ltk_info) {
+ g_free(peripheral_ltk_info);
+ peripheral_ltk_info = NULL;
}
if (irk_info) {
@@ -4553,8 +4553,8 @@ static void load_devices(struct btd_adapter *adapter)
if (ltk_info)
ltks = g_slist_append(ltks, ltk_info);
- if (slave_ltk_info)
- ltks = g_slist_append(ltks, slave_ltk_info);
+ if (peripheral_ltk_info)
+ ltks = g_slist_append(ltks, peripheral_ltk_info);
if (irk_info)
irks = g_slist_append(irks, irk_info);
@@ -4588,16 +4588,16 @@ device_exist:
device_set_bonded(device, BDADDR_BREDR);
}
- if (ltk_info || slave_ltk_info) {
+ if (ltk_info || peripheral_ltk_info) {
device_set_paired(device, bdaddr_type);
device_set_bonded(device, bdaddr_type);
if (ltk_info)
device_set_ltk_enc_size(device,
ltk_info->enc_size);
- else if (slave_ltk_info)
+ else if (peripheral_ltk_info)
device_set_ltk_enc_size(device,
- slave_ltk_info->enc_size);
+ peripheral_ltk_info->enc_size);
}
free:
@@ -5596,7 +5596,7 @@ static void convert_ltk_entry(GKeyFile *key_file, void *value)
{
char *auth_str, *rand_str, *str;
int i, ret;
- unsigned char auth, master, enc_size;
+ unsigned char auth, central, enc_size;
unsigned short ediv;
auth_str = strchr(value, ' ');
@@ -5613,7 +5613,7 @@ static void convert_ltk_entry(GKeyFile *key_file, void *value)
rand_str++;
}
- ret = sscanf(auth_str, " %hhd %hhd %hhd %hd", &auth, &master,
+ ret = sscanf(auth_str, " %hhd %hhd %hhd %hd", &auth, ¢ral,
&enc_size, &ediv);
if (ret < 4)
return;
@@ -5623,7 +5623,7 @@ static void convert_ltk_entry(GKeyFile *key_file, void *value)
g_free(str);
g_key_file_set_integer(key_file, "LongTermKey", "Authenticated", auth);
- g_key_file_set_integer(key_file, "LongTermKey", "Master", master);
+ g_key_file_set_integer(key_file, "LongTermKey", "Master", central);
g_key_file_set_integer(key_file, "LongTermKey", "EncSize", enc_size);
g_key_file_set_integer(key_file, "LongTermKey", "EDiv", ediv);
@@ -6312,7 +6312,7 @@ static struct btd_adapter *btd_adapter_new(uint16_t index)
return NULL;
adapter->dev_id = index;
- adapter->mgmt = mgmt_ref(mgmt_master);
+ adapter->mgmt = mgmt_ref(mgmt_primary);
adapter->pincode_requested = false;
/*
@@ -8043,11 +8043,11 @@ static void new_link_key_callback(uint16_t index, uint16_t length,
static void store_longtermkey(struct btd_adapter *adapter, const bdaddr_t *peer,
uint8_t bdaddr_type, const unsigned char *key,
- uint8_t master, uint8_t authenticated,
+ uint8_t central, uint8_t authenticated,
uint8_t enc_size, uint16_t ediv,
uint64_t rand)
{
- const char *group = master ? "LongTermKey" : "SlaveLongTermKey";
+ const char *group = central ? "LongTermKey" : "SlaveLongTermKey";
char device_addr[18];
char filename[PATH_MAX];
GKeyFile *key_file;
@@ -8056,8 +8056,8 @@ static void store_longtermkey(struct btd_adapter *adapter, const bdaddr_t *peer,
char *str;
int i;
- if (master != 0x00 && master != 0x01) {
- error("Unsupported LTK type %u", master);
+ if (central != 0x00 && central != 0x01) {
+ error("Unsupported LTK type %u", central);
return;
}
@@ -9220,7 +9220,8 @@ static bool set_blocked_keys(struct btd_adapter *adapter)
sizeof(cp->keys[i].val));
}
- return mgmt_send(mgmt_master, MGMT_OP_SET_BLOCKED_KEYS, adapter->dev_id,
+ return mgmt_send(mgmt_primary, MGMT_OP_SET_BLOCKED_KEYS,
+ adapter->dev_id,
sizeof(buffer), buffer,
set_blocked_keys_complete,
adapter, NULL);
@@ -9698,7 +9699,7 @@ static void reset_adv_monitors(uint16_t index)
/* Handle 0 indicates to remove all */
cp.monitor_handle = 0;
- if (mgmt_send(mgmt_master, MGMT_OP_REMOVE_ADV_MONITOR, index,
+ if (mgmt_send(mgmt_primary, MGMT_OP_REMOVE_ADV_MONITOR, index,
sizeof(cp), &cp, reset_adv_monitors_complete, NULL,
NULL) > 0) {
return;
@@ -9748,7 +9749,7 @@ static void index_added(uint16_t index, uint16_t length, const void *param,
DBG("sending read info command for index %u", index);
- if (mgmt_send(mgmt_master, MGMT_OP_READ_INFO, index, 0, NULL,
+ if (mgmt_send(mgmt_primary, MGMT_OP_READ_INFO, index, 0, NULL,
read_info_complete, adapter, NULL) > 0)
return;
@@ -9932,18 +9933,18 @@ static void read_version_complete(uint8_t status, uint16_t length,
* It is irrelevant if this command succeeds or fails. In case of
* failure safe settings are assumed.
*/
- mgmt_send(mgmt_master, MGMT_OP_READ_COMMANDS,
+ mgmt_send(mgmt_primary, MGMT_OP_READ_COMMANDS,
MGMT_INDEX_NONE, 0, NULL,
read_commands_complete, NULL, NULL);
- mgmt_register(mgmt_master, MGMT_EV_INDEX_ADDED, MGMT_INDEX_NONE,
+ mgmt_register(mgmt_primary, MGMT_EV_INDEX_ADDED, MGMT_INDEX_NONE,
index_added, NULL, NULL);
- mgmt_register(mgmt_master, MGMT_EV_INDEX_REMOVED, MGMT_INDEX_NONE,
+ mgmt_register(mgmt_primary, MGMT_EV_INDEX_REMOVED, MGMT_INDEX_NONE,
index_removed, NULL, NULL);
DBG("sending read index list command");
- if (mgmt_send(mgmt_master, MGMT_OP_READ_INDEX_LIST,
+ if (mgmt_send(mgmt_primary, MGMT_OP_READ_INDEX_LIST,
MGMT_INDEX_NONE, 0, NULL,
read_index_list_complete, NULL, NULL) > 0)
return;
@@ -9962,18 +9963,18 @@ int adapter_init(void)
{
dbus_conn = btd_get_dbus_connection();
- mgmt_master = mgmt_new_default();
- if (!mgmt_master) {
+ mgmt_primary = mgmt_new_default();
+ if (!mgmt_primary) {
error("Failed to access management interface");
return -EIO;
}
if (getenv("MGMT_DEBUG"))
- mgmt_set_debug(mgmt_master, mgmt_debug, "mgmt: ", NULL);
+ mgmt_set_debug(mgmt_primary, mgmt_debug, "mgmt: ", NULL);
DBG("sending read version command");
- if (mgmt_send(mgmt_master, MGMT_OP_READ_VERSION,
+ if (mgmt_send(mgmt_primary, MGMT_OP_READ_VERSION,
MGMT_INDEX_NONE, 0, NULL,
read_version_complete, NULL, NULL) > 0)
return 0;
@@ -10002,7 +10003,7 @@ void adapter_cleanup(void)
* This is just an extra precaution to be safe, and in
* reality should not make a difference.
*/
- mgmt_unregister_index(mgmt_master, MGMT_INDEX_NONE);
+ mgmt_unregister_index(mgmt_primary, MGMT_INDEX_NONE);
/*
* In case there is another reference active, cancel
@@ -10012,10 +10013,10 @@ void adapter_cleanup(void)
* that potentially then could leak memory or access
* an invalid structure.
*/
- mgmt_cancel_index(mgmt_master, MGMT_INDEX_NONE);
+ mgmt_cancel_index(mgmt_primary, MGMT_INDEX_NONE);
- mgmt_unref(mgmt_master);
- mgmt_master = NULL;
+ mgmt_unref(mgmt_primary);
+ mgmt_primary = NULL;
dbus_conn = NULL;
}
--
2.33.0.rc1.237.g0d66db33f3-goog
next prev 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 ` Archie Pusaka [this message]
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 ` [Bluez PATCH 55/62] tools/mesh: " Archie Pusaka
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.50.I390a2e541f55decd24fbf5c87e2b6c92522518a0@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).