diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-28 16:58:43 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-28 16:58:43 -0600 |
commit | 25cc0eca88a732ee368f342af291df37f36016fe (patch) | |
tree | 6afde56ea025e7fc324e8c507c46595ef2198bc6 | |
parent | e39ee98206f4d878d444e0700967573d2e2759a6 (diff) | |
download | nuttx-25cc0eca88a732ee368f342af291df37f36016fe.tar.gz nuttx-25cc0eca88a732ee368f342af291df37f36016fe.tar.bz2 nuttx-25cc0eca88a732ee368f342af291df37f36016fe.zip |
nuttx/fs: Remove explicity references to errno. That is a problem from within the kernel for certain configurations
-rw-r--r-- | nuttx/fs/fat/fs_mkfatfs.c | 2 | ||||
-rw-r--r-- | nuttx/fs/fat/fs_mkfatfs.h | 13 | ||||
-rw-r--r-- | nuttx/fs/mmap/fs_mmap.c | 6 | ||||
-rw-r--r-- | nuttx/fs/mmap/fs_munmap.c | 2 | ||||
-rw-r--r-- | nuttx/fs/mmap/fs_rammap.h | 4 | ||||
-rw-r--r-- | nuttx/fs/nfs/rpc_clnt.c | 20 | ||||
-rw-r--r-- | nuttx/fs/nxffs/nxffs_ioctl.c | 2 | ||||
-rw-r--r-- | nuttx/fs/nxffs/nxffs_open.c | 8 | ||||
-rw-r--r-- | nuttx/fs/nxffs/nxffs_read.c | 2 | ||||
-rw-r--r-- | nuttx/fs/nxffs/nxffs_write.c | 2 | ||||
-rw-r--r-- | nuttx/fs/smartfs/smartfs_mksmartfs.c | 2 |
11 files changed, 33 insertions, 30 deletions
diff --git a/nuttx/fs/fat/fs_mkfatfs.c b/nuttx/fs/fat/fs_mkfatfs.c index c7af71ad6..1191768f8 100644 --- a/nuttx/fs/fat/fs_mkfatfs.c +++ b/nuttx/fs/fat/fs_mkfatfs.c @@ -326,7 +326,7 @@ errout: if (ret < 0) { - errno = -ret; + set_errno(-ret); return ERROR; } diff --git a/nuttx/fs/fat/fs_mkfatfs.h b/nuttx/fs/fat/fs_mkfatfs.h index 05801c92d..d9212b1e4 100644 --- a/nuttx/fs/fat/fs_mkfatfs.h +++ b/nuttx/fs/fat/fs_mkfatfs.h @@ -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) diff --git a/nuttx/fs/mmap/fs_mmap.c b/nuttx/fs/mmap/fs_mmap.c index 85d796586..749f332bc 100644 --- a/nuttx/fs/mmap/fs_mmap.c +++ b/nuttx/fs/mmap/fs_mmap.c @@ -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 } diff --git a/nuttx/fs/mmap/fs_munmap.c b/nuttx/fs/mmap/fs_munmap.c index 3088ac7d7..6a846ef1f 100644 --- a/nuttx/fs/mmap/fs_munmap.c +++ b/nuttx/fs/mmap/fs_munmap.c @@ -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; } diff --git a/nuttx/fs/mmap/fs_rammap.h b/nuttx/fs/mmap/fs_rammap.h index 293a91ffb..4f9df6007 100644 --- a/nuttx/fs/mmap/fs_rammap.h +++ b/nuttx/fs/mmap/fs_rammap.h @@ -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 */ diff --git a/nuttx/fs/nfs/rpc_clnt.c b/nuttx/fs/nfs/rpc_clnt.c index 44817eb61..cdf3639fc 100644 --- a/nuttx/fs/nfs/rpc_clnt.c +++ b/nuttx/fs/nfs/rpc_clnt.c @@ -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; diff --git a/nuttx/fs/nxffs/nxffs_ioctl.c b/nuttx/fs/nxffs/nxffs_ioctl.c index cdb651bfd..96d39c339 100644 --- a/nuttx/fs/nxffs/nxffs_ioctl.c +++ b/nuttx/fs/nxffs/nxffs_ioctl.c @@ -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; } diff --git a/nuttx/fs/nxffs/nxffs_open.c b/nuttx/fs/nxffs/nxffs_open.c index 2970afbed..2859c31bd 100644 --- a/nuttx/fs/nxffs/nxffs_open.c +++ b/nuttx/fs/nxffs/nxffs_open.c @@ -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; } diff --git a/nuttx/fs/nxffs/nxffs_read.c b/nuttx/fs/nxffs/nxffs_read.c index 82a00d6b3..c548f5e50 100644 --- a/nuttx/fs/nxffs/nxffs_read.c +++ b/nuttx/fs/nxffs/nxffs_read.c @@ -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; } diff --git a/nuttx/fs/nxffs/nxffs_write.c b/nuttx/fs/nxffs/nxffs_write.c index 19d3fea59..7f081b92d 100644 --- a/nuttx/fs/nxffs/nxffs_write.c +++ b/nuttx/fs/nxffs/nxffs_write.c @@ -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; } diff --git a/nuttx/fs/smartfs/smartfs_mksmartfs.c b/nuttx/fs/smartfs/smartfs_mksmartfs.c index 292203979..620a6096f 100644 --- a/nuttx/fs/smartfs/smartfs_mksmartfs.c +++ b/nuttx/fs/smartfs/smartfs_mksmartfs.c @@ -183,7 +183,7 @@ errout: if (ret < 0) { - errno = -ret; + set_errno(-ret); return ERROR; } |