Skip to contentSkip to conversation

monitor/rfcomm: Remove packed attribute from structs

PATCH Applied Luiz Augusto von Dentz 1 participant 2 messages Dec 9, 2016 – Dec 16, 2016 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 monitor/rfcomm: Remove packed attribute from structs

From: Luiz Augusto von Dentz <[email protected]>

These structs do not represent the raw PDU format thus they don't need to be the exact same size.

---
 monitor/rfcomm.c | 10 +++++-----
 monitor/rfcomm.h | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
monitor/rfcomm.c +5 -5
index b32ad40..fd7bbdc 100644
@@ -90,13 +90,13 @@ struct rfcomm_lhdr {
 	uint16_t length;
 	uint8_t fcs;
 	uint8_t credits; /* only for UIH frame */
-} __attribute__((packed));
+};
 
 struct rfcomm_lmsc {
 	uint8_t dlci;
 	uint8_t v24_sig;
 	uint8_t break_sig;
-} __attribute__((packed));
+};
 
 struct rfcomm_rpn {
 	uint8_t dlci;
@@ -111,16 +111,16 @@ struct rfcomm_rpn {
 struct rfcomm_rls {
 	uint8_t dlci;
 	uint8_t error;
-} __attribute__((packed));
+};
 
 struct rfcomm_nsc {
 	uint8_t cmd_type;
-} __attribute__((packed));
+};
 
 struct rfcomm_lmcc {
 	uint8_t type;
 	uint16_t length;
-} __attribute__((packed));
+};
 
 struct rfcomm_frame {
 	struct rfcomm_lhdr hdr;
monitor/rfcomm.h +5 -5
index c157352..f95e9c7 100644
@@ -38,14 +38,14 @@ struct rfcomm_hdr {
 	uint8_t address;
 	uint8_t control;
 	uint8_t length;
-} __attribute__((packed));
+};
 
 struct rfcomm_cmd {
 	uint8_t address;
 	uint8_t control;
 	uint8_t length;
 	uint8_t fcs;
-} __attribute__((packed));
+};
 
 #define RFCOMM_TEST    0x08
 #define RFCOMM_FCON    0x28
@@ -62,12 +62,12 @@ struct rfcomm_cmd {
 struct rfcomm_mcc {
 	uint8_t type;
 	uint8_t length;
-} __attribute__((packed));
+};
 
 struct rfcomm_msc {
 	uint8_t dlci;
 	uint8_t v24_sig;
-} __attribute__((packed));
+};
 
 struct rfcomm_pn {
 	uint8_t  dlci;
@@ -77,4 +77,4 @@ struct rfcomm_pn {
 	uint16_t mtu;
 	uint8_t  max_retrans;
 	uint8_t  credits;
-} __attribute__((packed));
+};
Signature · 1 line
2.9.3
author maintainer Applied
#1 lore raw

Hi,

Quoted 92 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

These structs do not represent the raw PDU format thus they don't need to be the exact same size.

---
 monitor/rfcomm.c | 10 +++++-----
 monitor/rfcomm.h | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
monitor/rfcomm.c +5 -5
index b32ad40..fd7bbdc 100644
@@ -90,13 +90,13 @@ struct rfcomm_lhdr {
        uint16_t length;
        uint8_t fcs;
        uint8_t credits; /* only for UIH frame */
-} __attribute__((packed));
+};
 
 struct rfcomm_lmsc {
        uint8_t dlci;
        uint8_t v24_sig;
        uint8_t break_sig;
-} __attribute__((packed));
+};
 
 struct rfcomm_rpn {
        uint8_t dlci;
@@ -111,16 +111,16 @@ struct rfcomm_rpn {
 struct rfcomm_rls {
        uint8_t dlci;
        uint8_t error;
-} __attribute__((packed));
+};
 
 struct rfcomm_nsc {
        uint8_t cmd_type;
-} __attribute__((packed));
+};
 
 struct rfcomm_lmcc {
        uint8_t type;
        uint16_t length;
-} __attribute__((packed));
+};
 
 struct rfcomm_frame {
        struct rfcomm_lhdr hdr;
monitor/rfcomm.h +5 -6
index c157352..f95e9c7 100644
@@ -38,14 +38,14 @@ struct rfcomm_hdr {
        uint8_t address;
        uint8_t control;
        uint8_t length;
-} __attribute__((packed));
+};
 
 struct rfcomm_cmd {
        uint8_t address;
        uint8_t control;
        uint8_t length;
        uint8_t fcs;
-} __attribute__((packed));
+};
 
 #define RFCOMM_TEST    0x08
 #define RFCOMM_FCON    0x28
@@ -62,12 +62,12 @@ struct rfcomm_cmd {
 struct rfcomm_mcc {
        uint8_t type;
        uint8_t length;
-} __attribute__((packed));
+};
 
 struct rfcomm_msc {
        uint8_t dlci;
        uint8_t v24_sig;
-} __attribute__((packed));
+};
 
 struct rfcomm_pn {
        uint8_t  dlci;
@@ -77,4 +77,4 @@ struct rfcomm_pn {
        uint16_t mtu;
        uint8_t  max_retrans;
        uint8_t  credits;
-} __attribute__((packed));
+};
--
Quoted 1 line

2.9.3

Applied.

Signature · 1 line
Luiz Augusto von Dentz