mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
net: Make si_poll callback optional
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
c39be172da
commit
3c3dea5d7a
@@ -59,8 +59,6 @@ static int bluetooth_getpeername(FAR struct socket *psock,
|
|||||||
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
|
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
|
||||||
static int bluetooth_connect(FAR struct socket *psock,
|
static int bluetooth_connect(FAR struct socket *psock,
|
||||||
FAR const struct sockaddr *addr, socklen_t addrlen);
|
FAR const struct sockaddr *addr, socklen_t addrlen);
|
||||||
static int bluetooth_poll_local(FAR struct socket *psock,
|
|
||||||
FAR struct pollfd *fds, bool setup);
|
|
||||||
static int bluetooth_close(FAR struct socket *psock);
|
static int bluetooth_close(FAR struct socket *psock);
|
||||||
|
|
||||||
/* Protocol Specific Interfaces */
|
/* Protocol Specific Interfaces */
|
||||||
@@ -86,7 +84,7 @@ const struct sock_intf_s g_bluetooth_sockif =
|
|||||||
NULL, /* si_listen */
|
NULL, /* si_listen */
|
||||||
bluetooth_connect, /* si_connect */
|
bluetooth_connect, /* si_connect */
|
||||||
NULL, /* si_accept */
|
NULL, /* si_accept */
|
||||||
bluetooth_poll_local, /* si_poll */
|
NULL, /* si_poll */
|
||||||
bluetooth_sendmsg, /* si_sendmsg */
|
bluetooth_sendmsg, /* si_sendmsg */
|
||||||
bluetooth_recvmsg, /* si_recvmsg */
|
bluetooth_recvmsg, /* si_recvmsg */
|
||||||
bluetooth_close /* si_close */
|
bluetooth_close /* si_close */
|
||||||
@@ -616,35 +614,6 @@ static int bluetooth_getpeername(FAR struct socket *psock,
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: bluetooth_poll
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* The standard poll() operation redirects operations on socket descriptors
|
|
||||||
* to net_poll which, indiectly, calls to function.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* psock - An instance of the internal socket structure.
|
|
||||||
* fds - The structure describing the events to be monitored, OR NULL if
|
|
||||||
* this is a request to stop monitoring events.
|
|
||||||
* setup - true: Setup up the poll; false: Teardown the poll
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* 0: Success; Negated errno on failure
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static int bluetooth_poll_local(FAR struct socket *psock,
|
|
||||||
FAR struct pollfd *fds, bool setup)
|
|
||||||
{
|
|
||||||
/* We should need to support some kind of write ahead buffering for this
|
|
||||||
* feature.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#warning Missing logic
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: bluetooth_close
|
* Name: bluetooth_close
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ static int ieee802154_getpeername(FAR struct socket *psock,
|
|||||||
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
|
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
|
||||||
static int ieee802154_connect(FAR struct socket *psock,
|
static int ieee802154_connect(FAR struct socket *psock,
|
||||||
FAR const struct sockaddr *addr, socklen_t addrlen);
|
FAR const struct sockaddr *addr, socklen_t addrlen);
|
||||||
static int ieee802154_poll_local(FAR struct socket *psock,
|
|
||||||
FAR struct pollfd *fds, bool setup);
|
|
||||||
static int ieee802154_close(FAR struct socket *psock);
|
static int ieee802154_close(FAR struct socket *psock);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -76,7 +74,7 @@ const struct sock_intf_s g_ieee802154_sockif =
|
|||||||
NULL, /* si_listen */
|
NULL, /* si_listen */
|
||||||
ieee802154_connect, /* si_connect */
|
ieee802154_connect, /* si_connect */
|
||||||
NULL, /* si_accept */
|
NULL, /* si_accept */
|
||||||
ieee802154_poll_local, /* si_poll */
|
NULL, /* si_poll */
|
||||||
ieee802154_sendmsg, /* si_sendmsg */
|
ieee802154_sendmsg, /* si_sendmsg */
|
||||||
ieee802154_recvmsg, /* si_recvmsg */
|
ieee802154_recvmsg, /* si_recvmsg */
|
||||||
ieee802154_close /* si_close */
|
ieee802154_close /* si_close */
|
||||||
@@ -490,35 +488,6 @@ static int ieee802154_getpeername(FAR struct socket *psock,
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: ieee802154_poll
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* The standard poll() operation redirects operations on socket descriptors
|
|
||||||
* to net_poll which, indiectly, calls to function.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* psock - An instance of the internal socket structure.
|
|
||||||
* fds - The structure describing the events to be monitored, OR NULL if
|
|
||||||
* this is a request to stop monitoring events.
|
|
||||||
* setup - true: Setup up the poll; false: Teardown the poll
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* 0: Success; Negated errno on failure
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static int ieee802154_poll_local(FAR struct socket *psock,
|
|
||||||
FAR struct pollfd *fds, bool setup)
|
|
||||||
{
|
|
||||||
/* We should need to support some kind of write ahead buffering for this
|
|
||||||
* feature.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#warning Missing logic
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ieee802154_close
|
* Name: ieee802154_close
|
||||||
*
|
*
|
||||||
|
|||||||
+1
-27
@@ -52,8 +52,6 @@ static sockcaps_t pkt_sockcaps(FAR struct socket *psock);
|
|||||||
static void pkt_addref(FAR struct socket *psock);
|
static void pkt_addref(FAR struct socket *psock);
|
||||||
static int pkt_bind(FAR struct socket *psock,
|
static int pkt_bind(FAR struct socket *psock,
|
||||||
FAR const struct sockaddr *addr, socklen_t addrlen);
|
FAR const struct sockaddr *addr, socklen_t addrlen);
|
||||||
static int pkt_poll_local(FAR struct socket *psock,
|
|
||||||
FAR struct pollfd *fds, bool setup);
|
|
||||||
static int pkt_close(FAR struct socket *psock);
|
static int pkt_close(FAR struct socket *psock);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -71,7 +69,7 @@ const struct sock_intf_s g_pkt_sockif =
|
|||||||
NULL, /* si_listen */
|
NULL, /* si_listen */
|
||||||
NULL, /* si_connect */
|
NULL, /* si_connect */
|
||||||
NULL, /* si_accept */
|
NULL, /* si_accept */
|
||||||
pkt_poll_local, /* si_poll */
|
NULL, /* si_poll */
|
||||||
pkt_sendmsg, /* si_sendmsg */
|
pkt_sendmsg, /* si_sendmsg */
|
||||||
pkt_recvmsg, /* si_recvmsg */
|
pkt_recvmsg, /* si_recvmsg */
|
||||||
pkt_close /* si_close */
|
pkt_close /* si_close */
|
||||||
@@ -274,30 +272,6 @@ static int pkt_bind(FAR struct socket *psock,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: pkt_poll
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* The standard poll() operation redirects operations on socket descriptors
|
|
||||||
* to net_poll which, indiectly, calls to function.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* psock - An instance of the internal socket structure.
|
|
||||||
* fds - The structure describing the events to be monitored, OR NULL if
|
|
||||||
* this is a request to stop monitoring events.
|
|
||||||
* setup - true: Setup up the poll; false: Teardown the poll
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* 0: Success; Negated errno on failure
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static int pkt_poll_local(FAR struct socket *psock, FAR struct pollfd *fds,
|
|
||||||
bool setup)
|
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: pkt_close
|
* Name: pkt_close
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ int psock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup)
|
|||||||
|
|
||||||
/* Let the address family's poll() method handle the operation */
|
/* Let the address family's poll() method handle the operation */
|
||||||
|
|
||||||
DEBUGASSERT(psock->s_sockif != NULL && psock->s_sockif->si_poll != NULL);
|
DEBUGASSERT(psock->s_sockif != NULL);
|
||||||
|
if (psock->s_sockif->si_poll == NULL)
|
||||||
|
{
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
return psock->s_sockif->si_poll(psock, fds, setup);
|
return psock->s_sockif->si_poll(psock, fds, setup);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user