static int qemu_rbd_set_conf(rados_t cluster, const char *conf)

{

    char *p, *buf;

    char name[RBD_MAX_CONF_NAME_SIZE];

    char value[RBD_MAX_CONF_VAL_SIZE];

    int ret = 0;



    buf = g_strdup(conf);

    p = buf;



    while (p) {

        ret = qemu_rbd_next_tok(name, sizeof(name), p,

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

        if (ret < 0) {

            break;

        }



        if (!p) {

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

            ret = -EINVAL;

            break;

        }



        ret = qemu_rbd_next_tok(value, sizeof(value), p,

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

        if (ret < 0) {

            break;

        }



        if (strcmp(name, "conf")) {

            ret = rados_conf_set(cluster, name, value);

            if (ret < 0) {

                error_report("invalid conf option %s", name);

                ret = -EINVAL;

                break;

            }

        } else {

            ret = rados_conf_read_file(cluster, value);

            if (ret < 0) {

                error_report("error reading conf file %s", value);

                break;

            }

        }

    }



    g_free(buf);

    return ret;

}

static int qemu_rbd_set_conf(rados_t cluster, const char *conf)

{

    char *p, *buf;

    char name[RBD_MAX_CONF_NAME_SIZE];

    char value[RBD_MAX_CONF_VAL_SIZE];

    int ret = 0;



    buf = g_strdup(conf);

    p = buf;



    while (p) {

        ret = qemu_rbd_next_tok(name, sizeof(name), p,

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

        if (ret < 0) {

            break;

        }



        if (!p) {

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

            ret = -EINVAL;

            break;

        }



        ret = qemu_rbd_next_tok(value, sizeof(value), p,

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

        if (ret < 0) {

            break;

        }



        if (strcmp(name, "conf")) {

            ret = rados_conf_set(cluster, name, value);

            if (ret < 0) {

                error_report("invalid conf option %s", name);

                ret = -EINVAL;

                break;

            }

        } else {

            ret = rados_conf_read_file(cluster, value);

            if (ret < 0) {

                error_report("error reading conf file %s", value);

                break;

            }

        }

    }



    g_free(buf);

    return ret;

}

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

{

    char *VAR_2, *VAR_3;

    char VAR_4[RBD_MAX_CONF_NAME_SIZE];

    char VAR_5[RBD_MAX_CONF_VAL_SIZE];

    int VAR_6 = 0;



    VAR_3 = g_strdup(VAR_1);

    VAR_2 = VAR_3;



    while (VAR_2) {

        VAR_6 = qemu_rbd_next_tok(VAR_4, sizeof(VAR_4), VAR_2,

                                '=', "VAR_1 option VAR_4", &VAR_2);

        if (VAR_6 < 0) {

            break;

        }



        if (!VAR_2) {

            error_report("VAR_1 option %s has no VAR_5", VAR_4);

            VAR_6 = -EINVAL;

            break;

        }



        VAR_6 = qemu_rbd_next_tok(VAR_5, sizeof(VAR_5), VAR_2,

                                ':', "VAR_1 option VAR_5", &VAR_2);

        if (VAR_6 < 0) {

            break;

        }



        if (strcmp(VAR_4, "VAR_1")) {

            VAR_6 = rados_conf_set(VAR_0, VAR_4, VAR_5);

            if (VAR_6 < 0) {

                error_report("invalid VAR_1 option %s", VAR_4);

                VAR_6 = -EINVAL;

                break;

            }

        } else {

            VAR_6 = rados_conf_read_file(VAR_0, VAR_5);

            if (VAR_6 < 0) {

                error_report("error reading VAR_1 file %s", VAR_5);

                break;

            }

        }

    }



    g_free(VAR_3);

    return VAR_6;

}

static int FUNC_0(rados_t VAR_0, const char *VAR_1)
{ char *VAR_2, *VAR_3; char VAR_4[RBD_MAX_CONF_NAME_SIZE]; char VAR_5[RBD_MAX_CONF_VAL_SIZE]; int VAR_6 = 0; VAR_3 = g_strdup(VAR_1); VAR_2 = VAR_3; while (VAR_2) { VAR_6 = qemu_rbd_next_tok(VAR_4, sizeof(VAR_4), VAR_2,
'=', "VAR_1 option VAR_4", &VAR_2); if (VAR_6 < 0) { break; } if (!VAR_2) { error_report("VAR_1 option %s has no VAR_5", VAR_4); VAR_6 = -EINVAL; break; } VAR_6 = qemu_rbd_next_tok(VAR_5, sizeof(VAR_5), VAR_2,
':', "VAR_1 option VAR_5", &VAR_2); if (VAR_6 < 0) { break; } if (strcmp(VAR_4, "VAR_1")) { VAR_6 = rados_conf_set(VAR_0, VAR_4, VAR_5); if (VAR_6 < 0) { error_report("invalid VAR_1 option %s", VAR_4); VAR_6 = -EINVAL; break; } } else { VAR_6 = rados_conf_read_file(VAR_0, VAR_5); if (VAR_6 < 0) { error_report("error reading VAR_1 file %s", VAR_5); break; } } } g_free(VAR_3); return VAR_6; }