Back to index

avfs  1.0.1
Classes | Functions
volatile.c File Reference
#include "avfs.h"
#include "version.h"

Go to the source code of this file.

Classes

struct  volnode
struct  volentry
struct  volfs

Functions

static void vol_unlink_entry (struct volentry *ent)
static struct volentryvol_new_entry (const char *name)
static void vol_free_node (struct volnode *nod)
static struct volnodevol_new_node (struct avstat *initstat)
static void vol_link_node (struct volentry *ent, struct volnode *nod)
static void vol_unlink_node (struct volentry *ent)
static void vol_free_tree (struct volentry *ent)
static int vol_make_node (struct volfs *fs, struct volentry *ent, avmode_t mode)
static struct volentryvol_ventry_volentry (ventry *ve)
static struct volnodevol_vfile_volnode (vfile *vf)
static struct volfsvol_ventry_volfs (ventry *ve)
static struct volentryvol_get_entry (struct volentry *parent, const char *name)
static int vol_do_lookup (struct volentry *parent, const char *name, struct volentry **entp)
static struct volentryvol_get_root (ventry *ve)
static int vol_lookup (ventry *ve, const char *name, void **newp)
static char * vol_create_path (struct volentry *ent)
static int vol_getpath (ventry *ve, char **resp)
static void vol_putent (ventry *ve)
static int vol_copyent (ventry *ve, void **resp)
static void vol_truncate_node (struct volnode *nod, avoff_t length)
static int vol_need_write (int flags)
static int vol_open_check_type (avmode_t mode, int flags)
static int vol_open_check (struct volnode *nod, int flags)
static int vol_open (ventry *ve, int flags, avmode_t mode, void **resp)
static int vol_close (vfile *vf)
static avssize_t vol_read (vfile *vf, char *buf, avsize_t nbyte)
static avssize_t vol_write (vfile *vf, const char *buf, avsize_t nbyte)
static int vol_truncate (vfile *vf, avoff_t length)
static struct volnodevol_special_entry (int n, struct volnode *nod, const char **namep)
static struct volnodevol_nth_entry (int n, struct volnode *nod, const char **namep)
static int vol_readdir (vfile *vf, struct avdirent *buf)
static int vol_getattr (vfile *vf, struct avstat *buf, int attrmask)
static void vol_set_attributes (struct avstat *dest, const struct avstat *src, int attrmask)
static int vol_setattr (vfile *vf, struct avstat *buf, int attrmask)
static int vol_access (ventry *ve, int amode)
static int vol_readlink (ventry *ve, char **bufp)
static int vol_unlink (ventry *ve)
static int vol_check_rmdir (struct volentry *ent)
static int vol_rmdir (ventry *ve)
static int vol_mkdir (ventry *ve, avmode_t mode)
static int vol_mknod (ventry *ve, avmode_t mode, avdev_t dev)
static int vol_is_subdir (struct volentry *dir, struct volentry *basedir)
static int vol_check_rename (struct volentry *ent, struct volentry *newent)
static int vol_rename (ventry *ve, ventry *newve)
static int vol_check_link (struct volentry *ent, struct volentry *newent)
static int vol_link (ventry *ve, ventry *newve)
static int vol_symlink (const char *path, ventry *newve)
static void vol_destroy (struct avfs *avfs)
int av_init_module_volatile (struct vmodule *module)

Class Documentation

struct volnode

Definition at line 14 of file volatile.c.

Collaboration diagram for volnode:
Class Members
char * content
struct volentry * parent
struct volentry * subdir
struct volentry

Definition at line 23 of file volatile.c.

Collaboration diagram for volentry:
Class Members
char * name
struct volentry * next
struct volnode * node
struct volentry * parent
struct volentry ** prevp
struct volfs

Definition at line 32 of file volatile.c.

Collaboration diagram for volfs:
Class Members
struct avfs * avfs
struct volentry * root

Function Documentation

int av_init_module_volatile ( struct vmodule module)

Definition at line 810 of file volatile.c.

