You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/10 14:18:25 UTC

[incubator-nuttx] 08/08: netlink: Fix nxstyle issue

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 581dbb22fe5da600a1cc0e74c9ae9c4c3deaa72e
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Apr 10 21:03:34 2020 +0800

    netlink: Fix nxstyle issue
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 include/nuttx/net/netlink.h  |  4 +--
 net/netlink/netlink.h        |  6 ++--
 net/netlink/netlink_conn.c   |  7 ++--
 net/netlink/netlink_route.c  | 78 +++++++++++++++++++++++---------------------
 net/netlink/netlink_sockif.c | 17 ++++++----
 5 files changed, 59 insertions(+), 53 deletions(-)

diff --git a/include/nuttx/net/netlink.h b/include/nuttx/net/netlink.h
index cf1655b..04f9eaa 100644
--- a/include/nuttx/net/netlink.h
+++ b/include/nuttx/net/netlink.h
@@ -54,8 +54,8 @@
  * Public Types
  ****************************************************************************/
 
-/* This is the form of the obfuscated state structure passed to modules outside of the
- * networking layer.
+/* This is the form of the obfuscated state structure passed to modules
+ * outside of the networking layer.
  */
 
 typedef FAR void *NETLINK_HANDLE;
diff --git a/net/netlink/netlink.h b/net/netlink/netlink.h
index fc58cf8..9e04f0a 100644
--- a/net/netlink/netlink.h
+++ b/net/netlink/netlink.h
@@ -59,7 +59,7 @@
  * Public Type Definitions
  ****************************************************************************/
 
