lib: Inclusive language changes
authorArchie Pusaka <apusaka@chromium.org>
Wed, 15 Sep 2021 08:31:55 +0000 (16:31 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:36 +0000 (19:08 +0530)
BT core spec 5.3 promotes the usage of inclusive languages.
This CL replaces some terms with the more appropriate counterparts,
such as "central", "peripheral", and "accept list".

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
android/bluetooth.c
lib/hci.c
lib/mgmt.h
monitor/control.c
src/adapter.c
tools/oobtest.c

index 8cf501d..12b2853 100755 (executable)
@@ -2276,7 +2276,7 @@ static void new_long_term_key_event(uint16_t index, uint16_t length,
                ediv = le16_to_cpu(key->ediv);
                rand = le64_to_cpu(key->rand);
 
-               store_ltk(&key->addr.bdaddr, key->addr.type, key->master,
+               store_ltk(&key->addr.bdaddr, key->addr.type, key->central,
                                key->val, key->type, key->enc_size, ediv, rand);
        }
 
@@ -3097,7 +3097,7 @@ static struct mgmt_ltk_info *get_ltk_info(GKeyFile *key_file, const char *peer,
        info->ediv = g_key_file_get_integer(key_file, peer, ediv_s, NULL);
        info->ediv = cpu_to_le16(info->ediv);
 
-       info->master = master;
+       info->central = master;
 
 failed:
        g_free(key);
index 6593763..66c30c1 100755 (executable)
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -292,7 +292,7 @@ int hci_strtolp(char *str, unsigned int *val)
 static hci_map link_mode_map[] = {
        { "NONE",       0               },
        { "ACCEPT",     HCI_LM_ACCEPT   },
-       { "MASTER",     HCI_LM_MASTER   },
+       { "CENTRAL",    HCI_LM_MASTER   },
        { "AUTH",       HCI_LM_AUTH     },
        { "ENCRYPT",    HCI_LM_ENCRYPT  },
        { "TRUSTED",    HCI_LM_TRUSTED  },
@@ -309,7 +309,7 @@ char *hci_lmtostr(unsigned int lm)
 
        *str = 0;
        if (!(lm & HCI_LM_MASTER))
-               strcpy(str, "SLAVE ");
+               strcpy(str, "PERIPHERAL ");
 
        s = hci_bit2str(link_mode_map, lm);
        if (!s) {
@@ -324,7 +324,15 @@ char *hci_lmtostr(unsigned int lm)
 
 int hci_strtolm(char *str, unsigned int *val)
 {
-       return hci_str2bit(link_mode_map, str, val);
+       int ret = hci_str2bit(link_mode_map, str, val);
+
+       /* Deprecated name. Kept for compatibility. */
+       if (strcasestr(str, "MASTER")) {
+               ret = 1;
+               *val |= HCI_LM_MASTER;
+       }
+
+       return ret;
 }
 
 /* Command mapping */
@@ -349,7 +357,7 @@ static hci_map commands_map[] = {
 
        { "Set Connection Encryption",                  16  },
        { "Change Connection Link Key",                 17  },
-       { "Master Link Key",                            18  },
+       { "Temporary Link Key",                         18  },
        { "Remote Name Request",                        19  },
        { "Cancel Remote Name Request",                 20  },
        { "Read Remote Supported Features",             21  },
@@ -569,11 +577,11 @@ static hci_map commands_map[] = {
        { "LE Set Scan Enable",                         211 },
        { "LE Create Connection",                       212 },
        { "LE Create Connection Cancel",                213 },
-       { "LE Read White List Size",                    214 },
-       { "LE Clear White List",                        215 },
+       { "LE Read Accept List Size",                   214 },
+       { "LE Clear Accept List",                       215 },
 
-       { "LE Add Device To White List",                216 },
-       { "LE Remove Device From White List",           217 },
+       { "LE Add Device To Accept List",               216 },
+       { "LE Remove Device From Accept List",          217 },
        { "LE Connection Update",                       218 },
        { "LE Set Host Channel Classification",         219 },
        { "LE Read Channel Map",                        220 },
@@ -744,8 +752,8 @@ static hci_map lmp_features_map[8][9] = {
                { "<EV4 packets>",      LMP_EV4         },      /* Bit 0 */
                { "<EV5 packets>",      LMP_EV5         },      /* Bit 1 */
                { "<no. 34>",           0x04            },      /* Bit 2 */
-               { "<AFH cap. slave>",   LMP_AFH_CAP_SLV },      /* Bit 3 */
-               { "<AFH class. slave>", LMP_AFH_CLS_SLV },      /* Bit 4 */
+               { "<AFH cap. perip.>",  LMP_AFH_CAP_SLV },      /* Bit 3 */
+               { "<AFH cls. perip.>",  LMP_AFH_CLS_SLV },      /* Bit 4 */
                { "<BR/EDR not supp.>", LMP_NO_BREDR    },      /* Bit 5 */
                { "<LE support>",       LMP_LE          },      /* Bit 6 */
                { "<3-slot EDR ACL>",   LMP_EDR_3SLOT   },      /* Bit 7 */
@@ -755,8 +763,8 @@ static hci_map lmp_features_map[8][9] = {
                { "<5-slot EDR ACL>",   LMP_EDR_5SLOT   },      /* Bit 0 */
                { "<sniff subrating>",  LMP_SNIFF_SUBR  },      /* Bit 1 */
                { "<pause encryption>", LMP_PAUSE_ENC   },      /* Bit 2 */
-               { "<AFH cap. master>",  LMP_AFH_CAP_MST },      /* Bit 3 */
-               { "<AFH class. master>",LMP_AFH_CLS_MST },      /* Bit 4 */
+               { "<AFH cap. central>", LMP_AFH_CAP_MST },      /* Bit 3 */
+               { "<AFH cls. central>", LMP_AFH_CLS_MST },      /* Bit 4 */
                { "<EDR eSCO 2 Mbps>",  LMP_EDR_ESCO_2M },      /* Bit 5 */
                { "<EDR eSCO 3 Mbps>",  LMP_EDR_ESCO_3M },      /* Bit 6 */
                { "<3-slot EDR eSCO>",  LMP_EDR_3S_ESCO },      /* Bit 7 */
index 8236ab5..0b613be 100644 (file)
@@ -179,7 +179,7 @@ struct mgmt_cp_load_link_keys {
 struct mgmt_ltk_info {
        struct mgmt_addr_info addr;
        uint8_t type;
-       uint8_t master;
+       uint8_t central;
        uint8_t enc_size;
        uint16_t ediv;
        uint64_t rand;
index 025d461..c22d1c3 100755 (executable)
@@ -307,13 +307,13 @@ static void mgmt_new_long_term_key(uint16_t len, const void *buf)
        /* LE SC keys are both for master and slave */
        switch (ev->key.type) {
        case 0x00:
-               if (ev->key.master)
+               if (ev->key.central)
                        type = "Master (Unauthenticated)";
                else
                        type = "Slave (Unauthenticated)";
                break;
        case 0x01:
-               if (ev->key.master)
+               if (ev->key.central)
                        type = "Master (Authenticated)";
                else
                        type = "Slave (Authenticated)";
index 2a850fe..b0e71c5 100644 (file)
@@ -8951,7 +8951,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->master = info->master;
+               key->central = info->master;
                key->enc_size = info->enc_size;
        }
 
@@ -14185,11 +14185,11 @@ static void new_long_term_key_callback(uint16_t index, uint16_t length,
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
                device_get_tizen_addr(device, addr->type, &t_addr);
                store_longtermkey(adapter, &t_addr.bdaddr, t_addr.bdaddr_type,
-                                       key->val, key->master, key->type,
+                                       key->val, key->central, key->type,
                                        key->enc_size, ediv, rand);
 #else
                store_longtermkey(adapter, &key->addr.bdaddr,
-                                       key->addr.type, key->val, key->master,
+                                       key->addr.type, key->val, key->central,
                                        key->type, key->enc_size, ediv, rand);
 #endif
 
index c095036..0368bc3 100755 (executable)
@@ -133,13 +133,13 @@ static void new_long_term_key_event(uint16_t index, uint16_t len,
 
        switch (ev->key.type) {
        case 0x00:
-               if (ev->key.master)
+               if (ev->key.central)
                        type = "Unauthenticated, Master";
                else
                        type = "Unauthenticated, Slave";
                break;
        case 0x01:
-               if (ev->key.master)
+               if (ev->key.central)
                        type = "Authenticated, Master";
                else
                        type = "Authenticated, Slave";