Remove the duplicated _NX_ and _MQ_ macro

reuse the definition come from include/nuttx/fs/fs.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-02-15 22:29:45 +08:00 committed by Abdelatif Guettouche
parent f3043d133e
commit 35ec84ffca
4 changed files with 5 additions and 13 deletions

View File

@ -67,9 +67,6 @@
# define _MQ_TIMEDSEND(d,m,l,p,t) nxmq_timedsend(d,m,l,p,t)
# define _MQ_RECEIVE(d,m,l,p) nxmq_receive(d,m,l,p)
# define _MQ_TIMEDRECEIVE(d,m,l,p,t) nxmq_timedreceive(d,m,l,p,t)
# define _MQ_GETERRNO(r) (-(r))
# define _MQ_SETERRNO(r) set_errno(-(r))
# define _MQ_GETERRVAL(r) (r)
#else
# define _MQ_OPEN mq_open
# define _MQ_CLOSE(d) mq_close(d)
@ -78,9 +75,6 @@
# define _MQ_TIMEDSEND(d,m,l,p,t) mq_timedsend(d,m,l,p,t)
# define _MQ_RECEIVE(d,m,l,p) mq_receive(d,m,l,p)
# define _MQ_TIMEDRECEIVE(d,m,l,p,t) mq_timedreceive(d,m,l,p,t)
# define _MQ_GETERRNO(r) errno
# define _MQ_SETERRNO(r)
# define _MQ_GETERRVAL(r) (-errno)
#endif
/****************************************************************************

View File

@ -71,14 +71,10 @@
# define _NX_SEND(s,b,l,f) nx_send(s,b,l,f)
# define _NX_RECV(s,b,l,f) nx_recv(s,b,l,f)
# define _NX_RECVFROM(s,b,l,f,a,n) nx_recvfrom(s,b,l,f,a,n)
# define _NX_GETERRNO(r) (-(r))
# define _NX_GETERRVAL(r) (r)
#else
# define _NX_SEND(s,b,l,f) send(s,b,l,f)
# define _NX_RECV(s,b,l,f) recv(s,b,l,f)
# define _NX_RECVFROM(s,b,l,f,a,n) recvfrom(s,b,l,f,a,n)
# define _NX_GETERRNO(r) errno
# define _NX_GETERRVAL(r) (-errno)
#endif
/* Socket descriptors are the index into the TCB sockets list, offset by the

View File

@ -134,7 +134,7 @@ int nx_eventhandler(NXHANDLE handle)
nbytes = _MQ_RECEIVE(conn->crdmq, buffer, NX_MXCLIMSGLEN, 0);
if (nbytes < 0)
{
int errcode = _MQ_GETERRNO(nbytes);
int errcode = _NX_GETERRNO(nbytes);
/* EINTR is not an error. The wait was interrupted by a signal and
* we just need to try reading again.
@ -154,7 +154,7 @@ int nx_eventhandler(NXHANDLE handle)
else
{
gerr("ERROR: _MQ_RECEIVE failed: %d\n", errcode);
_MQ_SETERRNO(nbytes);
_NX_SETERRNO(nbytes);
return ERROR;
}
}

View File

@ -86,7 +86,9 @@ int nxmu_sendserver(FAR struct nxmu_conn_s *conn, FAR const void *msg,
ret = _MQ_SEND(conn->cwrmq, msg, msglen, NX_SVRMSG_PRIO);
if (ret < 0)
{
gerr("ERROR: _MQ_SEND failed: %d\n", _MQ_GETERRNO(ret));
_NX_SETERRNO(ret);
gerr("ERROR: _MQ_SEND failed: %d\n", _NX_GETERRNO(ret));
ret = ERROR;
}
return ret;