static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs,

                                 Error **errp)

{

    char *p, *buf;

    char *name;

    char *value;

    Error *local_err = NULL;

    int ret = 0;



    buf = g_strdup(keypairs);

    p = buf;



    while (p) {

        name = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, p,

                                 '=', "conf option name", &p, &local_err);

        if (local_err) {

            break;

        }



        if (!p) {

            error_setg(errp, "conf option %s has no value", name);

            ret = -EINVAL;

            break;

        }



        value = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, p,

                                  ':', "conf option value", &p, &local_err);

        if (local_err) {

            break;

        }



        ret = rados_conf_set(cluster, name, value);

        if (ret < 0) {

            error_setg_errno(errp, -ret, "invalid conf option %s", name);

            ret = -EINVAL;

            break;

        }

    }



    if (local_err) {

        error_propagate(errp, local_err);

        ret = -EINVAL;

    }

    g_free(buf);

    return ret;

}

static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs,

                                 Error **errp)

{

    char *p, *buf;

    char *name;

    char *value;

    Error *local_err = NULL;

    int ret = 0;



    buf = g_strdup(keypairs);

    p = buf;



    while (p) {

        name = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, p,

                                 '=', "conf option name", &p, &local_err);

        if (local_err) {

            break;

        }



        if (!p) {

            error_setg(errp, "conf option %s has no value", name);

            ret = -EINVAL;

            break;

        }



        value = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, p,

                                  ':', "conf option value", &p, &local_err);

        if (local_err) {

            break;

        }



        ret = rados_conf_set(cluster, name, value);

        if (ret < 0) {

            error_setg_errno(errp, -ret, "invalid conf option %s", name);

            ret = -EINVAL;

            break;

        }

    }



    if (local_err) {

        error_propagate(errp, local_err);

        ret = -EINVAL;

    }

    g_free(buf);

    return ret;

}

static int FUNC_0(rados_t VAR_0, const char *VAR_1,

                                 Error **VAR_2)

{

    char *VAR_3, *VAR_4;

    char *VAR_5;

    char *VAR_6;

    Error *local_err = NULL;

    int VAR_7 = 0;



    VAR_4 = g_strdup(VAR_1);

    VAR_3 = VAR_4;



    while (VAR_3) {

        VAR_5 = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, VAR_3,

                                 '=', "conf option VAR_5", &VAR_3, &local_err);

        if (local_err) {

            break;

        }



        if (!VAR_3) {

            error_setg(VAR_2, "conf option %s has no VAR_6", VAR_5);

            VAR_7 = -EINVAL;

            break;

        }



        VAR_6 = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, VAR_3,

                                  ':', "conf option VAR_6", &VAR_3, &local_err);

        if (local_err) {

            break;

        }



        VAR_7 = rados_conf_set(VAR_0, VAR_5, VAR_6);

        if (VAR_7 < 0) {

            error_setg_errno(VAR_2, -VAR_7, "invalid conf option %s", VAR_5);

            VAR_7 = -EINVAL;

            break;

        }

    }



    if (local_err) {

        error_propagate(VAR_2, local_err);

        VAR_7 = -EINVAL;

    }

    g_free(VAR_4);

    return VAR_7;

}

static int FUNC_0(rados_t VAR_0, const char *VAR_1,
Error **VAR_2)
{ char *VAR_3, *VAR_4; char *VAR_5; char *VAR_6; Error *local_err = NULL; int VAR_7 = 0; VAR_4 = g_strdup(VAR_1); VAR_3 = VAR_4; while (VAR_3) { VAR_5 = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, VAR_3,
'=', "conf option VAR_5", &VAR_3, &local_err); if (local_err) { break; } if (!VAR_3) { error_setg(VAR_2, "conf option %s has no VAR_6", VAR_5); VAR_7 = -EINVAL; break; } VAR_6 = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, VAR_3,
':', "conf option VAR_6", &VAR_3, &local_err); if (local_err) { break; } VAR_7 = rados_conf_set(VAR_0, VAR_5, VAR_6); if (VAR_7 < 0) { error_setg_errno(VAR_2, -VAR_7, "invalid conf option %s", VAR_5); VAR_7 = -EINVAL; break; } } if (local_err) { error_propagate(VAR_2, local_err); VAR_7 = -EINVAL; } g_free(VAR_4); return VAR_7; }