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/08 14:21:52 UTC

[incubator-nuttx] 22/31: Code style fixes

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

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

commit abdf87d8a1729d56e5c6ea314fbd8b0bce76ae11
Author: Jari van Ewijk <ja...@nxp.com>
AuthorDate: Fri Mar 13 13:48:10 2020 +0100

    Code style fixes
---
 fs/vfs/fs_write.c         |  3 ++-
 include/netpacket/can.h   | 46 +++++++++++++++++++++++-----------------------
 include/nuttx/can/error.h | 10 ++++++----
 include/nuttx/mm/iob.h    |  6 ++++--
 include/nuttx/net/can.h   | 10 ++++------
 include/nuttx/net/net.h   | 18 +++++++++---------
 6 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/fs/vfs/fs_write.c b/fs/vfs/fs_write.c
index ef5f137..b48812e 100644
--- a/fs/vfs/fs_write.c
+++ b/fs/vfs/fs_write.c
@@ -86,7 +86,8 @@
  *
  ****************************************************************************/
 
-ssize_t file_write(FAR struct file *filep, FAR const void *buf, size_t nbytes)
+ssize_t file_write(FAR struct file *filep, FAR const void *buf,
+                   size_t nbytes)
 {
   FAR struct inode *inode;
 
diff --git a/include/netpacket/can.h b/include/netpacket/can.h
index 0b4c7b9..4ea2104 100644
--- a/include/netpacket/can.h
+++ b/include/netpacket/can.h
@@ -102,37 +102,37 @@ struct sockaddr_can
   sa_family_t can_family;
   int16_t     can_ifindex;
   union
-    {
-      /* Transport protocol class address information */
+  {
+    /* Transport protocol class address information */
 
-      struct
-      {
-        canid_t rx_id;
-        canid_t tx_id;
-      } tp;
+    struct
+    {
+      canid_t rx_id;
+      canid_t tx_id;
+    } tp;
 
-      /* J1939 address information */
+    /* J1939 address information */
 
-      struct
-      {
-        /* 8 byte name when using dynamic addressing */
+    struct
+    {
+      /* 8 byte name when using dynamic addressing */
 
-        uint64_t name;
+      uint64_t name;
 
-        /* pgn:
-         *   8 bit: PS in PDU2 case, else 0
-         *   8 bit: PF
-         *   1 bit: DP
-         *   1 bit: reserved
-         */
+      /* pgn:
+       *   8 bit: PS in PDU2 case, else 0
+       *   8 bit: PF
+       *   1 bit: DP
+       *   1 bit: reserved
+       */
 
-        uint32_t pgn;
+      uint32_t pgn;
 
-        /* 1 byte address */
+      /* 1 byte address */
 
-        uint8_t addr;
-      } j1939;
-    } can_addr;
+      uint8_t addr;
+    } j1939;
+  } can_addr;
 };
 
 #endif /* __INCLUDE_NETPACKET_CAN_H */
diff --git a/include/nuttx/can/error.h b/include/nuttx/can/error.h
index 3463328..d9c2396 100644
--- a/include/nuttx/can/error.h
+++ b/include/nuttx/can/error.h
@@ -60,7 +60,8 @@
 
 /* arbitration lost in bit ... / data[0] */
 #define CAN_ERR_LOSTARB_UNSPEC   0x00 /* unspecified */
-				      /* else bit number in bitstream */
+
+/* else bit number in bitstream */
 
 /* error status of CAN-controller / data[1] */
 #define CAN_ERR_CRTL_UNSPEC      0x00 /* unspecified */
@@ -70,8 +71,8 @@
 #define CAN_ERR_CRTL_TX_WARNING  0x08 /* reached warning level for TX errors */
 #define CAN_ERR_CRTL_RX_PASSIVE  0x10 /* reached error passive status RX */
 #define CAN_ERR_CRTL_TX_PASSIVE  0x20 /* reached error passive status TX */
-				      /* (at least one error counter exceeds */
-				      /* the protocol-defined level of 127)  */
+                                      /* (at least one error counter exceeds */
+                                      /* the protocol-defined level of 127)  */
 #define CAN_ERR_CRTL_ACTIVE      0x40 /* recovered to error active state */
 
 /* error in CAN protocol (type) / data[2] */
@@ -108,7 +109,8 @@
 #define CAN_ERR_PROT_LOC_INTERM  0x12 /* intermission */
 
 /* error status of CAN-transceiver / data[4] */
-/*                                             CANH CANL */
+
+                                            /* CANH CANL */
 #define CAN_ERR_TRX_UNSPEC             0x00 /* 0000 0000 */
 #define CAN_ERR_TRX_CANH_NO_WIRE       0x04 /* 0000 0100 */
 #define CAN_ERR_TRX_CANH_SHORT_TO_BAT  0x05 /* 0000 0101 */
