net/: Fixes for more coding standard issues detected by nxstyle.

This commit is contained in:
Gregory Nutt
2018-10-29 18:00:30 -06:00
parent dcb7ce8afd
commit 88130a996a
26 changed files with 78 additions and 71 deletions
-1
View File
@@ -117,7 +117,6 @@ int pkt_input(struct net_driver_s *dev)
*/ */
nwarn("WARNING: Packet not processed\n"); nwarn("WARNING: Packet not processed\n");
//dev->d_len = 0; REVISIT
ret = ERROR; ret = ERROR;
} }
} }
+2 -3
View File
@@ -80,7 +80,7 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn)
{ {
/* Verify that the packet connection is valid */ /* Verify that the packet connection is valid */
if (conn) if (conn != NULL)
{ {
/* Setup for the application callback */ /* Setup for the application callback */
@@ -92,11 +92,10 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn)
(void)pkt_callback(dev, conn, PKT_POLL); (void)pkt_callback(dev, conn, PKT_POLL);
/* If the application has data to send, setup the UDP/IP header */ /* Check if the application has data to send */
if (dev->d_sndlen > 0) if (dev->d_sndlen > 0)
{ {
//devif_pkt_send(dev, conn);
return; return;
} }
} }
+1 -1
View File
@@ -368,7 +368,7 @@ static int pkt_bind(FAR struct socket *psock, FAR const struct sockaddr *addr,
/* Look at the addr and identify network interface */ /* Look at the addr and identify network interface */
ifindex = ((struct sockaddr_ll*)addr)->sll_ifindex; ifindex = ((FAR struct sockaddr_ll *)addr)->sll_ifindex;
/* Get the MAC address of that interface */ /* Get the MAC address of that interface */
+1 -1
View File
@@ -492,7 +492,7 @@ static int netprocfs_readdir(FAR struct fs_dirent_s *dir)
if (index >= level1->base.nentries) if (index >= level1->base.nentries)
{ {
/* We signal the end of the directory by returning the special /* We signal the end of the directory by returning the special
* error -ENOENT. * error -ENOENT.
*/ */
-1
View File
@@ -46,7 +46,6 @@
#include <debug.h> #include <debug.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
//#include <nuttx/net/net.h>
#include <nuttx/net/ip.h> #include <nuttx/net/ip.h>
#include "route/fileroute.h" #include "route/fileroute.h"
+1 -1
View File
@@ -74,7 +74,7 @@
(rr)->head = NULL; \ (rr)->head = NULL; \
(rr)->tail = NULL; \ (rr)->tail = NULL; \
} \ } \
while (0) \ while (0)
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
+4 -4
View File
@@ -276,7 +276,7 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
if (pos < 0) if (pos < 0)
{ {
nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos); nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos);
ret =(int)pos; ret = (int)pos;
goto errout_with_fshandle; goto errout_with_fshandle;
} }
@@ -302,7 +302,7 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
if (pos < 0) if (pos < 0)
{ {
nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos); nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos);
ret =(int)pos; ret = (int)pos;
goto errout_with_fshandle; goto errout_with_fshandle;
} }
@@ -425,7 +425,7 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask)
if (pos < 0) if (pos < 0)
{ {
nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos); nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos);
ret =(int)pos; ret = (int)pos;
goto errout_with_fshandle; goto errout_with_fshandle;
} }
@@ -451,7 +451,7 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask)
if (pos < 0) if (pos < 0)
{ {
nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos); nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos);
ret =(int)pos; ret = (int)pos;
goto errout_with_fshandle; goto errout_with_fshandle;
} }
+1 -1
View File
@@ -162,7 +162,7 @@ FAR struct net_route_ipv6_entry_s *
* *
* Description: * Description:
* Remove the entry in the IPv4/IPv6 routing table list after the specified * Remove the entry in the IPv4/IPv6 routing table list after the specified
entry. * entry.
* *
* Input Parameters: * Input Parameters:
* entry - A pointer to the new entry to add to the list * entry - A pointer to the new entry to add to the list
+1 -1
View File
@@ -68,7 +68,7 @@
(rr)->head = NULL; \ (rr)->head = NULL; \
(rr)->tail = NULL; \ (rr)->tail = NULL; \
} \ } \
while (0) \ while (0)
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
+1
View File
@@ -685,6 +685,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
ninfo("Fragment offset=%d, paysize=%d, rb_dgramtag=%d\n", ninfo("Fragment offset=%d, paysize=%d, rb_dgramtag=%d\n",
outlen >> 3, paysize, reass->rb_dgramtag); outlen >> 3, paysize, reass->rb_dgramtag);
sixlowpan_dumpbuffer("Outgoing frame", sixlowpan_dumpbuffer("Outgoing frame",
(FAR const uint8_t *)iob->io_data, (FAR const uint8_t *)iob->io_data,
iob->io_len); iob->io_len);
-1
View File
@@ -182,7 +182,6 @@ static const uint8_t g_ttl_values[] =
0, 1, 64, 255 0, 1, 64, 255
}; };
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -109,7 +109,7 @@
(ptr)[index] = ((uint16_t)(value) >> 8) & 0xff; \ (ptr)[index] = ((uint16_t)(value) >> 8) & 0xff; \
(ptr)[index + 1] = (uint16_t)(value) & 0xff; \ (ptr)[index + 1] = (uint16_t)(value) & 0xff; \
} \ } \
while(0) while (0)
/* Return values ************************************************************/ /* Return values ************************************************************/
+32 -32
View File
@@ -272,44 +272,44 @@ int sixlowpan_destaddrfromip(FAR struct radio_driver_s *radio,
#else /* CONFIG_NET_STARPOINT */ #else /* CONFIG_NET_STARPOINT */
/* Check for a multicast address */ /* Check for a multicast address */
if (net_is_addr_mcast(ipaddr)) if (net_is_addr_mcast(ipaddr))
{ {
DEBUGASSERT(radio->r_properties != NULL); DEBUGASSERT(radio->r_properties != NULL);
ret = radio->r_properties(radio, &properties); ret = radio->r_properties(radio, &properties);
if (ret < 0) if (ret < 0)
{ {
return ret; return ret;
} }
/* Check for the broadcast IP address /* Check for the broadcast IP address
* *
* IPv6 does not implement the method of broadcast, and therefore * IPv6 does not implement the method of broadcast, and therefore
* does not define broadcast addresses. Instead, IPv6 uses multicast * does not define broadcast addresses. Instead, IPv6 uses multicast
* addressing to the all-nodes multicast group: ff02:0:0:0:0:0:0:1. * addressing to the all-nodes multicast group: ff02:0:0:0:0:0:0:1.
* *
* However, the use of the all-nodes group is not common, and most * However, the use of the all-nodes group is not common, and most
* IPv6 protocols use a dedicated link-local multicast group to avoid * IPv6 protocols use a dedicated link-local multicast group to avoid
* disturbing every interface in the network. * disturbing every interface in the network.
*/ */
if (net_ipv6addr_cmp(ipaddr, g_ipv6_allnodes)) if (net_ipv6addr_cmp(ipaddr, g_ipv6_allnodes))
{ {
memcpy(destaddr, &properties.sp_bcast, memcpy(destaddr, &properties.sp_bcast,
sizeof(struct netdev_varaddr_s)); sizeof(struct netdev_varaddr_s));
} }
/* Some other RFC 3513 multicast address */ /* Some other RFC 3513 multicast address */
else else
{ {
memcpy(destaddr, &properties.sp_mcast, memcpy(destaddr, &properties.sp_mcast,
sizeof(struct netdev_varaddr_s)); sizeof(struct netdev_varaddr_s));
} }
return OK; return OK;
} }
/* Otherwise, the destination MAC address is encoded in the IP address */ /* Otherwise, the destination MAC address is encoded in the IP address */
+2 -2
View File
@@ -211,8 +211,8 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
/* Return the actual socket type */ /* Return the actual socket type */
*(int*)value = conn->type; *(FAR int *)value = conn->type;
*value_len = sizeof(int); *value_len = sizeof(int);
break; break;
} }
+1 -1
View File
@@ -231,7 +231,7 @@ ssize_t send(int sockfd, FAR const void *buf, size_t len, int flags)
(void)enter_cancellation_point(); (void)enter_cancellation_point();
/* Let nx_send() and psock_send() do all of the work*/ /* Let nx_send() and psock_send() do all of the work */
ret = nx_send(sockfd, buf, len, flags); ret = nx_send(sockfd, buf, len, flags);
if (ret < 0) if (ret < 0)
+2 -2
View File
@@ -381,8 +381,8 @@ static inline FAR struct tcp_conn_s *
* connection to be used with the provided TCP/IP header * connection to be used with the provided TCP/IP header
* *
* Assumptions: * Assumptions:
* This function is called from network logic with the nework locked. * This function is called from network logic with the network locked.
4 * *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
+1 -1
View File
@@ -90,7 +90,7 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: psock_setup_callbacks * Name: psock_setup_callbacks
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -217,7 +217,7 @@ static void tcp_shutdown_monitor(FAR struct tcp_conn_s *conn, uint16_t flags)
net_lock(); net_lock();
(void)tcp_callback(conn->dev, conn, flags); (void)tcp_callback(conn->dev, conn, flags);
/* Free all allocated connection event callback structure s*/ /* Free all allocated connection event callback structures */
while (conn->connevents != NULL) while (conn->connevents != NULL)
{ {
+1
View File
@@ -60,6 +60,7 @@
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
/* This is an allocated container that holds the poll-related information */ /* This is an allocated container that holds the poll-related information */
struct tcp_poll_s struct tcp_poll_s
-1
View File
@@ -826,7 +826,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
} }
#endif /* CONFIG_NET_ARP_SEND */ #endif /* CONFIG_NET_ARP_SEND */
#ifdef CONFIG_NET_ICMPv6_NEIGHBOR #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
#ifdef CONFIG_NET_ARP_SEND #ifdef CONFIG_NET_ARP_SEND
else else
+1 -1
View File
@@ -662,7 +662,7 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile,
if (state.snd_datacb == NULL) if (state.snd_datacb == NULL)
{ {
nerr("ERROR: Failed to allocate data callback\n"); nerr("ERROR: Failed to allocate data callback\n");
ret =- ENOMEM; ret = -ENOMEM;
goto errout_locked; goto errout_locked;
} }
+1
View File
@@ -59,6 +59,7 @@
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
/* This is an allocated container that holds the poll-related information */ /* This is an allocated container that holds the poll-related information */
struct udp_poll_s struct udp_poll_s
+9 -9
View File
@@ -389,16 +389,16 @@ static int sendto_next_transfer(FAR struct socket *psock,
return ret; return ret;
} }
/* Get the device that will handle the remote packet transfers. This /* Get the device that will handle the remote packet transfers. This
* should never be NULL. * should never be NULL.
*/ */
dev = udp_find_raddr_device(conn); dev = udp_find_raddr_device(conn);
if (dev == NULL) if (dev == NULL)
{ {
nerr("ERROR: udp_find_raddr_device failed\n"); nerr("ERROR: udp_find_raddr_device failed\n");
return -ENETUNREACH; return -ENETUNREACH;
} }
/* Make sure that the device is in the UP state */ /* Make sure that the device is in the UP state */
+4 -4
View File
@@ -88,7 +88,7 @@ struct usrsockdev_s
sem_t acksem; /* Request acknowledgment notification */ sem_t acksem; /* Request acknowledgment notification */
uint8_t ack_xid; /* Exchange id for which waiting ack */ uint8_t ack_xid; /* Exchange id for which waiting ack */
uint16_t nbusy; /* Number of requests blocked from different uint16_t nbusy; /* Number of requests blocked from different
threads */ * threads */
} req; } req;
FAR struct usrsock_conn_s *datain_conn; /* Connection instance to receive FAR struct usrsock_conn_s *datain_conn; /* Connection instance to receive
@@ -733,9 +733,9 @@ static ssize_t usrsockdev_handle_req_response(FAR struct usrsockdev_s *dev,
FAR struct usrsock_conn_s *conn; FAR struct usrsock_conn_s *conn;
unsigned int hdrlen; unsigned int hdrlen;
ssize_t ret; ssize_t ret;
ssize_t (* handle_response)(FAR struct usrsockdev_s *dev, ssize_t (*handle_response)(FAR struct usrsockdev_s *dev,
FAR struct usrsock_conn_s *conn, FAR struct usrsock_conn_s *conn,
FAR const void *buffer); FAR const void *buffer);
switch (hdr->head.msgid) switch (hdr->head.msgid)
{ {
+1
View File
@@ -330,6 +330,7 @@ uint16_t tcp_ipv4_chksum(FAR struct net_driver_s *dev);
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
/* REVIST: Is this used? */ /* REVIST: Is this used? */
uint16_t tcp_ipv6_chksum(FAR struct net_driver_s *dev); uint16_t tcp_ipv6_chksum(FAR struct net_driver_s *dev);
#endif #endif
+9 -1
View File
@@ -131,7 +131,7 @@ int main(int argc, char **argv, char **envp)
blank_lineno = lineno; blank_lineno = lineno;
} }
else /* this line is non-blank */ else /* This line is non-blank */
{ {
/* Check for a missing blank line after a comment */ /* Check for a missing blank line after a comment */
@@ -139,6 +139,10 @@ int main(int argc, char **argv, char **envp)
{ {
/* No blank line should be present if the current line contains /* No blank line should be present if the current line contains
* a right brace or a pre-processor line. * a right brace or a pre-processor line.
*
* REVISIT: Generates a false alarm if the current line is also
* a comment. Generally it is acceptable for one comment to
* follow another with no space separation.
*/ */
if (line[n] != '}' && line[n] != '#') if (line[n] != '}' && line[n] != '#')
@@ -534,6 +538,10 @@ int main(int argc, char **argv, char **envp)
if (prevdeclnest <= 0 || declnest > 0) if (prevdeclnest <= 0 || declnest > 0)
{ {
/* REVISIT: Generates false alarms on named structures
* that are fields of other structures or unions.
*/
fprintf(stderr, fprintf(stderr,
"Garbage follows right bracket at line %d:%d\n", "Garbage follows right bracket at line %d:%d\n",
lineno, n); lineno, n);