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

                             bool only_read_conf_file,

                             Error **errp)

{

    char *p, *buf;

    char *name;

    char *value;

    Error *local_err = NULL;

    int ret = 0;



    buf = g_strdup(conf);

    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;

        }

        qemu_rbd_unescape(name);



        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;

        }

        qemu_rbd_unescape(value);



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

            /* read the conf file alone, so it doesn't override more

               specific settings for a particular device */

            if (only_read_conf_file) {

                ret = rados_conf_read_file(cluster, value);

                if (ret < 0) {

                    error_setg_errno(errp, -ret, "error reading conf file %s",

                                     value);

                    break;

                }

            }

        } else if (strcmp(name, "id") == 0) {

            /* ignore, this is parsed by qemu_rbd_parse_clientname() */

        } else if (!only_read_conf_file) {

            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_conf(rados_t cluster, const char *conf,

                             bool only_read_conf_file,

                             Error **errp)

{

    char *p, *buf;

    char *name;

    char *value;

    Error *local_err = NULL;

    int ret = 0;



    buf = g_strdup(conf);

    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;

        }

        qemu_rbd_unescape(name);



        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;

        }

        qemu_rbd_unescape(value);



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

            



            if (only_read_conf_file) {

                ret = rados_conf_read_file(cluster, value);

                if (ret < 0) {

                    error_setg_errno(errp, -ret, "error reading conf file %s",

                                     value);

                    break;

                }

            }

        } else if (strcmp(name, "id") == 0) {

            

        } else if (!only_read_conf_file) {

            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,

                             bool VAR_2,

                             Error **VAR_3)

{

    char *VAR_4, *VAR_5;

    char *VAR_6;

    char *VAR_7;

    Error *local_err = NULL;

    int VAR_8 = 0;



    VAR_5 = g_strdup(VAR_1);

    VAR_4 = VAR_5;



    while (VAR_4) {

        VAR_6 = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, VAR_4,

                                 '=', "VAR_1 option VAR_6", &VAR_4, &local_err);

        if (local_err) {

            break;

        }

        qemu_rbd_unescape(VAR_6);



        if (!VAR_4) {

            error_setg(VAR_3, "VAR_1 option %s has no VAR_7", VAR_6);

            VAR_8 = -EINVAL;

            break;

        }



        VAR_7 = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, VAR_4,

                                  ':', "VAR_1 option VAR_7", &VAR_4, &local_err);

        if (local_err) {

            break;

        }

        qemu_rbd_unescape(VAR_7);



        if (strcmp(VAR_6, "VAR_1") == 0) {

            



            if (VAR_2) {

                VAR_8 = rados_conf_read_file(VAR_0, VAR_7);

                if (VAR_8 < 0) {

                    error_setg_errno(VAR_3, -VAR_8, "error reading VAR_1 file %s",

                                     VAR_7);

                    break;

                }

            }

        } else if (strcmp(VAR_6, "id") == 0) {

            

        } else if (!VAR_2) {

            VAR_8 = rados_conf_set(VAR_0, VAR_6, VAR_7);

            if (VAR_8 < 0) {

                error_setg_errno(VAR_3, -VAR_8, "invalid VAR_1 option %s", VAR_6);

                VAR_8 = -EINVAL;

                break;

            }

        }

    }



    if (local_err) {

        error_propagate(VAR_3, local_err);

        VAR_8 = -EINVAL;

    }

    g_free(VAR_5);

    return VAR_8;

}

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