static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)

{

    BDRVNBDState *s = bs->opaque;

    QDict *opts = qdict_new();

    QObject *saddr_qdict;

    Visitor *ov;

    const char *host = NULL, *port = NULL, *path = NULL;



    if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {

        const InetSocketAddress *inet = s->saddr->u.inet.data;

        if (!inet->has_ipv4 && !inet->has_ipv6 && !inet->has_to) {

            host = inet->host;

            port = inet->port;

        }

    } else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) {

        path = s->saddr->u.q_unix.data->path;

    }



    qdict_put(opts, "driver", qstring_from_str("nbd"));



    if (path && s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd+unix:///%s?socket=%s", s->export, path);

    } else if (path && !s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd+unix://?socket=%s", path);

    } else if (host && s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd://%s:%s/%s", host, port, s->export);

    } else if (host && !s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd://%s:%s", host, port);

    }



    ov = qobject_output_visitor_new(&saddr_qdict);

    visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);

    visit_complete(ov, &saddr_qdict);


    assert(qobject_type(saddr_qdict) == QTYPE_QDICT);



    qdict_put_obj(opts, "server", saddr_qdict);



    if (s->export) {

        qdict_put(opts, "export", qstring_from_str(s->export));

    }

    if (s->tlscredsid) {

        qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));

    }



    qdict_flatten(opts);

    bs->full_open_options = opts;

}
static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)

{

    BDRVNBDState *s = bs->opaque;

    QDict *opts = qdict_new();

    QObject *saddr_qdict;

    Visitor *ov;

    const char *host = NULL, *port = NULL, *path = NULL;



    if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {

        const InetSocketAddress *inet = s->saddr->u.inet.data;

        if (!inet->has_ipv4 && !inet->has_ipv6 && !inet->has_to) {

            host = inet->host;

            port = inet->port;

        }

    } else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) {

        path = s->saddr->u.q_unix.data->path;

    }



    qdict_put(opts, "driver", qstring_from_str("nbd"));



    if (path && s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd+unix:

    } else if (path && !s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd+unix:

    } else if (host && s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd:

    } else if (host && !s->export) {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "nbd:

    }



    ov = qobject_output_visitor_new(&saddr_qdict);

    visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);

    visit_complete(ov, &saddr_qdict);


    assert(qobject_type(saddr_qdict) == QTYPE_QDICT);



    qdict_put_obj(opts, "server", saddr_qdict);



    if (s->export) {

        qdict_put(opts, "export", qstring_from_str(s->export));

    }

    if (s->tlscredsid) {

        qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));

    }



    qdict_flatten(opts);

    bs->full_open_options = opts;

}
static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1)

{

    BDRVNBDState *s = VAR_0->opaque;

    QDict *opts = qdict_new();

    QObject *saddr_qdict;

    Visitor *ov;

    const char *VAR_2 = NULL, *VAR_3 = NULL, *VAR_4 = NULL;



    if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {

        const InetSocketAddress *VAR_5 = s->saddr->u.VAR_5.data;

        if (!VAR_5->has_ipv4 && !VAR_5->has_ipv6 && !VAR_5->has_to) {

            VAR_2 = VAR_5->VAR_2;

            VAR_3 = VAR_5->VAR_3;

        }

    } else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) {

        VAR_4 = s->saddr->u.q_unix.data->VAR_4;

    }



    qdict_put(opts, "driver", qstring_from_str("nbd"));



    if (VAR_4 && s->export) {

        snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),

                 "nbd+unix:

    } else if (VAR_4 && !s->export) {

        snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),

                 "nbd+unix:

    } else if (VAR_2 && s->export) {

        snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),

                 "nbd:

    } else if (VAR_2 && !s->export) {

        snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),

                 "nbd:

    }



    ov = qobject_output_visitor_new(&saddr_qdict);

    visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);

    visit_complete(ov, &saddr_qdict);


    assert(qobject_type(saddr_qdict) == QTYPE_QDICT);



    qdict_put_obj(opts, "server", saddr_qdict);



    if (s->export) {

        qdict_put(opts, "export", qstring_from_str(s->export));

    }

    if (s->tlscredsid) {

        qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));

    }



    qdict_flatten(opts);

    VAR_0->full_open_options = opts;

}
static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1)
{ BDRVNBDState *s = VAR_0->opaque; QDict *opts = qdict_new(); QObject *saddr_qdict; Visitor *ov; const char *VAR_2 = NULL, *VAR_3 = NULL, *VAR_4 = NULL; if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) { const InetSocketAddress *VAR_5 = s->saddr->u.VAR_5.data; if (!VAR_5->has_ipv4 && !VAR_5->has_ipv6 && !VAR_5->has_to) { VAR_2 = VAR_5->VAR_2; VAR_3 = VAR_5->VAR_3; } } else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) { VAR_4 = s->saddr->u.q_unix.data->VAR_4; } qdict_put(opts, "driver", qstring_from_str("nbd")); if (VAR_4 && s->export) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd+unix:
} else if (VAR_4 && !s->export) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd+unix:
} else if (VAR_2 && s->export) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd:
} else if (VAR_2 && !s->export) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd:
} ov = qobject_output_visitor_new(&saddr_qdict); visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort); visit_complete(ov, &saddr_qdict); assert(qobject_type(saddr_qdict) == QTYPE_QDICT); qdict_put_obj(opts, "server", saddr_qdict); if (s->export) { qdict_put(opts, "export", qstring_from_str(s->export)); } if (s->tlscredsid) { qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid)); } qdict_flatten(opts); VAR_0->full_open_options = opts; }