tfns.h - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
tfns.h (9281B)
---
     1 /*
     2  * sorted by 4,/^$/|sort -bd +1
     3  */
     4 int                addarena(Arena *name);
     5 void                addstat(int, int);
     6 void                addstat2(int, int, int, int);
     7 ZBlock                *alloczblock(u32int size, int zeroed, uint alignment);
     8 Arena                *amapitoa(Index *index, u64int a, u64int *aa);
     9 Arena                *amapitoag(Index *index, u64int a, u64int *gstart, u64int *glimit, int *g);
    10 u64int                arenadirsize(Arena *arena, u32int clumps);
    11 int                arenatog(Arena *arena, u64int aa, u64int *gstart, u64int *glimit, int *g);
    12 void                arenaupdate(Arena *arena, u32int size, u8int *score);
    13 int                asumload(Arena *arena, int g, IEntry *entries, int maxentries);
    14 void                backsumarena(Arena *arena);
    15 void        binstats(long (*fn)(Stats *s0, Stats *s1, void*), void *arg, long t0, long t1, Statbin *bin, int nbin);
    16 int                bloominit(Bloom*, vlong, uchar*);
    17 int                bucklook(u8int*, int, u8int*, int);
    18 u32int                buildbucket(Index *ix, IEStream *ies, IBucket *ib, uint);
    19 void                checkdcache(void);
    20 void                checklumpcache(void);
    21 int                clumpinfoeq(ClumpInfo *c, ClumpInfo *d);
    22 int                clumpinfoeq(ClumpInfo *c, ClumpInfo *d);
    23 u32int                clumpmagic(Arena *arena, u64int aa);
    24 uint                countbits(uint n);
    25 int                delarena(Arena *arena);
    26 void                delaykickicache(void);
    27 void                delaykickround(Round*);
    28 void                delaykickroundproc(void*);
    29 void                dirtydblock(DBlock*, int);
    30 void                diskaccess(int);
    31 void                disksched(void);
    32 void                *emalloc(ulong);
    33 void                emptydcache(void);
    34 void                emptyicache(void);
    35 void                emptylumpcache(void);
    36 void                *erealloc(void *, ulong);
    37 char                *estrdup(char*);
    38 void                *ezmalloc(ulong);
    39 Arena                *findarena(char *name);
    40 int                flushciblocks(Arena *arena);
    41 void                flushdcache(void);
    42 void                flushicache(void);
    43 int                flushpart(Part*);
    44 void                flushqueue(void);
    45 void                fmtzbinit(Fmt *f, ZBlock *b);
    46 void                freearena(Arena *arena);
    47 void                freearenapart(ArenaPart *ap, int freearenas);
    48 void                freeiestream(IEStream *ies);
    49 void                freeifile(IFile *f);
    50 void                freeisect(ISect *is);
    51 void                freeindex(Index *index);
    52 void                freepart(Part *part);
    53 void                freezblock(ZBlock *b);
    54 DBlock                *_getdblock(Part *part, u64int addr, int mode, int load);
    55 DBlock                *getdblock(Part *part, u64int addr, int mode);
    56 u32int                hashbits(u8int *score, int nbits);
    57 char                *hargstr(HConnect*, char*, char*);
    58 vlong        hargint(HConnect*, char*, vlong);
    59 int                hdebug(HConnect*);
    60 int                hdisk(HConnect*);
    61 int                hnotfound(HConnect*);
    62 int                hproc(HConnect*);
    63 int                hsethtml(HConnect*);
    64 int                hsettext(HConnect*);
    65 int                httpdinit(char *address, char *webroot);
    66 int                iaddrcmp(IAddr *ia1, IAddr *ia2);
    67 IEntry*        icachedirty(u32int, u32int, u64int);
    68 ulong        icachedirtyfrac(void);
    69 void                icacheclean(IEntry*);
    70 int                icachelookup(u8int *score, int type, IAddr *ia);
    71 AState        icachestate(void);
    72 int                ientrycmp(const void *vie1, const void *vie2);
    73 char                *ifileline(IFile *f);
    74 int                ifilename(IFile *f, char *dst);
    75 int                ifileu32int(IFile *f, u32int *r);
    76 int                inbloomfilter(Bloom*, u8int*);
    77 int                indexsect(Index *ix, u8int *score);
    78 int                indexsect0(Index *ix, u32int buck);
    79 Arena                *initarena(Part *part, u64int base, u64int size, u32int blocksize);
    80 ArenaPart        *initarenapart(Part *part);
    81 int                initarenasum(void);
    82 void                initbloomfilter(Index*);
    83 void                initdcache(u32int mem);
    84 void                initicache(u32int mem);
    85 void                initicachewrite(void);
    86 IEStream        *initiestream(Part *part, u64int off, u64int clumps, u32int size);
    87 ISect                *initisect(Part *part);
    88 Index                *initindex(char *name, ISect **sects, int n);
    89 void                initlumpcache(u32int size, u32int nblocks);
    90 int                initlumpqueues(int nq);
    91 Part*                initpart(char *name, int mode);
    92 void                initround(Round*, char*, int);
    93 int                initventi(char *config, Config *conf);
    94 void                insertlump(Lump *lump, Packet *p);
    95 int                insertscore(u8int *score, IAddr *ia, int state, AState *as);
    96 void                kickdcache(void);
    97 void                kickicache(void);
    98 void                kickround(Round*, int wait);
    99 int                loadbloom(Bloom*);
   100 ZBlock                *loadclump(Arena *arena, u64int aa, int blocks, Clump *cl, u8int *score, int verify);
   101 DBlock        *loadibucket(Index *index, u8int *score, ISect **is, u32int *buck, IBucket *ib);
   102 int                loadientry(Index *index, u8int *score, int type, IEntry *ie);
   103 void                logerr(int severity, char *fmt, ...);
   104 Lump                *lookuplump(u8int *score, int type);
   105 int                lookupscore(u8int *score, int type, IAddr *ia);
   106 int                maparenas(AMap *am, Arena **arenas, int n, char *what);
   107 void                markbloomfilter(Bloom*, u8int*);
   108 void                markbloomfiltern(Bloom*, u8int[][20], int);
   109 uint                msec(void);
   110 int                namecmp(char *s, char *t);
   111 void                namecp(char *dst, char *src);
   112 int                nameok(char *name);
   113 void                needmainindex(void);
   114 void                needzeroscore(void);
   115 Arena                *newarena(Part *part, u32int, char *name, u64int base, u64int size, u32int blocksize);
   116 ArenaPart        *newarenapart(Part *part, u32int blocksize, u32int tabsize);
   117 ISect                *newisect(Part *part, u32int vers, char *name, u32int blocksize, u32int tabsize);
   118 Index                *newindex(char *name, ISect **sects, int n);
   119 u32int                now(void);
   120 int                okamap(AMap *am, int n, u64int start, u64int stop, char *what);
   121 int                okibucket(IBucket*, ISect*);
   122 int                outputamap(Fmt *f, AMap *am, int n);
   123 int                outputindex(Fmt *f, Index *ix);
   124 int                _packarena(Arena *arena, u8int *buf, int);
   125 int                packarena(Arena *arena, u8int *buf);
   126 int                packarenahead(ArenaHead *head, u8int *buf);
   127 int                packarenapart(ArenaPart *as, u8int *buf);
   128 void                packbloomhead(Bloom*, u8int*);
   129 int                packclump(Clump *c, u8int *buf, u32int);
   130 void                packclumpinfo(ClumpInfo *ci, u8int *buf);
   131 void                packibucket(IBucket *b, u8int *buf, u32int magic);
   132 void                packientry(IEntry *i, u8int *buf);
   133 int                packisect(ISect *is, u8int *buf);
   134 void                packmagic(u32int magic, u8int *buf);
   135 ZBlock                *packet2zblock(Packet *p, u32int size);
   136 int                parseamap(IFile *f, AMapN *amn);
   137 int                parseindex(IFile *f, Index *ix);
   138 void                partblocksize(Part *part, u32int blocksize);
   139 int                partifile(IFile *f, Part *part, u64int start, u32int size);
   140 void                printarenapart(int fd, ArenaPart *ap);
   141 void                printarena(int fd, Arena *arena);
   142 void                printindex(int fd, Index *ix);
   143 void                printstats(void);
   144 void                putdblock(DBlock *b);
   145 void                putlump(Lump *b);
   146 int                queuewrite(Lump *b, Packet *p, int creator, uint ms);
   147 u32int                readarena(Arena *arena, u64int aa, u8int *buf, long n);
   148 int                readarenamap(AMapN *amn, Part *part, u64int base, u32int size);
   149 Bloom        *readbloom(Part*);
   150 int                readclumpinfo(Arena *arena, int clump, ClumpInfo *ci);
   151 int                readclumpinfos(Arena *arena, int clump, ClumpInfo *cis, int n);
   152 ZBlock                *readfile(char *name);
   153 int                readifile(IFile *f, char *name);
   154 Packet                *readlump(u8int *score, int type, u32int size, int *cached);
   155 int                readpart(Part *part, u64int addr, u8int *buf, u32int n);
   156 int                resetbloom(Bloom*);
   157 int                runconfig(char *config, Config*);
   158 int                scorecmp(u8int *, u8int *);
   159 void                scoremem(u8int *score, u8int *buf, int size);
   160 void                setatailstate(AState*);
   161 void                seterr(int severity, char *fmt, ...);
   162 void                setstat(int, long);
   163 void                settrace(char *type);
   164 u64int                sortrawientries(Index *ix, Part *tmp, u64int *tmpoff, Bloom *bloom);
   165 void                startbloomproc(Bloom*);
   166 Memimage*        statgraph(Graph *g);
   167 void                statsinit(void);
   168 int                storeclump(Index *index, ZBlock *b, u8int *score, int type, u32int creator, IAddr *ia);
   169 int                storeientry(Index *index, IEntry *m);
   170 int                strscore(char *s, u8int *score);
   171 int                stru32int(char *s, u32int *r);
   172 int                stru64int(char *s, u64int *r);
   173 void                sumarena(Arena *arena);
   174 int                syncarena(Arena *arena, u32int n, int zok, int fix);
   175 int                syncindex(Index *ix);
   176 void                trace(char *type, char*, ...);
   177 void                traceinit(void);
   178 int                u64log2(u64int v);
   179 u64int                unittoull(char *s);
   180 int                unpackarena(Arena *arena, u8int *buf);
   181 int                unpackarenahead(ArenaHead *head, u8int *buf);
   182 int                unpackarenapart(ArenaPart *as, u8int *buf);
   183 int                unpackbloomhead(Bloom*, u8int*);
   184 int                unpackclump(Clump *c, u8int *buf, u32int);
   185 void                unpackclumpinfo(ClumpInfo *ci, u8int *buf);
   186 void                unpackibucket(IBucket *b, u8int *buf, u32int magic);
   187 void                unpackientry(IEntry *i, u8int *buf);
   188 int                unpackisect(ISect *is, u8int *buf);
   189 u32int                unpackmagic(u8int *buf);
   190 void                ventifmtinstall(void);
   191 void                vtloghdump(Hio*, VtLog*);
   192 void                vtloghlist(Hio*);
   193 int                vtproc(void(*)(void*), void*);
   194 int                vttypevalid(int type);
   195 void                waitforkick(Round*);
   196 int                wbarena(Arena *arena);
   197 int                wbarenahead(Arena *arena);
   198 int                wbarenamap(AMap *am, int n, Part *part, u64int base, u64int size);
   199 int                wbarenapart(ArenaPart *ap);
   200 void                wbbloomhead(Bloom*);
   201 int                wbisect(ISect *is);
   202 int                wbindex(Index *ix);
   203 int                whackblock(u8int *dst, u8int *src, int ssize);
   204 u64int                writeaclump(Arena *a, Clump *c, u8int *clbuf);
   205 u32int                writearena(Arena *arena, u64int aa, u8int *clbuf, u32int n);
   206 int                writebloom(Bloom*);
   207 int                writeclumpinfo(Arena *arean, int clump, ClumpInfo *ci);
   208 int                writepng(Hio*, Memimage*);
   209 u64int                writeiclump(Index *ix, Clump *c, u8int *clbuf);
   210 int                writelump(Packet *p, u8int *score, int type, u32int creator, uint ms);
   211 int                writepart(Part *part, u64int addr, u8int *buf, u32int n);
   212 int                writeqlump(Lump *u, Packet *p, int creator, uint ms);
   213 Packet                *zblock2packet(ZBlock *zb, u32int size);
   214 void                zeropart(Part *part, int blocksize);
   215 
   216 /*
   217 #pragma        varargck        argpos        sysfatal                1
   218 #pragma        varargck        argpos        logerr                2
   219 #pragma        varargck        argpos        SetErr                2
   220 */
   221 
   222 #define scorecmp(h1,h2)                memcmp((h1),(h2),VtScoreSize)
   223 #define scorecp(h1,h2)                memmove((h1),(h2),VtScoreSize)
   224 
   225 #define MK(t)                        ((t*)emalloc(sizeof(t)))
   226 #define MKZ(t)                        ((t*)ezmalloc(sizeof(t)))
   227 #define MKN(t,n)                ((t*)emalloc((n)*sizeof(t)))
   228 #define MKNZ(t,n)                ((t*)ezmalloc((n)*sizeof(t)))
   229 #define MKNA(t,at,n)                ((t*)emalloc(sizeof(t) + (n)*sizeof(at)))