nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx-apps] 03/03: netlib: fix nxstyle issue for netlink related code
Date Fri, 10 Apr 2020 15:22:18 GMT
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-apps.git

commit 95efbf7e62d2b3abf201078807c6413d7386aaed
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
AuthorDate: Fri Apr 10 20:27:58 2020 +0800

    netlib: fix nxstyle issue for netlink related code
    
    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
 netutils/netlib/netlib_getarptab.c | 16 ++++++++--------
 netutils/netlib/netlib_getdevs.c   |  9 ++++++---
 netutils/netlib/netlib_getnbtab.c  | 16 ++++++++--------
 netutils/netlib/netlib_getroute.c  |  9 +++++----
 4 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/netutils/netlib/netlib_getarptab.c b/netutils/netlib/netlib_getarptab.c
index 1dbcf76..bc32544 100644
--- a/netutils/netlib/netlib_getarptab.c
+++ b/netutils/netlib/netlib_getarptab.c
@@ -144,7 +144,7 @@ ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab,
   addr.nl_groups = 0;
 
   ret = bind(fd, (FAR const struct sockaddr *)&addr,
-             sizeof( struct sockaddr_nl));
+             sizeof(struct sockaddr_nl));
   if (ret < 0)
     {
       int errcode = errno;
@@ -195,17 +195,17 @@ ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab,
       goto errout_with_socket;
     }
 
-   /* The sequence number in the response should match the sequence
-    * number in the request (since we created the socket, this should
-    * always be true).
-    */
+  /* The sequence number in the response should match the sequence
+   * number in the request (since we created the socket, this should
+   * always be true).
+   */
 
-   if (resp->hdr.nlmsg_seq != thiseq)
-     {
+  if (resp->hdr.nlmsg_seq != thiseq)
+    {
       fprintf(stderr, "ERROR: Bad sequence number in response\n");
       ret = -EIO;
       goto errout_with_socket;
-     }
+    }
 
   /* Copy the ARP table data to the caller's buffer */
 
diff --git a/netutils/netlib/netlib_getdevs.c b/netutils/netlib/netlib_getdevs.c
index 6093547..64a48d5 100644
--- a/netutils/netlib/netlib_getdevs.c
+++ b/netutils/netlib/netlib_getdevs.c
@@ -132,7 +132,7 @@ ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
   addr.nl_groups = 0;
 
   ret = bind(fd, (FAR const struct sockaddr *)&addr,
-             sizeof( struct sockaddr_nl));
+             sizeof(struct sockaddr_nl));
   if (ret < 0)
     {
       int errcode = errno;
@@ -203,7 +203,9 @@ ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
 
       switch (resp.hdr.nlmsg_type)
         {
-          /* NLMSG_DONE means that the entire list of devices has been returned */
+          /* NLMSG_DONE means that the entire list of devices has been
+           * returned
+           */
 
           case NLMSG_DONE:
             enddump = true;
@@ -220,7 +222,8 @@ ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
 
               if (nrecvd != sizeof(struct netlib_recvfrom_response_s))
                 {
-                  fprintf(stderr, "ERROR: Bad massage size: %ld\n", (long)nrecvd);
+                  fprintf(stderr, "ERROR: Bad massage size: %ld\n",
+                          (long)nrecvd);
                   goto errout_with_socket;
                 }
 
diff --git a/netutils/netlib/netlib_getnbtab.c b/netutils/netlib/netlib_getnbtab.c
index a6c3c54..a94f777 100644
--- a/netutils/netlib/netlib_getnbtab.c
+++ b/netutils/netlib/netlib_getnbtab.c
@@ -145,7 +145,7 @@ ssize_t netlib_get_nbtable(FAR struct neighbor_entry_s *nbtab,
   addr.nl_groups = 0;
 
   ret = bind(fd, (FAR const struct sockaddr *)&addr,
-             sizeof( struct sockaddr_nl));
+             sizeof(struct sockaddr_nl));
   if (ret < 0)
     {
       int errcode = errno;
@@ -196,17 +196,17 @@ ssize_t netlib_get_nbtable(FAR struct neighbor_entry_s *nbtab,
       goto errout_with_socket;
     }
 
-   /* The sequence number in the response should match the sequence
-    * number in the request (since we created the socket, this should
-    * always be true).
-    */
+  /* The sequence number in the response should match the sequence
+   * number in the request (since we created the socket, this should
+   * always be true).
+   */
 
-   if (resp->hdr.nlmsg_seq != thiseq)
-     {
+  if (resp->hdr.nlmsg_seq != thiseq)
+    {
       fprintf(stderr, "ERROR: Bad sequence number in response\n");
       ret = -EIO;
       goto errout_with_socket;
-     }
+    }
 
   /* Copy the Neighbor table data to the caller's buffer */
 
diff --git a/netutils/netlib/netlib_getroute.c b/netutils/netlib/netlib_getroute.c
index 502aec4..9e66787 100644
--- a/netutils/netlib/netlib_getroute.c
+++ b/netutils/netlib/netlib_getroute.c
@@ -161,7 +161,7 @@ ssize_t netlib_get_route(FAR struct rtentry *rtelist,
   addr.nl_groups = 0;
 
   ret = bind(fd, (FAR const struct sockaddr *)&addr,
-             sizeof( struct sockaddr_nl));
+             sizeof(struct sockaddr_nl));
   if (ret < 0)
     {
       int errcode = errno;
@@ -258,7 +258,8 @@ ssize_t netlib_get_route(FAR struct rtentry *rtelist,
               if (nrecvd <= sizeof(struct netlib_recvfrom_response_s) ||
                   u.resp.rte.rtm_family != family)
                 {
-                  fprintf(stderr, "ERROR: Bad massage size: %ld\n", (long)nrecvd);
+                  fprintf(stderr, "ERROR: Bad massage size: %ld\n",
+                          (long)nrecvd);
                   goto errout_with_socket;
                 }
 
@@ -320,8 +321,8 @@ ssize_t netlib_get_route(FAR struct rtentry *rtelist,
             break;
 
           default:
-            fprintf(stderr, "ERROR: Message type %u, length %lu\n",
-                    u.resp.hdr.nlmsg_type, (unsigned long)u.resp.hdr.nlmsg_len);
+            fprintf(stderr, "ERROR: Message type %u, length %u\n",
+                    u.resp.hdr.nlmsg_type, (unsigned)u.resp.hdr.nlmsg_len);
             ret = -EIO;
             goto errout_with_socket;
         }


Mime
View raw message