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/01/31 19:30:53 UTC
[incubator-nuttx] 09/10: Add FAR for pointer type for socket header
files
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch pr192
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit f79e9f522b16710bd30e43e6923a3feacc9e5f0c
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Feb 1 02:47:00 2020 +0800
Add FAR for pointer type for socket header files
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
include/nuttx/net/ip.h | 28 ++++++++++++++--------------
include/nuttx/net/netdev.h | 11 ++++-------
include/sys/socket.h | 26 +++++++++++++-------------
3 files changed, 31 insertions(+), 34 deletions(-)
diff --git a/include/nuttx/net/ip.h b/include/nuttx/net/ip.h
index af1a31e..6ab63b5 100644
--- a/include/nuttx/net/ip.h
+++ b/include/nuttx/net/ip.h
@@ -261,12 +261,12 @@ extern "C"
#ifdef CONFIG_ENDIAN_BIG
# define net_ip4addr_conv32(addr) \
- (((in_addr_t)((uint16_t*)addr)[0] << 16) | \
- (in_addr_t)((uint16_t*)addr)[1])
+ (((in_addr_t)((FAR uint16_t *)addr)[0] << 16) | \
+ (in_addr_t)((FAR uint16_t *)addr)[1])
#else
# define net_ip4addr_conv32(addr) \
- (((in_addr_t)((uint16_t*)addr)[1] << 16) | \
- (in_addr_t)((uint16_t*)addr)[0])
+ (((in_addr_t)((FAR uint16_t *)addr)[1] << 16) | \
+ (in_addr_t)((FAR uint16_t *)addr)[0])
#endif
/****************************************************************************
@@ -304,14 +304,14 @@ extern "C"
#define ip6_addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) \
do { \
- ((uint16_t*)(addr))[0] = HTONS((addr0)); \
- ((uint16_t*)(addr))[1] = HTONS((addr1)); \
- ((uint16_t*)(addr))[2] = HTONS((addr2)); \
- ((uint16_t*)(addr))[3] = HTONS((addr3)); \
- ((uint16_t*)(addr))[4] = HTONS((addr4)); \
- ((uint16_t*)(addr))[5] = HTONS((addr5)); \
- ((uint16_t*)(addr))[6] = HTONS((addr6)); \
- ((uint16_t*)(addr))[7] = HTONS((addr7)); \
+ ((FAR uint16_t *)(addr))[0] = HTONS((addr0)); \
+ ((FAR uint16_t *)(addr))[1] = HTONS((addr1)); \
+ ((FAR uint16_t *)(addr))[2] = HTONS((addr2)); \
+ ((FAR uint16_t *)(addr))[3] = HTONS((addr3)); \
+ ((FAR uint16_t *)(addr))[4] = HTONS((addr4)); \
+ ((FAR uint16_t *)(addr))[5] = HTONS((addr5)); \
+ ((FAR uint16_t *)(addr))[6] = HTONS((addr6)); \
+ ((FAR uint16_t *)(addr))[7] = HTONS((addr7)); \
} while (0)
/****************************************************************************
@@ -415,8 +415,8 @@ extern "C"
} while (0)
# define net_ipv4addr_hdrcopy(dest, src) \
do { \
- ((uint16_t*)(dest))[0] = ((uint16_t*)(src))[0]; \
- ((uint16_t*)(dest))[1] = ((uint16_t*)(src))[1]; \
+ ((FAR uint16_t *)(dest))[0] = ((FAR uint16_t *)(src))[0]; \
+ ((FAR uint16_t *)(dest))[1] = ((FAR uint16_t *)(src))[1]; \
} while (0)
#endif
diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h
index 3ab2fc9..360f7af 100644
--- a/include/nuttx/net/netdev.h
+++ b/include/nuttx/net/netdev.h
@@ -51,10 +51,7 @@
#include <sys/ioctl.h>
#include <stdint.h>
-
-#ifdef CONFIG_NET_MCASTGROUP
-# include <queue.h>
-#endif
+#include <queue.h>
#include <net/if.h>
#include <net/ethernet.h>
@@ -308,14 +305,14 @@ struct net_driver_s
* or written to in the packet buffer.
*/
- uint8_t *d_appdata;
+ FAR uint8_t *d_appdata;
#ifdef CONFIG_NET_TCPURGDATA
/* This pointer points to any urgent TCP data that has been received. Only
* present if compiled with support for urgent data (CONFIG_NET_TCPURGDATA).
*/
- uint8_t *d_urgdata;
+ FAR uint8_t *d_urgdata;
/* Length of the (received) urgent data */
@@ -400,7 +397,7 @@ struct net_driver_s
/* Drivers may attached device-specific, private information */
- void *d_private;
+ FAR void *d_private;
};
typedef CODE int (*devif_poll_callback_t)(FAR struct net_driver_s *dev);
diff --git a/include/sys/socket.h b/include/sys/socket.h
index b462cda..bbf350a 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -107,7 +107,7 @@
#define SOCK_PACKET 10 /* Obsolete and should not be used in new programs */
/* Bits in the FLAGS argument to `send', `recv', et al. These are the bits
- * recognized by Linus, not all are supported by NuttX.
+ * recognized by Linux, not all are supported by NuttX.
*/
#define MSG_OOB 0x0001 /* Process out-of-band data. */
@@ -238,7 +238,7 @@
#define CMSG_ALIGN(len) \
(((len)+sizeof(long)-1) & ~(sizeof(long)-1))
#define CMSG_DATA(cmsg) \
- ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
+ ((FAR void *)((FAR char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
#define CMSG_SPACE(len) \
(CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
#define CMSG_LEN(len) \
@@ -298,11 +298,11 @@ struct linger
struct msghdr
{
- void *msg_name; /* Socket name */
+ FAR void *msg_name; /* Socket name */
int msg_namelen; /* Length of name */
- struct iovec *msg_iov; /* Data blocks */
+ FAR struct iovec *msg_iov; /* Data blocks */
unsigned long msg_iovlen; /* Number of blocks */
- void *msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
+ FAR void *msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
unsigned long msg_controllen; /* Length of cmsg list */
unsigned int msg_flags;
};
@@ -318,23 +318,23 @@ struct cmsghdr
* Inline Functions
****************************************************************************/
-static inline struct cmsghdr *__cmsg_nxthdr(FAR void *__ctl,
- unsigned int __size,
- FAR struct cmsghdr *__cmsg)
+static inline FAR struct cmsghdr *__cmsg_nxthdr(FAR void *__ctl,
+ unsigned int __size,
+ FAR struct cmsghdr *__cmsg)
{
FAR struct cmsghdr *__ptr;
- __ptr = (struct cmsghdr *)(((unsigned char *)__cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
- if ((unsigned long)((char *)(__ptr + 1) - (char *)__ctl) > __size)
+ __ptr = (FAR struct cmsghdr *)(((FAR char *)__cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
+ if ((unsigned long)((FAR char *)(__ptr + 1) - (FAR char *)__ctl) > __size)
{
- return (struct cmsghdr *)0;
+ return (FAR struct cmsghdr *)NULL;
}
return __ptr;
}
-static inline struct cmsghdr *cmsg_nxthdr(FAR struct msghdr *__msg,
- FAR struct cmsghdr *__cmsg)
+static inline FAR struct cmsghdr *cmsg_nxthdr(FAR struct msghdr *__msg,
+ FAR struct cmsghdr *__cmsg)
{
return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
}