static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,

                             const char *model, const char *name,

                             const char *ifname, const char *script,

                             const char *downscript, const char *vhostfdname,

                             int vnet_hdr, int fd, Error **errp)

{

    Error *err = NULL;

    TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);

    int vhostfd;



    tap_set_sndbuf(s->fd, tap, &err);

    if (err) {

        error_propagate(errp, err);

        return;

    }



    if (tap->has_fd || tap->has_fds) {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd);

    } else if (tap->has_helper) {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s",

                 tap->helper);

    } else {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str),

                 "ifname=%s,script=%s,downscript=%s", ifname, script,

                 downscript);



        if (strcmp(downscript, "no") != 0) {

            snprintf(s->down_script, sizeof(s->down_script), "%s", downscript);

            snprintf(s->down_script_arg, sizeof(s->down_script_arg),

                     "%s", ifname);

        }

    }



    if (tap->has_vhost ? tap->vhost :

        vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {

        VhostNetOptions options;



        options.backend_type = VHOST_BACKEND_TYPE_KERNEL;

        options.net_backend = &s->nc;

        options.force = tap->has_vhostforce && tap->vhostforce;



        if (tap->has_vhostfd || tap->has_vhostfds) {

            vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);

            if (vhostfd == -1) {

                error_propagate(errp, err);

                return;

            }

        } else {

            vhostfd = open("/dev/vhost-net", O_RDWR);

            if (vhostfd < 0) {

                error_setg_errno(errp, errno,

                                 "tap: open vhost char device failed");

                return;

            }

        }

        options.opaque = (void *)(uintptr_t)vhostfd;



        s->vhost_net = vhost_net_init(&options);

        if (!s->vhost_net) {

            error_setg(errp,

                       "vhost-net requested but could not be initialized");

            return;

        }

    } else if (tap->has_vhostfd || tap->has_vhostfds) {

        error_setg(errp, "vhostfd= is not valid without vhost");

    }

}

static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,

                             const char *model, const char *name,

                             const char *ifname, const char *script,

                             const char *downscript, const char *vhostfdname,

                             int vnet_hdr, int fd, Error **errp)

{

    Error *err = NULL;

    TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);

    int vhostfd;



    tap_set_sndbuf(s->fd, tap, &err);

    if (err) {

        error_propagate(errp, err);

        return;

    }



    if (tap->has_fd || tap->has_fds) {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd);

    } else if (tap->has_helper) {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s",

                 tap->helper);

    } else {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str),

                 "ifname=%s,script=%s,downscript=%s", ifname, script,

                 downscript);



        if (strcmp(downscript, "no") != 0) {

            snprintf(s->down_script, sizeof(s->down_script), "%s", downscript);

            snprintf(s->down_script_arg, sizeof(s->down_script_arg),

                     "%s", ifname);

        }

    }



    if (tap->has_vhost ? tap->vhost :

        vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {

        VhostNetOptions options;



        options.backend_type = VHOST_BACKEND_TYPE_KERNEL;

        options.net_backend = &s->nc;

        options.force = tap->has_vhostforce && tap->vhostforce;



        if (tap->has_vhostfd || tap->has_vhostfds) {

            vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);

            if (vhostfd == -1) {

                error_propagate(errp, err);

                return;

            }

        } else {

            vhostfd = open("/dev/vhost-net", O_RDWR);

            if (vhostfd < 0) {

                error_setg_errno(errp, errno,

                                 "tap: open vhost char device failed");

                return;

            }

        }

        options.opaque = (void *)(uintptr_t)vhostfd;



        s->vhost_net = vhost_net_init(&options);

        if (!s->vhost_net) {

            error_setg(errp,

                       "vhost-net requested but could not be initialized");

            return;

        }

    } else if (tap->has_vhostfd || tap->has_vhostfds) {

        error_setg(errp, "vhostfd= is not valid without vhost");

    }

}

        options.force = tap->has_vhostforce && tap->vhostforce;
static void FUNC_0(const NetdevTapOptions *VAR_0, NetClientState *VAR_1,

                             const char *VAR_2, const char *VAR_3,

                             const char *VAR_4, const char *VAR_5,

                             const char *VAR_6, const char *VAR_7,

                             int VAR_8, int VAR_9, Error **VAR_10)

