diff --git a/fs/tmpfs/fs_tmpfs.c b/fs/tmpfs/fs_tmpfs.c index dd491e996b8..eb7ed448b91 100644 --- a/fs/tmpfs/fs_tmpfs.c +++ b/fs/tmpfs/fs_tmpfs.c @@ -805,7 +805,7 @@ static int tmpfs_open(FAR struct file *filep, FAR const char *relpath, * access is ignored. */ - if ((oflags & (O_TRUNC|O_WRONLY)) == (O_TRUNC|O_WRONLY)) + if ((oflags & (O_TRUNC | O_WRONLY)) == (O_TRUNC | O_WRONLY)) { /* Truncate the file to zero length (if it is not already * zero length) diff --git a/net/arp/arp_arpin.c b/net/arp/arp_arpin.c index a94bbb9fa0c..feb2dc0a06a 100644 --- a/net/arp/arp_arpin.c +++ b/net/arp/arp_arpin.c @@ -116,7 +116,7 @@ void arp_arpin(FAR struct net_driver_s *dev) dev->d_len = 0; ipaddr = net_ip4addr_conv32(arp->ah_dipaddr); - switch(arp->ah_opcode) + switch (arp->ah_opcode) { case HTONS(ARP_REQUEST): nllvdbg("ARP request for IP %04lx\n", (long)ipaddr); diff --git a/net/arp/arp_dump.c b/net/arp/arp_dump.c index 9c796863f7c..739c280837b 100644 --- a/net/arp/arp_dump.c +++ b/net/arp/arp_dump.c @@ -86,7 +86,7 @@ void arp_dump(FAR struct arp_hdr_s *arp) { nlldbg(" HW type: %04x Protocol: %04x\n", - arp->ah_hwtype, arp->ah_protocol);\ + arp->ah_hwtype, arp->ah_protocol); nlldbg(" HW len: %02x Proto len: %02x Operation: %04x\n", arp->ah_hwlen, arp->ah_protolen, arp->ah_opcode); nlldbg(" Sender MAC: %02x:%02x:%02x:%02x:%02x:%02x IP: %d.%d.%d.%d\n", diff --git a/net/arp/arp_out.c b/net/arp/arp_out.c index a815715c63d..daa71b2ac41 100644 --- a/net/arp/arp_out.c +++ b/net/arp/arp_out.c @@ -73,8 +73,16 @@ /* Support for broadcast address */ static const struct ether_addr g_broadcast_ethaddr = - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; -static const uint16_t g_broadcast_ipaddr[2] = {0xffff, 0xffff}; +{ + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + } +}; + +static const uint16_t g_broadcast_ipaddr[2] = +{ + 0xffff, 0xffff +}; /* Support for IGMP multicast addresses. * @@ -93,7 +101,10 @@ static const uint16_t g_broadcast_ipaddr[2] = {0xffff, 0xffff}; */ #ifdef CONFIG_NET_IGMP -static const uint8_t g_multicast_ethaddr[3] = {0x01, 0x00, 0x5e}; +static const uint8_t g_multicast_ethaddr[3] = +{ + 0x01, 0x00, 0x5e +}; #endif /**************************************************************************** @@ -186,7 +197,7 @@ void arp_out(FAR struct net_driver_s *dev) * last three bytes of the IP address. */ - FAR const uint8_t *ip = ((uint8_t*)pip->eh_destipaddr) + 1; + FAR const uint8_t *ip = ((FAR uint8_t *)pip->eh_destipaddr) + 1; memcpy(peth->dest, g_multicast_ethaddr, 3); memcpy(&peth->dest[3], ip, 3); } diff --git a/net/devif/ipv4_input.c b/net/devif/ipv4_input.c index 919471a3e55..cb90e462e19 100644 --- a/net/devif/ipv4_input.c +++ b/net/devif/ipv4_input.c @@ -130,7 +130,9 @@ static uint8_t g_reassembly_buffer[TCP_REASS_BUFSIZE]; static uint8_t g_reassembly_bitmap[TCP_REASS_BUFSIZE / (8 * 8)]; static const uint8_t g_bitmap_bits[8] = - {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01}; +{ + 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 +}; static uint16_t g_reassembly_len; static uint8_t g_reassembly_flags; @@ -202,93 +204,97 @@ static uint8_t devif_reassembly(void) memcpy(&g_reassembly_buffer[IPv4_HDRLEN + offset], (char *)pbuf + (int)((pbuf->vhl & 0x0f) * 4), len); - /* Update the bitmap. */ + /* Update the bitmap. */ - if (offset / (8 * 8) == (offset + len) / (8 * 8)) - { - /* If the two endpoints are in the same byte, we only update that byte. */ + if (offset / (8 * 8) == (offset + len) / (8 * 8)) + { + /* If the two endpoints are in the same byte, we only update that byte. */ - g_reassembly_bitmap[offset / (8 * 8)] |= - g_bitmap_bits[(offset / 8 ) & 7] & ~g_bitmap_bits[((offset + len) / 8 ) & 7]; + g_reassembly_bitmap[offset / (8 * 8)] |= + g_bitmap_bits[(offset / 8) & 7] & + ~g_bitmap_bits[((offset + len) / 8) & 7]; - } - else - { - /* If the two endpoints are in different bytes, we update the bytes - * in the endpoints and fill the stuff inbetween with 0xff. - */ + } + else + { + /* If the two endpoints are in different bytes, we update the bytes + * in the endpoints and fill the stuff inbetween with 0xff. + */ - g_reassembly_bitmap[offset / (8 * 8)] |= g_bitmap_bits[(offset / 8 ) & 7]; - for (i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) - { - g_reassembly_bitmap[i] = 0xff; - } + g_reassembly_bitmap[offset / (8 * 8)] |= + g_bitmap_bits[(offset / 8) & 7]; - g_reassembly_bitmap[(offset + len) / (8 * 8)] |= - ~g_bitmap_bits[((offset + len) / 8 ) & 7]; - } + for (i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) + { + g_reassembly_bitmap[i] = 0xff; + } - /* If this fragment has the More Fragments flag set to zero, we know that - * this is the last fragment, so we can calculate the size of the entire - * packet. We also set the IP_REASS_FLAG_LASTFRAG flag to indicate that - * we have received the final fragment. - */ + g_reassembly_bitmap[(offset + len) / (8 * 8)] |= + ~g_bitmap_bits[((offset + len) / 8) & 7]; + } - if ((pbuf->ipoffset[0] & IP_MF) == 0) - { - g_reassembly_flags |= TCP_REASS_LASTFRAG; - g_reassembly_len = offset + len; - } + /* If this fragment has the More Fragments flag set to zero, we know that + * this is the last fragment, so we can calculate the size of the entire + * packet. We also set the IP_REASS_FLAG_LASTFRAG flag to indicate that + * we have received the final fragment. + */ - /* Finally, we check if we have a full packet in the buffer. We do this - * by checking if we have the last fragment and if all bits in the bitmap - * are set. - */ + if ((pbuf->ipoffset[0] & IP_MF) == 0) + { + g_reassembly_flags |= TCP_REASS_LASTFRAG; + g_reassembly_len = offset + len; + } - if (g_reassembly_flags & TCP_REASS_LASTFRAG) - { - /* Check all bytes up to and including all but the last byte in - * the bitmap. - */ + /* Finally, we check if we have a full packet in the buffer. We do this + * by checking if we have the last fragment and if all bits in the bitmap + * are set. + */ - for (i = 0; i < g_reassembly_len / (8 * 8) - 1; ++i) - { - if (g_reassembly_bitmap[i] != 0xff) - { - goto nullreturn; - } - } + if (g_reassembly_flags & TCP_REASS_LASTFRAG) + { + /* Check all bytes up to and including all but the last byte in + * the bitmap. + */ - /* Check the last byte in the bitmap. It should contain just the - * right amount of bits. - */ + for (i = 0; i < g_reassembly_len / (8 * 8) - 1; ++i) + { + if (g_reassembly_bitmap[i] != 0xff) + { + goto nullreturn; + } + } - if (g_reassembly_bitmap[g_reassembly_len / (8 * 8)] != (uint8_t)~g_bitmap_bits[g_reassembly_len / 8 & 7]) - { - goto nullreturn; - } + /* Check the last byte in the bitmap. It should contain just the + * right amount of bits. + */ - /* If we have come this far, we have a full packet in the buffer, - * so we allocate a pbuf and copy the packet into it. We also reset - * the timer. - */ + if (g_reassembly_bitmap[g_reassembly_len / (8 * 8)] != + (uint8_t)~g_bitmap_bits[g_reassembly_len / 8 & 7]) + { + goto nullreturn; + } - g_reassembly_timer = 0; - memcpy(pbuf, pfbuf, g_reassembly_len); + /* If we have come this far, we have a full packet in the buffer, + * so we allocate a pbuf and copy the packet into it. We also reset + * the timer. + */ - /* Pretend to be a "normal" (i.e., not fragmented) IP packet from - * now on. - */ + g_reassembly_timer = 0; + memcpy(pbuf, pfbuf, g_reassembly_len); - pbuf->ipoffset[0] = pbuf->ipoffset[1] = 0; - pbuf->len[0] = g_reassembly_len >> 8; - pbuf->len[1] = g_reassembly_len & 0xff; - pbuf->ipchksum = 0; - pbuf->ipchksum = ~(ipv4_chksum(dev)); + /* Pretend to be a "normal" (i.e., not fragmented) IP packet from + * now on. + */ - return g_reassembly_len; - } - } + pbuf->ipoffset[0] = pbuf->ipoffset[1] = 0; + pbuf->len[0] = g_reassembly_len >> 8; + pbuf->len[1] = g_reassembly_len & 0xff; + pbuf->ipchksum = 0; + pbuf->ipchksum = ~(ipv4_chksum(dev)); + + return g_reassembly_len; + } + } nullreturn: return 0; @@ -379,11 +385,11 @@ int ipv4_input(FAR struct net_driver_s *dev) } #if defined(CONFIG_NET_BROADCAST) && defined(CONFIG_NET_UDP) - /* If IP broadcast support is configured, we check for a broadcast - * UDP packet, which may be destined to us (even if there is no IP - * address yet assigned to the device as is the case when we are - * negotiating over DHCP for an address). - */ + /* If IP broadcast support is configured, we check for a broadcast + * UDP packet, which may be destined to us (even if there is no IP + * address yet assigned to the device as is the case when we are + * negotiating over DHCP for an address). + */ if (pbuf->proto == IP_PROTO_UDP && net_ipv4addr_cmp(net_ip4addr_conv32(pbuf->destipaddr), diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c index 7b878ac4aba..19fdea6482f 100644 --- a/net/devif/ipv6_input.c +++ b/net/devif/ipv6_input.c @@ -191,11 +191,11 @@ int ipv6_input(FAR struct net_driver_s *dev) goto drop; } - /* If IP broadcast support is configured, we check for a broadcast - * UDP packet, which may be destined to us (even if there is no IP - * address yet assigned to the device as is the case when we are - * negotiating over DHCP for an address). - */ + /* If IP broadcast support is configured, we check for a broadcast + * UDP packet, which may be destined to us (even if there is no IP + * address yet assigned to the device as is the case when we are + * negotiating over DHCP for an address). + */ #if defined(CONFIG_NET_BROADCAST) && defined(CONFIG_NET_UDP) if (ipv6->proto == IP_PROTO_UDP && diff --git a/net/icmp/icmp_ping.c b/net/icmp/icmp_ping.c index 41bc604dfd3..767bceec160 100644 --- a/net/icmp/icmp_ping.c +++ b/net/icmp/icmp_ping.c @@ -390,7 +390,7 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen, if (state.png_cb) { state.png_cb->flags = (ICMP_POLL | ICMP_ECHOREPLY | NETDEV_DOWN); - state.png_cb->priv = (void*)&state; + state.png_cb->priv = (FAR void *)&state; state.png_cb->event = ping_interrupt; state.png_result = -EINTR; /* Assume sem-wait interrupted by signal */ diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c index add6e328b56..7899f07451a 100644 --- a/net/icmpv6/icmpv6_autoconfig.c +++ b/net/icmpv6/icmpv6_autoconfig.c @@ -398,7 +398,7 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev) */ lladdr[0] = HTONS(0xfe80); /* 10-bit address + 6 zeroes */ - memset(&lladdr[1], 0, 4* sizeof(uint16_t)); /* 64 more zeroes */ + memset(&lladdr[1], 0, 4 * sizeof(uint16_t)); /* 64 more zeroes */ memcpy(&lladdr[5], dev->d_mac.ether_addr_octet, sizeof(struct ether_addr)); /* 48-bit Ethernet address */ @@ -546,9 +546,9 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev) * first step. */ - /* On success, the new address was already set (in icmpv_rnotify()). We - * need only to bring the network back to the up state and return success. - */ + /* On success, the new address was already set (in icmpv_rnotify()). We + * need only to bring the network back to the up state and return success. + */ netdev_ifup(dev); net_unlock(save); diff --git a/net/icmpv6/icmpv6_notify.c b/net/icmpv6/icmpv6_notify.c index 2302b3b2a30..07191a53425 100644 --- a/net/icmpv6/icmpv6_notify.c +++ b/net/icmpv6/icmpv6_notify.c @@ -197,9 +197,9 @@ int icmpv6_wait(FAR struct icmpv6_notify_s *notify, abstime.tv_nsec -= 1000000000; } - /* REVISIT: If net_timedwait() is awakened with signal, we will return - * the wrong error code. - */ + /* REVISIT: If net_timedwait() is awakened with signal, we will return + * the wrong error code. + */ (void)net_timedwait(¬ify->nt_sem, &abstime); ret = notify->nt_result; diff --git a/net/icmpv6/icmpv6_ping.c b/net/icmpv6/icmpv6_ping.c index 3cb74d3a487..956c18c6564 100644 --- a/net/icmpv6/icmpv6_ping.c +++ b/net/icmpv6/icmpv6_ping.c @@ -456,7 +456,7 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno, if (state.png_cb) { state.png_cb->flags = (ICMPv6_POLL | ICMPv6_ECHOREPLY); - state.png_cb->priv = (void*)&state; + state.png_cb->priv = (FAR void *)&state; state.png_cb->event = ping_interrupt; state.png_result = -EINTR; /* Assume sem-wait interrupted by signal */ diff --git a/net/icmpv6/icmpv6_rnotify.c b/net/icmpv6/icmpv6_rnotify.c index 9a176771975..d7c04976eb7 100644 --- a/net/icmpv6/icmpv6_rnotify.c +++ b/net/icmpv6/icmpv6_rnotify.c @@ -293,9 +293,9 @@ int icmpv6_rwait(FAR struct icmpv6_rnotify_s *notify, abstime.tv_nsec -= 1000000000; } - /* REVISIT: If net_timedwait() is awakened with signal, we will return - * the wrong error code. - */ + /* REVISIT: If net_timedwait() is awakened with signal, we will return + * the wrong error code. + */ (void)net_timedwait(¬ify->rn_sem, &abstime); ret = notify->rn_result; diff --git a/net/icmpv6/icmpv6_solicit.c b/net/icmpv6/icmpv6_solicit.c index cceac688da8..7e84ccf7d50 100644 --- a/net/icmpv6/icmpv6_solicit.c +++ b/net/icmpv6/icmpv6_solicit.c @@ -174,7 +174,7 @@ void icmpv6_solicit(FAR struct net_driver_s *dev, * the four low-order octets OR'ed with the MAC 33:33:00:00:00:00, * so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map * to the Ethernet MAC address 33:33:00:01:00:03. - * + * * NOTES: This appears correct for the ICMPv6 Router Solicitation * Message, but the ICMPv6 Neighbor Solicitation message seems to * use 33:33:ff:01:00:03. diff --git a/net/igmp/igmp_group.c b/net/igmp/igmp_group.c index 3f33207f97d..03f2613026a 100644 --- a/net/igmp/igmp_group.c +++ b/net/igmp/igmp_group.c @@ -265,7 +265,7 @@ FAR struct igmp_group_s *igmp_grpalloc(FAR struct net_driver_s *dev, /* Add the group structure to the list in the device structure */ - sq_addfirst((FAR sq_entry_t*)group, &dev->grplist); + sq_addfirst((FAR sq_entry_t *)group, &dev->grplist); net_unlock(flags); } @@ -363,7 +363,7 @@ void igmp_grpfree(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group) /* Remove the group structure from the group list in the device structure */ - sq_rem((FAR sq_entry_t*)group, &dev->grplist); + sq_rem((FAR sq_entry_t *)group, &dev->grplist); /* Destroy the wait semaphore */ @@ -381,7 +381,7 @@ void igmp_grpfree(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group) if (IS_PREALLOCATED(group->flags)) { grplldbg("Put back on free list\n"); - sq_addlast((FAR sq_entry_t*)group, &g_freelist); + sq_addlast((FAR sq_entry_t *)group, &g_freelist); net_unlock(flags); } else diff --git a/net/igmp/igmp_input.c b/net/igmp/igmp_input.c index f2f7363d7f7..64a5aba9123 100644 --- a/net/igmp/igmp_input.c +++ b/net/igmp/igmp_input.c @@ -134,14 +134,14 @@ void igmp_input(struct net_driver_s *dev) /* Calculate and check the IGMP checksum */ - if (net_chksum((uint16_t*)&IGMPBUF->type, IGMP_HDRLEN) != 0) + if (net_chksum((FAR uint16_t *)&IGMPBUF->type, IGMP_HDRLEN) != 0) { IGMP_STATINCR(g_netstats.igmp.chksum_errors); nlldbg("Checksum error\n"); return; } - /* Find the group (or create a new one) using the incoming IP address*/ + /* Find the group (or create a new one) using the incoming IP address */ destipaddr = net_ip4addr_conv32(IGMPBUF->destipaddr); group = igmp_grpallocfind(dev, &destipaddr); diff --git a/net/igmp/igmp_send.c b/net/igmp/igmp_send.c index f800503ff21..5a2526395df 100644 --- a/net/igmp/igmp_send.c +++ b/net/igmp/igmp_send.c @@ -92,7 +92,7 @@ static uint16_t igmp_chksum(FAR uint8_t *buffer, int buflen) { - uint16_t sum = net_chksum((FAR uint16_t*)buffer, buflen); + uint16_t sum = net_chksum((FAR uint16_t *)buffer, buflen); return sum ? sum : 0xffff; } diff --git a/net/local/local_accept.c b/net/local/local_accept.c index 0c393dcf210..d26fc74813d 100644 --- a/net/local/local_accept.c +++ b/net/local/local_accept.c @@ -133,7 +133,7 @@ int psock_local_accept(FAR struct socket *psock, FAR struct sockaddr *addr, /* Loop as necessary if we have to wait for a connection */ - for (;;) + for (; ; ) { /* Are there pending connections. Remove the client from the * head of the waiting list. diff --git a/net/local/local_connect.c b/net/local/local_connect.c index 99ea989edfa..f1176ad3c8d 100644 --- a/net/local/local_connect.c +++ b/net/local/local_connect.c @@ -143,7 +143,7 @@ int inline local_stream_connect(FAR struct local_conn_s *client, return -ECONNREFUSED; } - /* Increment the number of pending server connection s*/ + /* Increment the number of pending server connection s */ server->u.server.lc_pending++; DEBUGASSERT(server->u.server.lc_pending != 0); @@ -271,7 +271,7 @@ int psock_local_connect(FAR struct socket *psock, /* Find the matching server connection */ state = net_lock(); - for(conn = (FAR struct local_conn_s *)g_local_listeners.head; + for (conn = (FAR struct local_conn_s *)g_local_listeners.head; conn; conn = (FAR struct local_conn_s *)dq_next(&conn->lc_node)) { diff --git a/net/local/local_recvfrom.c b/net/local/local_recvfrom.c index 5ea052cd426..bf5dc45c16f 100644 --- a/net/local/local_recvfrom.c +++ b/net/local/local_recvfrom.c @@ -94,7 +94,7 @@ static int psock_fifo_read(FAR struct socket *psock, FAR void *buf, * eventually be reported as ENOTCONN. */ - psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); + psock->s_flags &= ~(_SF_CONNECTED | _SF_CLOSED); conn->lc_state = LOCAL_STATE_DISCONNECTED; /* Did we receive any data? */ @@ -351,7 +351,7 @@ psock_dgram_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, close(conn->lc_infd); conn->lc_infd = -1; - /* Release our reference to the half duplex FIFO*/ + /* Release our reference to the half duplex FIFO */ (void)local_release_halfduplex(conn); @@ -375,7 +375,7 @@ errout_with_infd: conn->lc_infd = -1; errout_with_halfduplex: - /* Release our reference to the half duplex FIFO*/ + /* Release our reference to the half duplex FIFO */ (void)local_release_halfduplex(conn); return ret; diff --git a/net/local/local_sendto.c b/net/local/local_sendto.c index a4761413ef2..8142110c083 100644 --- a/net/local/local_sendto.c +++ b/net/local/local_sendto.c @@ -168,7 +168,7 @@ ssize_t psock_local_sendto(FAR struct socket *psock, FAR const void *buf, conn->lc_outfd = -1; errout_with_halfduplex: - /* Release our reference to the half duplex FIFO*/ + /* Release our reference to the half duplex FIFO */ (void)local_release_halfduplex(conn); return nsent; diff --git a/net/neighbor/neighbor_out.c b/net/neighbor/neighbor_out.c index 3a6e471988f..061a45518dc 100644 --- a/net/neighbor/neighbor_out.c +++ b/net/neighbor/neighbor_out.c @@ -67,7 +67,11 @@ /* Support for broadcast address */ static const struct ether_addr g_broadcast_ethaddr = - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; +{ + { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + } +}; /* Support for IGMP multicast addresses. * @@ -86,7 +90,10 @@ static const struct ether_addr g_broadcast_ethaddr = */ #ifdef CONFIG_NET_IGMP -static const uint8_t g_multicast_ethaddr[3] = {0x01, 0x00, 0x5e}; +static const uint8_t g_multicast_ethaddr[3] = +{ + 0x01, 0x00, 0x5e +}; #endif /**************************************************************************** diff --git a/net/netdev/netdev_findbyaddr.c b/net/netdev/netdev_findbyaddr.c index 041189842ab..1f752a2c64d 100644 --- a/net/netdev/netdev_findbyaddr.c +++ b/net/netdev/netdev_findbyaddr.c @@ -289,12 +289,12 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t ripaddr) */ #ifndef CONFIG_NETDEV_MULTINIC - /* If there is only a single, registered network interface, then the - * decision is pretty easy. Use that device and its default router - * address. - */ + /* If there is only a single, registered network interface, then the + * decision is pretty easy. Use that device and its default router + * address. + */ - dev = g_netdevices; + dev = g_netdevices; #endif /* If we will did not find the network device, then we might as well fail @@ -407,12 +407,12 @@ FAR struct net_driver_s *netdev_findby_ipv6addr(const net_ipv6addr_t ripaddr) */ #ifndef CONFIG_NETDEV_MULTINIC - /* If there is only a single, registered network interface, then the - * decision is pretty easy. Use that device and its default router - * address. - */ + /* If there is only a single, registered network interface, then the + * decision is pretty easy. Use that device and its default router + * address. + */ - dev = g_netdevices; + dev = g_netdevices; #endif /* If we will did not find the network device, then we might as well fail diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index 627d8025c88..24578e9f85f 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -713,7 +713,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd, { ret = -ENOTTY; } - break;; + break; } return ret; @@ -964,18 +964,18 @@ int netdev_ioctl(int sockfd, int cmd, unsigned long arg) /* Execute the command */ - ret = netdev_ifrioctl(psock, cmd, (FAR struct ifreq*)((uintptr_t)arg)); + ret = netdev_ifrioctl(psock, cmd, (FAR struct ifreq *)((uintptr_t)arg)); #ifdef CONFIG_NET_IGMP if (ret == -ENOTTY) { - ret = netdev_imsfioctl(psock, cmd, (FAR struct ip_msfilter*)((uintptr_t)arg)); + ret = netdev_imsfioctl(psock, cmd, (FAR struct ip_msfilter *)((uintptr_t)arg)); } #endif #ifdef CONFIG_NET_ROUTE if (ret == -ENOTTY) { - ret = netdev_rtioctl(psock, cmd, (FAR struct rtentry*)((uintptr_t)arg)); + ret = netdev_rtioctl(psock, cmd, (FAR struct rtentry *)((uintptr_t)arg)); } #endif diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index de5fa6c8f43..fd6ce96985f 100644 --- a/net/netdev/netdev_register.c +++ b/net/netdev/netdev_register.c @@ -294,7 +294,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) } #endif - snprintf(dev->d_ifname, IFNAMSIZ, devfmt, devnum ); + snprintf(dev->d_ifname, IFNAMSIZ, devfmt, devnum); /* Add the device to the list of known network devices */ diff --git a/net/pkt/pkt_poll.c b/net/pkt/pkt_poll.c index 14c536fbc14..561bb33fe51 100644 --- a/net/pkt/pkt_poll.c +++ b/net/pkt/pkt_poll.c @@ -114,7 +114,7 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn) if (dev->d_sndlen > 0) { -// devif_pkt_send(dev, conn); + //devif_pkt_send(dev, conn); return; } } diff --git a/net/pkt/pkt_send.c b/net/pkt/pkt_send.c index f7dbca8c67d..b36e3cb8bb1 100644 --- a/net/pkt/pkt_send.c +++ b/net/pkt/pkt_send.c @@ -266,7 +266,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf, /* Set up the callback in the connection */ state.snd_cb->flags = PKT_POLL; - state.snd_cb->priv = (void*)&state; + state.snd_cb->priv = (FAR void *)&state; state.snd_cb->event = psock_send_interrupt; /* Notify the device driver that new TX data is available. */ diff --git a/net/route/net_delroute.c b/net/route/net_delroute.c index 9e31768ff52..1efbb0e18eb 100644 --- a/net/route/net_delroute.c +++ b/net/route/net_delroute.c @@ -93,7 +93,7 @@ struct route_match_ipv6_s #ifdef CONFIG_NET_IPv4 static int net_match(FAR struct net_route_s *route, FAR void *arg) { - FAR struct route_match_s *match = ( FAR struct route_match_s *)arg; + FAR struct route_match_s *match = (FAR struct route_match_s *)arg; /* To match, the masked target address must be the same, and the masks * must be the same. @@ -133,7 +133,7 @@ static int net_match(FAR struct net_route_s *route, FAR void *arg) #ifdef CONFIG_NET_IPv6 static int net_match_ipv6(FAR struct net_route_ipv6_s *route, FAR void *arg) { - FAR struct route_match_ipv6_s *match = ( FAR struct route_match_ipv6_s *)arg; + FAR struct route_match_ipv6_s *match = (FAR struct route_match_ipv6_s *)arg; /* To match, the masked target address must be the same, and the masks * must be the same. diff --git a/net/route/net_router.c b/net/route/net_router.c index d0bd3eb0b2b..a72990e37da 100644 --- a/net/route/net_router.c +++ b/net/route/net_router.c @@ -60,7 +60,7 @@ struct route_ipv4_match_s { in_addr_t target; /* Target IPv4 address on an external network to match */ - in_addr_t router; /* IPv4 address of the router on one of our networks*/ + in_addr_t router; /* IPv4 address of the router on one of our networks */ }; #endif @@ -68,7 +68,7 @@ struct route_ipv4_match_s struct route_ipv6_match_s { net_ipv6addr_t target; /* Target IPv6 address on an external network to match */ - net_ipv6addr_t router; /* IPv6 address of the router on one of our networks*/ + net_ipv6addr_t router; /* IPv6 address of the router on one of our networks */ }; #endif diff --git a/net/route/netdev_router.c b/net/route/netdev_router.c index fda212c6644..d76a4e52b74 100644 --- a/net/route/netdev_router.c +++ b/net/route/netdev_router.c @@ -60,7 +60,7 @@ struct route_ipv4_devmatch_s { FAR struct net_driver_s *dev; /* The route must use this device */ in_addr_t target; /* Target IPv4 address on an external network to match */ - in_addr_t router; /* IPv6 address of the router on one of our networks*/ + in_addr_t router; /* IPv6 address of the router on one of our networks */ }; #endif @@ -69,7 +69,7 @@ struct route_ipv6_devmatch_s { FAR struct net_driver_s *dev; /* The route must use this device */ net_ipv6addr_t target; /* Target IPv4 address on an external network to match */ - net_ipv6addr_t router; /* IPv6 address of the router on one of our networks*/ + net_ipv6addr_t router; /* IPv6 address of the router on one of our networks */ }; #endif diff --git a/net/socket/bind.c b/net/socket/bind.c index c577dd8c26e..fa39ed6f64c 100644 --- a/net/socket/bind.c +++ b/net/socket/bind.c @@ -86,9 +86,15 @@ static int pkt_bind(FAR struct pkt_conn_s *conn, { int ifindex; #if 0 - char hwaddr[6] = {0x00, 0xa1, 0xb1, 0xc1, 0xd1, 0xe1}; /* our MAC for debugging */ + char hwaddr[6] = /* our MAC for debugging */ + { + 0x00, 0xa1, 0xb1, 0xc1, 0xd1, 0xe1 + }; #endif - char hwaddr[6] = {0x00, 0xe0, 0xde, 0xad, 0xbe, 0xef}; /* MAC from ifconfig */ + char hwaddr[6] = /* MAC from ifconfig */ + { + 0x00, 0xe0, 0xde, 0xad, 0xbe, 0xef + }; /* Look at the addr and identify network interface */ diff --git a/net/socket/connect.c b/net/socket/connect.c index 00e2db1e05a..cbd19e17745 100644 --- a/net/socket/connect.c +++ b/net/socket/connect.c @@ -121,7 +121,7 @@ static inline int psock_setup_callbacks(FAR struct socket *psock, pstate->tc_cb->flags = (TCP_NEWDATA | TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT | TCP_CONNECTED | NETDEV_DOWN); - pstate->tc_cb->priv = (void*)pstate; + pstate->tc_cb->priv = (FAR void *)pstate; pstate->tc_cb->event = psock_connect_interrupt; ret = OK; } @@ -217,7 +217,7 @@ static uint16_t psock_connect_interrupt(FAR struct net_driver_s *dev, else if ((flags & TCP_TIMEDOUT) != 0) { - /* Indicate that the connection timedout?)*/ + /* Indicate that the connection timedout?) */ pstate->tc_result = -ETIMEDOUT; } diff --git a/net/socket/getsockname.c b/net/socket/getsockname.c index 2a9223f5ff4..b6b8eebcee8 100644 --- a/net/socket/getsockname.c +++ b/net/socket/getsockname.c @@ -228,14 +228,14 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, /* Check if enough space has been provided for the full address */ if (*addrlen < sizeof(struct sockaddr_in6)) - { - /* This function is supposed to return the partial address if - * a smaller buffer has been provided. This support has not - * been implemented. - */ + { + /* This function is supposed to return the partial address if + * a smaller buffer has been provided. This support has not + * been implemented. + */ - return -ENOSYS; - } + return -ENOSYS; + } /* Set the port number */ diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c index 2af5dce60c2..c2236e75910 100644 --- a/net/socket/getsockopt.c +++ b/net/socket/getsockopt.c @@ -141,9 +141,9 @@ int psock_getsockopt(FAR struct socket *psock, int level, int option, * a macro will do. */ - optionset = psock->s_options; - *(int*)value = _SO_GETOPT(optionset, option); - *value_len = sizeof(int); + optionset = psock->s_options; + *(FAR int *)value = _SO_GETOPT(optionset, option); + *value_len = sizeof(int); } break; @@ -161,8 +161,8 @@ int psock_getsockopt(FAR struct socket *psock, int level, int option, /* Return the socket type */ - *(int*)value = psock->s_type; - *value_len = sizeof(int); + *(FAR int *)value = psock->s_type; + *value_len = sizeof(int); } break; diff --git a/net/socket/net_close.c b/net/socket/net_close.c index 499eee7c5df..c76baacaf2d 100644 --- a/net/socket/net_close.c +++ b/net/socket/net_close.c @@ -117,17 +117,17 @@ static inline int close_timeout(FAR struct tcp_close_s *pstate) if (pstate) { - /* Yes Check for a timeout configured via setsockopts(SO_LINGER). - * If none... we well let the send wait forever. - */ + /* Yes Check for a timeout configured via setsockopts(SO_LINGER). + * If none... we well let the send wait forever. + */ - psock = pstate->cl_psock; - if (psock && psock->s_linger != 0) - { - /* Check if the configured timeout has elapsed */ + psock = pstate->cl_psock; + if (psock && psock->s_linger != 0) + { + /* Check if the configured timeout has elapsed */ - return net_timeo(pstate->cl_start, psock->s_linger); - } + return net_timeo(pstate->cl_start, psock->s_linger); + } } /* No timeout */ @@ -179,7 +179,7 @@ static uint16_t netclose_interrupt(FAR struct net_driver_s *dev, /* The disconnection is complete */ #ifdef CONFIG_NET_SOLINGER - /* pstate non-NULL means that we are performing a LINGERing close.*/ + /* pstate non-NULL means that we are performing a LINGERing close. */ if (pstate) { diff --git a/net/socket/net_monitor.c b/net/socket/net_monitor.c index ed2f0acc53e..8c3f24f4a9c 100644 --- a/net/socket/net_monitor.c +++ b/net/socket/net_monitor.c @@ -117,7 +117,7 @@ static void connection_closed(FAR struct socket *psock, uint16_t flags) * be reported as an ENOTCONN error. */ - psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); + psock->s_flags &= ~(_SF_CONNECTED | _SF_CLOSED); } } @@ -262,7 +262,7 @@ int net_startmonitor(FAR struct socket *psock) if (cb != NULL) { cb->event = connection_event; - cb->priv = (void*)psock; + cb->priv = (FAR void *)psock; cb->flags = NETDEV_DOWN; } @@ -270,7 +270,7 @@ int net_startmonitor(FAR struct socket *psock) /* Set up to receive callbacks on connection-related events */ - conn->connection_private = (void*)psock; + conn->connection_private = (FAR void *)psock; conn->connection_event = connection_event; net_unlock(save); diff --git a/net/socket/net_sendfile.c b/net/socket/net_sendfile.c index d28ec93e9bc..0769662ce54 100644 --- a/net/socket/net_sendfile.c +++ b/net/socket/net_sendfile.c @@ -320,7 +320,7 @@ static inline bool sendfile_addrcheck(FAR struct tcp_conn_s *conn) static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn, FAR void *pvpriv, uint16_t flags) { - FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s*)pvconn; + FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn; FAR struct sendfile_s *pstate = (FAR struct sendfile_s *)pvpriv; int ret; @@ -720,7 +720,7 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset, /* Set up the ACK callback in the connection */ state.snd_ackcb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_DISCONN_EVENTS); - state.snd_ackcb->priv = (void*)&state; + state.snd_ackcb->priv = (FAR void *)&state; state.snd_ackcb->event = ack_interrupt; /* Perform the TCP send operation */ @@ -728,7 +728,7 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset, do { state.snd_datacb->flags = TCP_POLL; - state.snd_datacb->priv = (void*)&state; + state.snd_datacb->priv = (FAR void *)&state; state.snd_datacb->event = sendfile_interrupt; /* Notify the device driver of the availability of TX data */ diff --git a/net/socket/net_sockets.c b/net/socket/net_sockets.c index 83ad061f6e5..a327431b906 100644 --- a/net/socket/net_sockets.c +++ b/net/socket/net_sockets.c @@ -297,7 +297,7 @@ FAR struct socket *sockfd_socket(int sockfd) FAR struct socketlist *list; int ndx = sockfd - __SOCKFD_OFFSET; - if (ndx >=0 && ndx < CONFIG_NSOCKET_DESCRIPTORS) + if (ndx >= 0 && ndx < CONFIG_NSOCKET_DESCRIPTORS) { list = sched_getsockets(); if (list) diff --git a/net/socket/recvfrom.c b/net/socket/recvfrom.c index 43ef798b6d3..a14b673542e 100644 --- a/net/socket/recvfrom.c +++ b/net/socket/recvfrom.c @@ -450,12 +450,12 @@ static inline void recvfrom_udpreadahead(struct recvfrom_s *pstate) goto out; } - if ( 0 + if (0 #ifdef CONFIG_NET_IPv6 - || src_addr_size == sizeof(struct sockaddr_in6) + || src_addr_size == sizeof(struct sockaddr_in6) #endif #ifdef CONFIG_NET_IPv4 - || src_addr_size == sizeof(struct sockaddr_in) + || src_addr_size == sizeof(struct sockaddr_in) #endif ) { @@ -845,11 +845,11 @@ static uint16_t recvfrom_tcpinterrupt(FAR struct net_driver_s *dev, } #ifdef CONFIG_NET_SOCKOPTS - /* Reset the timeout. We will want a short timeout to terminate - * the TCP receive. - */ + /* Reset the timeout. We will want a short timeout to terminate + * the TCP receive. + */ - pstate->rf_starttime = clock_systimer(); + pstate->rf_starttime = clock_systimer(); #endif } @@ -1017,7 +1017,8 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_ if (infrom) { #ifdef CONFIG_NET_IPv6 - FAR struct udp_conn_s *conn = (FAR struct udp_conn_s*)pstate->rf_sock->s_conn; + FAR struct udp_conn_s *conn = + (FAR struct udp_conn_s *)pstate->rf_sock->s_conn; /* Hybrid dual-stack IPv6/IPv4 implementations recognize a special * class of addresses, the IPv4-mapped IPv6 addresses. @@ -1426,7 +1427,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, if (state.rf_cb) { state.rf_cb->flags = (PKT_NEWDATA | PKT_POLL); - state.rf_cb->priv = (void*)&state; + state.rf_cb->priv = (FAR void *)&state; state.rf_cb->event = recvfrom_pktinterrupt; /* Notify the device driver of the receive call */ @@ -1567,7 +1568,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, /* Set up the callback in the connection */ state.rf_cb->flags = (UDP_NEWDATA | UDP_POLL | NETDEV_DOWN); - state.rf_cb->priv = (void*)&state; + state.rf_cb->priv = (FAR void *)&state; state.rf_cb->event = recvfrom_udp_interrupt; /* Notify the device driver of the receive call */ @@ -1749,7 +1750,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, if (state.rf_cb) { state.rf_cb->flags = (TCP_NEWDATA | TCP_POLL | TCP_DISCONN_EVENTS); - state.rf_cb->priv = (void*)&state; + state.rf_cb->priv = (FAR void *)&state; state.rf_cb->event = recvfrom_tcpinterrupt; /* Wait for either the receive to complete or for an error/timeout diff --git a/net/socket/setsockopt.c b/net/socket/setsockopt.c index cc6d15dec9e..99ec9378ed0 100644 --- a/net/socket/setsockopt.c +++ b/net/socket/setsockopt.c @@ -147,7 +147,7 @@ int psock_setsockopt(FAR struct socket *psock, int level, int option, /* Get the value. Is the option being set or cleared? */ - setting = *(int*)value; + setting = *(FAR int *)value; /* Disable interrupts so that there is no conflict with interrupt * level access to options. diff --git a/net/tcp/tcp_accept.c b/net/tcp/tcp_accept.c index 0a92e3327e8..102f8c22133 100644 --- a/net/tcp/tcp_accept.c +++ b/net/tcp/tcp_accept.c @@ -96,7 +96,7 @@ struct accept_s * * Assumptions: * Running at the interrupt level -* + * ****************************************************************************/ #ifdef CONFIG_NET_TCP @@ -291,7 +291,7 @@ int psock_tcp_accept(FAR struct socket *psock, FAR struct sockaddr *addr, /* Set up the callback in the connection */ - conn->accept_private = (void*)&state; + conn->accept_private = (FAR void *)&state; conn->accept = accept_interrupt; /* Wait for the send to complete or an error to occur: NOTES: (1) diff --git a/net/tcp/tcp_backlog.c b/net/tcp/tcp_backlog.c index 4d2ecbc2cb1..bbd5c263533 100644 --- a/net/tcp/tcp_backlog.c +++ b/net/tcp/tcp_backlog.c @@ -123,7 +123,7 @@ int tcp_backlogcreate(FAR struct tcp_conn_s *conn, int nblg) /* Then add all of the pre-allocated containers to the free list */ - blc = (FAR struct tcp_blcontainer_s*)(((FAR uint8_t*)bls) + offset); + blc = (FAR struct tcp_blcontainer_s *)(((FAR uint8_t *)bls) + offset); for (i = 0; i < nblg; i++) { sq_addfirst(&blc->bc_node, &bls->bl_free); @@ -189,7 +189,7 @@ int tcp_backlogdestroy(FAR struct tcp_conn_s *conn) /* Handle any pending connections in the backlog */ - while ((blc = (FAR struct tcp_blcontainer_s*)sq_remfirst(&blg->bl_pending)) != NULL) + while ((blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&blg->bl_pending)) != NULL) { blconn = blc->bc_conn; if (blconn) @@ -242,25 +242,26 @@ int tcp_backlogadd(FAR struct tcp_conn_s *conn, FAR struct tcp_conn_s *blconn) bls = conn->backlog; if (bls && blconn) { - /* Allocate a container for the connection from the free list */ + /* Allocate a container for the connection from the free list */ - blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&bls->bl_free); - if (!blc) - { - nlldbg("Failed to allocate container\n"); - ret = -ENOMEM; - } - else - { - /* Save the connection reference in the container and put the - * container at the end of the pending connection list (FIFO). - */ + blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&bls->bl_free); + if (!blc) + { + nlldbg("Failed to allocate container\n"); + ret = -ENOMEM; + } + else + { + /* Save the connection reference in the container and put the + * container at the end of the pending connection list (FIFO). + */ - blc->bc_conn = blconn; - sq_addlast(&blc->bc_node, &bls->bl_pending); - ret = OK; - } + blc->bc_conn = blconn; + sq_addlast(&blc->bc_node, &bls->bl_pending); + ret = OK; + } } + return ret; } @@ -311,21 +312,21 @@ FAR struct tcp_conn_s *tcp_backlogremove(FAR struct tcp_conn_s *conn) bls = conn->backlog; if (bls) { - /* Remove the a container at the head of the pending connection list - * (FIFO) - */ + /* Remove the a container at the head of the pending connection list + * (FIFO) + */ - blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&bls->bl_pending); - if (blc) - { - /* Extract the connection reference from the container and put - * container in the free list - */ + blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&bls->bl_pending); + if (blc) + { + /* Extract the connection reference from the container and put + * container in the free list + */ - blconn = blc->bc_conn; - blc->bc_conn = NULL; - sq_addlast(&blc->bc_node, &bls->bl_free); - } + blconn = blc->bc_conn; + blc->bc_conn = NULL; + sq_addlast(&blc->bc_node, &bls->bl_free); + } } nllvdbg("conn=%p, returning %p\n", conn, blconn); @@ -364,41 +365,41 @@ int tcp_backlogdelete(FAR struct tcp_conn_s *conn, bls = conn->backlog; if (bls) { - /* Find the container hold the connection */ + /* Find the container hold the connection */ - for (blc = (FAR struct tcp_blcontainer_s *)sq_peek(&bls->bl_pending), prev = NULL; - blc; - prev = blc, blc = (FAR struct tcp_blcontainer_s *)sq_next(&blc->bc_node)) - { - if (blc->bc_conn == blconn) - { - if (prev) - { - /* Remove the a container from the middle of the list of - * pending connections - */ + for (blc = (FAR struct tcp_blcontainer_s *)sq_peek(&bls->bl_pending), prev = NULL; + blc; + prev = blc, blc = (FAR struct tcp_blcontainer_s *)sq_next(&blc->bc_node)) + { + if (blc->bc_conn == blconn) + { + if (prev) + { + /* Remove the a container from the middle of the list of + * pending connections + */ - (void)sq_remafter(&prev->bc_node, &bls->bl_pending); - } - else - { - /* Remove the a container from the head of the list of - * pending connections - */ + (void)sq_remafter(&prev->bc_node, &bls->bl_pending); + } + else + { + /* Remove the a container from the head of the list of + * pending connections + */ - (void)sq_remfirst(&bls->bl_pending); - } + (void)sq_remfirst(&bls->bl_pending); + } - /* Put container in the free list */ + /* Put container in the free list */ - blc->bc_conn = NULL; - sq_addlast(&blc->bc_node, &bls->bl_free); - return OK; - } - } + blc->bc_conn = NULL; + sq_addlast(&blc->bc_node, &bls->bl_free); + return OK; + } + } - nlldbg("Failed to find pending connection\n"); - return -EINVAL; + nlldbg("Failed to find pending connection\n"); + return -EINVAL; } return OK; diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index c63a08557c2..109e27b7639 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -228,7 +228,7 @@ static void tcp_input(FAR struct net_driver_s *dev, unsigned int iplen) if ((tcp->tcpoffset & 0xf0) > 0x50) { - for (i = 0; i < ((tcp->tcpoffset >> 4) - 5) << 2 ;) + for (i = 0; i < ((tcp->tcpoffset >> 4) - 5) << 2 ; ) { opt = dev->d_buf[hdrlen + i]; if (opt == TCP_OPT_END) @@ -520,7 +520,7 @@ found: if ((tcp->tcpoffset & 0xf0) > 0x50) { - for (i = 0; i < ((tcp->tcpoffset >> 4) - 5) << 2 ;) + for (i = 0; i < ((tcp->tcpoffset >> 4) - 5) << 2 ; ) { opt = dev->d_buf[hdrlen + i]; if (opt == TCP_OPT_END) @@ -682,7 +682,8 @@ found: { dev->d_urglen = 0; #else /* CONFIG_NET_TCPURGDATA */ - dev->d_appdata = ((uint8_t*)dev->d_appdata) + ((tcp->urgp[0] << 8) | tcp->urgp[1]); + dev->d_appdata = ((FAR uint8_t *)dev->d_appdata) + ((tcp->urgp[0] << 8) | + tcp->urgp[1]); dev->d_len -= (tcp->urgp[0] << 8) | tcp->urgp[1]; #endif /* CONFIG_NET_TCPURGDATA */ } diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index 0a24144ccf1..9b226301436 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -131,13 +131,13 @@ static void psock_insert_segment(FAR struct tcp_wrbuffer_s *wrb, FAR sq_queue_t *q) { - sq_entry_t *entry = (sq_entry_t*)wrb; - sq_entry_t *insert = NULL; + FAR sq_entry_t *entry = (FAR sq_entry_t *)wrb; + FAR sq_entry_t *insert = NULL; - sq_entry_t *itr; + FAR sq_entry_t *itr; for (itr = sq_peek(q); itr; itr = sq_next(itr)) { - FAR struct tcp_wrbuffer_s *wrb0 = (FAR struct tcp_wrbuffer_s*)itr; + FAR struct tcp_wrbuffer_s *wrb0 = (FAR struct tcp_wrbuffer_s *)itr; if (WRB_SEQNO(wrb0) < WRB_SEQNO(wrb)) { insert = itr; @@ -403,7 +403,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, /* Check of some or all of this write buffer has been ACKed. */ next = sq_next(entry); - wrb = (FAR struct tcp_wrbuffer_s*)entry; + wrb = (FAR struct tcp_wrbuffer_s *)entry; /* If the ACKed sequence number is greater than the start * sequence number of the write buffer, then some or all of @@ -469,7 +469,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, * before the entire write buffer has even been sent. */ - wrb = (FAR struct tcp_wrbuffer_s*)sq_peek(&conn->write_q); + wrb = (FAR struct tcp_wrbuffer_s *)sq_peek(&conn->write_q); if (wrb && WRB_SENT(wrb) > 0 && ackno > WRB_SEQNO(wrb)) { uint32_t nacked; @@ -597,7 +597,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, while ((entry = sq_remlast(&conn->unacked_q)) != NULL) { - wrb = (FAR struct tcp_wrbuffer_s*)entry; + wrb = (FAR struct tcp_wrbuffer_s *)entry; uint16_t sent; /* Reset the number of bytes sent sent from the write buffer */ @@ -1036,7 +1036,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, psock->s_sndcb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_POLL | TCP_DISCONN_EVENTS); - psock->s_sndcb->priv = (void*)psock; + psock->s_sndcb->priv = (FAR void *)psock; psock->s_sndcb->event = psock_send_interrupt; /* Initialize the write buffer */ diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index c8ee594fbd9..559820b1ddd 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -399,17 +399,17 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev, goto end_wait; } - /* Check if the outgoing packet is available (it may have been claimed - * by a sendto interrupt serving a different thread). - */ + /* Check if the outgoing packet is available (it may have been claimed + * by a sendto interrupt serving a different thread). + */ #if 0 /* We can't really support multiple senders on the same TCP socket */ - else if (dev->d_sndlen > 0) - { - /* Another thread has beat us sending data, wait for the next poll */ + else if (dev->d_sndlen > 0) + { + /* Another thread has beat us sending data, wait for the next poll */ - return flags; - } + return flags; + } #endif /* We get here if (1) not all of the data has been ACKed, (2) we have been diff --git a/net/udp/udp_callback.c b/net/udp/udp_callback.c index 1f09ede3138..0492fb5bb8b 100644 --- a/net/udp/udp_callback.c +++ b/net/udp/udp_callback.c @@ -174,7 +174,7 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con * any failure to allocated, the entire I/O buffer chain will be discarded. */ - ret = iob_trycopyin(iob, (FAR const uint8_t*)&src_addr_size, + ret = iob_trycopyin(iob, (FAR const uint8_t *)&src_addr_size, sizeof(uint8_t), 0, true); if (ret < 0) { @@ -187,7 +187,7 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con return 0; } - ret = iob_trycopyin(iob, (FAR const uint8_t*)src_addr, src_addr_size, + ret = iob_trycopyin(iob, (FAR const uint8_t *)src_addr, src_addr_size, sizeof(uint8_t), true); if (ret < 0) { diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c index fbc8c8c9c84..7a0ce2e60c0 100644 --- a/net/udp/udp_conn.c +++ b/net/udp/udp_conn.c @@ -141,7 +141,7 @@ static FAR struct udp_conn_s *udp_find_conn(uint16_t portno) FAR struct udp_conn_s *conn; int i; - /* Now search each connection structure.*/ + /* Now search each connection structure. */ for (i = 0; i < CONFIG_NET_UDP_CONNS; i++) { diff --git a/net/udp/udp_psock_sendto.c b/net/udp/udp_psock_sendto.c index 36ba573f25a..7714db60c6b 100644 --- a/net/udp/udp_psock_sendto.c +++ b/net/udp/udp_psock_sendto.c @@ -247,10 +247,10 @@ static uint16_t sendto_interrupt(FAR struct net_driver_s *dev, FAR void *conn, else if (dev->d_sndlen > 0 || (flags & UDP_NEWDATA) != 0) { - /* Another thread has beat us sending data or the buffer is busy, - * Check for a timeout. If not timed out, wait for the next - * polling cycle and check again. - */ + /* Another thread has beat us sending data or the buffer is busy, + * Check for a timeout. If not timed out, wait for the next + * polling cycle and check again. + */ #ifdef CONFIG_NET_SENDTO_TIMEOUT if (send_timeout(pstate)) @@ -441,7 +441,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, if (state.st_cb) { state.st_cb->flags = (UDP_POLL | NETDEV_DOWN); - state.st_cb->priv = (void*)&state; + state.st_cb->priv = (FAR void *)&state; state.st_cb->event = sendto_interrupt; /* Notify the device driver of the availability of TX data */ diff --git a/net/udp/udp_send.c b/net/udp/udp_send.c index b505a5953fb..021ea576e8f 100644 --- a/net/udp/udp_send.c +++ b/net/udp/udp_send.c @@ -122,7 +122,7 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) #ifdef CONFIG_NET_IPv6 if (conn->domain == PF_INET || (conn->domain == PF_INET6 && - ip6_is_ipv4addr((FAR struct in6_addr*)conn->u.ipv6.raddr))) + ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr))) #endif { /* Get pointers to the IPv4 header and the offset TCP header */ @@ -148,9 +148,9 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) #ifdef CONFIG_NET_IPv6 if (conn->domain == PF_INET6 && - ip6_is_ipv4addr((FAR struct in6_addr*)conn->u.ipv6.raddr)) + ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr)) { - in_addr_t raddr = ip6_get_ipv4addr((FAR struct in6_addr*)conn->u.ipv6.raddr); + in_addr_t raddr = ip6_get_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr); net_ipv4addr_hdrcopy(ipv4->destipaddr, &raddr); } else @@ -242,7 +242,7 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) #ifdef CONFIG_NET_IPv6 if (conn->domain == PF_INET || (conn->domain == PF_INET6 && - ip6_is_ipv4addr((FAR struct in6_addr*)conn->u.ipv6.raddr))) + ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr))) #endif { udp->udpchksum = ~udp_ipv4_chksum(dev); diff --git a/net/utils/net_chksum.c b/net/utils/net_chksum.c index 526ebf9e888..776438b607c 100644 --- a/net/utils/net_chksum.c +++ b/net/utils/net_chksum.c @@ -413,7 +413,7 @@ uint16_t udp_ipv6_chksum(FAR struct net_driver_s *dev) uint16_t icmp_chksum(FAR struct net_driver_s *dev, int len) { FAR struct icmp_iphdr_s *icmp = ICMPBUF; - return net_chksum((uint16_t*)&icmp->type, len); + return net_chksum((FAR uint16_t *)&icmp->type, len); } #endif /* CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING */