mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
fs/: Fix various coding standard issues found while testing tools/nxstyle.c
This commit is contained in:
+2
-1
@@ -63,7 +63,8 @@ int dup(int fd)
|
||||
int ret = OK;
|
||||
|
||||
/* Check the range of the descriptor to see if we got a file or a socket
|
||||
* descriptor. */
|
||||
* descriptor.
|
||||
*/
|
||||
|
||||
if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS)
|
||||
{
|
||||
|
||||
@@ -130,4 +130,3 @@ errout:
|
||||
set_errno(-ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
|
||||
{
|
||||
if (eph->evs[i].data.fd == fd)
|
||||
{
|
||||
if (i != eph->occupied-1)
|
||||
if (i != eph->occupied - 1)
|
||||
{
|
||||
memmove(&eph->evs[i], &eph->evs[i + 1],
|
||||
eph->occupied - i);
|
||||
|
||||
+11
-8
@@ -107,7 +107,8 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, bool setup)
|
||||
/* Perform the socket ioctl */
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
|
||||
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS +
|
||||
CONFIG_NSOCKET_DESCRIPTORS))
|
||||
{
|
||||
return net_poll(fd, fds, setup);
|
||||
}
|
||||
@@ -478,18 +479,20 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
|
||||
#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \
|
||||
defined(CONFIG_HAVE_LONG_LONG)
|
||||
ticks = (((unsigned long long)timeout * USEC_PER_MSEC) + (USEC_PER_TICK - 1)) /
|
||||
ticks = (((unsigned long long)timeout * USEC_PER_MSEC) +
|
||||
(USEC_PER_TICK - 1)) /
|
||||
USEC_PER_TICK;
|
||||
#else
|
||||
ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK;
|
||||
ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) /
|
||||
MSEC_PER_TICK;
|
||||
#endif
|
||||
|
||||
/* Either wait for either a poll event(s), for a signal to occur,
|
||||
* or for the specified timeout to elapse with no event.
|
||||
*
|
||||
* NOTE: If a poll event is pending (i.e., the semaphore has already
|
||||
* been incremented), nxsem_tickwait() will not wait, but will return
|
||||
* immediately.
|
||||
* NOTE: If a poll event is pending (i.e., the semaphore has
|
||||
* already been incremented), nxsem_tickwait() will not wait, but
|
||||
* will return immediately.
|
||||
*/
|
||||
|
||||
ret = nxsem_tickwait(&sem, clock_systimer(), ticks);
|
||||
@@ -512,8 +515,8 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
ret = poll_semtake(&sem);
|
||||
}
|
||||
|
||||
/* Teardown the poll operation and get the count of events. Zero will be
|
||||
* returned in the case of a timeout.
|
||||
/* Teardown the poll operation and get the count of events. Zero will
|
||||
* be returned in the case of a timeout.
|
||||
*
|
||||
* Preserve ret, if negative, since it holds the result of the wait.
|
||||
*/
|
||||
|
||||
+3
-2
@@ -390,7 +390,7 @@ next_subdir:
|
||||
{
|
||||
FAR char *subdirname;
|
||||
|
||||
/* Yes.. In this case, the target of the rename must be a
|
||||
/* Yes.. In this case, the target of the rename must be a
|
||||
* subdirectory of newinode, not the newinode itself. For
|
||||
* example: mv b a/ must move b to a/b.
|
||||
*/
|
||||
@@ -414,7 +414,8 @@ next_subdir:
|
||||
FAR char *tmp = subdir;
|
||||
|
||||
subdir = NULL;
|
||||
(void)asprintf(&subdir, "%s/%s", newrelpath, subdirname);
|
||||
(void)asprintf(&subdir, "%s/%s", newrelpath,
|
||||
subdirname);
|
||||
|
||||
if (tmp != NULL)
|
||||
{
|
||||
|
||||
+2
-2
@@ -137,8 +137,8 @@ int rmdir(FAR const char *pathname)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||
/* If this is a "dangling" pseudo-directory node (i.e., it has no operations)
|
||||
* then rmdir should remove the node.
|
||||
/* If this is a "dangling" pseudo-directory node (i.e., it has no
|
||||
* operations) then rmdir should remove the node.
|
||||
*/
|
||||
|
||||
if (!inode->u.i_ops)
|
||||
|
||||
Reference in New Issue
Block a user