From c99fa1994f5c7e8593c5da879d38eeb9494dcc22 Mon Sep 17 00:00:00 2001 From: zhangyuan29 Date: Mon, 16 Dec 2024 21:47:28 +0800 Subject: [PATCH] net/utils: add union name for tasking compiler compatibility Some compilers like Tasking do not support anonymous unions/structs. Add explicit names to the anonymous union and struct members in snoop_packet_header_s and update all references accordingly. Signed-off-by: zhangyuan29 --- net/utils/net_snoop.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/utils/net_snoop.c b/net/utils/net_snoop.c index 7c19d6ad1cd..16e1a8f1547 100644 --- a/net/utils/net_snoop.c +++ b/net/utils/net_snoop.c @@ -146,7 +146,7 @@ begin_packed_struct struct snoop_packet_header_s { uint32_t flags; /* Packet Flags: 1 hci cmd , eg: btsnoop */ uint32_t rec_len; /* length of record */ - }; + } u1; uint32_t cum_drops; /* cumulative number of dropped packets */ union { @@ -156,7 +156,7 @@ begin_packed_struct struct snoop_packet_header_s uint32_t ts_sec; /* timestamp seconds */ uint32_t ts_usec; /* timestamp microseconds */ } ts; - }; + } u2; } end_packed_struct; /**************************************************************************** @@ -185,8 +185,8 @@ static void snoop_fill_packet_header(FAR struct snoop_s *snoop, case SNOOP_DATALINK_HCI_BSCP: case SNOOP_DATALINK_HCI_SERIAL: gettimeofday(&tv, NULL); - header->ts_usec = htobe64(SNOOP_EPOCH_USEC(tv)); - header->flags = htobe32(flags); + header->u2.ts_usec = htobe64(SNOOP_EPOCH_USEC(tv)); + header->u1.flags = htobe32(flags); break; case SNOOP_DATALINK_TYPE_TOKENBUS: @@ -199,9 +199,9 @@ static void snoop_fill_packet_header(FAR struct snoop_s *snoop, case SNOOP_DATALINK_TYPE_FDDI: case SNOOP_DATALINK_TYPE_OTHER: gettimeofday(&tv, NULL); - header->ts.ts_sec = htobe32(tv.tv_sec); - header->ts.ts_usec = htobe32(tv.tv_usec); - header->rec_len = htobe32(flags); + header->u2.ts.ts_sec = htobe32(tv.tv_sec); + header->u2.ts.ts_usec = htobe32(tv.tv_usec); + header->u1.rec_len = htobe32(flags); break; default: