Back to index

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

Go to the source code of this file.

Defines

#define AVFS_SEP_CHAR   '#'
#define AVFS_SEP_STR   "#"
#define AVFS_LOCK(avfs)   if(!(avfs->flags & AVF_NOLOCK)) AV_LOCK(avfs->lock)
#define AVFS_UNLOCK(avfs)   if(!(avfs->flags & AVF_NOLOCK)) AV_UNLOCK(avfs->lock)

Functions

int av_get_ventry (const char *path, int resolvelast, ventry **retp)
int av_copy_vmount (struct avmount *mnt, struct avmount **retp)
void av_free_vmount (struct avmount *mnt)
void av_default_avfs (struct avfs *avfs)
void av_init_dynamic_modules ()
void av_close_all_files ()
void av_delete_tmpdir ()
void av_init_avfsstat ()
void av_init_logstat ()
void av_init_cache ()
void av_check_malloc ()
void av_init_filecache ()
void av_do_exit ()
void av_avfsstat_register (const char *path, struct statefile *func)
int av_get_symlink_rewrite ()

Define Documentation

#define AVFS_LOCK (   avfs)    if(!(avfs->flags & AVF_NOLOCK)) AV_LOCK(avfs->lock)

Definition at line 15 of file internal.h.

#define AVFS_SEP_CHAR   '#'

Definition at line 12 of file internal.h.

#define AVFS_SEP_STR   "#"

Definition at line 13 of file internal.h.

#define AVFS_UNLOCK (   avfs)    if(!(avfs->flags & AVF_NOLOCK)) AV_UNLOCK(avfs->lock)

Definition at line 16 of file internal.h.


Function Documentation

void av_avfsstat_register ( const char *  path,
struct statefile func 
)

Definition at line 166 of file utils.c.

{
    struct entry *ent;
    struct statefile *stf;

    ent = av_namespace_resolve(avfsstat_ns, path);
    AV_NEW(stf);

    *stf = *func;
    av_namespace_set(ent, stf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void av_check_malloc ( )

Definition at line 186 of file leak.c.

 {
    const char *filename = "/tmp/leak.out";
    FILE *fp;

    av_log(AVLOG_DEBUG, "leak_count: %i (%i)", new_count, leaks_count);
    
    if (!(fp = fopen(filename, "w")))
        av_log(AVLOG_ERROR, "LeakTracer: Could not open %s: %s\n", filename,
                 strerror(errno));
    else {
        int i;
        int numunfreed = 0;

        AV_LOCK(lock);

        fprintf(fp, 
                "set prompt\n"
                "echo\n"
                "set listsize 0\n"
                "set height 0\n");
        fprintf(fp, "echo leak size: %6d\\n\n", new_size);
        for (i = 0; i <  leaks_count; i++)

            if (leaks[i].addr != NULL) {
                int j;
                
                numunfreed ++;
                fprintf(fp, "echo -------------------------------------------------------------------------\\n\n");
                fprintf(fp, "echo addr: %8p size: %9ld\\n\n",
                        leaks[i].addr,  (long) leaks[i].size);
                for(j = 0; j < 10; j++) {
                    if(!x(leaks[i].ret[j]))
                        break;

                    fprintf(fp, "l *0x%x\n", (int) leaks[i].ret[j]);
                }
            }
        AV_UNLOCK(lock);

        fclose(fp);
        av_log(AVLOG_WARNING, "number of unfreed pointers: %i", numunfreed);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 261 of file fdops.c.

{
    int fd;
    vfile *vf;
    
    AV_LOCK(files_lock);
    for(fd = 0; fd < file_table_size; fd++) {
        vf = file_table[fd];
        if(vf != NULL) {
            av_log(AVLOG_WARNING, "File handle still in use: %i", fd);
            av_file_close(vf);
            av_unref_obj(vf);
        }
    }
    av_free(file_table);
    file_table = NULL;
    AV_UNLOCK(files_lock);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int av_copy_vmount ( struct avmount mnt,
struct avmount **  retp 
)

Definition at line 834 of file parse.c.

{
    int res;
    ventry *newbase;
    
    if(mnt->base != NULL) {
        res = av_copy_ventry(mnt->base, &newbase);
        if(res < 0)
            return res;
    }
    else
        newbase = NULL;

    av_ref_obj(mnt->avfs);

    *resp = new_mount(newbase, mnt->avfs, mnt->opts);
    
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void av_default_avfs ( struct avfs avfs)

Definition at line 196 of file default.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void av_delete_tmpdir ( )

Definition at line 67 of file tmpfile.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void av_do_exit ( )

Definition at line 20 of file exit.c.

{
    struct exithandler *hand;

    AV_LOCK(exit_lock);
    for(hand = exit_handlers; hand != NULL; hand = exit_handlers) {
        exit_handlers = hand->next;
        hand->func();
        av_free(hand);
    }
    AV_UNLOCK(exit_lock);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void av_free_vmount ( struct avmount mnt)

Definition at line 886 of file parse.c.

{
    av_unref_obj(mnt->avfs);

    av_free(mnt->opts);
    av_free_ventry(mnt->base);
    av_free(mnt);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1000 of file parse.c.

{
    return symlink_rewrite;
}

Here is the caller graph for this function:

int av_get_ventry ( const char *  path,
int  resolvelast,
ventry **  retp 
)

Definition at line 783 of file parse.c.

{
    int res;
    struct parse_state ps;
    char *copypath;

    res = init();
    if(res < 0)
        return res;

    if(path == NULL)
        return -ENOENT;

    copypath = av_strdup(path);
    ps.path = copypath;
    ps.resolvelast = resolvelast;
    ps.linkctr = 10;

    AV_NEW(ps.ve);
    ps.ve->mnt = new_mount(NULL, get_local_avfs(), NULL);
    ps.ve->data = av_strdup("");

    res = parse_path(&ps, 0);

    /* no ventry so force localfile to be able to create files with
       the magic character inside filename */
    if(res < 0) {
        av_free(copypath);
        copypath = av_strdup(path);
        av_free_ventry(ps.ve);
        ps.path = copypath;
        ps.resolvelast = resolvelast;
        ps.linkctr = 10;
        AV_NEW(ps.ve);
        ps.ve->mnt = new_mount(NULL, get_local_avfs(), NULL);
        ps.ve->data = av_strdup("");
        res = parse_path(&ps, 1);
    }

    if(res < 0) {
        av_free_ventry(ps.ve);
        *resp = NULL;
    }
    else
        *resp = ps.ve;

    av_free(copypath);

    return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void av_init_avfsstat ( )

Definition at line 158 of file utils.c.

{
    struct avfs *avfs;

    av_state_new(NULL, "avfsstat", &avfsstat_ns, &avfs);
    av_unref_obj(avfsstat_ns);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void av_init_cache ( )

Definition at line 138 of file cache.c.

{
    struct statefile statf;

    cachelist.next = &cachelist;
    cachelist.prev = &cachelist;

    statf.get = cache_getoff;
    statf.set = cache_setoff;
 
    statf.data = &disk_cache_limit;
    av_avfsstat_register("cache/limit", &statf);
    
    statf.data = &disk_keep_free;
    av_avfsstat_register("cache/keep_free", &statf);

    statf.set = NULL;
    statf.data = &disk_usage;
    av_avfsstat_register("cache/usage", &statf);

    statf.set = cache_setfunc;
    statf.get = cache_getfunc;
    statf.data = cache_clear;
    av_avfsstat_register("cache/clear", &statf);
    
    av_add_exithandler(destroy_cache);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 106 of file modload.c.

{
    DIR *dirp;
    struct dirent *ent;
    char *moduledir;

    moduledir = av_get_config("moduledir");
    if(moduledir == NULL)
        return;

    dirp = opendir(moduledir);
    if(dirp != NULL) {
        while((ent = readdir(dirp)) != NULL)
            check_moduledir_entry(moduledir, ent->d_name);

        closedir(dirp);
    }
    av_free(moduledir);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 120 of file filecache.c.

{
    fclist.next = &fclist;
    fclist.prev = &fclist;
    fclist.obj = NULL;
    fclist.key = NULL;
    
    av_add_exithandler(destroy_filecache);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void av_init_logstat ( )

Definition at line 168 of file sysdeps.c.

{
    struct statefile statf;

    if(!loginited)
        log_init();

    statf.data = NULL;
    statf.get = debug_get;
    statf.set = debug_set;

    av_avfsstat_register("debug", &statf);

    statf.get = logfile_get;
    statf.set = logfile_set;

    av_avfsstat_register("logfile", &statf);
}

Here is the call graph for this function:

Here is the caller graph for this function: