This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3cfa57b2565d31e2a38d9a82e8cab0af6e9137d4
Author: Bowen Wang <[email protected]>
AuthorDate: Sun Nov 29 16:32:16 2026 +0800

    drivers/vhost/vhost-can: fix the build
    
    vhost-can no longer builds:
    
      vhost-can.c:547:33: error: passing argument 2 of 'psock_poll' from
      incompatible pointer type [-Werror=incompatible-pointer-types]
      vhost-can.c:801:25: error: 'struct pollfd' has no member named 'arg'
      vhost-can.c:881:25: error: 'struct net_driver_s' has no member named
      'd_ifindex'
    
    and once that compiles, it fails to link with undefined references to
    psock_setsockopt.
    
    psock_poll() takes the kernel struct pollfd_s, d_ifindex only exists with
    CONFIG_NETDEV_IFINDEX, and psock_setsockopt() on a CAN socket needs
    CONFIG_NET_CAN_SOCK_OPTS. Use struct pollfd_s and select both options.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/vhost/Kconfig     | 2 ++
 drivers/vhost/vhost-can.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
index 019e7b44a25..0edbb22549e 100644
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -171,6 +171,8 @@ config DRIVERS_VHOST_CAN
        depends on NET_CAN
        default n
        select DRIVERS_VHOST
+       select NETDEV_IFINDEX
+       select NET_CAN_SOCK_OPTS
        ---help---
                Enable the vhost CAN backend.  It bridges a VirtIO CAN device
                (device ID 36) to a local SocketCAN interface, forwarding frames
diff --git a/drivers/vhost/vhost-can.c b/drivers/vhost/vhost-can.c
index d2765c90e79..97e26b2acfc 100644
--- a/drivers/vhost/vhost-can.c
+++ b/drivers/vhost/vhost-can.c
@@ -81,7 +81,7 @@ struct vhost_can_priv_s
   FAR struct vhost_device *hdev;
   FAR struct net_driver_s *dev;
   struct socket            sock;
-  struct pollfd            pfd;
+  struct pollfd_s          pfd;
   struct work_s            txwork;
   struct work_s            ctlwork;
   struct work_s            rxwork;
@@ -796,7 +796,7 @@ static void vhost_can_rxready(FAR struct vhost_can_priv_s 
*priv)
  * Name: vhost_can_poll_cb
  ****************************************************************************/
 
-static void vhost_can_poll_cb(FAR struct pollfd *pfds)
+static void vhost_can_poll_cb(FAR struct pollfd_s *pfds)
 {
   vhost_can_rxready(pfds->arg);
 }

Reply via email to