From 1c024a6d397c1c376a2a52f32ac47776eb53b4e8 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 1 May 2020 18:15:33 +0800 Subject: [PATCH] Remove the argument from get_errno Signed-off-by: Xiang Xiao --- fs/hostfs/hostfs_rpmsg_server.c | 19 ++++++++++--------- include/errno.h | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/hostfs/hostfs_rpmsg_server.c b/fs/hostfs/hostfs_rpmsg_server.c index dac6caf9c4..c10ed27f93 100644 --- a/fs/hostfs/hostfs_rpmsg_server.c +++ b/fs/hostfs/hostfs_rpmsg_server.c @@ -481,7 +481,7 @@ static int hostfs_rpmsg_closedir_handler(FAR struct rpmsg_endpoint *ept, nxsem_wait(&priv->sem); priv->dirs[msg->fd] = NULL; nxsem_post(&priv->sem); - ret = ret ? get_errno(ret) : 0; + ret = ret ? -get_errno() : 0; } msg->header.result = ret; @@ -496,7 +496,7 @@ static int hostfs_rpmsg_statfs_handler(FAR struct rpmsg_endpoint *ept, int ret; ret = statfs(msg->pathname, &msg->buf); - msg->header.result = ret ? get_errno(ret) : 0; + msg->header.result = ret ? -get_errno() : 0; return rpmsg_send(ept, msg, sizeof(*msg)); } @@ -508,7 +508,7 @@ static int hostfs_rpmsg_unlink_handler(FAR struct rpmsg_endpoint *ept, int ret; ret = unlink(msg->pathname); - msg->header.result = ret ? get_errno(ret) : 0; + msg->header.result = ret ? -get_errno() : 0; return rpmsg_send(ept, msg, sizeof(*msg)); } @@ -520,7 +520,7 @@ static int hostfs_rpmsg_mkdir_handler(FAR struct rpmsg_endpoint *ept, int ret; ret = mkdir(msg->pathname, msg->mode); - msg->header.result = ret ? get_errno(ret) : 0; + msg->header.result = ret ? -get_errno() : 0; return rpmsg_send(ept, msg, sizeof(*msg)); } @@ -532,7 +532,7 @@ static int hostfs_rpmsg_rmdir_handler(FAR struct rpmsg_endpoint *ept, int ret; ret = rmdir(msg->pathname); - msg->header.result = ret ? get_errno(ret) : 0; + msg->header.result = ret ? -get_errno() : 0; return rpmsg_send(ept, msg, sizeof(*msg)); } @@ -549,7 +549,7 @@ static int hostfs_rpmsg_rename_handler(FAR struct rpmsg_endpoint *ept, newpath = msg->pathname + oldlen; ret = rename(msg->pathname, newpath); - msg->header.result = ret ? get_errno(ret) : 0; + msg->header.result = ret ? -get_errno() : 0; return rpmsg_send(ept, msg, sizeof(*msg)); } @@ -561,7 +561,7 @@ static int hostfs_rpmsg_stat_handler(FAR struct rpmsg_endpoint *ept, int ret; ret = stat(msg->pathname, &msg->buf); - msg->header.result = ret ? get_errno(ret) : 0; + msg->header.result = ret ? -get_errno() : 0; return rpmsg_send(ept, msg, sizeof(*msg)); } @@ -623,8 +623,9 @@ static void hostfs_rpmsg_ns_unbind(FAR struct rpmsg_endpoint *ept) kmm_free(priv); } -static int hostfs_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data, - size_t len, uint32_t src, FAR void *priv) +static int hostfs_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, + FAR void *data, size_t len, uint32_t src, + FAR void *priv) { struct hostfs_rpmsg_header_s *header = data; uint32_t command = header->command; diff --git a/include/errno.h b/include/errno.h index 35dca4232f..8bd8bcf683 100644 --- a/include/errno.h +++ b/include/errno.h @@ -93,7 +93,7 @@ # define errno *get_errno_ptr() # define set_errno(e) do { errno = (int)(e); } while (0) -# define get_errno(e) errno +# define get_errno() errno #else