{

    Error *err = NULL;

    TAPState *s = net_tap_fd_init(VAR_1, VAR_2, VAR_3, VAR_9, VAR_8);

    int VAR_11;



    tap_set_sndbuf(s->VAR_9, VAR_0, &err);

    if (err) {

        error_propagate(VAR_10, err);

        return;

    }



    if (VAR_0->has_fd || VAR_0->has_fds) {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str), "VAR_9=%d", VAR_9);

    } else if (VAR_0->has_helper) {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s",

                 VAR_0->helper);

    } else {

        snprintf(s->nc.info_str, sizeof(s->nc.info_str),

                 "VAR_4=%s,VAR_5=%s,VAR_6=%s", VAR_4, VAR_5,

                 VAR_6);



        if (strcmp(VAR_6, "no") != 0) {

            snprintf(s->down_script, sizeof(s->down_script), "%s", VAR_6);

            snprintf(s->down_script_arg, sizeof(s->down_script_arg),

                     "%s", VAR_4);

        }

    }



    if (VAR_0->has_vhost ? VAR_0->vhost :

        VAR_7 || (VAR_0->has_vhostforce && VAR_0->vhostforce)) {

        VhostNetOptions options;



        options.backend_type = VHOST_BACKEND_TYPE_KERNEL;

        options.net_backend = &s->nc;

        options.force = VAR_0->has_vhostforce && VAR_0->vhostforce;



        if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) {

            VAR_11 = monitor_fd_param(cur_mon, VAR_7, &err);

            if (VAR_11 == -1) {

                error_propagate(VAR_10, err);

                return;

            }

        } else {

            VAR_11 = open("/dev/vhost-net", O_RDWR);

            if (VAR_11 < 0) {

                error_setg_errno(VAR_10, errno,

                                 "VAR_0: open vhost char device failed");

                return;

            }

        }

        options.opaque = (void *)(uintptr_t)VAR_11;



        s->vhost_net = vhost_net_init(&options);

        if (!s->vhost_net) {

            error_setg(VAR_10,

                       "vhost-net requested but could not be initialized");

            return;

        }

    } else if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) {

        error_setg(VAR_10, "VAR_11= is not valid without vhost");

    }

}

static void FUNC_0(const NetdevTapOptions *VAR_0, NetClientState *VAR_1,
const char *VAR_2, const char *VAR_3,
const char *VAR_4, const char *VAR_5,
const char *VAR_6, const char *VAR_7,
int VAR_8, int VAR_9, Error **VAR_10)
{ Error *err = NULL; TAPState *s = net_tap_fd_init(VAR_1, VAR_2, VAR_3, VAR_9, VAR_8); int VAR_11; tap_set_sndbuf(s->VAR_9, VAR_0, &err); if (err) { error_propagate(VAR_10, err); return; } if (VAR_0->has_fd || VAR_0->has_fds) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "VAR_9=%d", VAR_9); } else if (VAR_0->has_helper) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s",
VAR_0->helper); } else { snprintf(s->nc.info_str, sizeof(s->nc.info_str),
"VAR_4=%s,VAR_5=%s,VAR_6=%s", VAR_4, VAR_5,
VAR_6); if (strcmp(VAR_6, "no") != 0) { snprintf(s->down_script, sizeof(s->down_script), "%s", VAR_6); snprintf(s->down_script_arg, sizeof(s->down_script_arg),
"%s", VAR_4); } } if (VAR_0->has_vhost ? VAR_0->vhost :
VAR_7 || (VAR_0->has_vhostforce && VAR_0->vhostforce)) { VhostNetOptions options; options.backend_type = VHOST_BACKEND_TYPE_KERNEL; options.net_backend = &s->nc; options.force = VAR_0->has_vhostforce && VAR_0->vhostforce; if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) { VAR_11 = monitor_fd_param(cur_mon, VAR_7, &err); if (VAR_11 == -1) { error_propagate(VAR_10, err); return; } } else { VAR_11 = open("/dev/vhost-net", O_RDWR); if (VAR_11 < 0) { error_setg_errno(VAR_10, errno,
"VAR_0: open vhost char device failed"); return; } } options.opaque = (void *)(uintptr_t)VAR_11; s->vhost_net = vhost_net_init(&options); if (!s->vhost_net) { error_setg(VAR_10,
"vhost-net requested but could not be initialized"); return; } } else if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) { error_setg(VAR_10, "VAR_11= is not valid without vhost"); } }