-/* This "connection" structure describes the underlying state of the socket. */
+/* This connection structure describes the underlying state of the socket. */
 
 struct netlink_conn_s
 {
@@ -127,8 +127,8 @@ FAR struct netlink_conn_s *netlink_alloc(void);
  * Name: netlink_free()
  *
  * Description:
- *   Free a NetLink connection structure that is no longer in use. This should
- *   be done by the implementation of close().
+ *   Free a NetLink connection structure that is no longer in use. This
+ *   should be done by the implementation of close().
  *
  ****************************************************************************/
 
diff --git a/net/netlink/netlink_conn.c b/net/netlink/netlink_conn.c
index cbd18c5..331beec 100644
--- a/net/netlink/netlink_conn.c
+++ b/net/netlink/netlink_conn.c
@@ -171,7 +171,8 @@ FAR struct netlink_conn_s *netlink_alloc(void)
   /* The free list is protected by a semaphore (that behaves like a mutex). */
 
   _netlink_semtake(&g_free_sem);
-  conn = (FAR struct netlink_conn_s *)dq_remfirst(&g_free_netlink_connections);
+  conn = (FAR struct netlink_conn_s *)
+           dq_remfirst(&g_free_netlink_connections);
   if (conn != NULL)
     {
       /* Make sure that the connection is marked as uninitialized */
@@ -191,8 +192,8 @@ FAR struct netlink_conn_s *netlink_alloc(void)
  * Name: netlink_free()
  *
  * Description:
- *   Free a NetLink connection structure that is no longer in use. This should
- *   be done by the implementation of close().
+ *   Free a NetLink connection structure that is no longer in use. This
+ *   should be done by the implementation of close().
  *
  ****************************************************************************/
 
diff --git a/net/netlink/netlink_route.c b/net/netlink/netlink_route.c
index 46fd844..f42b95d 100644
--- a/net/netlink/netlink_route.c
+++ b/net/netlink/netlink_route.c
@@ -260,8 +260,8 @@ static int netlink_device_callback(FAR struct net_driver_s *dev,
 #endif
 
 #ifdef CONFIG_NET_IPv6
-        /* Should have info->psock->s_domain == PF_INET6 but d_lltype could be
-         * several things.
+        /* Should have info->psock->s_domain == PF_INET6 but d_lltype could
+         * be several things.
          */
 
       case AF_INET6:
@@ -277,8 +277,8 @@ static int netlink_device_callback(FAR struct net_driver_s *dev,
 #endif
 
 #ifdef CONFIG_NET_BLUETOOTH
-        /* Should have info->psock->s_domain == PF_PACKET and d_lltype should be
-         * NET_LL_BLUETOOTH.
+        /* Should have info->psock->s_domain == PF_PACKET and d_lltype should
+         * be NET_LL_BLUETOOTH.
          */
 
       case AF_BLUETOOTH:
@@ -387,7 +387,7 @@ static int netlink_device_callback(FAR struct net_driver_s *dev,
 
 #ifndef CONFIG_NETLINK_DISABLE_GETLINK
 static int netlink_get_devlist(FAR struct socket *psock,
-                               FAR const struct nlroute_sendto_request_s *req)
+                              FAR const struct nlroute_sendto_request_s *req)
 {
   struct nlroute_info_s info;
   FAR struct nlroute_msgdone_rsplist_s *alloc;
@@ -444,7 +444,7 @@ static int netlink_get_devlist(FAR struct socket *psock,
 
 #if defined(CONFIG_NET_ARP) && !defined(CONFIG_NETLINK_DISABLE_GETNEIGH)
 static int netlink_get_arptable(FAR struct socket *psock,
-                                FAR const struct nlroute_sendto_request_s *req)
+                              FAR const struct nlroute_sendto_request_s *req)
 {
   FAR struct getneigh_recvfrom_rsplist_s *entry;
   unsigned int ncopied;
@@ -462,7 +462,7 @@ static int netlink_get_arptable(FAR struct socket *psock,
   rspsize   = SIZEOF_NLROUTE_RECVFROM_RESPONSE_S(tabsize);
   allocsize = SIZEOF_NLROUTE_RECVFROM_RSPLIST_S(tabsize);
 
-  entry     = (FAR struct getneigh_recvfrom_rsplist_s *)kmm_zalloc(allocsize);
+  entry = (FAR struct getneigh_recvfrom_rsplist_s *)kmm_zalloc(allocsize);
   if (entry == NULL)
     {
       nerr("ERROR: Failed to allocate response buffer.\n");
@@ -526,7 +526,7 @@ static int netlink_get_arptable(FAR struct socket *psock,
 
 #if defined(CONFIG_NET_IPv6) && !defined(CONFIG_NETLINK_DISABLE_GETNEIGH)
 static int netlink_get_nbtable(FAR struct socket *psock,
-                               FAR const struct nlroute_sendto_request_s *req)
+                              FAR const struct nlroute_sendto_request_s *req)
 {
   FAR struct getneigh_recvfrom_rsplist_s *entry;
   unsigned int ncopied;
@@ -545,7 +545,7 @@ static int netlink_get_nbtable(FAR struct socket *psock,
   rspsize   = SIZEOF_NLROUTE_RECVFROM_RESPONSE_S(tabsize);
   allocsize = SIZEOF_NLROUTE_RECVFROM_RSPLIST_S(tabsize);
 
-  entry     = (FAR struct getneigh_recvfrom_rsplist_s *)kmm_zalloc(allocsize);
+  entry = (FAR struct getneigh_recvfrom_rsplist_s *)kmm_zalloc(allocsize);
   if (entry == NULL)
     {
       nerr("ERROR: Failed to allocate response buffer.\n");
@@ -564,8 +564,9 @@ static int netlink_get_nbtable(FAR struct socket *psock,
    */
 
   net_lock();
-  ncopied = neighbor_snapshot((FAR struct neighbor_entry_s *)entry->payload.data,
-                              CONFIG_NET_IPv6_NCONF_ENTRIES);
+  ncopied = neighbor_snapshot(
+    (FAR struct neighbor_entry_s *)entry->payload.data,
+    CONFIG_NET_IPv6_NCONF_ENTRIES);
   net_unlock();
 
   /* Now we have the real number of valid entries in the Neighbor table
@@ -671,21 +672,21 @@ static int netlink_ipv4_route(FAR struct net_route_ipv4_s *route,
 
   /* Format the response */
 
-  resp                        = &alloc->payload;
-  resp->hdr.nlmsg_len         = sizeof(struct getroute_recvfrom_ipv4response_s);
-  resp->hdr.nlmsg_type        = RTM_NEWROUTE;
-  resp->hdr.nlmsg_flags       = info->req->hdr.nlmsg_flags;
-  resp->hdr.nlmsg_seq         = info->req->hdr.nlmsg_seq;
-  resp->hdr.nlmsg_pid         = info->req->hdr.nlmsg_pid;
+  resp                  = &alloc->payload;
+  resp->hdr.nlmsg_len   = sizeof(struct getroute_recvfrom_ipv4response_s);
+  resp->hdr.nlmsg_type  = RTM_NEWROUTE;
+  resp->hdr.nlmsg_flags = info->req->hdr.nlmsg_flags;
+  resp->hdr.nlmsg_seq   = info->req->hdr.nlmsg_seq;
+  resp->hdr.nlmsg_pid   = info->req->hdr.nlmsg_pid;
 
-  resp->rte.rtm_family        = info->req->gen.rtgen_family;
-  resp->rte.rtm_table         = RT_TABLE_MAIN;
-  resp->rte.rtm_protocol      = RTPROT_STATIC;
-  resp->rte.rtm_scope         = RT_SCOPE_SITE;
+  resp->rte.rtm_family   = info->req->gen.rtgen_family;
+  resp->rte.rtm_table    = RT_TABLE_MAIN;
+  resp->rte.rtm_protocol = RTPROT_STATIC;
+  resp->rte.rtm_scope    = RT_SCOPE_SITE;
 
-  resp->dst.attr.rta_len      = RTA_LENGTH(sizeof(in_addr_t));
-  resp->dst.attr.rta_type     = RTA_DST;
-  resp->dst.addr              = route->target;
+  resp->dst.attr.rta_len  = RTA_LENGTH(sizeof(in_addr_t));
+  resp->dst.attr.rta_type = RTA_DST;
+  resp->dst.addr          = route->target;
 
   resp->genmask.attr.rta_len  = RTA_LENGTH(sizeof(in_addr_t));
   resp->genmask.attr.rta_type = RTA_GENMASK;
@@ -712,7 +713,7 @@ static int netlink_ipv4_route(FAR struct net_route_ipv4_s *route,
 
 #if defined(CONFIG_NET_IPv4) && !defined(CONFIG_NETLINK_DISABLE_GETROUTE)
 static int netlink_get_ipv4route(FAR struct socket *psock,
-                                 FAR const struct nlroute_sendto_request_s *req)
+                              FAR const struct nlroute_sendto_request_s *req)
 {
   struct nlroute_info_s info;
   int ret;
@@ -764,20 +765,20 @@ static int netlink_ipv6_route(FAR struct net_route_ipv6_s *route,
 
   /* Format the response */
 
-  resp                        = &alloc->payload;
-  resp->hdr.nlmsg_len         = sizeof(struct getroute_recvfrom_ipv6response_s);
-  resp->hdr.nlmsg_type        = RTM_NEWROUTE;
-  resp->hdr.nlmsg_flags       = info->req->hdr.nlmsg_flags;
-  resp->hdr.nlmsg_seq         = info->req->hdr.nlmsg_seq;
-  resp->hdr.nlmsg_pid         = info->req->hdr.nlmsg_pid;
+  resp                  = &alloc->payload;
+  resp->hdr.nlmsg_len   = sizeof(struct getroute_recvfrom_ipv6response_s);
+  resp->hdr.nlmsg_type  = RTM_NEWROUTE;
+  resp->hdr.nlmsg_flags = info->req->hdr.nlmsg_flags;
+  resp->hdr.nlmsg_seq   = info->req->hdr.nlmsg_seq;
+  resp->hdr.nlmsg_pid   = info->req->hdr.nlmsg_pid;
 
-  resp->rte.rtm_family        = info->req->gen.rtgen_family;
-  resp->rte.rtm_table         = RT_TABLE_MAIN;
-  resp->rte.rtm_protocol      = RTPROT_STATIC;
-  resp->rte.rtm_scope         = RT_SCOPE_SITE;
+  resp->rte.rtm_family   = info->req->gen.rtgen_family;
+  resp->rte.rtm_table    = RT_TABLE_MAIN;
+  resp->rte.rtm_protocol = RTPROT_STATIC;
+  resp->rte.rtm_scope    = RT_SCOPE_SITE;
 
-  resp->dst.attr.rta_len      = RTA_LENGTH(sizeof(net_ipv6addr_t));
-  resp->dst.attr.rta_type     = RTA_DST;
+  resp->dst.attr.rta_len  = RTA_LENGTH(sizeof(net_ipv6addr_t));
+  resp->dst.attr.rta_type = RTA_DST;
   net_ipv6addr_copy(resp->dst.addr, route->target);
 
   resp->genmask.attr.rta_len  = RTA_LENGTH(sizeof(net_ipv6addr_t));
@@ -805,7 +806,7 @@ static int netlink_ipv6_route(FAR struct net_route_ipv6_s *route,
 
 #if defined(CONFIG_NET_IPv6) && !defined(CONFIG_NETLINK_DISABLE_GETROUTE)
 static int netlink_get_ip6vroute(FAR struct socket *psock,
-                                 FAR const struct nlroute_sendto_request_s *req)
+                              FAR const struct nlroute_sendto_request_s *req)
 {
   struct nlroute_info_s info;
   int ret;
@@ -863,6 +864,7 @@ ssize_t netlink_route_sendto(FAR struct socket *psock,
       /* Dump a list of all devices */
 
       case RTM_GETLINK:
+
         /* Generate the response */
 
         ret = netlink_get_devlist(psock, req);
diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c
index 8d981c4..9295901 100644
--- a/net/netlink/netlink_sockif.c
+++ b/net/netlink/netlink_sockif.c
@@ -74,8 +74,9 @@ static int  netlink_getpeername(FAR struct socket *psock,
 static int  netlink_listen(FAR struct socket *psock, int backlog);
 static int  netlink_connect(FAR struct socket *psock,
               FAR const struct sockaddr *addr, socklen_t addrlen);
-static int  netlink_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
-              FAR socklen_t *addrlen, FAR struct socket *newsock);
+static int  netlink_accept(FAR struct socket *psock,
+              FAR struct sockaddr *addr, FAR socklen_t *addrlen,
+              FAR struct socket *newsock);
 static int  netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
               bool setup);
 static ssize_t netlink_send(FAR struct socket *psock,
@@ -428,7 +429,7 @@ static int netlink_listen(FAR struct socket *psock, int backlog)
  *   Perform a netlink connection
  *
  * Input Parameters:
- *   psock   A reference to the socket structure of the socket to be connected
+ *   psock   A reference to the structure of the socket to be connected
  *   addr    The address of the remote server to connect to
  *   addrlen Length of address buffer
  *
@@ -504,8 +505,9 @@ static int netlink_connect(FAR struct socket *psock,
  *
  ****************************************************************************/
 
-static int netlink_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
-                          FAR socklen_t *addrlen, FAR struct socket *newsock)
+static int netlink_accept(FAR struct socket *psock,
+                          FAR struct sockaddr *addr, FAR socklen_t *addrlen,
+                          FAR struct socket *newsock)
 {
   return -EOPNOTSUPP;
 }
@@ -643,7 +645,8 @@ static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
           conn->pollsem    = fds->sem;
           conn->pollevent  = &fds->revents;
 
-          ret = netlink_notifier_setup(netlink_response_available, conn, conn);
+          ret = netlink_notifier_setup(netlink_response_available,
+                                       conn, conn);
           if (ret < 0)
             {
               nerr("ERROR: netlink_notifier_setup() failed: %d\n", ret);
@@ -722,7 +725,7 @@ static ssize_t netlink_send(FAR struct socket *psock, FAR const void *buf,
  *   returned when the socket was not actually connected.
  *
  * Input Parameters:
- *   psock    A reference to the socket structure of the socket to be connected
+ *   psock    A reference to the structure of the socket to be connected
  *   buf      Data to send
  *   len      Length of data to send
  *   flags    Send flags (ignored)