Add FAR for pointer type for socket header files

This commit is contained in:
Xiang Xiao 2020-02-01 02:47:00 +08:00 committed by Gregory Nutt
parent c1b0aa118c
commit 3ae5f52757
3 changed files with 31 additions and 34 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);
}