nuttx/fs: Remove explicity references to errno. That is a problem from within the kernel for certain configurations
This commit is contained in:
parent
7088c9a5c7
commit
220216cc38
@ -326,7 +326,7 @@ errout:
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
errno = -ret;
|
||||
set_errno(-ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,8 @@ struct fat_var_s
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
@ -141,8 +142,9 @@ extern "C" {
|
||||
* Zero on success; negated errno on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
EXTERN int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
|
||||
FAR struct fat_var_s *var);
|
||||
|
||||
int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
|
||||
FAR struct fat_var_s *var);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mkfatfs_writefat
|
||||
@ -159,8 +161,9 @@ EXTERN int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
|
||||
* Zero on success; negated errno on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
EXTERN int mkfatfs_writefatfs(FAR struct fat_format_s *fmt,
|
||||
FAR struct fat_var_s *var);
|
||||
|
||||
int mkfatfs_writefatfs(FAR struct fat_format_s *fmt,
|
||||
FAR struct fat_var_s *var);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
@ -136,14 +136,14 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags,
|
||||
(flags & (MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_DENYWRITE)) != 0)
|
||||
{
|
||||
fdbg("Unsupported options, prot=%x flags=%04x\n", prot, flags);
|
||||
errno = ENOSYS;
|
||||
set_errno(ENOSYS);
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
if (length == 0 || (flags & MAP_SHARED) == 0)
|
||||
{
|
||||
fdbg("Invalid options, lengt=%d flags=%04x\n", length, flags);
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return MAP_FAILED;
|
||||
}
|
||||
#endif
|
||||
@ -163,7 +163,7 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags,
|
||||
#ifdef CONFIG_FS_RAMMAP
|
||||
return rammap(fd, length, offset);
|
||||
#else
|
||||
fdbg("ioctl(FIOC_MMAP) failed: %d\n", errno);
|
||||
fdbg("ioctl(FIOC_MMAP) failed: %d\n", get_errno());
|
||||
return MAP_FAILED;
|
||||
#endif
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ int munmap(FAR void *start, size_t length)
|
||||
|
||||
errout_with_semaphore:
|
||||
sem_post(&g_rammaps.exclsem);
|
||||
errno = err;
|
||||
set_errno(err);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ extern struct fs_allmaps_s g_rammaps;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
extern void rammap_initialize(void);
|
||||
void rammap_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rammmap
|
||||
@ -144,7 +144,7 @@ extern void rammap_initialize(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
extern FAR void *rammap(int fd, size_t length, off_t offset);
|
||||
FAR void *rammap(int fd, size_t length, off_t offset);
|
||||
|
||||
#endif /* CONFIG_FS_RAMMAP */
|
||||
#endif /* __FS_MMAP_RAMMAP_H */
|
||||
|
@ -179,7 +179,7 @@ static int rpcclnt_send(FAR struct rpcclnt *rpc, int procid, int prog,
|
||||
{
|
||||
/* psock_sendto failed */
|
||||
|
||||
error = errno;
|
||||
error = get_errno();
|
||||
fdbg("ERROR: psock_sendto failed: %d\n", error);
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc, FAR struct sockaddr *aname,
|
||||
nbytes = psock_recvfrom(rpc->rc_so, reply, resplen, 0, aname, &fromlen);
|
||||
if (nbytes < 0)
|
||||
{
|
||||
error = errno;
|
||||
error = get_errno();
|
||||
fdbg("ERROR: psock_recvfrom failed: %d\n", error);
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
|
||||
error = psock_socket(saddr->sa_family, rpc->rc_sotype, IPPROTO_UDP, so);
|
||||
if (error < 0)
|
||||
{
|
||||
errval = errno;
|
||||
errval = get_errno();
|
||||
fdbg("ERROR: psock_socket failed: %d", errval);
|
||||
return error;
|
||||
}
|
||||
@ -425,7 +425,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
|
||||
(const void *)&tv, sizeof(tv));
|
||||
if (error < 0)
|
||||
{
|
||||
errval = errno;
|
||||
errval = get_errno();
|
||||
fdbg("ERROR: psock_setsockopt failed: %d\n", errval);
|
||||
goto bad;
|
||||
}
|
||||
@ -447,7 +447,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
|
||||
error = psock_bind(rpc->rc_so, (struct sockaddr *)&sin, sizeof(sin));
|
||||
if (error < 0)
|
||||
{
|
||||
errval = errno;
|
||||
errval = get_errno();
|
||||
fdbg("ERROR: psock_bind failed: %d\n", errval);
|
||||
}
|
||||
}
|
||||
@ -467,7 +467,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
|
||||
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
|
||||
if (error < 0)
|
||||
{
|
||||
errval = errno;
|
||||
errval = get_errno();
|
||||
fdbg("ERROR: psock_connect to PMAP port failed: %d", errval);
|
||||
goto bad;
|
||||
}
|
||||
@ -496,7 +496,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
|
||||
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
|
||||
if (error < 0)
|
||||
{
|
||||
errval = errno;
|
||||
errval = get_errno();
|
||||
fdbg("ERROR: psock_connect MOUNTD port failed: %d\n", errval);
|
||||
goto bad;
|
||||
}
|
||||
@ -533,7 +533,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
|
||||
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
|
||||
if (error < 0)
|
||||
{
|
||||
errval = errno;
|
||||
errval = get_errno();
|
||||
fdbg("ERROR: psock_connect PMAP port failed: %d\n", errval);
|
||||
goto bad;
|
||||
}
|
||||
@ -624,7 +624,7 @@ int rpcclnt_umount(struct rpcclnt *rpc)
|
||||
ret = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
error = errno;
|
||||
error = get_errno();
|
||||
fdbg("ERROR: psock_connect failed [port=%d]: %d\n",
|
||||
ntohs(sa->sin_port), error);
|
||||
goto bad;
|
||||
@ -649,7 +649,7 @@ int rpcclnt_umount(struct rpcclnt *rpc)
|
||||
ret = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
error = errno;
|
||||
error = get_errno();
|
||||
fdbg("ERROR: psock_connect failed [port=%d]: %d\n",
|
||||
ntohs(sa->sin_port), error);
|
||||
goto bad;
|
||||
|
@ -103,7 +103,7 @@ int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
ret = sem_wait(&volume->exclsem);
|
||||
if (ret != OK)
|
||||
{
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
fdbg("ERROR: sem_wait failed: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume,
|
||||
if (ret != OK)
|
||||
{
|
||||
fdbg("ERROR: sem_wait failed: %d\n", ret);
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume,
|
||||
if (ret != OK)
|
||||
{
|
||||
fdbg("ERROR: sem_wait failed: %d\n", ret);
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
goto errout_with_wrsem;
|
||||
}
|
||||
|
||||
@ -715,7 +715,7 @@ static inline int nxffs_rdopen(FAR struct nxffs_volume_s *volume,
|
||||
if (ret != OK)
|
||||
{
|
||||
fdbg("ERROR: sem_wait failed: %d\n", ret);
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -1160,7 +1160,7 @@ int nxffs_close(FAR struct file *filep)
|
||||
ret = sem_wait(&volume->exclsem);
|
||||
if (ret != OK)
|
||||
{
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
fdbg("ERROR: sem_wait failed: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ ssize_t nxffs_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
|
||||
ret = sem_wait(&volume->exclsem);
|
||||
if (ret != OK)
|
||||
{
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
fdbg("ERROR: sem_wait failed: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer, size_t bufle
|
||||
ret = sem_wait(&volume->exclsem);
|
||||
if (ret != OK)
|
||||
{
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
fdbg("ERROR: sem_wait failed: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ errout:
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
errno = -ret;
|
||||
set_errno(-ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user