Back to index

avfs  1.0.1
archive.h
Go to the documentation of this file.
00001 /*
00002     AVFS: A Virtual File System Library
00003     Copyright (C) 2000-2001  Miklos Szeredi <miklos@szeredi.hu>
00004 
00005     This program can be distributed under the terms of the GNU GPL.
00006     See the file COPYING.
00007 */
00008 
00009 #include "avfs.h"
00010 #include "namespace.h"
00011 
00012 struct archive;
00013 struct archnode;
00014 struct archfile;
00015 
00016 #define ARF_NOBASE (1 << 0)
00017 
00018 struct archparams {
00019     void *data;
00020     int flags;
00021     int (*parse) (void *data, ventry *ent, struct archive *arch);
00022     int (*open) (ventry *ve, struct archfile *fil);
00023     int (*close) (struct archfile *fil);
00024     avssize_t (*read)  (vfile *vf, char *buf, avsize_t nbyte);
00025     void (*release) (struct archive *arch, struct archnode *nod);
00026 };
00027 
00028 #define ANOF_DIRTY    (1 << 0)
00029 #define ANOF_CREATED  (1 << 1)
00030 #define ANOF_AUTODIR  (1 << 2)
00031 
00032 struct archnode {
00033     struct avstat st;
00034     char *linkname;
00035     int flags;
00036     
00037     avoff_t offset;
00038     avoff_t realsize;
00039     
00040     int numopen;
00041 
00042     void *data;
00043 };
00044 
00045 struct archfile {
00046     vfile *basefile;
00047     struct archive *arch;
00048     struct archnode *nod;
00049     struct entry *ent;     /* Only for readdir */
00050     struct entry *curr;
00051     int currn;
00052     void *data;
00053 };
00054 
00055 
00056 int av_archive_init(const char *name, struct ext_info *exts, int version,
00057                     struct vmodule *module, struct avfs **avfsp);
00058 
00059 avssize_t av_arch_read(vfile *vf, char *buf, avsize_t nbyte);
00060 struct archnode *av_arch_new_node(struct archive *arch, struct entry *ent,
00061                                   int isdir);
00062 void av_arch_del_node(struct entry *ent);
00063 struct entry *av_arch_resolve(struct archive *arch, const char *path,
00064                               int create, int flags);
00065 int av_arch_isroot(struct archive *arch, struct entry *ent);
00066 struct entry *av_arch_create(struct archive *arch, const char *path,
00067                              int flags);
00068 
00069 static inline struct archfile *arch_vfile_file(vfile *vf)
00070 {
00071     return (struct archfile *) vf->data;
00072 }
00073