int net_init_vhost_user(const Netdev *netdev, const char *name,

                        NetClientState *peer, Error **errp)

{

    int queues;

    const NetdevVhostUserOptions *vhost_user_opts;

    CharDriverState *chr;



    assert(netdev->type == NET_CLIENT_DRIVER_VHOST_USER);

    vhost_user_opts = &netdev->u.vhost_user;



    chr = net_vhost_parse_chardev(vhost_user_opts, errp);

    if (!chr) {

        return -1;

    }



    /* verify net frontend */

    if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net,

                          (char *)name, errp)) {

        return -1;

    }



    queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1;

    if (queues < 1 || queues > MAX_QUEUE_NUM) {

        error_setg(errp,

                   "vhost-user number of queues must be in range [1, %d]",

                   MAX_QUEUE_NUM);

        return -1;

    }



    return net_vhost_user_init(peer, "vhost_user", name, chr, queues);

}

int net_init_vhost_user(const Netdev *netdev, const char *name,

                        NetClientState *peer, Error **errp)

{

    int queues;

    const NetdevVhostUserOptions *vhost_user_opts;

    CharDriverState *chr;



    assert(netdev->type == NET_CLIENT_DRIVER_VHOST_USER);

    vhost_user_opts = &netdev->u.vhost_user;



    chr = net_vhost_parse_chardev(vhost_user_opts, errp);

    if (!chr) {

        return -1;

    }



    

    if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net,

                          (char *)name, errp)) {

        return -1;

    }



    queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1;

    if (queues < 1 || queues > MAX_QUEUE_NUM) {

        error_setg(errp,

                   "vhost-user number of queues must be in range [1, %d]",

                   MAX_QUEUE_NUM);

        return -1;

    }



    return net_vhost_user_init(peer, "vhost_user", name, chr, queues);

}

        error_setg(errp,         return -1;         error_setg(errp,         return -1;     chr = net_vhost_parse_chardev(vhost_user_opts, errp);
int FUNC_0(const Netdev *VAR_0, const char *VAR_1,

                        NetClientState *VAR_2, Error **VAR_3)

{

    int VAR_4;

    const NetdevVhostUserOptions *VAR_5;

    CharDriverState *chr;



    assert(VAR_0->type == NET_CLIENT_DRIVER_VHOST_USER);

    VAR_5 = &VAR_0->u.vhost_user;



    chr = net_vhost_parse_chardev(VAR_5, VAR_3);

    if (!chr) {

        return -1;

    }



    

    if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net,

                          (char *)VAR_1, VAR_3)) {

        return -1;

    }



    VAR_4 = VAR_5->has_queues ? VAR_5->VAR_4 : 1;

    if (VAR_4 < 1 || VAR_4 > MAX_QUEUE_NUM) {

        error_setg(VAR_3,

                   "vhost-user number of VAR_4 must be in range [1, %d]",

                   MAX_QUEUE_NUM);

        return -1;

    }



    return net_vhost_user_init(VAR_2, "vhost_user", VAR_1, chr, VAR_4);

}

int FUNC_0(const Netdev *VAR_0, const char *VAR_1,
NetClientState *VAR_2, Error **VAR_3)
{ int VAR_4; const NetdevVhostUserOptions *VAR_5; CharDriverState *chr; assert(VAR_0->type == NET_CLIENT_DRIVER_VHOST_USER); VAR_5 = &VAR_0->u.vhost_user; chr = net_vhost_parse_chardev(VAR_5, VAR_3); if (!chr) { return -1; } if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net,
(char *)VAR_1, VAR_3)) { return -1; } VAR_4 = VAR_5->has_queues ? VAR_5->VAR_4 : 1; if (VAR_4 < 1 || VAR_4 > MAX_QUEUE_NUM) { error_setg(VAR_3,
"vhost-user number of VAR_4 must be in range [1, %d]",
MAX_QUEUE_NUM); return -1; } return net_vhost_user_init(VAR_2, "vhost_user", VAR_1, chr, VAR_4); }