This is an automated email from the ASF dual-hosted git repository. michallenc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit e44cb579d6e95eb440128089835887db6e01a143 Author: Marco Casaroli <[email protected]> AuthorDate: Mon Oct 19 00:19:20 2026 +0200 fs/vfs, net: Fix the nxstyle errors in 8 files. Fix the older nxstyle errors in these files: indentation, alignment of braces and comments, and the blank line after declarations. This is a layout change only. The C tokens do not change, except one pair of braces around a single return statement in rpmsg_sockif.c. tools/nxstyle.c reports no error for them now. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- fs/vfs/fs_epoll.c | 2 ++ fs/vfs/fs_inotify.c | 8 ++++++ net/can/can_sockif.c | 3 +++ net/icmp/icmp_sockif.c | 61 ++++++++++++++++++++++---------------------- net/icmpv6/icmpv6_sockif.c | 1 + net/local/local_sockif.c | 8 +++--- net/netlink/netlink_sockif.c | 5 ++-- net/rpmsg/rpmsg_sockif.c | 5 ++++ 8 files changed, 58 insertions(+), 35 deletions(-) diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c index 50eba1aee97..802d7c0acb6 100644 --- a/fs/vfs/fs_epoll.c +++ b/fs/vfs/fs_epoll.c @@ -799,6 +799,7 @@ retry: else /* ret >= 0 or ret == -ETIMEDOUT */ { int num = epoll_teardown(eph, evs, maxevents); + if (num == 0 && ret >= 0) { goto retry; @@ -881,6 +882,7 @@ retry: else /* ret >= 0 or ret == -ETIMEDOUT */ { int num = epoll_teardown(eph, evs, maxevents); + if (num == 0 && ret >= 0) { goto retry; diff --git a/fs/vfs/fs_inotify.c b/fs/vfs/fs_inotify.c index 0ce16aaa753..940de4a491e 100644 --- a/fs/vfs/fs_inotify.c +++ b/fs/vfs/fs_inotify.c @@ -319,6 +319,7 @@ inotify_remove_watch_no_event(FAR struct inotify_watch_s *watch) if (list_is_empty(&list->watches)) { ENTRY item; + item.key = list->path; hsearch_r(item, DELETE, NULL, &g_inotify.hash); } @@ -419,6 +420,7 @@ static int inotify_poll(FAR struct file *filep, FAR struct pollfd *fds, if (!setup) { FAR struct pollfd **slot = fds->priv; + *slot = NULL; fds->priv = NULL; goto out; @@ -469,6 +471,7 @@ static int inotify_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case FIONREAD: { FAR int *nbytes = (FAR int *)((uintptr_t)arg); + if (nbytes) { *nbytes = dev->event_size; @@ -525,6 +528,7 @@ static ssize_t inotify_read(FAR struct file *filp, FAR char *buffer, list_first_entry(&dev->events, struct inotify_event_s, node); size_t eventlen = sizeof(struct inotify_event) + event->event.len; + if (len < eventlen) { break; @@ -572,6 +576,7 @@ static int inotify_close(FAR struct file *filep) while (!list_is_empty(&dev->watches)) { FAR struct inotify_watch_s *watch; + watch = list_first_entry(&dev->watches, struct inotify_watch_s, d_node); inotify_remove_watch_no_event(watch); @@ -582,6 +587,7 @@ static int inotify_close(FAR struct file *filep) while (!list_is_empty(&dev->events)) { FAR struct inotify_event_s *event; + event = list_first_entry(&dev->events, struct inotify_event_s, node); inotify_remove_event(dev, event); } @@ -1116,6 +1122,7 @@ int inotify_add_watch(int fd, FAR const char *pathname, uint32_t mask) if (old != NULL) { uint32_t tmpmask = old->mask; + if (mask & IN_MASK_CREATE) { ret = -EEXIST; @@ -1139,6 +1146,7 @@ int inotify_add_watch(int fd, FAR const char *pathname, uint32_t mask) if (watch == NULL && list_is_empty(&list->watches)) { ENTRY item; + item.key = list->path; hsearch_r(item, DELETE, NULL, &g_inotify.hash); ret = -ENOMEM; diff --git a/net/can/can_sockif.c b/net/can/can_sockif.c index 808a3cbf7a0..ff7541a1dee 100644 --- a/net/can/can_sockif.c +++ b/net/can/can_sockif.c @@ -208,6 +208,7 @@ static int can_setup(FAR struct socket *psock) */ FAR struct can_conn_s *conn = can_alloc(); + if (conn == NULL) { /* Failed to reserve a connection structure */ @@ -327,6 +328,7 @@ static int can_bind(FAR struct socket *psock, { FAR struct sockaddr_can *canaddr; FAR struct can_conn_s *conn; + DEBUGASSERT(addr != NULL && addrlen >= sizeof(struct sockaddr_can)); @@ -341,6 +343,7 @@ static int can_bind(FAR struct socket *psock, conn->dev = netdev_findbyindex(canaddr->can_ifindex); #else char netdev_name[5] = "can0"; + netdev_name[3] += canaddr->can_ifindex; conn->dev = netdev_findbyname((const char *)&netdev_name); #endif diff --git a/net/icmp/icmp_sockif.c b/net/icmp/icmp_sockif.c index 5f879e2e99b..318b83aed04 100644 --- a/net/icmp/icmp_sockif.c +++ b/net/icmp/icmp_sockif.c @@ -126,6 +126,7 @@ static int icmp_setup(FAR struct socket *psock) */ FAR struct icmp_conn_s *conn = icmp_alloc(); + if (conn == NULL) { /* Failed to reserve a connection structure */ @@ -379,26 +380,26 @@ static int icmp_getsockopt(FAR struct socket *psock, int level, int option, FAR void *value, FAR socklen_t *value_len) { switch (level) - { - case SOL_SOCKET: + { + case SOL_SOCKET: - /* Socket-level options are handled by psock_getsockopt()/inet layer. - * Return -ENOPROTOOPT so upper layer will fallback to socket-level - * handler without emitting misleading ICMP error logs. - */ + /* Socket-level options are handled by psock_getsockopt()/inet layer. + * Return -ENOPROTOOPT so upper layer will fallback to socket-level + * handler without emitting misleading ICMP error logs. + */ - return -ENOPROTOOPT; + return -ENOPROTOOPT; - case SOL_IP: - return ipv4_getsockopt(psock, option, value, value_len); + case SOL_IP: + return ipv4_getsockopt(psock, option, value, value_len); - case SOL_RAW: - return icmp_getsockopt_internal(psock, option, value, value_len); + case SOL_RAW: + return icmp_getsockopt_internal(psock, option, value, value_len); - default: - nerr("ERROR: Unrecognized ICMP option: %d\n", option); - return -ENOPROTOOPT; - } + default: + nerr("ERROR: Unrecognized ICMP option: %d\n", option); + return -ENOPROTOOPT; + } } /**************************************************************************** @@ -491,26 +492,26 @@ static int icmp_setsockopt(FAR struct socket *psock, int level, int option, FAR const void *value, socklen_t value_len) { switch (level) - { - case SOL_SOCKET: + { + case SOL_SOCKET: - /* Socket-level options are handled by psock_setsockopt()/inet layer. - * Return -ENOPROTOOPT so upper layer will fallback to socket-level - * handler without emitting misleading ICMP error logs. - */ + /* Socket-level options are handled by psock_setsockopt()/inet layer. + * Return -ENOPROTOOPT so upper layer will fallback to socket-level + * handler without emitting misleading ICMP error logs. + */ - return -ENOPROTOOPT; + return -ENOPROTOOPT; - case SOL_IP: - return ipv4_setsockopt(psock, option, value, value_len); + case SOL_IP: + return ipv4_setsockopt(psock, option, value, value_len); - case SOL_RAW: - return icmp_setsockopt_internal(psock, option, value, value_len); + case SOL_RAW: + return icmp_setsockopt_internal(psock, option, value, value_len); - default: - nerr("ERROR: Unrecognized ICMP option: %d\n", option); - return -ENOPROTOOPT; - } + default: + nerr("ERROR: Unrecognized ICMP option: %d\n", option); + return -ENOPROTOOPT; + } } #endif diff --git a/net/icmpv6/icmpv6_sockif.c b/net/icmpv6/icmpv6_sockif.c index 051f6af6689..b9524fe818d 100644 --- a/net/icmpv6/icmpv6_sockif.c +++ b/net/icmpv6/icmpv6_sockif.c @@ -125,6 +125,7 @@ static int icmpv6_setup(FAR struct socket *psock) */ FAR struct icmpv6_conn_s *conn = icmpv6_alloc(); + if (conn == NULL) { /* Failed to reserve a connection structure */ diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index 672f1bff848..06c7c1243c6 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -132,6 +132,7 @@ static int local_sockif_alloc(FAR struct socket *psock) /* Allocate the local connection structure */ FAR struct local_conn_s *conn; + local_lock(); conn = local_alloc(); local_unlock(); @@ -494,7 +495,7 @@ static int local_getpeername(FAR struct socket *psock, } else { - strlcpy(unaddr->sun_path, peer->lc_path, namelen); + strlcpy(unaddr->sun_path, peer->lc_path, namelen); } *addrlen = sizeof(sa_family_t) + namelen; @@ -1029,9 +1030,9 @@ static int local_socketpair(FAR struct socket *psocks[2]) conns[0]->lc_instance_id = conns[1]->lc_instance_id #ifdef CONFIG_NET_LOCAL_STREAM - = local_generate_instance_id(); + = local_generate_instance_id(); #else - = -1; + = -1; #endif /* Create the FIFOs needed for the connection */ @@ -1132,6 +1133,7 @@ static int local_shutdown(FAR struct socket *psock, int how) case SOCK_STREAM: { FAR struct local_conn_s *conn = psock->s_conn; + if (how & SHUT_RD) { if (conn->lc_infile.f_inode != NULL) diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c index 646bb4a4b00..9740f8e73f9 100644 --- a/net/netlink/netlink_sockif.c +++ b/net/netlink/netlink_sockif.c @@ -150,6 +150,7 @@ static int netlink_setup(FAR struct socket *psock) */ FAR struct netlink_conn_s *conn = netlink_alloc(); + if (conn == NULL) { /* Failed to reserve a connection structure */ @@ -638,8 +639,8 @@ static ssize_t netlink_sendmsg(FAR struct socket *psock, #endif default: - ret = -EOPNOTSUPP; - break; + ret = -EOPNOTSUPP; + break; } return ret; diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c index 1bd687d47c1..19f512e0b0a 100644 --- a/net/rpmsg/rpmsg_sockif.c +++ b/net/rpmsg/rpmsg_sockif.c @@ -503,6 +503,7 @@ static void rpmsg_socket_format_name(FAR struct rpmsg_socket_conn_s *conn, { uint32_t crc = crc32((const uint8_t *)conn->rpaddr.rp_name, strlen(conn->rpaddr.rp_name)); + snprintf(namebuf, RPMSG_NAME_SIZE, "%s%.2s%08" PRIx32 "%s", RPMSG_SOCKET_NAME_PREFIX, conn->rpaddr.rp_name, crc, conn->nameid); @@ -991,6 +992,7 @@ static uint32_t rpmsg_socket_get_iovlen(FAR const struct iovec *buf, size_t iovcnt) { uint32_t len = 0; + while (iovcnt--) { len += (buf++)->iov_len; @@ -1060,6 +1062,7 @@ static ssize_t rpmsg_socket_send_continuous(FAR struct socket *psock, while (block_written < block) { uint32_t chunk = MIN(block - block_written, buf->iov_len - offset); + memcpy(msg->data + block_written, (FAR const uint8_t *)buf->iov_base + offset, chunk); offset += chunk; @@ -1451,7 +1454,9 @@ static int rpmsg_socket_shutdown(FAR struct socket *psock, int how) ret = rpmsg_send(&conn->ept, &msg, sizeof(msg)); if (ret < 0) + { return ret; + } return OK; }
