diff --git a/COPYING b/COPYING index 3ad348726948d..860f3884798f0 100644 --- a/COPYING +++ b/COPYING @@ -16,6 +16,12 @@ that copyrighted additions were made during the years of 2007 and 2011 whereas "2007-2011" would indicate copyrighted additions in the years 2007, 2008, 2009, 2010, and 2011. +Copyright Line Continuation: Copy information which exceeds the usable line +lengh may be broken and continued on the following line, such as: + + Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All + rights reserved. + NuttX ^^^^^ diff --git a/net/arp/arp.h b/net/arp/arp.h index b905c455c7def..498670b7b2a70 100644 --- a/net/arp/arp.h +++ b/net/arp/arp.h @@ -63,6 +63,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_DEBUG_FEATURES diff --git a/net/arp/arp_send.c b/net/arp/arp_send.c index 43af7efe4c96d..64c433eea637a 100644 --- a/net/arp/arp_send.c +++ b/net/arp/arp_send.c @@ -144,8 +144,10 @@ static uint16_t arp_send_eventhandler(FAR struct net_driver_s *dev, return flags; } - /* It looks like we are good to send the data */ - /* Copy the packet data into the device packet buffer and send it */ + /* It looks like we are good to send the data. + * + * Copy the packet data into the device packet buffer and send it. + */ arp_format(dev, state->snd_ipaddr); diff --git a/net/arp/arp_table.c b/net/arp/arp_table.c index 27b46c02a5890..9ab9c58bbe3d0 100644 --- a/net/arp/arp_table.c +++ b/net/arp/arp_table.c @@ -140,7 +140,6 @@ static int arp_match(FAR struct net_driver_s *dev, FAR void *arg) return 1; } - /**************************************************************************** * Name: arp_return_old_entry * diff --git a/net/bluetooth/bluetooth_poll.c b/net/bluetooth/bluetooth_poll.c index 2632675daaf2c..af08d51a73ea3 100644 --- a/net/bluetooth/bluetooth_poll.c +++ b/net/bluetooth/bluetooth_poll.c @@ -92,8 +92,10 @@ void bluetooth_poll(FAR struct net_driver_s *dev, radio->r_dev.d_len = 0; radio->r_dev.d_sndlen = 0; - /* Perform the application callback */ - /* REVISIT: Need to pass the meta data and the IOB through the callback */ + /* Perform the application callback. + * + * REVISIT: Need to pass the meta data and the IOB through the callback + */ #warning Missing logic /* Perform the application callback */ diff --git a/net/bluetooth/bluetooth_sockif.c b/net/bluetooth/bluetooth_sockif.c index e778e338c2f51..ce7f83bd21832 100644 --- a/net/bluetooth/bluetooth_sockif.c +++ b/net/bluetooth/bluetooth_sockif.c @@ -420,8 +420,9 @@ static int bluetooth_bind(FAR struct socket *psock, iaddr = (FAR const struct sockaddr_bt_s *)addr; - /* Very that some address was provided */ - /* REVISIT: Currently and explict address must be assigned. Should we + /* Very that some address was provided. + * + * REVISIT: Currently and explict address must be assigned. Should we * support some moral equivalent to INADDR_ANY? */ @@ -667,7 +668,7 @@ static ssize_t bluetooth_send(FAR struct socket *psock, FAR const void *buf, { /* send() may be used only if the socket is has been connected. */ - if (!_SS_ISCONNECTED( psock->s_flags)) + if (!_SS_ISCONNECTED(psock->s_flags)) { ret = -ENOTCONN; } diff --git a/net/devif/ipv4_input.c b/net/devif/ipv4_input.c index bcda50cd5f49f..d693e2c15a3b4 100644 --- a/net/devif/ipv4_input.c +++ b/net/devif/ipv4_input.c @@ -223,7 +223,6 @@ static uint8_t devif_reassembly(FAR struct net_driver_s *dev) g_reassembly_bitmap[offset / (8 * 8)] |= g_bitmap_bits[(offset / 8) & 7] & ~g_bitmap_bits[((offset + len) / 8) & 7]; - } else { @@ -342,8 +341,10 @@ int ipv4_input(FAR struct net_driver_s *dev) g_netstats.ipv4.recv++; #endif - /* Start of IP input header processing code. */ - /* Check validity of the IP header. */ + /* Start of IP input header processing code. + * + * Check validity of the IP header. + */ if (ipv4->vhl != 0x45) { diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c index c596051c812d4..0c1f3103112f8 100644 --- a/net/devif/ipv6_input.c +++ b/net/devif/ipv6_input.c @@ -289,8 +289,10 @@ int ipv6_input(FAR struct net_driver_s *dev) g_netstats.ipv6.recv++; #endif - /* Start of IP input header processing code. */ - /* Check validity of the IP header. */ + /* Start of IP input header processing code. + * + * Check validity of the IP header. + */ if ((ipv6->vtc & 0xf0) != 0x60) { diff --git a/net/ieee802154/ieee802154_conn.c b/net/ieee802154/ieee802154_conn.c index 7a3d9bc92f4c3..924f0f9e93d7f 100644 --- a/net/ieee802154/ieee802154_conn.c +++ b/net/ieee802154/ieee802154_conn.c @@ -213,8 +213,9 @@ FAR struct ieee802154_conn_s * conn != NULL; conn = (FAR struct ieee802154_conn_s *)conn->node.flink) { - /* Does the destination address match the bound address of the socket. */ - /* REVISIT: Currently and explicit address must be assigned. Should we + /* Does the destination address match the bound address of the socket. + * + * REVISIT: Currently and explicit address must be assigned. Should we * support some moral equivalent to INADDR_ANY? */ diff --git a/net/ieee802154/ieee802154_poll.c b/net/ieee802154/ieee802154_poll.c index 65a91e715c48e..9d49c9900368b 100644 --- a/net/ieee802154/ieee802154_poll.c +++ b/net/ieee802154/ieee802154_poll.c @@ -92,8 +92,10 @@ void ieee802154_poll(FAR struct net_driver_s *dev, radio->r_dev.d_len = 0; radio->r_dev.d_sndlen = 0; - /* Perform the application callback */ - /* REVISIT: Need to pass the meta data and the IOB through the callback */ + /* Perform the application callback. + * + * REVISIT: Need to pass the meta data and the IOB through the callback. + */ #warning Missing logic /* Perform the application callback */ diff --git a/net/ieee802154/ieee802154_sendto.c b/net/ieee802154/ieee802154_sendto.c index 2539562002c80..a6e381552ade6 100644 --- a/net/ieee802154/ieee802154_sendto.c +++ b/net/ieee802154/ieee802154_sendto.c @@ -229,8 +229,9 @@ static void ieee802154_meta_data(FAR struct radio_driver_s *radio, meta->flags.ackreq = TRUE; } - /* Destination address */ - /* If the output address is NULL, then it is broadcast on the 802.15.4 + /* Destination address. + * + * If the output address is NULL, then it is broadcast on the 802.15.4 * network. */ diff --git a/net/ieee802154/ieee802154_sockif.c b/net/ieee802154/ieee802154_sockif.c index e3723a9093c3f..405d329b0dfe5 100644 --- a/net/ieee802154/ieee802154_sockif.c +++ b/net/ieee802154/ieee802154_sockif.c @@ -421,8 +421,9 @@ static int ieee802154_bind(FAR struct socket *psock, iaddr = (FAR const struct sockaddr_ieee802154_s *)addr; - /* Very that some address was provided */ - /* REVISIT: Currently and explict address must be assigned. Should we + /* Very that some address was provided. + * + * REVISIT: Currently and explict address must be assigned. Should we * support some moral equivalent to INADDR_ANY? */ diff --git a/net/igmp/igmp.h b/net/igmp/igmp.h index df301964835fd..e97352bb87689 100644 --- a/net/igmp/igmp.h +++ b/net/igmp/igmp.h @@ -32,8 +32,8 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ -/* - * ________________ + +/* ________________ * | | * | | * | | diff --git a/net/igmp/igmp_poll.c b/net/igmp/igmp_poll.c index f3f4e1872b13f..d4c66e96cd319 100644 --- a/net/igmp/igmp_poll.c +++ b/net/igmp/igmp_poll.c @@ -81,6 +81,7 @@ static inline void igmp_sched_send(FAR struct net_driver_s *dev, in_addr_t *dest; /* REVISIT: This should be deferred to a work queue */ + /* Check what kind of message we need to send. There are only two * possibilities: */ diff --git a/net/inet/inet_recvfrom.c b/net/inet/inet_recvfrom.c index a62a4e85dc34a..29382b763f7c9 100644 --- a/net/inet/inet_recvfrom.c +++ b/net/inet/inet_recvfrom.c @@ -1548,8 +1548,9 @@ ssize_t inet_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, } } - /* Read from the network interface driver buffer */ - /* Or perform the TCP/IP or UDP recv() operation */ + /* Read from the network interface driver buffer. + * Or perform the TCP/IP or UDP recv() operation. + */ switch (psock->s_type) { diff --git a/net/local/local.h b/net/local/local.h index d61adbf83ff22..258c8453fd9d6 100644 --- a/net/local/local.h +++ b/net/local/local.h @@ -183,7 +183,7 @@ struct local_conn_s struct { uint16_t lc_remaining; /* (For binary compatibility with peer) */ - volatile int lc_result; /* Result of the connection operation (client)*/ + volatile int lc_result; /* Result of the connection operation (client) */ } client; /* Fields common to connected peers (connected or accepted) */ @@ -651,7 +651,6 @@ int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path, bool nonblock); #endif - /**************************************************************************** * Name: local_accept_pollnotify ****************************************************************************/ diff --git a/net/local/local_accept.c b/net/local/local_accept.c index 18daaf56b0c9d..e11d6872ecc9a 100644 --- a/net/local/local_accept.c +++ b/net/local/local_accept.c @@ -180,8 +180,8 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr, conn->lc_type = LOCAL_TYPE_PATHNAME; conn->lc_state = LOCAL_STATE_CONNECTED; - strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX-1); - conn->lc_path[UNIX_PATH_MAX-1] = '\0'; + strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1); + conn->lc_path[UNIX_PATH_MAX - 1] = '\0'; conn->lc_instance_id = client->lc_instance_id; /* Open the server-side write-only FIFO. This should not diff --git a/net/local/local_bind.c b/net/local/local_bind.c index 08a82efca3b37..c831f11f701c8 100644 --- a/net/local/local_bind.c +++ b/net/local/local_bind.c @@ -91,7 +91,7 @@ int psock_local_bind(FAR struct socket *psock, } else { - namelen = strnlen(unaddr->sun_path, UNIX_PATH_MAX-1); + namelen = strnlen(unaddr->sun_path, UNIX_PATH_MAX - 1); if (namelen <= 0) { /* Zero-length sun_path... This is an abstract Unix domain socket */ @@ -107,8 +107,8 @@ int psock_local_bind(FAR struct socket *psock, /* Copy the path into the connection structure */ - (void)strncpy(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1); - conn->lc_path[UNIX_PATH_MAX-1] = '\0'; + (void)strncpy(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1); + conn->lc_path[UNIX_PATH_MAX - 1] = '\0'; conn->lc_instance_id = -1; } } diff --git a/net/local/local_connect.c b/net/local/local_connect.c index c5e25d6028094..484543e64b823 100644 --- a/net/local/local_connect.c +++ b/net/local/local_connect.c @@ -309,15 +309,16 @@ int psock_local_connect(FAR struct socket *psock, case LOCAL_TYPE_PATHNAME: /* lc_path holds a null terminated string */ { - if (strncmp(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1) == 0) + if (strncmp(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1) + == 0) { int ret = OK; /* Bind the address and protocol */ client->lc_proto = conn->lc_proto; - strncpy(client->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1); - client->lc_path[UNIX_PATH_MAX-1] = '\0'; + strncpy(client->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1); + client->lc_path[UNIX_PATH_MAX - 1] = '\0'; client->lc_instance_id = local_generate_instance_id(); /* The client is now bound to an address */ diff --git a/net/local/local_fifo.c b/net/local/local_fifo.c index 535b05cf543ab..a3da6e678ce31 100644 --- a/net/local/local_fifo.c +++ b/net/local/local_fifo.c @@ -82,16 +82,16 @@ static inline void local_cs_name(FAR struct local_conn_s *conn, { if (conn->lc_instance_id < 0) { - (void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_CS_SUFFIX, + (void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_CS_SUFFIX, conn->lc_path); } else { - (void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_CS_SUFFIX "%x", + (void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_CS_SUFFIX "%x", conn->lc_path, conn->lc_instance_id); } - path[LOCAL_FULLPATH_LEN-1] = '\0'; + path[LOCAL_FULLPATH_LEN - 1] = '\0'; } #endif /* CONFIG_NET_LOCAL_STREAM */ @@ -109,16 +109,16 @@ static inline void local_sc_name(FAR struct local_conn_s *conn, { if (conn->lc_instance_id < 0) { - (void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_SC_SUFFIX, + (void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_SC_SUFFIX, conn->lc_path); } else { - (void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_SC_SUFFIX "%x", + (void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_SC_SUFFIX "%x", conn->lc_path, conn->lc_instance_id); } - path[LOCAL_FULLPATH_LEN-1] = '\0'; + path[LOCAL_FULLPATH_LEN - 1] = '\0'; } #endif /* CONFIG_NET_LOCAL_STREAM */ @@ -133,8 +133,9 @@ static inline void local_sc_name(FAR struct local_conn_s *conn, #ifdef CONFIG_NET_LOCAL_DGRAM static inline void local_hd_name(FAR const char *inpath, FAR char *outpath) { - (void)snprintf(outpath, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_HD_SUFFIX, inpath); - outpath[LOCAL_FULLPATH_LEN-1] = '\0'; + (void)snprintf(outpath, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_HD_SUFFIX, + inpath); + outpath[LOCAL_FULLPATH_LEN - 1] = '\0'; } #endif /* CONFIG_NET_LOCAL_DGRAM */ diff --git a/net/local/local_recvutils.c b/net/local/local_recvutils.c index 590b7f850e31e..8ffe079a54d1a 100644 --- a/net/local/local_recvutils.c +++ b/net/local/local_recvutils.c @@ -219,7 +219,7 @@ int local_getaddr(FAR struct local_conn_s *conn, FAR struct sockaddr *addr, * of the whole Unix domain address. */ - pathlen = strnlen(conn->lc_path, UNIX_PATH_MAX-1); + pathlen = strnlen(conn->lc_path, UNIX_PATH_MAX - 1); totlen = sizeof(sa_family_t) + pathlen + 1; /* If the length of the whole Unix domain address is larger than the diff --git a/net/local/local_release.c b/net/local/local_release.c index c2f7f951c734d..425c9e19114cf 100644 --- a/net/local/local_release.c +++ b/net/local/local_release.c @@ -70,7 +70,6 @@ int local_release(FAR struct local_conn_s *conn) { - /* There should be no references on this structure */ DEBUGASSERT(conn->lc_crefs == 0); diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index 8563167590273..aa4a338e07c43 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -558,6 +558,7 @@ static int local_connect(FAR struct socket *psock, { /* Perform the datagram connection logic */ #warning Missing logic + return -ENOSYS; } break; @@ -703,6 +704,7 @@ static ssize_t local_send(FAR struct socket *psock, FAR const void *buf, { /* Local UDP packet send */ #warning Missing logic + ret = -ENOSYS; } break; diff --git a/net/loopback/loopback.h b/net/loopback/loopback.h index a881f46fdb961..50d7148265572 100644 --- a/net/loopback/loopback.h +++ b/net/loopback/loopback.h @@ -52,7 +52,7 @@ * Public Types ****************************************************************************/ - /**************************************************************************** +/**************************************************************************** * Public Data ****************************************************************************/ diff --git a/net/mld/mld_group.c b/net/mld/mld_group.c index 6e8dac795f586..47c47b41e5755 100644 --- a/net/mld/mld_group.c +++ b/net/mld/mld_group.c @@ -299,18 +299,18 @@ void mld_new_pollcycle(FAR struct net_driver_s *dev) /* Update member ship in every group */ - for (member = (FAR struct mld_group_s *)dev->d_mld.grplist.head; - member; - member = member->next) - { - /* Save the number of members that reported in the previous query - * cycle; reset the number of members that have reported in the new - * query cycle. - */ - - member->lstmbrs = member->members; - member->members = 0; - } + for (member = (FAR struct mld_group_s *)dev->d_mld.grplist.head; + member; + member = member->next) + { + /* Save the number of members that reported in the previous query + * cycle; reset the number of members that have reported in the new + * query cycle. + */ + + member->lstmbrs = member->members; + member->members = 0; + } } #endif diff --git a/net/mld/mld_report.c b/net/mld/mld_report.c index 8498b86b76c7b..be8d512314485 100644 --- a/net/mld/mld_report.c +++ b/net/mld/mld_report.c @@ -82,7 +82,6 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr) return -EINVAL; } - group = mld_grpallocfind(dev, grpaddr); if (group == NULL) { diff --git a/net/neighbor/neighbor_dumpentry.c b/net/neighbor/neighbor_dumpentry.c index 12221fb526802..01a2800ae9890 100644 --- a/net/neighbor/neighbor_dumpentry.c +++ b/net/neighbor/neighbor_dumpentry.c @@ -67,8 +67,8 @@ static void neighbor_dump_address(FAR const void *buf, unsigned int buflen) { - char outbuf[16*3 + 9]; /* 6-byte header header + 16 hex bytes + - * 2 space separator + NUL termination */ + char outbuf[16 * 3 + 9]; /* 6-byte header header + 16 hex bytes + + * 2 space separator + NUL termination */ FAR const uint8_t *buffer = buf; FAR char *ptr; unsigned int i; diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index 12fa1ba030ffc..3fda02d6db3b4 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -1804,7 +1804,6 @@ void netdev_ifdown(FAR struct net_driver_s *dev) netdown_notifier_signal(dev); #endif - } } diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c index bfa6dc0522920..e741c95c3faec 100644 --- a/net/netlink/netlink_sockif.c +++ b/net/netlink/netlink_sockif.c @@ -298,8 +298,7 @@ static int netlink_getpeername(FAR struct socket *psock, FAR socklen_t *addrlen) { #warning Missing logic for NETLINK getsockname - return -EOPNOTSUPP; -//return -EAFNOSUPPORT; + return -EOPNOTSUPP; /* Or maybe return -EAFNOSUPPORT; */ } /**************************************************************************** diff --git a/net/procfs/net_procfs_route.c b/net/procfs/net_procfs_route.c index 7d6dee10e48d9..d45a18c1d823f 100644 --- a/net/procfs/net_procfs_route.c +++ b/net/procfs/net_procfs_route.c @@ -231,7 +231,6 @@ static const char g_route_ipv4_subdir[] = "ipv4"; static const char g_route_ipv6_subdir[] = "ipv6"; #endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -735,7 +734,7 @@ static int route_readdir(struct fs_dirent_s *dir) /* Save the filename and file type */ dir->fd_dir.d_type = DTYPE_FILE; - strncpy(dir->fd_dir.d_name, dname, NAME_MAX+1); + strncpy(dir->fd_dir.d_name, dname, NAME_MAX + 1); /* Set up the next directory entry offset. NOTE that we could use the * standard f_pos instead of our own private index. diff --git a/net/procfs/net_statistics.c b/net/procfs/net_statistics.c index 288ec35c03ffb..022717fbca2ac 100644 --- a/net/procfs/net_statistics.c +++ b/net/procfs/net_statistics.c @@ -58,6 +58,7 @@ /**************************************************************************** * Private Function Prototypes ****************************************************************************/ + /* Line generating functions */ static int netprocfs_header(FAR struct netprocfs_file_s *netfile); diff --git a/net/route/net_cacheroute.c b/net/route/net_cacheroute.c index ceccd4702f009..cf5fac67c5683 100644 --- a/net/route/net_cacheroute.c +++ b/net/route/net_cacheroute.c @@ -466,7 +466,6 @@ static void net_reset_ipv6_cache(void) { net_add_newest_ipv6(&g_prealloc_ipv6cache[i]); } - } #endif @@ -538,8 +537,10 @@ int net_addcache_ipv4(FAR struct net_route_ipv4_s *route) return ret; } - /* First, check if the route already exists in the cache */ - /* Visit each entry in the cache */ + /* First, check if the route already exists in the cache. + * + * Visit each entry in the cache + */ for (prev = NULL, cache = g_ipv4_cache.head; cache != NULL; @@ -618,8 +619,10 @@ int net_addcache_ipv6(FAR struct net_route_ipv6_s *route) return ret; } - /* First, check if the route already exists in the cache */ - /* Visit each entry in the cache */ + /* First, check if the route already exists in the cache. + * + * Visit each entry in the cache. + */ for (prev = NULL, cache = g_ipv6_cache.head; cache != NULL; diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index b721522cedd7c..2d7ecbe03aa99 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -665,8 +665,10 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio, fragn_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN; - /* Copy payload and enqueue */ - /* Check for the last fragment */ + /* Copy payload and enqueue. + * + * Check for the last fragment. + */ paysize = (framelen - fragn_hdrlen) & SIXLOWPAN_DISPATCH_FRAG_MASK; if (paysize > buflen - outlen + protosize) diff --git a/net/sixlowpan/sixlowpan_hc06.c b/net/sixlowpan/sixlowpan_hc06.c index 9c8d01589a4bd..668c0e7c1fa04 100644 --- a/net/sixlowpan/sixlowpan_hc06.c +++ b/net/sixlowpan/sixlowpan_hc06.c @@ -106,6 +106,7 @@ struct sixlowpan_addrcontext_s ****************************************************************************/ /* HC06 specific variables **************************************************/ + /* Use of global variables simplifies the logic and is safe in the multi- * device environment because access is serialized via the network lock. * @@ -124,6 +125,7 @@ static struct sixlowpan_addrcontext_s static FAR uint8_t *g_hc06ptr; /* Constant Data ************************************************************/ + /* Uncompression of linklocal * * 0 -> 16 bytes from packet @@ -487,8 +489,10 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr, ipaddr[6] = HTONS(0xfe00); } - /* Handle the even bytes in the address */ - /* If the postcount is even then take extra care with endian-ness */ + /* Handle the even bytes in the address. + * + * If the postcount is even then take extra care with endian-ness. + */ destndx = 8 - (postcount >> 1); @@ -802,8 +806,10 @@ int sixlowpan_compresshdr_hc06(FAR struct radio_driver_s *radio, } } - /* Note that the payload length is always compressed */ - /* Next header. We compress it if UDP */ + /* Note that the payload length is always compressed. + * + * Next header. We compress it if UDP. + */ #ifdef CONFIG_NET_UDP if (ipv6->proto == IP_PROTO_UDP) @@ -1169,8 +1175,9 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, tmp = *g_hc06ptr; g_hc06ptr += 4; - /* hc06 format of tc is ECN | DSCP , original is DSCP | ECN */ - /* set version, pick highest DSCP bits and set in vtc */ + /* hc06 format of tc is ECN | DSCP , original is DSCP | ECN + * Set version, pick highest DSCP bits and set in vtc. + */ ipv6->vtc = 0x60 | ((tmp >> 2) & 0x0f); @@ -1193,15 +1200,17 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, } else { - /* Version is always 6! */ - /* Version and flow label are compressed */ + /* Version is always 6! + * + * Version and flow label are compressed. + */ if ((iphc0 & SIXLOWPAN_IPHC_TC_01) == 0) { /* Traffic class is inline */ ipv6->vtc = 0x60 | ((*g_hc06ptr >> 2) & 0x0f); - ipv6->tcf = ((*g_hc06ptr << 6) & 0xC0) | ((*g_hc06ptr >> 2) & 0x30); + ipv6->tcf = ((*g_hc06ptr << 6) & 0xc0) | ((*g_hc06ptr >> 2) & 0x30); ipv6->flow = 0; g_hc06ptr += 1; } @@ -1268,8 +1277,9 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, } } - /* If tmp == 0 we do not have a address context and therefore no prefix */ - /* REVISIT: Source address may not be the same size as the destination + /* If tmp == 0 we do not have a address context and therefore no prefix. + * + * REVISIT: Source address may not be the same size as the destination * address. */ @@ -1279,8 +1289,9 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, } else { - /* No compression and link local */ - /* REVISIT: Source address may not be the same size as the destination + /* No compression and link local. + * + * REVISIT: Source address may not be the same size as the destination * address. */ @@ -1288,8 +1299,10 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, ipv6->srcipaddr); } - /* Destination address */ - /* Put the destination address compression mode into tmp */ + /* Destination address. + * + * Put the destination address compression mode into tmp. + */ tmp = ((iphc1 & SIXLOWPAN_IPHC_DAM_MASK) >> SIXLOWPAN_IPHC_DAM_BIT) & 0x03; @@ -1320,7 +1333,11 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, * DAM 11: 8 bits ff02::00xx */ - uint8_t prefix[] = { 0xff, 0x02 }; + uint8_t prefix[] = + { + 0xff, 0x02 + }; + if (tmp > 0 && tmp < 3) { prefix[1] = *g_hc06ptr; @@ -1333,8 +1350,10 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio, } else { - /* No multicast */ - /* Context based */ + /* No multicast. + * + * Context based. + */ if ((iphc1 & SIXLOWPAN_IPHC_DAC) != 0) { diff --git a/net/sixlowpan/sixlowpan_hc1.c b/net/sixlowpan/sixlowpan_hc1.c index 6cbe776b35751..1ca20b1881b5a 100644 --- a/net/sixlowpan/sixlowpan_hc1.c +++ b/net/sixlowpan/sixlowpan_hc1.c @@ -137,7 +137,7 @@ int sixlowpan_compresshdr_hc1(FAR struct radio_driver_s *radio, !sixlowpan_ismacbased(ipv6->srcipaddr, &radio->r_dev.d_mac.radio) || !sixlowpan_islinklocal(ipv6->destipaddr) || !sixlowpan_ismacbased(ipv6->destipaddr, destmac) || - ( 1 + (1 #ifdef CONFIG_NET_TCP && ipv6->proto != IP_PROTO_TCP #endif @@ -306,8 +306,9 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio, ninfo("fptr=%p g_frame_hdrlen=%u\n", fptr, g_frame_hdrlen); - /* Format the IPv6 header in the device d_buf */ - /* Set version, traffic clase, and flow label. This assumes that Bit 4 is + /* Format the IPv6 header in the device d_buf. + * + * Set version, traffic clase, and flow label. This assumes that Bit 4 is * set in HC1. */ @@ -363,9 +364,11 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio, /* UDP ports, len, checksum */ udp->srcport = - htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] >> 4)); + htons(CONFIG_NET_6LOWPAN_MINPORT + + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] >> 4)); udp->destport = - htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] & 0x0F)); + htons(CONFIG_NET_6LOWPAN_MINPORT + + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] & 0x0f)); ninfo("UDP srcport=%04x destport=%04x\n", udp->srcport, udp->destport); @@ -459,7 +462,7 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio, /* This is a 1st fragment */ ipv6->len[0] = (iplen - IPv6_HDRLEN) >> 8; - ipv6->len[1] = (iplen - IPv6_HDRLEN) & 0x00FF; + ipv6->len[1] = (iplen - IPv6_HDRLEN) & 0x00ff; } ninfo("IPv6 len=%02x:%02x\n", ipv6->len[0], ipv6->len[1]); diff --git a/net/sixlowpan/sixlowpan_internal.h b/net/sixlowpan/sixlowpan_internal.h index 75dd6839a8482..b60e83996408e 100644 --- a/net/sixlowpan/sixlowpan_internal.h +++ b/net/sixlowpan/sixlowpan_internal.h @@ -80,8 +80,10 @@ memcpy(dest, src, len) #ifdef CONFIG_WIRELESS_IEEE802154 -/* IEEE 802.15.4 address macros */ -/* Copy a an IEEE 802.15.4 address */ +/* IEEE 802.15.4 address macros + * + * Copy a an IEEE 802.15.4 address. + */ #define sixlowpan_saddrcopy(dest,src) \ sixlowpan_anyaddrcopy(dest,src,NET_6LOWPAN_SADDRSIZE) diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index db64c2265f2db..870d6f93eb665 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -246,8 +246,9 @@ static int sixlowpan_tcp_header(FAR struct tcp_conn_s *conn, ipv6tcp->tcp.urgp[0] = 0; /* No urgent data */ ipv6tcp->tcp.urgp[1] = 0; - /* Set the sequency number information */ - /* REVISIT: There is currently no wait for the data to be ACKed and, + /* Set the sequency number information. + * + * REVISIT: There is currently no wait for the data to be ACKed and, * hence, no mechanism to retransmit the packet. */ diff --git a/net/sixlowpan/sixlowpan_udpsend.c b/net/sixlowpan/sixlowpan_udpsend.c index bede2da378eb8..56684d7117fea 100644 --- a/net/sixlowpan/sixlowpan_udpsend.c +++ b/net/sixlowpan/sixlowpan_udpsend.c @@ -445,7 +445,6 @@ void sixlowpan_udp_send(FAR struct net_driver_s *dev, if (dev != NULL && dev->d_len > 0 && fwddev != NULL) { - sixlowpan_dumpbuffer("Outgoing UDP packet", (FAR const uint8_t *)ipv6udp, dev->d_len); diff --git a/net/sixlowpan/sixlowpan_utils.c b/net/sixlowpan/sixlowpan_utils.c index 896766b460640..492d0f6f4d3b5 100644 --- a/net/sixlowpan/sixlowpan_utils.c +++ b/net/sixlowpan/sixlowpan_utils.c @@ -694,7 +694,8 @@ int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio, srcaddr->nv_addrlen = NET_6LOWPAN_SADDRSIZE; /* MAC802154 gives us Short Address in Little Endinan Order, but we - * need it in Network Order */ + * need it in Network Order. + */ srcaddr->nv_addr[0] = ind->src.saddr[1]; srcaddr->nv_addr[1] = ind->src.saddr[0]; @@ -704,7 +705,8 @@ int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio, srcaddr->nv_addrlen = NET_6LOWPAN_EADDRSIZE; /* MAC802154 gives us Extended Address in Little Endinan Order, but - * we need it in Network Order */ + * we need it in Network Order. + */ srcaddr->nv_addr[0] = ind->src.eaddr[7]; srcaddr->nv_addr[1] = ind->src.eaddr[6]; @@ -777,7 +779,8 @@ int sixlowpan_extract_destaddr(FAR struct radio_driver_s *radio, destaddr->nv_addrlen = NET_6LOWPAN_SADDRSIZE; /* MAC802154 gives us Short Address in Little Endinan Order, but we - * need it in Network Order */ + * need it in Network Order. + */ destaddr->nv_addr[0] = ind->dest.saddr[1]; destaddr->nv_addr[1] = ind->dest.saddr[0]; @@ -787,7 +790,8 @@ int sixlowpan_extract_destaddr(FAR struct radio_driver_s *radio, destaddr->nv_addrlen = NET_6LOWPAN_EADDRSIZE; /* MAC802154 gives us Extended Address in Little Endinan Order, but - * we need it in Network Order */ + * we need it in Network Order. + */ destaddr->nv_addr[0] = ind->dest.eaddr[7]; destaddr->nv_addr[1] = ind->dest.eaddr[6]; diff --git a/net/tcp/tcp_callback.c b/net/tcp/tcp_callback.c index 0f8944a20e0aa..e72876fce4cdd 100644 --- a/net/tcp/tcp_callback.c +++ b/net/tcp/tcp_callback.c @@ -171,9 +171,9 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * and that no further process of the new data should be * attempted. * TCP_SNDACK - If TCP_NEWDATA is cleared, then TCP_SNDACK may be set - * to indicate that an ACK should be included in the response. - * (In TCP_NEWDATA is cleared but TCP_SNDACK is not set, then - * dev->d_len should also be cleared). + * to indicate that an ACK should be included in the + * response. (In TCP_NEWDATA is cleared but TCP_SNDACK is + * not set, then dev->d_len should also be cleared). */ flags = devif_conn_event(dev, conn, flags, conn->list); diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c index 1ba18b8131afa..e935957ce6944 100644 --- a/net/tcp/tcp_conn.c +++ b/net/tcp/tcp_conn.c @@ -265,9 +265,9 @@ static int tcp_selectport(uint8_t domain, FAR const union ip_addr_u *ipaddr, if (portno == 0) { /* No local port assigned. Loop until we find a valid listen port number - * that is not being used by any other connection. NOTE the following loop - * is assumed to terminate but could not if all 32000-4096+1 ports are - * in used (unlikely). + * that is not being used by any other connection. NOTE the following + * loop is assumed to terminate but could not if all 32000-4096+1 ports + * are in used (unlikely). */ do @@ -701,7 +701,8 @@ FAR struct tcp_conn_s *tcp_alloc(uint8_t domain) /* Now there is guaranteed to be one free connection. Get it! */ - conn = (FAR struct tcp_conn_s *)dq_remfirst(&g_free_tcp_connections); + conn = (FAR struct tcp_conn_s *) + dq_remfirst(&g_free_tcp_connections); } } #endif @@ -753,8 +754,8 @@ void tcp_free(FAR struct tcp_conn_s *conn) DEBUGASSERT(conn->crefs == 0); net_lock(); - /* Free remaining callbacks, actually there should be only the close callback - * left. + /* Free remaining callbacks, actually there should be only the close + * callback left. */ for (cb = conn->list; cb; cb = next) @@ -783,12 +784,14 @@ void tcp_free(FAR struct tcp_conn_s *conn) #ifdef CONFIG_NET_TCP_WRITE_BUFFERS /* Release any write buffers attached to the connection */ - while ((wrbuffer = (struct tcp_wrbuffer_s *)sq_remfirst(&conn->write_q)) != NULL) + while ((wrbuffer = (struct tcp_wrbuffer_s *) + sq_remfirst(&conn->write_q)) != NULL) { tcp_wrbuffer_release(wrbuffer); } - while ((wrbuffer = (struct tcp_wrbuffer_s *)sq_remfirst(&conn->unacked_q)) != NULL) + while ((wrbuffer = (struct tcp_wrbuffer_s *) + sq_remfirst(&conn->unacked_q)) != NULL) { tcp_wrbuffer_release(wrbuffer); } diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index daf3f8f3bd699..1029d5c3d7355 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -269,14 +269,14 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, } else { - /* All other options have a length field, so that we easily - * can skip past them. + /* All other options have a length field, so that we + * easily can skip past them. */ if (dev->d_buf[hdrlen + 1 + i] == 0) { - /* If the length field is zero, the options are malformed - * and we don't process them further. + /* If the length field is zero, the options are + * malformed and we don't process them further. */ break; @@ -395,13 +395,14 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, /* Check for a to KeepAlive probes. These packets have these properties: * * - TCP_ACK flag is set. SYN/FIN/RST never appear in a Keepalive probe. - * - Sequence number is the sequence number of previously ACKed data, i.e., - * the expected sequence number minus one. + * - Sequence number is the sequence number of previously ACKed data, + * i.e., the expected sequence number minus one. * - The data payload is one or two bytes. * * We would expect a KeepAlive only in the ESTABLISHED state and only after - * some time has elapsed with no network activity. If there is un-ACKed data, - * then we will let the normal TCP re-transmission logic handle that case. + * some time has elapsed with no network activity. If there is un-ACKed + * data, then we will let the normal TCP re-transmission logic handle that + * case. */ if ((tcp->flags & TCP_ACK) != 0 && @@ -590,7 +591,8 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, * handshake is not complete */ - nwarn("WARNING: Listen canceled while waiting for ACK on port %d\n", + nwarn("WARNING: Listen canceled while waiting for ACK on " + "port %d\n", tcp->destport); /* Free the connection structure */ @@ -643,7 +645,8 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, * state. */ - if ((flags & TCP_ACKDATA) != 0 && (tcp->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) + if ((flags & TCP_ACKDATA) != 0 && + (tcp->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) { /* Parse the TCP MSS option, if present. */ @@ -750,7 +753,8 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, * sequence numbers will be screwed up. */ - if ((tcp->flags & TCP_FIN) != 0 && (conn->tcpstateflags & TCP_STOPPED) == 0) + if ((tcp->flags & TCP_FIN) != 0 && + (conn->tcpstateflags & TCP_STOPPED) == 0) { /* Needs to be investigated further. * Windows often sends FIN packets together with the last ACK for @@ -811,8 +815,8 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, { dev->d_urglen = 0; #else /* CONFIG_NET_TCPURGDATA */ - dev->d_appdata = ((FAR 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 */ } @@ -823,7 +827,8 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain, * the keep alive timer. */ - if (conn->keepalive && (dev->d_len > 0 || (tcp->flags & TCP_ACK) != 0)) + if (conn->keepalive && + (dev->d_len > 0 || (tcp->flags & TCP_ACK) != 0)) { /* Reset the last known "alive" time. * diff --git a/net/tcp/tcp_listen.c b/net/tcp/tcp_listen.c index 5c1d0d671e54c..6b8a497e05dca 100644 --- a/net/tcp/tcp_listen.c +++ b/net/tcp/tcp_listen.c @@ -294,7 +294,8 @@ int tcp_accept_connection(FAR struct net_driver_s *dev, else { /* Add the connection to the backlog and notify any threads that - * may be waiting on poll()/select() that the connection is available. + * may be waiting on poll()/select() that the connection is + * available. */ ret = tcp_backlogadd(listener, conn); diff --git a/net/tcp/tcp_monitor.c b/net/tcp/tcp_monitor.c index 57b99dabbb77a..3a1ecf930d467 100644 --- a/net/tcp/tcp_monitor.c +++ b/net/tcp/tcp_monitor.c @@ -94,7 +94,8 @@ static void tcp_close_connection(FAR struct socket *psock, uint16_t flags) * And we need to set these two socket status bits appropriately: * * _SF_CONNECTED==1 && _SF_CLOSED==0 - the socket is connected - * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully disconnected + * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully + * disconnected * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was rudely disconnected */ @@ -111,8 +112,8 @@ static void tcp_close_connection(FAR struct socket *psock, uint16_t flags) } else if ((flags & (TCP_ABORT | TCP_TIMEDOUT | NETDEV_DOWN)) != 0) { - /* The loss of connection was less than graceful. This will (eventually) - * be reported as an ENOTCONN error. + /* The loss of connection was less than graceful. This will + * (eventually) be reported as an ENOTCONN error. */ psock->s_flags &= ~(_SF_CONNECTED | _SF_CLOSED); @@ -162,7 +163,8 @@ static uint16_t tcp_disconnect_event(FAR struct net_driver_s *dev, else if ((flags & TCP_CONNECTED) != 0) { #if 0 /* REVISIT: Assertion fires. Why? */ - FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)psock->s_conn; + FAR struct tcp_conn_s *conn = + (FAR struct tcp_conn_s *)psock->s_conn; /* Make sure that this is the device bound to the connection */ diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index f207b2c92e183..60ecb27129337 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -286,8 +286,10 @@ static inline void send_ipselect(FAR struct net_driver_s *dev, #ifdef CONFIG_NET_ETHERNET static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn) { - /* Only Ethernet drivers are supported by this function */ - /* REVISIT: Could the MAC address not also be in a routing table? */ + /* Only Ethernet drivers are supported by this function. + * + * REVISIT: Could the MAC address not also be in a routing table? + */ if (conn->dev->d_lltype != NET_LL_ETHERNET) { @@ -804,7 +806,8 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, sndlen = conn->winsize; } - ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u mss=%u winsize=%u\n", + ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u mss=%u " + "winsize=%u\n", wrb, TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb), sndlen, conn->mss, conn->winsize); @@ -1270,7 +1273,8 @@ int psock_tcp_cansend(FAR struct socket *psock) } /* In order to setup the send, we need to have at least one free write - * buffer head and at least one free IOB to initialize the write buffer head. + * buffer head and at least one free IOB to initialize the write buffer + * head. * * REVISIT: The send will still block if we are unable to buffer the entire * user-provided buffer which may be quite large. We will almost certainly diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index 000d81f71b195..a4a3327ecb2ff 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -234,8 +234,10 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev, #ifdef CONFIG_NET_ETHERNET static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn) { - /* Only Ethernet drivers are supported by this function */ - /* REVISIT: Could the MAC address not also be in a routing table? */ + /* Only Ethernet drivers are supported by this function. + * + * REVISIT: Could the MAC address not also be in a routing table? + */ if (conn->dev->d_lltype != NET_LL_ETHERNET) { @@ -525,11 +527,11 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev, * Then we will split the remaining, single packet into two partial * packets. This will stimulate the RFC 1122 peer to ACK sooner. * - * Don't try to split very small packets (less than CONFIG_NET_TCP_SPLIT_SIZE). - * Only the first even packet and the last odd packets could have - * sndlen less than CONFIG_NET_TCP_SPLIT_SIZE. The value of sndlen on - * the last even packet is guaranteed to be at least MSS/2 by the - * logic below. + * Don't try to split very small packets (less than + * CONFIG_NET_TCP_SPLIT_SIZE). Only the first even packet and the + * last odd packets could have sndlen less than + * CONFIG_NET_TCP_SPLIT_SIZE. The value of sndlen on the last even + * packet is guaranteed to be at least MSS / 2 by the logic below. */ if (sndlen >= CONFIG_NET_TCP_SPLIT_SIZE) @@ -599,11 +601,12 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev, if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->winsize) { - /* Set the sequence number for this packet. NOTE: The network updates - * sndseq on receipt of ACK *before* this function is called. In that - * case sndseq will point to the next unacknowledged byte (which might - * have already been sent). We will overwrite the value of sndseq - * here before the packet is sent. + /* Set the sequence number for this packet. NOTE: The network + * updates sndseq on receipt of ACK *before* this function is + * called. In that case sndseq will point to the next + * unacknowledged byte (which might have already been sent). We + * will overwrite the value of sndseq here before the packet is + * sent. */ seqno = pstate->snd_sent + pstate->snd_isn; @@ -637,7 +640,6 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev, pstate->snd_sent += sndlen; ninfo("SEND: acked=%d sent=%d buflen=%d\n", pstate->snd_acked, pstate->snd_sent, pstate->snd_buflen); - } } } @@ -934,8 +936,9 @@ ssize_t psock_tcp_send(FAR struct socket *psock, goto errout; } - /* If net_lockedwait failed, then we were probably reawakened by a signal. In - * this case, net_lockedwait will have returned negated errno appropriately. + /* If net_lockedwait failed, then we were probably reawakened by a signal. + * In this case, net_lockedwait will have returned negated errno + * appropriately. */ if (ret < 0) diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c index 0a1ac09d2b094..d6d45bf31db16 100644 --- a/net/tcp/tcp_sendfile.c +++ b/net/tcp/tcp_sendfile.c @@ -437,15 +437,17 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev, dev->d_sndlen = sndlen; - /* Set the sequence number for this packet. NOTE: The network updates - * sndseq on recept of ACK *before* this function is called. In that - * case sndseq will point to the next unacknowledge byte (which might - * have already been sent). We will overwrite the value of sndseq - * here before the packet is sent. + /* Set the sequence number for this packet. NOTE: The network + * updates sndseq on recept of ACK *before* this function is + * called. In that case sndseq will point to the next + * unacknowledge byte (which might have already been sent). We + * will overwrite the value of sndseq here before the packet is + * sent. */ seqno = pstate->snd_sent + pstate->snd_isn; - ninfo("SEND: sndseq %08x->%08x len: %d\n", conn->sndseq, seqno, ret); + ninfo("SEND: sndseq %08x->%08x len: %d\n", + conn->sndseq, seqno, ret); tcp_setsequence(conn->sndseq, seqno); diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c index 0d5ec99d89e30..5da238e4110ba 100644 --- a/net/tcp/tcp_timer.c +++ b/net/tcp/tcp_timer.c @@ -393,8 +393,9 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, if (conn->keepretries >= conn->keepcnt) { - /* Yes... stop the network monitor, closing the connection and all sockets - * associated with the connection. + /* Yes... stop the network monitor, closing the + * connection and all sockets associated with the + * connection. */ tcp_stop_monitor(conn, TCP_ABORT); @@ -445,8 +446,8 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, tcp_setsequence(conn->sndseq, saveseq); - /* Increment the number of un-ACKed bytes due to the dummy - * byte that we just sent. + /* Increment the number of un-ACKed bytes due to the + * dummy byte that we just sent. */ conn->unacked++; diff --git a/net/tcp/tcp_wrbuffer.c b/net/tcp/tcp_wrbuffer.c index d074bffeeb79b..8f600fb372583 100644 --- a/net/tcp/tcp_wrbuffer.c +++ b/net/tcp/tcp_wrbuffer.c @@ -163,8 +163,8 @@ FAR struct tcp_wrbuffer_s *tcp_wrbuffer_alloc(void) wrb->wb_iob = net_ioballoc(false); - /* Did we get an IOB? We should always get one except under some really weird - * error conditions. + /* Did we get an IOB? We should always get one except under some really + * weird error conditions. */ if (wrb->wb_iob == NULL) diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c index f83fdb7981cda..f8dec4b1a8324 100644 --- a/net/udp/udp_conn.c +++ b/net/udp/udp_conn.c @@ -420,7 +420,8 @@ static inline FAR struct udp_conn_s * * IP address is available and we will insist that the * destination IP matches the bound address. If a socket is bound * to INADDR6_ANY (laddr), then it should receive all packets - * directed to the port. REVISIT: Should also depend on SO_BROADCAST. + * directed to the port. REVISIT: Should also depend on + * SO_BROADCAST. * * 2. If this is a connection mode UDP socket, then the source address * is verified against the connected remote address. @@ -638,7 +639,8 @@ void udp_free(FAR struct udp_conn_s *conn) #ifdef CONFIG_NET_UDP_WRITE_BUFFERS /* Release any write buffers attached to the connection */ - while ((wrbuffer = (struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q)) != NULL) + while ((wrbuffer = (struct udp_wrbuffer_s *) + sq_remfirst(&conn->write_q)) != NULL) { udp_wrbuffer_release(wrbuffer); } @@ -762,7 +764,8 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr) * interfaces for receiving (Sending will use the default port). */ - net_ipv6addr_copy(conn->u.ipv6.laddr, inaddr->sin6_addr.in6_u.u6_addr16); + net_ipv6addr_copy(conn->u.ipv6.laddr, + inaddr->sin6_addr.in6_u.u6_addr16); } #endif /* CONFIG_NET_IPv6 */ diff --git a/net/udp/udp_finddev.c b/net/udp/udp_finddev.c index 6846ebcd47e9f..d772302ebb766 100644 --- a/net/udp/udp_finddev.c +++ b/net/udp/udp_finddev.c @@ -106,7 +106,6 @@ static FAR struct net_driver_s *upd_bound_device(FAR struct udp_conn_s *conn) # define upd_bound_device(c) netdev_default(); #endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -250,8 +249,9 @@ FAR struct net_driver_s *udp_find_raddr_device(FAR struct udp_conn_s *conn) } else { - /* Not a suitable IPv4 unicast address for device lookup */ - /* Return the device bound to this UDP socket, if any */ + /* Not a suitable IPv4 unicast address for device lookup. + * Return the device bound to this UDP socket, if any. + */ return upd_bound_device(conn); } @@ -302,8 +302,9 @@ FAR struct net_driver_s *udp_find_raddr_device(FAR struct udp_conn_s *conn) } else { - /* Not a suitable IPv6 unicast address for device lookup */ - /* Return the device bound to this UDP socket, if any */ + /* Not a suitable IPv6 unicast address for device lookup. + * Return the device bound to this UDP socket, if any. + */ return upd_bound_device(conn); } diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index 26874f26b9bed..5f159d1ecfead 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -766,8 +766,10 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, goto errout_with_lock; } - /* Initialize the write buffer */ - /* Check if the socket is connected */ + /* Initialize the write buffer + * + * Check if the socket is connected + */ if (_SS_ISCONNECTED(psock->s_flags)) { @@ -915,11 +917,13 @@ int psock_udp_cansend(FAR struct socket *psock) } /* In order to setup the send, we need to have at least one free write - * buffer head and at least one free IOB to initialize the write buffer head. + * buffer head and at least one free IOB to initialize the write buffer + * head. * - * REVISIT: The send will still block if we are unable to buffer the entire - * user-provided buffer which may be quite large. We will almost certainly - * need to have more than one free IOB, but we don't know how many more. + * REVISIT: The send will still block if we are unable to buffer the + * entire user-provided buffer which may be quite large. We will almost + * certainly need to have more than one free IOB, but we don't know how + * many more. */ if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0) diff --git a/net/udp/udp_send.c b/net/udp/udp_send.c index 0413f13b35b28..1284a85eca932 100644 --- a/net/udp/udp_send.c +++ b/net/udp/udp_send.c @@ -139,7 +139,8 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) if (conn->domain == PF_INET6 && 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 diff --git a/net/udp/udp_wrbuffer_dump.c b/net/udp/udp_wrbuffer_dump.c index e3e8df1f59d5d..487e302319d6e 100644 --- a/net/udp/udp_wrbuffer_dump.c +++ b/net/udp/udp_wrbuffer_dump.c @@ -63,7 +63,8 @@ void udp_wrbuffer_dump(FAR const char *msg, FAR struct udp_wrbuffer_s *wrb, unsigned int len, unsigned int offset) { - syslog(LOG_DEBUG, "%s: wrb=%p pktlen=%d\n", msg, wrb, wrb->wb_iob->io_pktlen); + syslog(LOG_DEBUG, "%s: wrb=%p pktlen=%d\n", + msg, wrb, wrb->wb_iob->io_pktlen); iob_dump("I/O Buffer Chain", wrb->wb_iob, len, offset); } diff --git a/net/usrsock/usrsock_accept.c b/net/usrsock/usrsock_accept.c index 29ff6b9152c5e..70ac45b41f620 100644 --- a/net/usrsock/usrsock_accept.c +++ b/net/usrsock/usrsock_accept.c @@ -98,7 +98,8 @@ static uint16_t accept_event(FAR struct net_driver_s *dev, FAR void *pvconn, pstate->reqstate.result == -EAGAIN) { /* After reception of connection, mark input not ready. Daemon will - * send event to restore this flag. */ + * send event to restore this flag. + */ conn->flags &= ~USRSOCK_EVENT_RECVFROM_AVAIL; } @@ -153,9 +154,12 @@ static uint16_t accept_event(FAR struct net_driver_s *dev, FAR void *pvconn, * Name: do_accept_request ****************************************************************************/ -static int do_accept_request(FAR struct usrsock_conn_s *conn, socklen_t addrlen) +static int do_accept_request(FAR struct usrsock_conn_s *conn, + socklen_t addrlen) { - struct usrsock_request_accept_s req = {}; + struct usrsock_request_accept_s req = + { + }; struct iovec bufs[1]; if (addrlen > UINT16_MAX) @@ -226,7 +230,9 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr, FAR socklen_t *addrlen, FAR struct socket *newsock) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_data_reqstate_s state = {}; + struct usrsock_data_reqstate_s state = + { + }; FAR struct usrsock_conn_s *newconn; struct iovec inbufs[2]; socklen_t inaddrlen = 0; @@ -259,7 +265,8 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr, ninfo("usockid=%d; accept() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } @@ -422,7 +429,8 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr, usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs)); /* We might start getting events for this socket right after - * returning to daemon, so setup 'newconn' already here. */ + * returning to daemon, so setup 'newconn' already here. + */ newconn->state = USRSOCK_CONN_STATE_READY; @@ -455,7 +463,8 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr, newsock->s_sockif = psock->s_sockif; /* Store length of 'from' address that was available at - * daemon-side. */ + * daemon-side. + */ outaddrlen = state.valuelen_nontrunc; diff --git a/net/usrsock/usrsock_bind.c b/net/usrsock/usrsock_bind.c index cbc1e4afef20a..67f5944b2a6e5 100644 --- a/net/usrsock/usrsock_bind.c +++ b/net/usrsock/usrsock_bind.c @@ -109,7 +109,9 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn, FAR const struct sockaddr *addr, socklen_t addrlen) { - struct usrsock_request_bind_s req = {}; + struct usrsock_request_bind_s req = + { + }; struct iovec bufs[2]; /* Prepare request for daemon to read. */ @@ -165,7 +167,9 @@ int usrsock_bind(FAR struct socket *psock, socklen_t addrlen) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_reqstate_s state = {}; + struct usrsock_reqstate_s state = + { + }; ssize_t ret; DEBUGASSERT(conn); @@ -180,7 +184,8 @@ int usrsock_bind(FAR struct socket *psock, ninfo("usockid=%d; connect() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } diff --git a/net/usrsock/usrsock_close.c b/net/usrsock/usrsock_close.c index 78368f9da852a..e0486930d9056 100644 --- a/net/usrsock/usrsock_close.c +++ b/net/usrsock/usrsock_close.c @@ -108,7 +108,9 @@ static uint16_t close_event(FAR struct net_driver_s *dev, FAR void *pvconn, static int do_close_request(FAR struct usrsock_conn_s *conn) { - struct usrsock_request_close_s req = {}; + struct usrsock_request_close_s req = + { + }; struct iovec bufs[1]; /* Prepare request for daemon to read. */ @@ -135,7 +137,9 @@ static int do_close_request(FAR struct usrsock_conn_s *conn) int usrsock_close(FAR struct usrsock_conn_s *conn) { - struct usrsock_reqstate_s state = {}; + struct usrsock_reqstate_s state = + { + }; int ret; net_lock(); diff --git a/net/usrsock/usrsock_conn.c b/net/usrsock/usrsock_conn.c index 9b592164910e3..cdc3c71660356 100644 --- a/net/usrsock/usrsock_conn.c +++ b/net/usrsock/usrsock_conn.c @@ -124,7 +124,8 @@ FAR struct usrsock_conn_s *usrsock_alloc(void) /* The free list is protected by a semaphore (that behaves like a mutex). */ _usrsock_semtake(&g_free_sem); - conn = (FAR struct usrsock_conn_s *)dq_remfirst(&g_free_usrsock_connections); + conn = (FAR struct usrsock_conn_s *) + dq_remfirst(&g_free_usrsock_connections); if (conn) { /* Make sure that the connection is marked as uninitialized */ @@ -287,7 +288,8 @@ int usrsock_setup_data_request_callback(FAR struct usrsock_conn_s *conn, { pstate->valuelen = 0; pstate->valuelen_nontrunc = 0; - return usrsock_setup_request_callback(conn, &pstate->reqstate, event, flags); + return usrsock_setup_request_callback(conn, &pstate->reqstate, event, + flags); } /**************************************************************************** diff --git a/net/usrsock/usrsock_connect.c b/net/usrsock/usrsock_connect.c index d6b093e4d186c..344c476f0c338 100644 --- a/net/usrsock/usrsock_connect.c +++ b/net/usrsock/usrsock_connect.c @@ -109,7 +109,9 @@ static int do_connect_request(FAR struct usrsock_conn_s *conn, FAR const struct sockaddr *addr, socklen_t addrlen) { - struct usrsock_request_connect_s req = {}; + struct usrsock_request_connect_s req = + { + }; struct iovec bufs[2]; if (addrlen > UINT16_MAX) @@ -157,7 +159,9 @@ int usrsock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_reqstate_s state = {}; + struct usrsock_reqstate_s state = + { + }; int ret; DEBUGASSERT(conn); @@ -172,7 +176,8 @@ int usrsock_connect(FAR struct socket *psock, ninfo("usockid=%d; connect() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNREFUSED; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNREFUSED; goto errout_unlock; } diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c index 96ccb176a3e1f..821dcf98542a7 100644 --- a/net/usrsock/usrsock_dev.c +++ b/net/usrsock/usrsock_dev.c @@ -279,7 +279,8 @@ static uint8_t usrsockdev_get_xid(FAR struct usrsock_conn_s *conn) #endif /* Each connection can one only one request/response pending. So map - * connection structure index to xid value. */ + * connection structure index to xid value. + */ conn_idx = usrsock_connidx(conn); @@ -341,7 +342,8 @@ static bool usrsockdev_is_opened(FAR struct usrsockdev_s *dev) * Name: usrsockdev_pollnotify ****************************************************************************/ -static void usrsockdev_pollnotify(FAR struct usrsockdev_s *dev, pollevent_t eventset) +static void usrsockdev_pollnotify(FAR struct usrsockdev_s *dev, + pollevent_t eventset) { #ifndef CONFIG_DISABLE_POLL int i; @@ -561,7 +563,8 @@ static ssize_t usrsockdev_handle_response(FAR struct usrsockdev_s *dev, if (USRSOCK_MESSAGE_REQ_IN_PROGRESS(hdr->head.flags)) { /* In-progress response is acknowledgment that response was - * received. */ + * received. + */ conn->resp.inprogress = true; } @@ -593,7 +596,8 @@ usrsockdev_handle_datareq_response(FAR struct usrsockdev_s *dev, { FAR const struct usrsock_message_datareq_ack_s *datahdr = buffer; FAR const struct usrsock_message_req_ack_s *hdr = &datahdr->reqack; - int num_inbufs, iovpos; + int num_inbufs; + int iovpos; ssize_t ret; if (USRSOCK_MESSAGE_REQ_IN_PROGRESS(hdr->head.flags)) @@ -612,7 +616,8 @@ usrsockdev_handle_datareq_response(FAR struct usrsockdev_s *dev, } /* In-progress response is acknowledgment that response was - * received. */ + * received. + */ conn->resp.inprogress = true; @@ -635,7 +640,8 @@ usrsockdev_handle_datareq_response(FAR struct usrsockdev_s *dev, if (datahdr->valuelen > 0 || datahdr->valuelen_nontrunc > 0) { - nerr("error: response result negative, and valuelen or valuelen_nontrunc non-zero.\n"); + nerr("error: response result negative, and valuelen or " + "valuelen_nontrunc non-zero.\n"); ret = -EINVAL; goto unlock_out; @@ -788,8 +794,9 @@ static ssize_t usrsockdev_handle_req_response(FAR struct usrsockdev_s *dev, if (dev->req.ack_xid == hdr->xid && dev->req.iov) { - /* Signal that request was received and read by daemon and acknowledgment - * response was received. */ + /* Signal that request was received and read by daemon and + * acknowledgment response was received. + */ dev->req.iov = NULL; @@ -830,8 +837,8 @@ static ssize_t usrsockdev_handle_message(FAR struct usrsockdev_s *dev, * Name: usrsockdev_write ****************************************************************************/ -static ssize_t usrsockdev_write(FAR struct file *filep, FAR const char *buffer, - size_t len) +static ssize_t usrsockdev_write(FAR struct file *filep, + FAR const char *buffer, size_t len) { FAR struct inode *inode = filep->f_inode; FAR struct usrsock_conn_s *conn; @@ -860,7 +867,8 @@ static ssize_t usrsockdev_write(FAR struct file *filep, FAR const char *buffer, if (!dev->datain_conn) { /* Start of message, buffer length should be at least size of common - * message header. */ + * message header. + */ if (len < sizeof(struct usrsock_message_common_s)) { @@ -932,7 +940,8 @@ static int usrsockdev_open(FAR struct file *filep) { FAR struct inode *inode = filep->f_inode; FAR struct usrsockdev_s *dev; - int ret, tmp; + int ret; + int tmp; DEBUGASSERT(inode); @@ -1239,7 +1248,8 @@ int usrsockdev_do_request(FAR struct usrsock_conn_s *conn, } else { - ninfo("usockid=%d; daemon abruptly closed /usr/usrsock.\n", conn->usockid); + ninfo("usockid=%d; daemon abruptly closed /usr/usrsock.\n", + conn->usockid); ret = -ESHUTDOWN; } @@ -1271,7 +1281,8 @@ void usrsockdev_register(void) nxsem_init(&g_usrsockdev.req.acksem, 0, 0); nxsem_setprotocol(&g_usrsockdev.req.acksem, SEM_PRIO_NONE); - (void)register_driver("/dev/usrsock", &g_usrsockdevops, 0666, &g_usrsockdev); + (void)register_driver("/dev/usrsock", &g_usrsockdevops, 0666, + &g_usrsockdev); } #endif /* CONFIG_NET && CONFIG_NET_USRSOCK */ diff --git a/net/usrsock/usrsock_getpeername.c b/net/usrsock/usrsock_getpeername.c index cb13ab377f14c..e058a8ea644e6 100644 --- a/net/usrsock/usrsock_getpeername.c +++ b/net/usrsock/usrsock_getpeername.c @@ -120,7 +120,9 @@ static uint16_t getpeername_event(FAR struct net_driver_s *dev, static int do_getpeername_request(FAR struct usrsock_conn_s *conn, socklen_t addrlen) { - struct usrsock_request_getpeername_s req = {}; + struct usrsock_request_getpeername_s req = + { + }; struct iovec bufs[1]; if (addrlen > UINT16_MAX) @@ -170,7 +172,9 @@ int usrsock_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr, FAR socklen_t *addrlen) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_data_reqstate_s state = {}; + struct usrsock_data_reqstate_s state = + { + }; struct iovec inbufs[1]; ssize_t ret; socklen_t outaddrlen = 0; @@ -185,7 +189,8 @@ int usrsock_getpeername(FAR struct socket *psock, ninfo("usockid=%d; usrsock_getpeername() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } diff --git a/net/usrsock/usrsock_getsockname.c b/net/usrsock/usrsock_getsockname.c index 72cc924e4882b..f4e218e57110c 100644 --- a/net/usrsock/usrsock_getsockname.c +++ b/net/usrsock/usrsock_getsockname.c @@ -120,7 +120,9 @@ static uint16_t getsockname_event(FAR struct net_driver_s *dev, static int do_getsockname_request(FAR struct usrsock_conn_s *conn, socklen_t addrlen) { - struct usrsock_request_getsockname_s req = {}; + struct usrsock_request_getsockname_s req = + { + }; struct iovec bufs[1]; if (addrlen > UINT16_MAX) @@ -170,7 +172,9 @@ int usrsock_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, FAR socklen_t *addrlen) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_data_reqstate_s state = {}; + struct usrsock_data_reqstate_s state = + { + }; struct iovec inbufs[1]; ssize_t ret; socklen_t outaddrlen = 0; @@ -185,7 +189,8 @@ int usrsock_getsockname(FAR struct socket *psock, ninfo("usockid=%d; connect() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } diff --git a/net/usrsock/usrsock_getsockopt.c b/net/usrsock/usrsock_getsockopt.c index 50b6cf6034324..52c10d7a2c39e 100644 --- a/net/usrsock/usrsock_getsockopt.c +++ b/net/usrsock/usrsock_getsockopt.c @@ -60,8 +60,9 @@ * Private Functions ****************************************************************************/ -static uint16_t getsockopt_event(FAR struct net_driver_s *dev, FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t getsockopt_event(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { FAR struct usrsock_data_reqstate_s *pstate = pvpriv; FAR struct usrsock_conn_s *conn = pvconn; @@ -118,7 +119,9 @@ static uint16_t getsockopt_event(FAR struct net_driver_s *dev, FAR void *pvconn, static int do_getsockopt_request(FAR struct usrsock_conn_s *conn, int level, int option, socklen_t value_len) { - struct usrsock_request_getsockopt_s req = {}; + struct usrsock_request_getsockopt_s req = + { + }; struct iovec bufs[1]; if (level < INT16_MIN || level > INT16_MAX) @@ -183,7 +186,9 @@ static int do_getsockopt_request(FAR struct usrsock_conn_s *conn, int level, int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option, FAR void *value, FAR socklen_t *value_len) { - struct usrsock_data_reqstate_s state = {}; + struct usrsock_data_reqstate_s state = + { + }; struct iovec inbufs[1]; ssize_t ret; @@ -197,7 +202,8 @@ int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option, ninfo("usockid=%d; connect() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } diff --git a/net/usrsock/usrsock_ioctl.c b/net/usrsock/usrsock_ioctl.c index 9b24d818b2fcd..a95a34245c540 100644 --- a/net/usrsock/usrsock_ioctl.c +++ b/net/usrsock/usrsock_ioctl.c @@ -119,7 +119,9 @@ static uint16_t ioctl_event(FAR struct net_driver_s *dev, static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd, FAR void *arg, size_t arglen) { - struct usrsock_request_ioctl_s req = {}; + struct usrsock_request_ioctl_s req = + { + }; struct iovec bufs[2]; if (arglen > UINT16_MAX) @@ -159,10 +161,13 @@ static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd, * ****************************************************************************/ -int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg, size_t arglen) +int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg, + size_t arglen) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_data_reqstate_s state = {}; + struct usrsock_data_reqstate_s state = + { + }; struct iovec inbufs[1]; int ret; @@ -176,7 +181,8 @@ int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg, size_t argle ninfo("usockid=%d; ioctl() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } diff --git a/net/usrsock/usrsock_listen.c b/net/usrsock/usrsock_listen.c index 546055438dcb7..d4e5017629505 100644 --- a/net/usrsock/usrsock_listen.c +++ b/net/usrsock/usrsock_listen.c @@ -102,7 +102,9 @@ static uint16_t listen_event(FAR struct net_driver_s *dev, FAR void *pvconn, static int do_listen_request(FAR struct usrsock_conn_s *conn, int backlog) { - struct usrsock_request_listen_s req = {}; + struct usrsock_request_listen_s req = + { + }; struct iovec bufs[1]; if (backlog > UINT16_MAX) @@ -155,7 +157,9 @@ static int do_listen_request(FAR struct usrsock_conn_s *conn, int backlog) int usrsock_listen(FAR struct socket *psock, int backlog) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_reqstate_s state = {}; + struct usrsock_reqstate_s state = + { + }; int ret; DEBUGASSERT(conn); @@ -170,7 +174,8 @@ int usrsock_listen(FAR struct socket *psock, int backlog) ninfo("usockid=%d; listen() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNREFUSED; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNREFUSED; goto errout_unlock; } diff --git a/net/usrsock/usrsock_poll.c b/net/usrsock/usrsock_poll.c index 55dc85a14c79c..985554dc7e56b 100644 --- a/net/usrsock/usrsock_poll.c +++ b/net/usrsock/usrsock_poll.c @@ -183,7 +183,8 @@ static int usrsock_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds) /* Allocate a container to hold the poll information */ - info = (FAR struct usrsock_poll_s *)kmm_malloc(sizeof(struct usrsock_poll_s)); + info = (FAR struct usrsock_poll_s *) + kmm_malloc(sizeof(struct usrsock_poll_s)); if (!info) { return -ENOMEM; @@ -305,7 +306,8 @@ static int usrsock_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds) * * Input Parameters: * psock - An instance of the internal socket structure. - * fds - The structure describing the events to be stopped being monitored. + * fds - The structure describing the events to be stopped being + * monitored. * * Returned Value: * 0: Success; Negated errno on failure diff --git a/net/usrsock/usrsock_recvfrom.c b/net/usrsock/usrsock_recvfrom.c index a1dd191727b91..a3db76f9b0376 100644 --- a/net/usrsock/usrsock_recvfrom.c +++ b/net/usrsock/usrsock_recvfrom.c @@ -59,8 +59,9 @@ * Private Functions ****************************************************************************/ -static uint16_t recvfrom_event(FAR struct net_driver_s *dev, FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t recvfrom_event(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { FAR struct usrsock_data_reqstate_s *pstate = pvpriv; FAR struct usrsock_conn_s *conn = pvconn; @@ -103,7 +104,8 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev, FAR void *pvconn, pstate->reqstate.result == -EAGAIN) { /* After reception of data, mark input not ready. Daemon will - * send event to restore this flag. */ + * send event to restore this flag. + */ conn->flags &= ~USRSOCK_EVENT_RECVFROM_AVAIL; } @@ -161,7 +163,9 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev, FAR void *pvconn, static int do_recvfrom_request(FAR struct usrsock_conn_s *conn, size_t buflen, socklen_t addrlen) { - struct usrsock_request_recvfrom_s req = {}; + struct usrsock_request_recvfrom_s req = + { + }; struct iovec bufs[1]; if (addrlen > UINT16_MAX) @@ -214,7 +218,9 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, FAR socklen_t *fromlen) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_data_reqstate_s state = {}; + struct usrsock_data_reqstate_s state = + { + }; struct iovec inbufs[2]; socklen_t addrlen = 0; socklen_t outaddrlen = 0; @@ -246,7 +252,8 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, ninfo("usockid=%d; connect() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } @@ -432,7 +439,8 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, if (ret >= 0) { /* Store length of 'from' address that was available at - * daemon-side. */ + * daemon-side. + */ outaddrlen = state.valuelen_nontrunc; } diff --git a/net/usrsock/usrsock_sendto.c b/net/usrsock/usrsock_sendto.c index a9fa80ce595b3..75d1b63c514d4 100644 --- a/net/usrsock/usrsock_sendto.c +++ b/net/usrsock/usrsock_sendto.c @@ -90,7 +90,8 @@ static uint16_t sendto_event(FAR struct net_driver_s *dev, FAR void *pvconn, if (pstate->result >= 0 || pstate->result == -EAGAIN) { /* After reception of data, mark input not ready. Daemon will - * send event to restore this flag. */ + * send event to restore this flag. + */ conn->flags &= ~USRSOCK_EVENT_SENDTO_READY; } @@ -152,7 +153,9 @@ static int do_sendto_request(FAR struct usrsock_conn_s *conn, FAR const struct sockaddr *addr, socklen_t addrlen) { - struct usrsock_request_sendto_s req = {}; + struct usrsock_request_sendto_s req = + { + }; struct iovec bufs[3]; if (addrlen > UINT16_MAX) @@ -210,7 +213,9 @@ ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf, socklen_t tolen) { FAR struct usrsock_conn_s *conn = psock->s_conn; - struct usrsock_reqstate_s state = {}; + struct usrsock_reqstate_s state = + { + }; ssize_t ret; #ifdef CONFIG_NET_SOCKOPTS struct timespec abstime; @@ -229,7 +234,8 @@ ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf, ninfo("usockid=%d; connect() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } diff --git a/net/usrsock/usrsock_setsockopt.c b/net/usrsock/usrsock_setsockopt.c index 33071dbf61af3..fe31a16f4ad3b 100644 --- a/net/usrsock/usrsock_setsockopt.c +++ b/net/usrsock/usrsock_setsockopt.c @@ -60,8 +60,9 @@ * Private Functions ****************************************************************************/ -static uint16_t setsockopt_event(FAR struct net_driver_s *dev, FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t setsockopt_event(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { FAR struct usrsock_reqstate_s *pstate = pvpriv; FAR struct usrsock_conn_s *conn = pvconn; @@ -110,7 +111,9 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn, int level, int option, FAR const void *value, socklen_t value_len) { - struct usrsock_request_setsockopt_s req = {}; + struct usrsock_request_setsockopt_s req = + { + }; struct iovec bufs[2]; if (level < INT16_MIN || level > INT16_MAX) @@ -154,7 +157,8 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn, * Description: * psock_setsockopt() sets the option specified by the 'option' argument, * at the protocol level specified by the 'level' argument, to the value - * pointed to by the 'value' argument for the socket on the 'psock' argument. + * pointed to by the 'value' argument for the socket on the 'psock' + * argument. * * The 'level' argument specifies the protocol level of the option. To set * options at the socket level, specify the level argument as SOL_SOCKET. @@ -173,7 +177,9 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn, int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option, FAR const void *value, FAR socklen_t value_len) { - struct usrsock_reqstate_s state = {}; + struct usrsock_reqstate_s state = + { + }; ssize_t ret; DEBUGASSERT(conn); @@ -188,7 +194,8 @@ int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option, ninfo("usockid=%d; connect() with uninitialized usrsock.\n", conn->usockid); - ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET; + ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : + -ECONNRESET; goto errout_unlock; } diff --git a/net/usrsock/usrsock_socket.c b/net/usrsock/usrsock_socket.c index 23683dbe22efc..e0c4159e29d05 100644 --- a/net/usrsock/usrsock_socket.c +++ b/net/usrsock/usrsock_socket.c @@ -90,7 +90,8 @@ static uint16_t socket_event(FAR struct net_driver_s *dev, FAR void *pvconn, if (pstate->result >= 0) { /* We might start getting events for this socket right after - * returning to daemon, so setup 'conn' already here. */ + * returning to daemon, so setup 'conn' already here. + */ conn->state = USRSOCK_CONN_STATE_READY; conn->usockid = pstate->result; @@ -117,7 +118,9 @@ static uint16_t socket_event(FAR struct net_driver_s *dev, FAR void *pvconn, static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain, int type, int protocol) { - struct usrsock_request_socket_s req = {}; + struct usrsock_request_socket_s req = + { + }; struct iovec bufs[1]; /* Prepare request for daemon to read. */ @@ -160,10 +163,11 @@ static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain, * structure. * * Input Parameters: - * domain (see sys/socket.h) - * type (see sys/socket.h) - * protocol (see sys/socket.h) - * psock A pointer to a user allocated socket structure to be initialized. + * domain - (see sys/socket.h) + * type - (see sys/socket.h) + * protocol - (see sys/socket.h) + * psock - A pointer to a user allocated socket structure to be + * initialized. * * Returned Value: * 0 on success; negative error-code on error @@ -190,9 +194,12 @@ static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain, * ****************************************************************************/ -int usrsock_socket(int domain, int type, int protocol, FAR struct socket *psock) +int usrsock_socket(int domain, int type, int protocol, + FAR struct socket *psock) { - struct usrsock_reqstate_s state = {}; + struct usrsock_reqstate_s state = + { + }; FAR struct usrsock_conn_s *conn; int err; int ret; diff --git a/net/usrsock/usrsock_sockif.c b/net/usrsock/usrsock_sockif.c index ac6f88d2b96f4..7572d41ca2f66 100644 --- a/net/usrsock/usrsock_sockif.c +++ b/net/usrsock/usrsock_sockif.c @@ -56,7 +56,8 @@ * Private Function Prototypes ****************************************************************************/ -static int usrsock_sockif_setup(FAR struct socket *psock, int protocol); +static int usrsock_sockif_setup(FAR struct socket *psock, + int protocol); static sockcaps_t usrsock_sockif_sockcaps(FAR struct socket *psock); static void usrsock_sockif_addref(FAR struct socket *psock); static ssize_t usrsock_sockif_send(FAR struct socket *psock, @@ -105,8 +106,9 @@ const struct sock_intf_s g_usrsock_sockif = * specific socket fields. * * Input Parameters: - * psock A pointer to a user allocated socket structure to be initialized. - * protocol (see sys/socket.h) + * psock - A pointer to a user allocated socket structure to be + * initialized. + * protocol - (see sys/socket.h) * * Returned Value: * Zero (OK) is returned on success. Otherwise, a negated errno value is diff --git a/net/utils/net_chksum.c b/net/utils/net_chksum.c index 6527238775993..ac5095f0d07d4 100644 --- a/net/utils/net_chksum.c +++ b/net/utils/net_chksum.c @@ -1,7 +1,8 @@ /**************************************************************************** * net/utils/net_chksum.c * - * Copyright (C) 2007-2010, 2012, 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2012, 2014-2015 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -69,8 +70,9 @@ * data and len. * * Input Parameters: - * sum - Partial calculations carried over from a previous call to chksum(). - * This should be zero on the first time that check sum is called. + * sum - Partial calculations carried over from a previous call to + * chksum(). This should be zero on the first time that check + * sum is called. * data - Beginning of the data to include in the checksum. * len - Length of the data to include in the checksum. * diff --git a/net/utils/net_incr32.c b/net/utils/net_incr32.c index b80acb6f8d474..c50695e91e5a5 100644 --- a/net/utils/net_incr32.c +++ b/net/utils/net_incr32.c @@ -1,7 +1,8 @@ /**************************************************************************** * net/utils/net_incr32.c * - * Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All + * rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/net/utils/net_ipchksum.c b/net/utils/net_ipchksum.c index be96db9871f8f..15c62b1fa6085 100644 --- a/net/utils/net_ipchksum.c +++ b/net/utils/net_ipchksum.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/utils/net_ipchksum.c * - * Copyright (C) 2007-2010, 2012, 2014-2015, 2017-2018 Gregory Nutt. All + * Copyright (C) 2007-2010, 2012, 2014-2015, 2017-2018 Gregory Nutt. All * rights reserved. * Author: Gregory Nutt * @@ -100,8 +100,10 @@ uint16_t ipv4_upperlayer_chksum(FAR struct net_driver_s *dev, uint8_t proto) return 0; } - /* First sum pseudo-header. */ - /* IP protocol and length fields. This addition cannot carry. */ + /* First sum pseudo-header. + * + * IP protocol and length fields. This addition cannot carry. + */ sum = upperlen + proto; @@ -173,7 +175,8 @@ uint16_t ipv6_upperlayer_chksum(FAR struct net_driver_s *dev, /* Sum IP source and destination addresses. */ - sum = chksum(sum, (FAR uint8_t *)&ipv6->srcipaddr, 2 * sizeof(net_ipv6addr_t)); + sum = chksum(sum, (FAR uint8_t *)&ipv6->srcipaddr, + 2 * sizeof(net_ipv6addr_t)); /* Sum IP payload data. */ diff --git a/net/utils/net_tcpchksum.c b/net/utils/net_tcpchksum.c index 364887f0634db..2f96f2a30249d 100644 --- a/net/utils/net_tcpchksum.c +++ b/net/utils/net_tcpchksum.c @@ -1,7 +1,8 @@ /**************************************************************************** * net/utils/net_tcpchksum.c * - * Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All + * rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/net/utils/net_udpchksum.c b/net/utils/net_udpchksum.c index 7f98e847e642b..533475b06beab 100644 --- a/net/utils/net_udpchksum.c +++ b/net/utils/net_udpchksum.c @@ -1,7 +1,8 @@ /**************************************************************************** * net/utils/net_udpchksum.c * - * Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All + * rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/tools/nxstyle.c b/tools/nxstyle.c index edc6037d62751..4c36a0dfe362b 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -1068,20 +1068,20 @@ int main(int argc, char **argv, char **envp) break; case '/': - /* C++-style comment */ + /* C comment terminator*/ - if (line[n] == '/') + if (line[n - 1] == '*') { - if (line[n - 1] == '*') - { - n++; - } - else if (line[n + 1] == '/') - { - fprintf(stderr, "C++ style comment on at %d:%d\n", - lineno, n); - n++; - } + n++; + } + + /* C++-style comment */ + + else if (line[n + 1] == '/') + { + fprintf(stderr, "C++ style comment on at %d:%d\n", + lineno, n); + n++; } /* /= */ @@ -1091,6 +1091,9 @@ int main(int argc, char **argv, char **envp) check_spaces_leftright(line, lineno, n, n + 1); n++; } + + /* Division operator */ + else { check_spaces_leftright(line, lineno, n, n);