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

View File

@ -117,7 +117,6 @@ int pkt_input(struct net_driver_s *dev)
*/
nwarn("WARNING: Packet not processed\n");
//dev->d_len = 0; REVISIT
ret = ERROR;
}
}

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 */
if (conn)
if (conn != NULL)
{
/* 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);
/* 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)
{
//devif_pkt_send(dev, conn);
return;
}
}

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 */
ifindex = ((struct sockaddr_ll*)addr)->sll_ifindex;
ifindex = ((FAR struct sockaddr_ll *)addr)->sll_ifindex;
/* Get the MAC address of that interface */

View File

@ -492,7 +492,7 @@ static int netprocfs_readdir(FAR struct fs_dirent_s *dir)
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.
*/

View File

@ -46,7 +46,6 @@
#include <debug.h>
#include <nuttx/fs/fs.h>
//#include <nuttx/net/net.h>
#include <nuttx/net/ip.h>
#include "route/fileroute.h"

View File

@ -74,7 +74,7 @@
(rr)->head = NULL; \
(rr)->tail = NULL; \
} \
while (0) \
while (0)
/****************************************************************************
* Public Types

View File

@ -276,7 +276,7 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
if (pos < 0)
{
nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos);
ret =(int)pos;
ret = (int)pos;
goto errout_with_fshandle;
}
@ -302,7 +302,7 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
if (pos < 0)
{
nerr("ERROR: net_readroute_ipv4 failed: %ld\n", (long)pos);
ret =(int)pos;
ret = (int)pos;
goto errout_with_fshandle;
}
@ -425,7 +425,7 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask)
if (pos < 0)
{
nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos);
ret =(int)pos;
ret = (int)pos;
goto errout_with_fshandle;
}
@ -451,7 +451,7 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask)
if (pos < 0)
{
nerr("ERROR: net_readroute_ipv6 failed: %ld\n", (long)pos);
ret =(int)pos;
ret = (int)pos;
goto errout_with_fshandle;
}

View File

@ -162,7 +162,7 @@ FAR struct net_route_ipv6_entry_s *
*
* Description:
* Remove the entry in the IPv4/IPv6 routing table list after the specified
entry.
* entry.
*
* Input Parameters:
* entry - A pointer to the new entry to add to the list

View File

@ -68,7 +68,7 @@
(rr)->head = NULL; \
(rr)->tail = NULL; \
} \
while (0) \
while (0)
/****************************************************************************
* Public Types

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",
outlen >> 3, paysize, reass->rb_dgramtag);
sixlowpan_dumpbuffer("Outgoing frame",
(FAR const uint8_t *)iob->io_data,
iob->io_len);

View File

@ -182,7 +182,6 @@ static const uint8_t g_ttl_values[] =
0, 1, 64, 255
};
/****************************************************************************
* Private Functions
****************************************************************************/

View File

@ -109,7 +109,7 @@
(ptr)[index] = ((uint16_t)(value) >> 8) & 0xff; \
(ptr)[index + 1] = (uint16_t)(value) & 0xff; \
} \
while(0)
while (0)
/* Return values ************************************************************/

View File

@ -272,44 +272,44 @@ int sixlowpan_destaddrfromip(FAR struct radio_driver_s *radio,
#else /* CONFIG_NET_STARPOINT */
/* Check for a multicast address */
/* Check for a multicast address */
if (net_is_addr_mcast(ipaddr))
{
DEBUGASSERT(radio->r_properties != NULL);
ret = radio->r_properties(radio, &properties);
if (ret < 0)
{
return ret;
}
if (net_is_addr_mcast(ipaddr))
{
DEBUGASSERT(radio->r_properties != NULL);
ret = radio->r_properties(radio, &properties);
if (ret < 0)
{
return ret;
}
/* Check for the broadcast IP address
*
* IPv6 does not implement the method of broadcast, and therefore
* does not define broadcast addresses. Instead, IPv6 uses multicast
* 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
* IPv6 protocols use a dedicated link-local multicast group to avoid
* disturbing every interface in the network.
*/
/* Check for the broadcast IP address
*
* IPv6 does not implement the method of broadcast, and therefore
* does not define broadcast addresses. Instead, IPv6 uses multicast
* 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
* IPv6 protocols use a dedicated link-local multicast group to avoid
* disturbing every interface in the network.
*/
if (net_ipv6addr_cmp(ipaddr, g_ipv6_allnodes))
{
memcpy(destaddr, &properties.sp_bcast,
sizeof(struct netdev_varaddr_s));
}
if (net_ipv6addr_cmp(ipaddr, g_ipv6_allnodes))
{
memcpy(destaddr, &properties.sp_bcast,
sizeof(struct netdev_varaddr_s));
}
/* Some other RFC 3513 multicast address */
/* Some other RFC 3513 multicast address */
else
{
memcpy(destaddr, &properties.sp_mcast,
sizeof(struct netdev_varaddr_s));
}
else
{
memcpy(destaddr, &properties.sp_mcast,
sizeof(struct netdev_varaddr_s));
}
return OK;
}
return OK;
}
/* Otherwise, the destination MAC address is encoded in the IP address */

View File

@ -211,8 +211,8 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
/* Return the actual socket type */
*(int*)value = conn->type;
*value_len = sizeof(int);
*(FAR int *)value = conn->type;
*value_len = sizeof(int);
break;
}

