usrsock: Move event field to usrsock_message_common_s

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2022-03-22 21:59:46 +08:00 committed by Masayuki Ishikawa
parent bcb2530b18
commit 451c53daa4
3 changed files with 6 additions and 7 deletions

View File

@ -138,11 +138,11 @@ static int usrsock_send_event(FAR struct usrsock_s *usrsock,
{
struct usrsock_message_socket_event_s event;
event.head.msgid = USRSOCK_MESSAGE_SOCKET_EVENT;
event.head.flags = USRSOCK_MESSAGE_FLAG_EVENT;
event.head.msgid = USRSOCK_MESSAGE_SOCKET_EVENT;
event.head.flags = USRSOCK_MESSAGE_FLAG_EVENT;
event.head.events = events;
event.usockid = usockid;
event.events = events;
return usrsock_send(usrsock, &event, sizeof(event));
}

View File

@ -220,6 +220,7 @@ begin_packed_struct struct usrsock_message_common_s
{
int8_t msgid;
int8_t flags;
uint16_t events;
} end_packed_struct;
/* Request acknowledgment/completion message */
@ -228,7 +229,6 @@ begin_packed_struct struct usrsock_message_req_ack_s
{
struct usrsock_message_common_s head;
int16_t reserved;
int32_t result;
uint64_t xid;
} end_packed_struct;
@ -253,7 +253,6 @@ begin_packed_struct struct usrsock_message_socket_event_s
struct usrsock_message_common_s head;
int16_t usockid;
uint16_t events;
} end_packed_struct;
#endif /* __INCLUDE_NUTTX_NET_USRSOCK_H */

View File

@ -479,13 +479,13 @@ static ssize_t usrsockdev_handle_event(FAR struct usrsockdev_s *dev,
#ifdef CONFIG_DEV_RANDOM
/* Add randomness. */
add_sw_randomness((hdr->events << 16) - hdr->usockid);
add_sw_randomness((hdr->head.events << 16) - hdr->usockid);
#endif
/* Handle event. */
ret = usrsock_event(conn,
hdr->events & ~USRSOCK_EVENT_INTERNAL_MASK);
hdr->head.events & ~USRSOCK_EVENT_INTERNAL_MASK);
if (ret < 0)
{
return ret;