mirror of
https://github.com/apache/nuttx.git
synced 2026-08-28 21:00:44 +00:00
fs/hostfs: fix pre-existing nxstyle issues in touched files
Add missing blank lines after declarations and fix one bad alignment in hostfs/rpmsgfs-related files. These are pre-existing style issues flagged by CI's whole-file nxstyle check when our PR touches these files. No logic change (git diff -w is blank-line-only additions). Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
This commit is contained in:
parent
41ec966941
commit
9c467c5114
8 changed files with 51 additions and 3 deletions
|
|
@ -60,9 +60,11 @@ static long host_call(unsigned int nbr, void *parm, size_t size)
|
|||
#endif
|
||||
|
||||
long ret = smh_call(nbr, parm);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
long err = smh_call(HOST_ERROR, NULL);
|
||||
|
||||
if (err > 0)
|
||||
{
|
||||
ret = -err;
|
||||
|
|
@ -98,6 +100,7 @@ static int host_flags_to_mode(int flags)
|
|||
};
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nitems(modeflags); i++)
|
||||
{
|
||||
if ((modemasks & flags) == modeflags[i])
|
||||
|
|
@ -137,6 +140,7 @@ int host_open(const char *pathname, int flags, int mode)
|
|||
int host_close(int fd_)
|
||||
{
|
||||
long fd = fd_;
|
||||
|
||||
return host_call(HOST_CLOSE, &fd, sizeof(long));
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +227,7 @@ off_t host_lseek(int fd, off_t pos, off_t offset, int whence)
|
|||
ret = host_call(HOST_SEEK, &seek, sizeof(seek));
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = offset;
|
||||
ret = offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -347,9 +351,11 @@ int host_rename(const char *oldpath, const char *newpath)
|
|||
int host_stat(const char *path, struct stat *buf)
|
||||
{
|
||||
int ret = host_open(path, O_RDONLY, 0);
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
int fd = ret;
|
||||
|
||||
ret = host_fstat(fd, buf);
|
||||
host_close(fd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,9 +60,11 @@ static long host_call(unsigned int nbr, void *parm, size_t size)
|
|||
#endif
|
||||
|
||||
long ret = smh_call(nbr, parm);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
long err = smh_call(HOST_ERROR, NULL);
|
||||
|
||||
if (err > 0)
|
||||
{
|
||||
ret = -err;
|
||||
|
|
@ -98,6 +100,7 @@ static int host_flags_to_mode(int flags)
|
|||
};
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nitems(modeflags); i++)
|
||||
{
|
||||
if ((modemasks & flags) == modeflags[i])
|
||||
|
|
@ -137,6 +140,7 @@ int host_open(const char *pathname, int flags, int mode)
|
|||
int host_close(int fd_)
|
||||
{
|
||||
long fd = fd_;
|
||||
|
||||
return host_call(HOST_CLOSE, &fd, sizeof(long));
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +227,7 @@ off_t host_lseek(int fd, off_t pos, off_t offset, int whence)
|
|||
ret = host_call(HOST_SEEK, &seek, sizeof(seek));
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = offset;
|
||||
ret = offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -347,9 +351,11 @@ int host_rename(const char *oldpath, const char *newpath)
|
|||
int host_stat(const char *path, struct stat *buf)
|
||||
{
|
||||
int ret = host_open(path, O_RDONLY, 0);
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
int fd = ret;
|
||||
|
||||
ret = host_fstat(fd, buf);
|
||||
host_close(fd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,9 +60,11 @@ static long host_call(unsigned int nbr, void *parm, size_t size)
|
|||
#endif
|
||||
|
||||
long ret = smh_call(nbr, parm);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
long err = smh_call(HOST_ERROR, NULL);
|
||||
|
||||
if (err > 0)
|
||||
{
|
||||
ret = -err;
|
||||
|
|
@ -98,6 +100,7 @@ static int host_flags_to_mode(int flags)
|
|||
};
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nitems(modeflags); i++)
|
||||
{
|
||||
if ((modemasks & flags) == modeflags[i])
|
||||
|
|
@ -137,6 +140,7 @@ int host_open(const char *pathname, int flags, int mode)
|
|||
int host_close(int fd_)
|
||||
{
|
||||
long fd = fd_;
|
||||
|
||||
return host_call(HOST_CLOSE, &fd, sizeof(long));
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +227,7 @@ off_t host_lseek(int fd, off_t pos, off_t offset, int whence)
|
|||
ret = host_call(HOST_SEEK, &seek, sizeof(seek));
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = offset;
|
||||
ret = offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -345,9 +349,11 @@ int host_rename(const char *oldpath, const char *newpath)
|
|||
int host_stat(const char *path, struct stat *buf)
|
||||
{
|
||||
int ret = host_open(path, O_RDONLY, 0);
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
int fd = ret;
|
||||
|
||||
ret = host_fstat(fd, buf);
|
||||
host_close(fd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,6 +314,7 @@ int host_open(const char *pathname, int flags, int mode)
|
|||
int mapflags = host_oflags_convert(flags);
|
||||
|
||||
int ret = open(pathname, mapflags, mode);
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -331,6 +332,7 @@ int host_close(int fd)
|
|||
/* Just call the close routine */
|
||||
|
||||
int ret = close(fd);
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -348,6 +350,7 @@ nuttx_ssize_t host_read(int fd, void *buf, nuttx_size_t count)
|
|||
/* Just call the read routine */
|
||||
|
||||
nuttx_ssize_t ret = read(fd, buf, count);
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -365,6 +368,7 @@ nuttx_ssize_t host_write(int fd, const void *buf, nuttx_size_t count)
|
|||
/* Just call the write routine */
|
||||
|
||||
nuttx_ssize_t ret = write(fd, buf, count);
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -383,6 +387,7 @@ nuttx_off_t host_lseek(int fd, nuttx_off_t pos, nuttx_off_t offset,
|
|||
/* Just call the lseek routine */
|
||||
|
||||
nuttx_off_t ret = lseek(fd, offset, whence);
|
||||
|
||||
if (ret == (nuttx_off_t)-1)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -439,6 +444,7 @@ void host_sync(int fd)
|
|||
int host_dup(int fd)
|
||||
{
|
||||
int ret = dup(fd);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -538,6 +544,7 @@ int host_fchstat(int fd, const struct nuttx_stat_s *buf, int flags)
|
|||
int host_ftruncate(int fd, nuttx_off_t length)
|
||||
{
|
||||
int ret = ftruncate(fd, length);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -636,6 +643,7 @@ void host_rewinddir(void *dirp)
|
|||
int host_closedir(void *dirp)
|
||||
{
|
||||
int ret = closedir(dirp);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -682,6 +690,7 @@ int host_statfs(const char *path, struct nuttx_statfs_s *buf)
|
|||
int host_unlink(const char *pathname)
|
||||
{
|
||||
int ret = unlink(pathname);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -699,6 +708,7 @@ int host_mkdir(const char *pathname, int mode)
|
|||
/* Just call the host's mkdir routine */
|
||||
|
||||
int ret = mkdir(pathname, mode);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -714,6 +724,7 @@ int host_mkdir(const char *pathname, int mode)
|
|||
int host_rmdir(const char *pathname)
|
||||
{
|
||||
int ret = rmdir(pathname);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -729,6 +740,7 @@ int host_rmdir(const char *pathname)
|
|||
int host_rename(const char *oldpath, const char *newpath)
|
||||
{
|
||||
int ret = rename(oldpath, newpath);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = host_errno_convert(-errno);
|
||||
|
|
@ -829,6 +841,7 @@ int host_chstat(const char *path, const struct nuttx_stat_s *buf, int flags)
|
|||
int host_link(const char *path1, const char *path2)
|
||||
{
|
||||
int ret = link(path1, path2);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -844,6 +857,7 @@ int host_link(const char *path1, const char *path2)
|
|||
int host_symlink(const char *target, const char *linkpath)
|
||||
{
|
||||
int ret = symlink(target, linkpath);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -860,6 +874,7 @@ nuttx_ssize_t host_readlink(const char *path, char *buf,
|
|||
nuttx_size_t bufsize)
|
||||
{
|
||||
ssize_t ret = readlink(path, buf, bufsize);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ int host_close(int fd)
|
|||
/* Just call the close routine */
|
||||
|
||||
int ret = _close(fd);
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -175,6 +176,7 @@ nuttx_ssize_t host_read(int fd, void *buf, nuttx_size_t count)
|
|||
/* Just call the read routine */
|
||||
|
||||
nuttx_ssize_t ret = _read(fd, buf, count);
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -192,6 +194,7 @@ nuttx_ssize_t host_write(int fd, const void *buf, nuttx_size_t count)
|
|||
/* Just call the write routine */
|
||||
|
||||
nuttx_ssize_t ret = _write(fd, buf, count);
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -210,6 +213,7 @@ nuttx_off_t host_lseek(int fd, nuttx_off_t pos, nuttx_off_t offset,
|
|||
/* Just call the lseek routine */
|
||||
|
||||
nuttx_off_t ret = _lseek(fd, offset, whence);
|
||||
|
||||
if (ret == (nuttx_off_t)-1)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -244,6 +248,7 @@ void host_sync(int fd)
|
|||
int host_dup(int fd)
|
||||
{
|
||||
int ret = _dup(fd);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -376,6 +381,7 @@ int host_statfs(const char *path, struct nuttx_statfs_s *buf)
|
|||
int host_unlink(const char *pathname)
|
||||
{
|
||||
int ret = _unlink(pathname);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -393,6 +399,7 @@ int host_mkdir(const char *pathname, int mode)
|
|||
/* Just call the host's mkdir routine */
|
||||
|
||||
int ret = _mkdir(pathname, mode);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
@ -408,6 +415,7 @@ int host_mkdir(const char *pathname, int mode)
|
|||
int host_rmdir(const char *pathname)
|
||||
{
|
||||
int ret = _rmdir(pathname);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ int host_fstat(int fd, struct stat *buf)
|
|||
|
||||
off_t saved_off = host_lseek(fd, 0, 0, SEEK_CUR);
|
||||
off_t size = host_lseek(fd, 0, 0, SEEK_END);
|
||||
|
||||
host_lseek(fd, 0, saved_off, SEEK_SET);
|
||||
|
||||
memset(buf, 0, sizeof(*buf));
|
||||
|
|
@ -231,9 +232,11 @@ int host_rename(const char *oldpath, const char *newpath)
|
|||
int host_stat(const char *path, struct stat *buf)
|
||||
{
|
||||
int ret = host_open(path, O_RDONLY, 0);
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
int fd = ret;
|
||||
|
||||
ret = host_fstat(fd, buf);
|
||||
host_close(fd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -640,6 +640,7 @@ static int hostfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||
case FIOC_FILEPATH:
|
||||
{
|
||||
FAR char *path = (FAR char *)(uintptr_t)arg;
|
||||
|
||||
ret = inode_getpath(filep->f_inode, path, PATH_MAX);
|
||||
if (ret >= 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -297,9 +297,11 @@ static int rpmsgfs_init_handler(FAR struct rpmsg_endpoint *ept,
|
|||
uint32_t src, FAR void *priv)
|
||||
{
|
||||
FAR struct rpmsgfs_s *ept_priv = ept->priv;
|
||||
|
||||
rpmsg_post(&ept_priv->ept, &ept_priv->wait);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FS_LINKS
|
||||
static int rpmsgfs_readlink_handler(FAR struct rpmsg_endpoint *ept,
|
||||
FAR void *data, size_t len,
|
||||
|
|
@ -340,6 +342,7 @@ static FAR void *rpmsgfs_get_tx_payload_buffer(FAR struct rpmsgfs_s *priv,
|
|||
static void rpmsgfs_ns_bound(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
FAR struct rpmsgfs_s *priv = ept->priv;
|
||||
|
||||
rpmsg_post(&priv->ept, &priv->wait);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue