Back to index

avfs  1.0.1
Functions
filecache.h File Reference
#include "avfs.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void * av_filecache_get (const char *key)
void av_filecache_set (const char *key, void *obj)
int av_filecache_getkey (ventry *ve, char **resp)

Function Documentation

void* av_filecache_get ( const char *  key)

Definition at line 69 of file filecache.c.

{
    struct filecache *fc;
    void *obj = NULL;
    
    AV_LOCK(fclock);
    fc = filecache_find(key);
    if(fc != NULL) {
        filecache_remove(fc);
        filecache_insert(fc);
        obj = fc->obj;
        av_ref_obj(obj);
    }
    AV_UNLOCK(fclock);

    return obj;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int av_filecache_getkey ( ventry *  ve,
char **  resp 
)

Definition at line 131 of file filecache.c.

{
    int res;
    char *key;

    res = av_generate_path(ve->mnt->base, &key);
    if(res < 0)
        return res;

    key = av_stradd(key, AVFS_SEP_STR, ve->mnt->avfs->name, NULL);

    *resp = key;
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void av_filecache_set ( const char *  key,
void *  obj 
)

Definition at line 87 of file filecache.c.

{
    struct filecache *oldfc;
    struct filecache *fc;

    if(obj != NULL) {
        AV_NEW(fc);
        fc->key = av_strdup(key);
        fc->obj = obj;
        av_ref_obj(obj);
    }
    else
        fc = NULL;

    AV_LOCK(fclock);
    oldfc = filecache_find(key);
    if(oldfc != NULL)
        filecache_delete(oldfc);
    if(fc != NULL) {
        av_log(AVLOG_DEBUG, "FILECACHE: insert <%s>", key);
        filecache_insert(fc);
    }
    AV_UNLOCK(fclock);
}

Here is the call graph for this function:

Here is the caller graph for this function: