|
|
1.1 root 1:
2: static Inode *inodes;
3: static long ip;
4: static long ninodes = 0;
5: static char *nameb;
6: static long np;
7: static long nnameb = 0;
8: static long nblocks;
9: #define IINC 1024
10: #define NINC (64*IINC)
11:
12: ininit()
13: {
14: if(nnameb == 0)
15: nameb = malloc((unsigned)(nnameb = NINC));
16: np = 0;
17: if(ninodes == 0)
18: inodes = (Inode *)malloc(sizeof(Inode)*(unsigned)(ninodes = IINC));
19: ip = 0;
20: }
21:
22: inadd(s, i)
23: Superblock *s;
24: register Inode *i;
25: {
26: register long len;
27:
28: len = strlen(i->name.n)+1;
29: if(np+len > nnameb){
30: while(np+len > nnameb)
31: nnameb += NINC;
32: nameb = realloc(nameb, (unsigned)nnameb);
33: }
34: strcpy(nameb+np, i->name.n);
35: i->name.o = np;
36: np += len;
37: if(ip == ninodes){
38: ninodes += IINC;
39: inodes = (Inode *)realloc((char *)inodes, (unsigned)ninodes*sizeof(Inode));
40: }
41: inodes[ip++] = *i;
42: return(0);
43: }
44:
45: inwrite(s)
46: Superblock *s;
47: {
48: char *e;
49:
50: if(e = lkwri(s, inodes, ip, nameb, np, 0L)){
51: fprint(2, "%s\n", e);
52: bad = 1;
53: return;
54: }
55: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.