* [PATCH] lib: Fix two size constants
@ 2013-06-11 21:16 Alex Deymo
2013-06-12 7:34 ` Andrei Emeltchenko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alex Deymo @ 2013-06-11 21:16 UTC (permalink / raw)
To: linux-bluetooth; +Cc: keybuk, Alex Deymo
Fixes the value of RESET_FAILED_CONTACT_COUNTER_RP_SIZE and
RESET_FAILED_CONTACT_COUNTER_RP_SIZE macros to respect the
associated struct.
---
Hi! I was playing with the libbluetooth and found these two constants
wrongly defined. I actually checked with the Core spec that the structs
are fine... but I still have a very very naive question:
Why don't you use sizeof(some_struct) and be happy???
Thanks!
Alex.
lib/hci.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/hci.h b/lib/hci.h
index 56c9316..898cf52 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -1350,7 +1350,7 @@ typedef struct {
uint8_t status;
uint16_t handle;
} __attribute__ ((packed)) reset_failed_contact_counter_rp;
-#define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 4
+#define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 3
#define OCF_READ_LINK_QUALITY 0x0003
typedef struct {
@@ -1764,7 +1764,7 @@ typedef struct {
uint16_t handle;
uint8_t encrypt;
} __attribute__ ((packed)) evt_encrypt_change;
-#define EVT_ENCRYPT_CHANGE_SIZE 5
+#define EVT_ENCRYPT_CHANGE_SIZE 4
#define EVT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
typedef struct {
--
1.8.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: Fix two size constants
2013-06-11 21:16 [PATCH] lib: Fix two size constants Alex Deymo
@ 2013-06-12 7:34 ` Andrei Emeltchenko
2013-06-12 7:50 ` Marcel Holtmann
2013-06-16 15:30 ` Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Andrei Emeltchenko @ 2013-06-12 7:34 UTC (permalink / raw)
To: Alex Deymo; +Cc: linux-bluetooth, keybuk
Hi Alex,
On Tue, Jun 11, 2013 at 02:16:42PM -0700, Alex Deymo wrote:
> Fixes the value of RESET_FAILED_CONTACT_COUNTER_RP_SIZE and
> RESET_FAILED_CONTACT_COUNTER_RP_SIZE macros to respect the
> associated struct.
> ---
>
> Hi! I was playing with the libbluetooth and found these two constants
> wrongly defined. I actually checked with the Core spec that the structs
> are fine... but I still have a very very naive question:
>
> Why don't you use sizeof(some_struct) and be happy???
This sounds very reasonable! I could not understand this myself.
Best regards
Andrei Emeltchenko
>
> Thanks!
> Alex.
>
> lib/hci.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/hci.h b/lib/hci.h
> index 56c9316..898cf52 100644
> --- a/lib/hci.h
> +++ b/lib/hci.h
> @@ -1350,7 +1350,7 @@ typedef struct {
> uint8_t status;
> uint16_t handle;
> } __attribute__ ((packed)) reset_failed_contact_counter_rp;
> -#define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 4
> +#define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 3
>
> #define OCF_READ_LINK_QUALITY 0x0003
> typedef struct {
> @@ -1764,7 +1764,7 @@ typedef struct {
> uint16_t handle;
> uint8_t encrypt;
> } __attribute__ ((packed)) evt_encrypt_change;
> -#define EVT_ENCRYPT_CHANGE_SIZE 5
> +#define EVT_ENCRYPT_CHANGE_SIZE 4
>
> #define EVT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
> typedef struct {
> --
> 1.8.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: Fix two size constants
2013-06-11 21:16 [PATCH] lib: Fix two size constants Alex Deymo
2013-06-12 7:34 ` Andrei Emeltchenko
@ 2013-06-12 7:50 ` Marcel Holtmann
2013-06-16 15:30 ` Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2013-06-12 7:50 UTC (permalink / raw)
To: Alex Deymo; +Cc: linux-bluetooth, keybuk
Hi Alex,
> Fixes the value of RESET_FAILED_CONTACT_COUNTER_RP_SIZE and
> RESET_FAILED_CONTACT_COUNTER_RP_SIZE macros to respect the
> associated struct.
> ---
>
> Hi! I was playing with the libbluetooth and found these two constants
> wrongly defined. I actually checked with the Core spec that the structs
> are fine... but I still have a very very naive question:
>
> Why don't you use sizeof(some_struct) and be happy???
the original kernel code this is based on is from 2001 and we have not bothered to change it. I think there also were some gcc version that had problems with sizeof(struct xxx) when we needed packed structs. Take it as some legacy that has not changed in the last 12 years.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: Fix two size constants
2013-06-11 21:16 [PATCH] lib: Fix two size constants Alex Deymo
2013-06-12 7:34 ` Andrei Emeltchenko
2013-06-12 7:50 ` Marcel Holtmann
@ 2013-06-16 15:30 ` Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2013-06-16 15:30 UTC (permalink / raw)
To: Alex Deymo; +Cc: linux-bluetooth, keybuk
Hi Alex,
On Tue, Jun 11, 2013, Alex Deymo wrote:
> Fixes the value of RESET_FAILED_CONTACT_COUNTER_RP_SIZE and
> RESET_FAILED_CONTACT_COUNTER_RP_SIZE macros to respect the
> associated struct.
> ---
> lib/hci.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-16 15:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-11 21:16 [PATCH] lib: Fix two size constants Alex Deymo
2013-06-12 7:34 ` Andrei Emeltchenko
2013-06-12 7:50 ` Marcel Holtmann
2013-06-16 15:30 ` Johan Hedberg
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).