File: archive.h

package info (click to toggle)
avfs 1.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,916 kB
  • sloc: ansic: 31,364; sh: 6,482; perl: 1,916; makefile: 351
file content (73 lines) | stat: -rw-r--r-- 1,897 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
    AVFS: A Virtual File System Library
    Copyright (C) 2000-2001  Miklos Szeredi <miklos@szeredi.hu>

    This program can be distributed under the terms of the GNU GPL.
    See the file COPYING.
*/

#include "avfs.h"
#include "namespace.h"

struct archive;
struct archnode;
struct archfile;

#define ARF_NOBASE (1 << 0)

struct archparams {
    void *data;
    int flags;
    int (*parse) (void *data, ventry *ent, struct archive *arch);
    int (*open) (ventry *ve, struct archfile *fil);
    int (*close) (struct archfile *fil);
    avssize_t (*read)  (vfile *vf, char *buf, avsize_t nbyte);
    void (*release) (struct archive *arch, struct archnode *nod);
};

#define ANOF_DIRTY    (1 << 0)
#define ANOF_CREATED  (1 << 1)
#define ANOF_AUTODIR  (1 << 2)

struct archnode {
    struct avstat st;
    char *linkname;
    int flags;
    
    avoff_t offset;
    avoff_t realsize;
    
    int numopen;

    void *data;
};

struct archfile {
    vfile *basefile;
    struct archive *arch;
    struct archnode *nod;
    struct entry *ent;     /* Only for readdir */
    struct entry *curr;
    int currn;
    void *data;
};


int av_archive_init(const char *name, struct ext_info *exts, int version,
                    struct vmodule *module, struct avfs **avfsp);

avssize_t av_arch_read(vfile *vf, char *buf, avsize_t nbyte);
struct archnode *av_arch_new_node(struct archive *arch, struct entry *ent,
                                  int isdir);
void av_arch_del_node(struct entry *ent);
struct entry *av_arch_resolve(struct archive *arch, const char *path,
                              int create, int flags);
int av_arch_isroot(struct archive *arch, struct entry *ent);
struct entry *av_arch_create(struct archive *arch, const char *path,
                             int flags);

static inline struct archfile *arch_vfile_file(vfile *vf)
{
    return (struct archfile *) vf->data;
}