| plan 9 kernel history: overview | file list | diff list |
1996/0203/port/devtinyfs.c (diff list | history)
| 1996/0202/sys/src/9/port/devtinyfs.c:28,33 – 1996/0203/sys/src/9/port/devtinyfs.c:28,36 (short | long | prev | next) | ||
| 1996/0201 | ||
| 1996/0202 | Notapin= 0xffff, Notabno= 0xffff, | |
| 1996/0203 | Fcreating= 1, Frmonclose= 2, | |
| 1996/0116 | }; | |
| 1996/0202 | /* representation of a Tdir on medium */ | |
| 1996/0202/sys/src/9/port/devtinyfs.c:57,63 – 1996/0203/sys/src/9/port/devtinyfs.c:60,66 | ||
| 1996/0201 | ushort bno; ushort dbno; ushort pin; | |
| 1996/0202 |
| |
| 1996/0203 | uchar flag; | |
| 1996/0201 | ulong length; }; | |
| 1996/0202/sys/src/9/port/devtinyfs.c:271,277 – 1996/0203/sys/src/9/port/devtinyfs.c:274,280 | ||
| 1996/0202 | expand(fs); } | |
| 1996/0203 | f->flag = Fcreating; | |
| 1996/0202 | f->dbno = Notabno; f->bno = mapalloc(fs); | |
| 1996/0202/sys/src/9/port/devtinyfs.c:553,572 – 1996/0203/sys/src/9/port/devtinyfs.c:556,586 | ||
| 1996/0202 | if(c->qid.path != CHDIR){ f = &fs->f[c->qid.path]; f->r--; | |
| 1996/0203 | if(f->r == 0){ if(f->creating){ /* remove all other files with this name */ for(i = 0; i < fs->fsize; i++){ nf = &fs->f[i]; if(f == nf) continue; if(strcmp(nf->name, f->name) == 0){ if(nf->r) nf->flag |= Frmonclose; else freefile(fs, nf, Notabno); } } f->flag &= ~(Frmonclose|Fcreating); | |
| 1996/0202 | } | |
| 1996/0203 | if(f->flag & Frmonclose){ freefile(fs, f, Notabno); | |
| 1996/0202 | } } /* dereference fs and remove on zero refs */ fs->r--; | |
| 1996/0203 | unlock(fs); qlock(&tinyfs); | |
| 1996/0201 | if(fs->ref == 0){ for(l = &fs->l; *l;){ if(*l == fs){ | |
| 1996/0202/sys/src/9/port/devtinyfs.c:575,589 – 1996/0203/sys/src/9/port/devtinyfs.c:589,599 | ||
| 1996/0201 | } l = &(*l)->next; } | |
| 1996/0203 | free(fs-f); | |
| 1996/0201 | free(fs->map); close(fs->c); | |
| 1996/0203 | memset(fs, 0, sizeof(*fs)); | |
| 1996/0201 | } | |
| 1996/0116 | } | |
| 1996/0202/sys/src/9/port/devtinyfs.c:590,604 – 1996/0203/sys/src/9/port/devtinyfs.c:600,619 | ||
| 1996/0116 | long tinyfsread(Chan *c, void *a, long n, ulong offset) { | |
| 1996/0203 | Tfs *fs; Tfile *f; int sofar, i; if(c->qid.path & CHDIR) | |
| 1996/0201 | return devdirread(c, a, n, tinyfstab, Ntinyfstab, tinyfsgen); | |
| 1996/0116 |
| |
| 1996/0203 | fs = tinyfs.fs[c->dev]; f = &fs->f[c->qid.path]; if(offset >= f->length) return 0; if(n + offset >= f->length) n = f->length - offset; | |
| 1996/0116 | return n; } | |