Re: [RFC PATCH net-next v6 02/14] af_vsock: refactor transport lookup code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 24, 2024 at 11:41 PM Arseniy Krasnov
<avkrasnov@xxxxxxxxxxxxxxxxx> wrote:
>
> Hi
>
> +static const struct vsock_transport *
> +vsock_connectible_lookup_transport(unsigned int cid, __u8 flags)
>                                                       ^^^ may be just 'u8' ?
> +{
> +       const struct vsock_transport *transport;
>                                        ^^^ do we really need this variable now?
>                                        May be shorter like:
>                                        if (A)
>                                            return transport_local;
>                                        else if (B)
>                                            return transport_g2h;
>                                        else
>                                            return transport_h2g;

Looks good to me. Will change it in the next version.

Thanks,
Amery

> +
> +       if (vsock_use_local_transport(cid))
> +               transport = transport_local;
> +       else if (cid <= VMADDR_CID_HOST || !transport_h2g ||
> +                (flags & VMADDR_FLAG_TO_HOST))
> +               transport = transport_g2h;
> +       else
> +               transport = transport_h2g;
> +
> +       return transport;
> +}
> +
>
> Thanks





[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux