int32_t
gf_store_handle_create_on_absence (gf_store_handle_t **shandle,
                                   char *path)
{
        GF_ASSERT (shandle);
        int32_t     ret = 0;

        if (*shandle == NULL) {
                ret = gf_store_handle_new (path, shandle);

                if (ret) {
                        gf_log ("", GF_LOG_ERROR, "Unable to create store"
                                " handle for path: %s", path);
                }
        }
        return ret;
}
Exemple #2
0
int
gf_store_handle_retrieve (char *path, gf_store_handle_t **handle)
{
    int32_t                 ret = -1;
    struct stat statbuf = {0};

    ret = stat (path, &statbuf);
    if (ret) {
        gf_log ("", GF_LOG_ERROR, "Unable to retrieve store handle "
                "%s, error: %s", path, strerror (errno));
        goto out;
    }
    ret =  gf_store_handle_new (path, handle);
out:
    gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
    return ret;
}
int
gf_store_handle_retrieve (char *path, gf_store_handle_t **handle)
{
        int32_t                 ret = -1;
        struct stat statbuf = {0};

        ret = stat (path, &statbuf);
        if (ret) {
                gf_log ("", GF_LOG_ERROR, "Path corresponding to "
                        "%s, returned error: (%s)",
                        path, strerror (errno));
                goto out;
        }
        ret =  gf_store_handle_new (path, handle);
out:
        gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
        return ret;
}