diff --git a/include/nuttx/mm/iob.h b/include/nuttx/mm/iob.h
index e986105..32c0bfd 100644
--- a/include/nuttx/mm/iob.h
+++ b/include/nuttx/mm/iob.h
@@ -252,7 +252,8 @@ void iob_initialize(void);
  * Name: iob_alloc
  *
  * Description:
- *   Allocate an I/O buffer by taking the buffer at the head of the free list.
+ *   Allocate an I/O buffer by taking the buffer at the head of the free
+ *   list.
  *
  ****************************************************************************/
 
@@ -590,7 +591,8 @@ void iob_dump(FAR const char *msg, FAR struct iob_s *iob, unsigned int len,
  * Name: iob_getuserstats
  *
  * Description:
- *   Return a reference to the IOB usage statistics for the IOB consumer/producer
+ *   Return a reference to the IOB usage statistics for the IOB
+ *   consumer/producer
  *
  * Input Parameters:
  *   userid - id representing the IOB producer/consumer
diff --git a/include/nuttx/net/can.h b/include/nuttx/net/can.h
index d426c7b..9cda480 100644
--- a/include/nuttx/net/can.h
+++ b/include/nuttx/net/can.h
@@ -53,15 +53,15 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define CAN_HDRLEN 4 //FIXME standard id vs extended
-#define NET_CAN_PKTSIZE sizeof(struct canfd_frame) // max size we can send through socket
-//FIXME think about can & canfd support
+#define CAN_HDRLEN 4                               /* FIXME standard id vs extended */
+#define NET_CAN_PKTSIZE sizeof(struct canfd_frame) /* max size we can send through socket*/
+
+/* FIXME think about can & canfd support */
 
 /****************************************************************************
  * Public Types
  ****************************************************************************/
 
-
 /****************************************************************************
  * Public Data
  ****************************************************************************/
@@ -74,8 +74,6 @@ extern "C"
 #define EXTERN extern
 #endif
 
-
-
 /****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h
index 20da67a..61f1f55 100644
--- a/include/nuttx/net/net.h
+++ b/include/nuttx/net/net.h
@@ -121,9 +121,9 @@
 
 /* Connection state encoding:
  *
- *  _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==0 - the socket was rudely disconnected
+ *  _SF_CONNECTED==1 && _SF_CLOSED==0 - socket is connected
+ *  _SF_CONNECTED==0 && _SF_CLOSED==1 - socket was gracefully disconnected
+ *  _SF_CONNECTED==0 && _SF_CLOSED==0 - socket was rudely disconnected
  */
 
 /* Macro to manage the socket state and flags */
@@ -214,7 +214,7 @@ struct sock_intf_s
                     FAR socklen_t *fromlen);
 #ifdef CONFIG_NET_RECVMSG_CMSG
   CODE ssize_t    (*si_recvmsg)(FAR struct socket *psock,
-		            FAR struct msghdr *msg, int flags);
+                FAR struct msghdr *msg, int flags);
 #endif
   CODE int        (*si_close)(FAR struct socket *psock);
 #ifdef CONFIG_NET_USRSOCK
@@ -504,9 +504,9 @@ FAR struct iob_s *net_ioballoc(bool throttled, enum iob_user_e consumerid);
  * Description:
  *   Check if the socket descriptor is valid for the provided TCB and if it
  *   supports the requested access.  This trivial operation is part of the
- *   fdopen() operation when the fdopen() is performed on a socket descriptor.
- *   It simply performs some sanity checking before permitting the socket
- *   descriptor to be wrapped as a C FILE stream.
+ *   fdopen() operation when the fdopen() is performed on a socket
+ *   descriptor.  It simply performs some sanity checking before permitting
+ *   the socket descriptor to be wrapped as a C FILE stream.
  *
  ****************************************************************************/
 
@@ -739,7 +739,7 @@ int psock_listen(FAR struct socket *psock, int backlog);
  * Input Parameters:
  *   psock    Reference to the listening socket structure
  *   addr     Receives the address of the connecting client
- *   addrlen  Input: allocated size of 'addr', Return: returned size of 'addr'
+ *   addrlen  Input: allocated size of addr, Return: returned size of addr
  *   newsock  Location to return the accepted socket information.
  *
  * Returned Value:
@@ -1563,7 +1563,7 @@ int net_vfcntl(int sockfd, int cmd, va_list ap);
  *
  * Input Parameters:
  *   dev    - The device driver structure to be registered.
- *   lltype - Link level protocol used by the driver (Ethernet, SLIP, TUN, ...
+ *   lltype - Link level protocol used by driver (Ethernet, SLIP, TUN, ...
  *
  * Returned Value:
  *   0:Success; negated errno on failure