{
    int res;
    struct avfs *avfs;
    struct volfs *fs;

    res = av_new_avfs("volatile", NULL, AV_VER, AVF_ONLYROOT, module, &avfs);
    if(res < 0)
        return res;

    avfs->destroy = vol_destroy;

    AV_NEW(fs);

    avfs->data = (void *) fs;

    fs->root = vol_new_entry("/");
    fs->avfs = avfs;

    vol_make_node(fs, fs->root, 0755 | AV_IFDIR);

    avfs->lookup    = vol_lookup;
    avfs->putent    = vol_putent;
    avfs->copyent   = vol_copyent;
    avfs->getpath   = vol_getpath;
    
    avfs->open      = vol_open;
    avfs->close     = vol_close;
    avfs->read      = vol_read;
    avfs->write     = vol_write;
    avfs->readdir   = vol_readdir;
    avfs->getattr   = vol_getattr;
    avfs->setattr   = vol_setattr;
    avfs->truncate  = vol_truncate;

    avfs->access    = vol_access;
    avfs->readlink  = vol_readlink;
    avfs->unlink    = vol_unlink;
    avfs->rmdir     = vol_rmdir;
    avfs->mkdir     = vol_mkdir;
    avfs->mknod     = vol_mknod;
    avfs->rename    = vol_rename;
    avfs->link      = vol_link;
    avfs->symlink   = vol_symlink;

    av_add_avfs(avfs);
    
    return 0;
}

Here is the call graph for this function:

static int vol_access ( ventry *  ve,
int  amode 
) [static]

Definition at line 571 of file volatile.c.

{
    struct volnode *nod = vol_ventry_volentry(ve)->node;

    if(nod == NULL) 
        return -ENOENT;
    
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_check_link ( struct volentry ent,
struct volentry newent 
) [static]

Definition at line 745 of file volatile.c.

{
    if(ent->node == NULL)
        return -ENOENT;

    if(newent->name == NULL)
        return -ENOENT;

    if(AV_ISDIR(ent->node->st.mode))
        return -EPERM;
    
    if(newent->node != NULL)
        return -EEXIST;
    
    return 0;
}

Here is the caller graph for this function:

static int vol_check_rename ( struct volentry ent,
struct volentry newent 
) [static]

Definition at line 696 of file volatile.c.

{
    if(ent->node == NULL)
        return -ENOENT;

    if(newent->name == NULL)
        return -ENOENT;

    if(AV_ISDIR(ent->node->st.mode) && vol_is_subdir(newent, ent))
        return -EINVAL;

    if(newent->node != NULL) {
        if(AV_ISDIR(ent->node->st.mode)) {
            if(!AV_ISDIR(newent->node->st.mode))
                return -ENOTDIR;

            if(newent->node->subdir != NULL)
                return -ENOTEMPTY;
        }
        else {
            if(AV_ISDIR(newent->node->st.mode))
               return -EISDIR;
        }
        vol_unlink_node(newent);
    }

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_check_rmdir ( struct volentry ent) [static]

Definition at line 612 of file volatile.c.

{
    struct volnode *nod = ent->node;

    if(nod == NULL)
        return -ENOENT;

    if(!AV_ISDIR(nod->st.mode)) 
        return -ENOTDIR;

    if(nod->subdir != NULL)
        return -ENOTEMPTY;

    if(ent->parent == NULL)
        return -EBUSY;

    return 0;
}

Here is the caller graph for this function:

static int vol_close ( vfile *  vf) [static]

Definition at line 414 of file volatile.c.

{
    struct volnode *nod = vol_vfile_volnode(vf);

    av_unref_obj(nod);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_copyent ( ventry *  ve,
void **  resp 
) [static]

Definition at line 314 of file volatile.c.

{
    struct volentry *ent = vol_ventry_volentry(ve);
    
    av_ref_obj(ent);

    *resp = (void *) ent;

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* vol_create_path ( struct volentry ent) [static]

Definition at line 286 of file volatile.c.

{
    char *path;
    
    if(ent->parent == NULL)
        return av_strdup("");
    
    path = vol_create_path(ent->parent);

    return av_stradd(path, "/", ent->name, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_destroy ( struct avfs avfs) [static]

Definition at line 796 of file volatile.c.

{
    struct volfs *fs = (struct volfs *) avfs->data;

    vol_free_tree(fs->root);
    av_unref_obj(fs->root);
    av_free(fs);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_do_lookup ( struct volentry parent,
const char *  name,
struct volentry **  entp 
) [static]

Definition at line 226 of file volatile.c.

{
    if(parent->node == NULL)
        return -ENOENT;

    if(name == NULL) {
        *entp = parent->parent;
        av_ref_obj(*entp);
        return 0;
    }

    if(!AV_ISDIR(parent->node->st.mode))
        return -ENOTDIR;

    *entp = vol_get_entry(parent, name);
    
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_free_node ( struct volnode nod) [static]

Definition at line 70 of file volatile.c.

{
    av_free(nod->content);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_free_tree ( struct volentry ent) [static]

Definition at line 135 of file volatile.c.

{
    struct volnode *nod = ent->node;

    if(nod != NULL) {
        while(nod->subdir != NULL)
            vol_free_tree(nod->subdir);
        
        vol_unlink_entry(ent);
        vol_unlink_node(ent);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct volentry* vol_get_entry ( struct volentry parent,
const char *  name 
) [static, read]

Definition at line 189 of file volatile.c.

{
    struct volentry **entp;
    struct volentry *ent;

    if(strcmp(name, ".") == 0) {
        ent = parent;
       av_ref_obj(ent);
       return ent;
    }
    if(strcmp(name, "..") == 0) {
        ent = parent->parent;
       av_ref_obj(ent);
       return ent;
    }
    for(entp = &parent->node->subdir; *entp != NULL; entp = &(*entp)->next)
       if(strcmp(name, (*entp)->name) == 0) {
           ent = *entp;
           av_ref_obj(ent);
           return ent;
       }

    /* lookup failed, so create a new entry and add it to the
       directory list temporarily */
 
    ent = vol_new_entry(name);
    
    *entp = ent;
    ent->prevp = entp;
    ent->parent = parent;
    av_ref_obj(parent);

    return ent;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct volentry* vol_get_root ( ventry *  ve) [static, read]

Definition at line 247 of file volatile.c.

{
    struct volfs *fs = vol_ventry_volfs(ve);
    struct volentry *root = fs->root;

    av_ref_obj(root);

    return root;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_getattr ( vfile *  vf,
struct avstat buf,
int  attrmask 
) [static]

Definition at line 538 of file volatile.c.

{
    struct volnode *nod = vol_vfile_volnode(vf);

    *buf = nod->st;

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_getpath ( ventry *  ve,
char **  resp 
) [static]

Definition at line 298 of file volatile.c.

{
    struct volentry *ent = vol_ventry_volentry(ve);

    *resp = vol_create_path(ent);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_is_subdir ( struct volentry dir,
struct volentry basedir 
) [static]

Definition at line 680 of file volatile.c.

{
    while(1) {
        if(dir == basedir)
            return 1;

        if(dir->parent == NULL)
            break;

        dir = dir->parent;
    }

    return 0;
}

Here is the caller graph for this function:

static int vol_link ( ventry *  ve,
ventry *  newve 
) [static]

Definition at line 762 of file volatile.c.

{
    int res;
    struct volentry *ent = vol_ventry_volentry(ve);
    struct volentry *newent = vol_ventry_volentry(newve);
    
    res = vol_check_link(ent, newent);
    if(res < 0)
        return res;

    vol_link_node(newent, ent->node);
    
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_link_node ( struct volentry ent,
struct volnode nod 
) [static]

Definition at line 91 of file volatile.c.

{
    av_ref_obj(ent);
    av_ref_obj(nod);
    ent->node = nod;
    
    if(AV_ISDIR(nod->st.mode)) {
        nod->st.nlink = 2;
        if(ent->parent != NULL) {
            nod->parent = ent->parent;
            ent->parent->node->st.nlink ++;
        }
        else 
            nod->parent = ent;
    }
    else
        nod->st.nlink ++;

    if(ent->parent != NULL)
        ent->parent->node->st.size ++;    
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_lookup ( ventry *  ve,
const char *  name,
void **  newp 
) [static]

Definition at line 257 of file volatile.c.

{
    int res = 0;
    struct volentry *parent = vol_ventry_volentry(ve);
    struct volentry *ent;
    
    if(parent == NULL) {
        if(name[0] != '\0' || ve->mnt->opts[0] != '\0')
            return -ENOENT;

        ent = vol_get_root(ve);
    }
    else {
        res = vol_do_lookup(parent, name, &ent);
        if(res < 0)
            return res;
        
        av_unref_obj(parent);
    }

    *newp = ent;

    if(ent != NULL && ent->node != NULL)
        return AV_TYPE(ent->node->st.mode);
    else
        return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_make_node ( struct volfs fs,
struct volentry ent,
avmode_t  mode 
) [static]

Definition at line 148 of file volatile.c.

{
    struct volnode *nod;
    struct avstat initstat;

    if(ent->name == NULL)
        return -ENOENT;

    av_default_stat(&initstat);
    
    initstat.dev = fs->avfs->dev;
    initstat.ino = av_new_ino(fs->avfs);

    nod = vol_new_node(&initstat);
    nod->st.mode = mode;
    
    vol_link_node(ent, nod);
    av_unref_obj(nod);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_mkdir ( ventry *  ve,
avmode_t  mode 
) [static]

Definition at line 645 of file volatile.c.

{
    int res;
    struct volfs *fs = vol_ventry_volfs(ve);
    struct volentry *ent = vol_ventry_volentry(ve);
    
    if(ent->node != NULL)
        return -EEXIST;
    
    res = vol_make_node(fs, ent, mode | AV_IFDIR);
    if(res < 0)
        return res;

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_mknod ( ventry *  ve,
avmode_t  mode,
avdev_t  dev 
) [static]

Definition at line 661 of file volatile.c.

{
    int res;
    struct volfs *fs = vol_ventry_volfs(ve);
    struct volentry *ent = vol_ventry_volentry(ve);
    
    if(ent->node != NULL)
        return -EEXIST;
    
    res = vol_make_node(fs, ent, mode);
    if(res < 0)
        return res;

    ent->node->st.rdev = dev;

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_need_write ( int  flags) [static]

Definition at line 334 of file volatile.c.

{
    if((flags & AVO_ACCMODE) == AVO_WRONLY ||
       (flags & AVO_ACCMODE) == AVO_RDWR ||
       (flags & AVO_TRUNC) != 0)
        return 1;
    
    return 0;
}

Here is the caller graph for this function:

static struct volentry* vol_new_entry ( const char *  name) [static, read]

Definition at line 54 of file volatile.c.

{
    struct volentry *ent;

    AV_NEW_OBJ(ent, vol_unlink_entry);

    ent->node = NULL;
    ent->next = NULL;
    ent->prevp = NULL;
    ent->parent = NULL;
    ent->name = av_strdup(name);

    return ent;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct volnode* vol_new_node ( struct avstat initstat) [static, read]

Definition at line 76 of file volatile.c.

{
    struct volnode *nod;

    AV_NEW_OBJ(nod, vol_free_node);

    nod->st = *initstat;
    nod->subdir = NULL;
    nod->parent = NULL;
    nod->content = NULL;

    return nod;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct volnode* vol_nth_entry ( int  n,
struct volnode nod,
const char **  namep 
) [static, read]

Definition at line 492 of file volatile.c.

{
    struct volentry *ent;
    int i;

    if(nod->parent != NULL) {
        if(n  < 2)
            return vol_special_entry(n, nod, namep);

        n -= 2;
    }

    ent = nod->subdir;
    for(i = 0; i < n && ent != NULL; i++)
        ent = ent->next;
    
    if(ent == NULL)
        return NULL;

    *namep = ent->name;
    return ent->node;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_open ( ventry *  ve,
int  flags,
avmode_t  mode,
void **  resp 
) [static]

Definition at line 387 of file volatile.c.

{
    int res;
    struct volfs *fs = vol_ventry_volfs(ve);
    struct volentry *ent = vol_ventry_volentry(ve);
    
    /* check permissions */
    res = vol_open_check(ent->node, flags);
    if(res < 0)
        return res;

    /* create the file if it doesn't exist yet */
    if(ent->node == NULL) {
        res = vol_make_node(fs, ent, mode | AV_IFREG);
        if(res < 0)
            return res;
    }
    else if((flags & AVO_TRUNC) != 0)
        vol_truncate_node(ent->node, 0);

    av_ref_obj(ent->node);
    
    *resp = ent->node;

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_open_check ( struct volnode nod,
int  flags 
) [static]

Definition at line 373 of file volatile.c.

{
    if(nod == NULL) {
        if(!(flags & AVO_CREAT))
            return -ENOENT;
        return 0;
    }

    if((flags & AVO_EXCL) != 0)
        return -EEXIST;

    return vol_open_check_type(nod->st.mode, flags);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_open_check_type ( avmode_t  mode,
int  flags 
) [static]

Definition at line 345 of file volatile.c.

{
    if((flags & AVO_DIRECTORY) != 0 && !AV_ISDIR(mode))
        return -ENOTDIR;
    
    switch(mode & AV_IFMT) {
    case AV_IFREG:
        return 0;
        
    case AV_IFDIR:
        if(vol_need_write(flags))
            return -EISDIR;
        return 0;

    case AV_IFLNK:
        if((flags & AVO_ACCMODE) != AVO_NOPERM || !(flags & AVO_NOFOLLOW))
            return -ENOENT;
        return 0;

    default:
        /* FIFO, char/bockdev, socket */
        if((flags & AVO_ACCMODE) != AVO_NOPERM)
            return -ENXIO;
        return 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_putent ( ventry *  ve) [static]

Definition at line 307 of file volatile.c.

{
    struct volentry *ent = vol_ventry_volentry(ve);

    av_unref_obj(ent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static avssize_t vol_read ( vfile *  vf,
char *  buf,
avsize_t  nbyte 
) [static]

Definition at line 423 of file volatile.c.

{
    avoff_t nact;
    struct volnode *nod = vol_vfile_volnode(vf);

    if(AV_ISDIR(nod->st.mode))
        return -EISDIR;
    
    if(vf->ptr >= nod->st.size)
       return 0;
    
    nact = AV_MIN(nbyte, (avsize_t) (nod->st.size - vf->ptr));
    
    memcpy(buf, nod->content + vf->ptr, nact);
    
    vf->ptr += nact;
    
    return nact;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_readdir ( vfile *  vf,
struct avdirent buf 
) [static]

Definition at line 516 of file volatile.c.

{
    struct volnode *parent = vol_vfile_volnode(vf);
    struct volnode *nod;
    const char *name;
    
    if(!AV_ISDIR(parent->st.mode))
        return -ENOTDIR;
    
    nod = vol_nth_entry(vf->ptr, parent, &name);
    if(nod == NULL)
        return 0;

    buf->name = av_strdup(name);
    buf->ino = nod->st.ino;
    buf->type = AV_TYPE(nod->st.mode);
    
    vf->ptr ++;
    
    return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_readlink ( ventry *  ve,
char **  bufp 
) [static]

Definition at line 581 of file volatile.c.

{
    struct volnode *nod = vol_ventry_volentry(ve)->node;

    if(nod == NULL)
        return -ENOENT;

    if(!AV_ISLNK(nod->st.mode))
        return -EINVAL;

    *bufp = av_strdup(nod->content);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_rename ( ventry *  ve,
ventry *  newve 
) [static]

Definition at line 725 of file volatile.c.

{
    int res;
    struct volentry *ent = vol_ventry_volentry(ve);
    struct volentry *newent = vol_ventry_volentry(newve);

    if(ent->node != NULL && ent == newent)
        return 0;

    res = vol_check_rename(ent, newent);
    if(res < 0)
        return res;

    vol_link_node(newent, ent->node);
    vol_unlink_node(ent);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_rmdir ( ventry *  ve) [static]

Definition at line 631 of file volatile.c.

{
    int res;
    struct volentry *ent = vol_ventry_volentry(ve);

    res = vol_check_rmdir(ent);
    if(res < 0) 
        return res;

    vol_unlink_node(ent);
    
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_set_attributes ( struct avstat dest,
const struct avstat src,
int  attrmask 
) [static]

Definition at line 547 of file volatile.c.

{
    if((attrmask & AVA_ATIME) != 0)
        dest->atime = src->atime;
    if((attrmask & AVA_MTIME) != 0)
        dest->mtime = src->mtime;
    if((attrmask & AVA_MODE) != 0)
        dest->mode = (dest->mode & AV_IFMT) | src->mode;
    if((attrmask & AVA_UID) != 0)
        dest->uid = src->uid;
    if((attrmask & AVA_GID) != 0)
        dest->gid = src->gid;
}

Here is the caller graph for this function:

static int vol_setattr ( vfile *  vf,
struct avstat buf,
int  attrmask 
) [static]

Definition at line 562 of file volatile.c.

{
    struct volnode *nod = vol_vfile_volnode(vf);

    vol_set_attributes(&nod->st, buf, attrmask);
    
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct volnode* vol_special_entry ( int  n,
struct volnode nod,
const char **  namep 
) [static, read]

Definition at line 478 of file volatile.c.

{
    if(n == 0) {
        *namep = ".";
        return nod;
    }
    else {
        *namep = "..";
        return nod->parent->node;
    }
}

Here is the caller graph for this function:

static int vol_symlink ( const char *  path,
ventry *  newve 
) [static]

Definition at line 777 of file volatile.c.

{
    int res;
    struct volfs *fs = vol_ventry_volfs(newve);
    struct volentry *ent = vol_ventry_volentry(newve);
    
    if(ent->node != NULL)
        return -EEXIST;

    res = vol_make_node(fs, ent, 0777 | AV_IFLNK);
    if(res < 0)
        return res;
    
    ent->node->content = av_strdup(path);
    ent->node->st.size = strlen(path);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_truncate ( vfile *  vf,
avoff_t  length 
) [static]

Definition at line 467 of file volatile.c.

{
    struct volnode *nod = vol_vfile_volnode(vf);

    if(length < nod->st.size)
        vol_truncate_node(nod, length);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_truncate_node ( struct volnode nod,
avoff_t  length 
) [static]

Definition at line 326 of file volatile.c.

{
    nod->st.size = length;
    nod->st.blocks = AV_DIV(nod->st.size, 512);
    av_curr_time(&nod->st.mtime);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int vol_unlink ( ventry *  ve) [static]

Definition at line 596 of file volatile.c.

{
    struct volentry *ent = vol_ventry_volentry(ve);

    if(ent->node == NULL)
        return -ENOENT;

    if(AV_ISDIR(ent->node->st.mode))
        return -EISDIR;
    
    vol_unlink_node(ent);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_unlink_entry ( struct volentry ent) [static]

Definition at line 38 of file volatile.c.

{
    if(ent->prevp != NULL)
        *ent->prevp = ent->next;
    if(ent->next != NULL)
        ent->next->prevp = ent->prevp;
    av_unref_obj(ent->parent);
    av_free(ent->name);

    ent->prevp = NULL;
    ent->next = NULL;
    ent->parent = NULL;
    ent->name = NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void vol_unlink_node ( struct volentry ent) [static]

Definition at line 113 of file volatile.c.

{
    struct volnode *nod = ent->node;
    
    if(AV_ISDIR(nod->st.mode)) {
        nod->st.nlink = 0;
        if(nod->parent != NULL)
            nod->parent->node->st.nlink --;
    }
    else
        nod->st.nlink --;

    if(ent->parent != NULL)
        ent->parent->node->st.size --;


    ent->node = NULL;
    av_unref_obj(nod);
    av_unref_obj(ent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct volentry* vol_ventry_volentry ( ventry *  ve) [static, read]

Definition at line 170 of file volatile.c.

{
    return (struct volentry *) ve->data;
}

Here is the caller graph for this function:

static struct volfs* vol_ventry_volfs ( ventry *  ve) [static, read]

Definition at line 180 of file volatile.c.

{
    return (struct volfs *) ve->mnt->avfs->data;
}

Here is the caller graph for this function:

static struct volnode* vol_vfile_volnode ( vfile *  vf) [static, read]

Definition at line 175 of file volatile.c.

{
    return (struct volnode *) vf->data;
}

Here is the caller graph for this function:

static avssize_t vol_write ( vfile *  vf,
const char *  buf,
avsize_t  nbyte 
) [static]

Definition at line 443 of file volatile.c.

{
    avoff_t end;
    struct volnode *nod = vol_vfile_volnode(vf);

    if((vf->flags & AVO_APPEND) != 0)
        vf->ptr = nod->st.size;

    end = vf->ptr + nbyte;
    if(end > nod->st.size) {
        nod->content = av_realloc(nod->content, end);
        nod->st.size = end;
        nod->st.blocks = AV_DIV(nod->st.size, 512);
    }

    memcpy(nod->content + vf->ptr, buf, nbyte);

    av_curr_time(&nod->st.mtime);

    vf->ptr = end;

    return nbyte;
}

Here is the call graph for this function:

Here is the caller graph for this function: