diff mbox series

[Bluez,v2,13/13] adapter: Inclusive language for storing LTK

Message ID 20210902120509.Bluez.v2.13.I90a92f48ae29b2a8d8b18f856ea2a43afba52299@changeid (mailing list archive)
State Superseded
Headers show
Series Inclusive language changes | expand

Commit Message

Archie Pusaka Sept. 2, 2021, 4:07 a.m. UTC
From: Archie Pusaka <apusaka@chromium.org>

BT core spec 5.3 promotes the usage of inclusive languages.
This CL replaces some terms with the more appropriate counterparts,
such as "central" and "peripheral"
---

(no changes since v1)

 doc/settings-storage.txt |  4 ++--
 src/adapter.c            | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Marcel Holtmann Sept. 2, 2021, 9:29 a.m. UTC | #1
Hi Archie,

> BT core spec 5.3 promotes the usage of inclusive languages.
> This CL replaces some terms with the more appropriate counterparts,
> such as "central" and "peripheral"
> ---
> 
> (no changes since v1)
> 
> doc/settings-storage.txt |  4 ++--
> src/adapter.c            | 10 +++++-----
> 2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/doc/settings-storage.txt b/doc/settings-storage.txt
> index 1d96cd66d9..3c637c3521 100644
> --- a/doc/settings-storage.txt
> +++ b/doc/settings-storage.txt
> @@ -314,9 +314,9 @@ Long term key) related to a remote device.
>   Rand			Integer		Randomizer
> 
> 
> -[SlaveLongTermKey] group contains:
> +[PeripheralLongTermKey] group contains:
> 
> -  Same as the [LongTermKey] group, except for slave keys.
> +  Same as the [LongTermKey] group, except for peripheral keys.
> 
> 
> [ConnectionParameters] group contains:
> diff --git a/src/adapter.c b/src/adapter.c
> index 4ad53a3a24..8528e2b6e0 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -3745,7 +3745,7 @@ 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);
> 
> -	central = g_key_file_get_boolean(key_file, group, "Master", &gerr);
> +	central = g_key_file_get_boolean(key_file, group, "Central", &gerr);
> 	if (gerr)
> 		g_error_free(gerr);
> 	else
> @@ -3777,7 +3777,7 @@ static struct smp_ltk_info *get_peripheral_ltk_info(GKeyFile *key_file,
> 
> 	DBG("%s", peer);
> 
> -	ltk = get_ltk(key_file, peer, bdaddr_type, "SlaveLongTermKey");
> +	ltk = get_ltk(key_file, peer, bdaddr_type, "PeripheralLongTermKey");
> 	if (ltk)
> 		ltk->central = false;
> 
> @@ -5780,7 +5780,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", central);
> +	g_key_file_set_integer(key_file, "LongTermKey", "Central", central);
> 	g_key_file_set_integer(key_file, "LongTermKey", "EncSize", enc_size);
> 	g_key_file_set_integer(key_file, "LongTermKey", "EDiv", ediv);

this is just not going to work. You are going to break existing installations that upgrade to a new version. The storage format, D-Bus API and libbluetooth API are something that you can not search+replace.

Regards

Marcel
Archie Pusaka Sept. 2, 2021, 9:32 a.m. UTC | #2
Got it, then let's simply leave this patch out.

Cheers,
Archie

On Thu, 2 Sept 2021 at 17:29, Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Archie,
>
> > BT core spec 5.3 promotes the usage of inclusive languages.
> > This CL replaces some terms with the more appropriate counterparts,
> > such as "central" and "peripheral"
> > ---
> >
> > (no changes since v1)
> >
> > doc/settings-storage.txt |  4 ++--
> > src/adapter.c            | 10 +++++-----
> > 2 files changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/doc/settings-storage.txt b/doc/settings-storage.txt
> > index 1d96cd66d9..3c637c3521 100644
> > --- a/doc/settings-storage.txt
> > +++ b/doc/settings-storage.txt
> > @@ -314,9 +314,9 @@ Long term key) related to a remote device.
> >   Rand                        Integer         Randomizer
> >
> >
> > -[SlaveLongTermKey] group contains:
> > +[PeripheralLongTermKey] group contains:
> >
> > -  Same as the [LongTermKey] group, except for slave keys.
> > +  Same as the [LongTermKey] group, except for peripheral keys.
> >
> >
> > [ConnectionParameters] group contains:
> > diff --git a/src/adapter.c b/src/adapter.c
> > index 4ad53a3a24..8528e2b6e0 100644
> > --- a/src/adapter.c
> > +++ b/src/adapter.c
> > @@ -3745,7 +3745,7 @@ 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);
> >
> > -     central = g_key_file_get_boolean(key_file, group, "Master", &gerr);
> > +     central = g_key_file_get_boolean(key_file, group, "Central", &gerr);
> >       if (gerr)
> >               g_error_free(gerr);
> >       else
> > @@ -3777,7 +3777,7 @@ static struct smp_ltk_info *get_peripheral_ltk_info(GKeyFile *key_file,
> >
> >       DBG("%s", peer);
> >
> > -     ltk = get_ltk(key_file, peer, bdaddr_type, "SlaveLongTermKey");
> > +     ltk = get_ltk(key_file, peer, bdaddr_type, "PeripheralLongTermKey");
> >       if (ltk)
> >               ltk->central = false;
> >
> > @@ -5780,7 +5780,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", central);
> > +     g_key_file_set_integer(key_file, "LongTermKey", "Central", central);
> >       g_key_file_set_integer(key_file, "LongTermKey", "EncSize", enc_size);
> >       g_key_file_set_integer(key_file, "LongTermKey", "EDiv", ediv);
>
> this is just not going to work. You are going to break existing installations that upgrade to a new version. The storage format, D-Bus API and libbluetooth API are something that you can not search+replace.
>
> Regards
>
> Marcel
>
diff mbox series

Patch

diff --git a/doc/settings-storage.txt b/doc/settings-storage.txt
index 1d96cd66d9..3c637c3521 100644
--- a/doc/settings-storage.txt
+++ b/doc/settings-storage.txt
@@ -314,9 +314,9 @@  Long term key) related to a remote device.
   Rand			Integer		Randomizer
 
 
-[SlaveLongTermKey] group contains:
+[PeripheralLongTermKey] group contains:
 
-  Same as the [LongTermKey] group, except for slave keys.
+  Same as the [LongTermKey] group, except for peripheral keys.
 
 
 [ConnectionParameters] group contains:
diff --git a/src/adapter.c b/src/adapter.c
index 4ad53a3a24..8528e2b6e0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3745,7 +3745,7 @@  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);
 
-	central = g_key_file_get_boolean(key_file, group, "Master", &gerr);
+	central = g_key_file_get_boolean(key_file, group, "Central", &gerr);
 	if (gerr)
 		g_error_free(gerr);
 	else
@@ -3777,7 +3777,7 @@  static struct smp_ltk_info *get_peripheral_ltk_info(GKeyFile *key_file,
 
 	DBG("%s", peer);
 
-	ltk = get_ltk(key_file, peer, bdaddr_type, "SlaveLongTermKey");
+	ltk = get_ltk(key_file, peer, bdaddr_type, "PeripheralLongTermKey");
 	if (ltk)
 		ltk->central = false;
 
@@ -5780,7 +5780,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", central);
+	g_key_file_set_integer(key_file, "LongTermKey", "Central", central);
 	g_key_file_set_integer(key_file, "LongTermKey", "EncSize", enc_size);
 	g_key_file_set_integer(key_file, "LongTermKey", "EDiv", ediv);
 
@@ -8211,7 +8211,7 @@  static void store_longtermkey(struct btd_adapter *adapter, const bdaddr_t *peer,
 				uint8_t enc_size, uint16_t ediv,
 				uint64_t rand)
 {
-	const char *group = central ? "LongTermKey" : "SlaveLongTermKey";
+	const char *group = central ? "LongTermKey" : "PeripheralLongTermKey";
 	char device_addr[18];
 	char filename[PATH_MAX];
 	GKeyFile *key_file;
@@ -8233,7 +8233,7 @@  static void store_longtermkey(struct btd_adapter *adapter, const bdaddr_t *peer,
 	g_key_file_load_from_file(key_file, filename, 0, NULL);
 
 	/* Old files may contain this so remove it in case it exists */
-	g_key_file_remove_key(key_file, "LongTermKey", "Master", NULL);
+	g_key_file_remove_key(key_file, "LongTermKey", "Central", NULL);
 
 	for (i = 0; i < 16; i++)
 		sprintf(key_str + (i * 2), "%2.2X", key[i]);