View File

@ -231,7 +231,7 @@ ssize_t send(int sockfd, FAR const void *buf, size_t len, int flags)
(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);
if (ret < 0)

View File

@ -381,8 +381,8 @@ static inline FAR struct tcp_conn_s *
* connection to be used with the provided TCP/IP header
*
* Assumptions:
* This function is called from network logic with the nework locked.
4 *
* This function is called from network logic with the network locked.
*
****************************************************************************/
#ifdef CONFIG_NET_IPv6

View File

@ -90,7 +90,7 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
* Private Functions
****************************************************************************/
/****************************************************************************
/****************************************************************************
* Name: psock_setup_callbacks
****************************************************************************/

View File

@ -217,7 +217,7 @@ static void tcp_shutdown_monitor(FAR struct tcp_conn_s *conn, uint16_t flags)
net_lock();
(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)
{

View File

@ -60,6 +60,7 @@
/****************************************************************************
* Private Types
****************************************************************************/
/* This is an allocated container that holds the poll-related information */
struct tcp_poll_s

View File

@ -826,7 +826,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
}
#endif /* CONFIG_NET_ARP_SEND */
#ifdef CONFIG_NET_ICMPv6_NEIGHBOR
#ifdef CONFIG_NET_ARP_SEND
else

View File

@ -662,7 +662,7 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile,
if (state.snd_datacb == NULL)
{
nerr("ERROR: Failed to allocate data callback\n");
ret =- ENOMEM;
ret = -ENOMEM;
goto errout_locked;
}

View File

@ -59,6 +59,7 @@
/****************************************************************************
* Private Types
****************************************************************************/
/* This is an allocated container that holds the poll-related information */
struct udp_poll_s

View File

@ -389,16 +389,16 @@ static int sendto_next_transfer(FAR struct socket *psock,
return ret;
}
/* Get the device that will handle the remote packet transfers. This
* should never be NULL.
*/
/* Get the device that will handle the remote packet transfers. This
* should never be NULL.
*/
dev = udp_find_raddr_device(conn);
if (dev == NULL)
{
nerr("ERROR: udp_find_raddr_device failed\n");
return -ENETUNREACH;
}
dev = udp_find_raddr_device(conn);
if (dev == NULL)
{
nerr("ERROR: udp_find_raddr_device failed\n");
return -ENETUNREACH;
}
/* Make sure that the device is in the UP state */

View File

@ -88,7 +88,7 @@ struct usrsockdev_s
sem_t acksem; /* Request acknowledgment notification */
uint8_t ack_xid; /* Exchange id for which waiting ack */
uint16_t nbusy; /* Number of requests blocked from different
threads */
* threads */
} req;
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;
unsigned int hdrlen;
ssize_t ret;
ssize_t (* handle_response)(FAR struct usrsockdev_s *dev,
FAR struct usrsock_conn_s *conn,
FAR const void *buffer);
ssize_t (*handle_response)(FAR struct usrsockdev_s *dev,
FAR struct usrsock_conn_s *conn,
FAR const void *buffer);
switch (hdr->head.msgid)
{

View File

@ -330,6 +330,7 @@ uint16_t tcp_ipv4_chksum(FAR struct net_driver_s *dev);
#ifdef CONFIG_NET_IPv6
/* REVIST: Is this used? */
uint16_t tcp_ipv6_chksum(FAR struct net_driver_s *dev);
#endif

View File

@ -131,7 +131,7 @@ int main(int argc, char **argv, char **envp)
blank_lineno = lineno;
}
else /* this line is non-blank */
else /* This line is non-blank */
{
/* 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
* 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] != '#')
@ -534,6 +538,10 @@ int main(int argc, char **argv, char **envp)
if (prevdeclnest <= 0 || declnest > 0)
{
/* REVISIT: Generates false alarms on named structures
* that are fields of other structures or unions.
*/
fprintf(stderr,
"Garbage follows right bracket at line %d:%d\n",
lineno, n);