static int nbd_config(BDRVNBDState *s, QDict *options, char **export)

{

    Error *local_err = NULL;



    if (qdict_haskey(options, "path") == qdict_haskey(options, "host")) {

        if (qdict_haskey(options, "path")) {

            qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not "

                          "be used at the same time.");

        } else {

            qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host "

                          "must be specified.");

        }

        return -EINVAL;

    }



    s->client.is_unix = qdict_haskey(options, "path");

    s->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0,

                                      &error_abort);



    qemu_opts_absorb_qdict(s->socket_opts, options, &local_err);

    if (local_err) {

        qerror_report_err(local_err);

        error_free(local_err);

        return -EINVAL;

    }



    if (!qemu_opt_get(s->socket_opts, "port")) {

        qemu_opt_set_number(s->socket_opts, "port", NBD_DEFAULT_PORT);

    }



    *export = g_strdup(qdict_get_try_str(options, "export"));

    if (*export) {

        qdict_del(options, "export");

    }



    return 0;

}

static int nbd_config(BDRVNBDState *s, QDict *options, char **export)

{

    Error *local_err = NULL;



    if (qdict_haskey(options, "path") == qdict_haskey(options, "host")) {

        if (qdict_haskey(options, "path")) {

            qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not "

                          "be used at the same time.");

        } else {

            qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host "

                          "must be specified.");

        }

        return -EINVAL;

    }



    s->client.is_unix = qdict_haskey(options, "path");

    s->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0,

                                      &error_abort);



    qemu_opts_absorb_qdict(s->socket_opts, options, &local_err);

    if (local_err) {

        qerror_report_err(local_err);

        error_free(local_err);

        return -EINVAL;

    }



    if (!qemu_opt_get(s->socket_opts, "port")) {

        qemu_opt_set_number(s->socket_opts, "port", NBD_DEFAULT_PORT);

    }



    *export = g_strdup(qdict_get_try_str(options, "export"));

    if (*export) {

        qdict_del(options, "export");

    }



    return 0;

}

static int FUNC_0(BDRVNBDState *VAR_0, QDict *VAR_1, char **VAR_2)

{

    Error *local_err = NULL;



    if (qdict_haskey(VAR_1, "path") == qdict_haskey(VAR_1, "host")) {

        if (qdict_haskey(VAR_1, "path")) {

            qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not "

                          "be used at the same time.");

        } else {

            qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host "

                          "must be specified.");

        }

        return -EINVAL;

    }



    VAR_0->client.is_unix = qdict_haskey(VAR_1, "path");

    VAR_0->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0,

                                      &error_abort);



    qemu_opts_absorb_qdict(VAR_0->socket_opts, VAR_1, &local_err);

    if (local_err) {

        qerror_report_err(local_err);

        error_free(local_err);

        return -EINVAL;

    }



    if (!qemu_opt_get(VAR_0->socket_opts, "port")) {

        qemu_opt_set_number(VAR_0->socket_opts, "port", NBD_DEFAULT_PORT);

    }



    *VAR_2 = g_strdup(qdict_get_try_str(VAR_1, "VAR_2"));

    if (*VAR_2) {

        qdict_del(VAR_1, "VAR_2");

    }



    return 0;

}

static int FUNC_0(BDRVNBDState *VAR_0, QDict *VAR_1, char **VAR_2)
{ Error *local_err = NULL; if (qdict_haskey(VAR_1, "path") == qdict_haskey(VAR_1, "host")) { if (qdict_haskey(VAR_1, "path")) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not "
"be used at the same time."); } else { qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host "
"must be specified."); } return -EINVAL; } VAR_0->client.is_unix = qdict_haskey(VAR_1, "path"); VAR_0->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0,
&error_abort); qemu_opts_absorb_qdict(VAR_0->socket_opts, VAR_1, &local_err); if (local_err) { qerror_report_err(local_err); error_free(local_err); return -EINVAL; } if (!qemu_opt_get(VAR_0->socket_opts, "port")) { qemu_opt_set_number(VAR_0->socket_opts, "port", NBD_DEFAULT_PORT); } *VAR_2 = g_strdup(qdict_get_try_str(VAR_1, "VAR_2")); if (*VAR_2) { qdict_del(VAR_1, "VAR_2"); } return 0; }