> +static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename)
> +{
> +    URI *uri;
> +    QueryParams *qp = NULL;
> +    bool is_unix = false;
> +    int ret = 0;
> +    char *unescape_str = NULL;
> +
> +    uri = uri_parse(filename);
> +    if (!uri) {
> +        return -EINVAL;
> +    }
> +
> +    /* transport */
> +    if (!strcmp(uri->scheme, "gluster")) {
> +        gconf->transport = g_strdup("tcp");
> +    } else if (!strcmp(uri->scheme, "gluster+tcp")) {
> +        gconf->transport = g_strdup("tcp");
> +    } else if (!strcmp(uri->scheme, "gluster+unix")) {
> +        gconf->transport = g_strdup("unix");
> +        is_unix = true;
> +    } else if (!strcmp(uri->scheme, "gluster+rdma")) {
> +        gconf->transport = g_strdup("rdma");
> +    } else {
> +        ret = -EINVAL;
> +        goto out;
> +    }
> +
> +    ret = parse_volume_options(gconf, uri->path);
> +    if (ret < 0) {
> +        goto out;
> +    }
> +
> +    if (uri->query) {
> +        unescape_str = uri_string_unescape(uri->query, -1, NULL);
> +        if (!unescape_str) {
> +            ret = -EINVAL;
> +            goto out;
> +        }
> +    }
> +
> +    qp = query_params_parse(unescape_str);

query_params_parse already does the unescaping.

Paolo

Reply via email to