| plan 9 kernel history: overview | file list | diff list |
1990/11211/port/devsrv.c (diff list | history)
| 1990/1121/sys/src/9/port/devsrv.c:45,51 – 1990/11211/sys/src/9/port/devsrv.c:45,51 (short | long | prev | next) | ||
| 1990/1110 | e = calloc(1, sizeof(Entry)); | |
| 1990/1002 | e->dir.atime = e->dir.mtime = seconds(); lock(&qidlock); /* for qid allocation */ | |
| 1990/11211 | e->dir.qid = (Qid){mode|nextqid++, 0}; | |
| 1990/1002 | unlock(&qidlock); return e; } | |
| 1990/1121/sys/src/9/port/devsrv.c:97,105 – 1990/11211/sys/src/9/port/devsrv.c:97,103 | ||
| 1990/1002 | unlock(dir); } | |
| 1990/1110 | if(e==0){ | |
| 1990/1002 |
| |
| 1990/11211 | strncpy(u->error, errstrtab[Enonexist], NAMELEN); | |
| 1990/1002 | return 0; } c->qid = e->dir.qid; | |
| 1990/1121/sys/src/9/port/devsrv.c:122,130 – 1990/11211/sys/src/9/port/devsrv.c:120,128 | ||
| 1990/1110 | Entry *e; | |
| 1990/0227 | Chan *f; | |
| 1990/1110 |
| |
| 1990/11211 | if(c->qid.path & CHDIR){ | |
| 1990/1110 | if(omode != OREAD) | |
| 1990/0227 |
| |
| 1990/11211 | error(Eisdir); | |
| 1990/0227 | c->mode = omode; c->flag |= COPEN; c->offset = 0; | |
| 1990/1121/sys/src/9/port/devsrv.c:131,143 – 1990/11211/sys/src/9/port/devsrv.c:129,141 | ||
| 1990/0227 | return c; } | |
| 1990/1110 | if((e=c->aux) == 0) | |
| 1990/11211 | error(Egreg); | |
| 1990/1110 | if((f=e->chan) == 0) | |
| 1990/0227 |
| |
| 1990/11211 | error(Eshutdown); | |
| 1990/1110 | if(omode & OTRUNC) | |
| 1990/0227 |
| |
| 1990/11211 | error(Eperm); | |
| 1990/1110 | if(omode!=f->mode && f->mode!=ORDWR) | |
| 1990/0227 |
| |
| 1990/11211 | error(Eperm); | |
| 1990/0227 | close(c); incref(f); return f; | |
| 1990/1121/sys/src/9/port/devsrv.c:157,168 – 1990/11211/sys/src/9/port/devsrv.c:155,166 | ||
| 1990/0227 | } | |
| 1990/1110 | for(e=parent->entries; e; e=e->next) if(strcmp(name, e->dir.name) == 0) | |
| 1990/0227 |
| |
| 1990/11211 | error(Einuse); | |
| 1990/1110 | e = srvalloc(perm & CHDIR); | |
| 1990/1002 | e->parent = parent; strcpy(e->dir.name, name); e->dir.mode = perm & parent->dir.mode; | |
| 1990/11211 | strcpy(e->dir.gid, parent->dir.gid); | |
| 1990/1110 | if(e->next = parent->entries) /* assign = */ | |
| 1990/1002 | e->next->back = &e->next; | |
| 1990/1110 | e->back = &parent->entries; | |
| 1990/1121/sys/src/9/port/devsrv.c:183,189 – 1990/11211/sys/src/9/port/devsrv.c:181,187 | ||
| 1990/0227 | ||
| 1990/1110 | e = c->aux; if(e->parent == 0) | |
| 1990/0227 |
| |
| 1990/11211 | error(Eperm); | |
| 1990/1002 | lock(e->parent); | |
| 1990/1110 | if(waserror()){ | |
| 1990/1002 | unlock(e->parent); | |
| 1990/1121/sys/src/9/port/devsrv.c:191,200 – 1990/11211/sys/src/9/port/devsrv.c:189,198 | ||
| 1990/0227 | } | |
| 1990/1110 | if(e->dir.mode & CHDIR){ | |
| 1990/1002 | if (e->entries != 0) | |
| 1990/11211 | error(Eperm); | |
| 1990/1110 | }else{ if(e->chan == 0) | |
| 1990/1002 |
| |
| 1990/11211 | error(Eshutdown); | |
| 1990/1002 | close(e->chan); } | |
| 1990/1110 | if(*e->back = e->next) /* assign = */ | |
| 1990/1121/sys/src/9/port/devsrv.c:207,213 – 1990/11211/sys/src/9/port/devsrv.c:205,211 | ||
| 1990/0227 | void srvwstat(Chan *c, char *dp) { | |
| 1990/11211 | error(Egreg); | |
| 1990/0227 | } void | |
| 1990/1121/sys/src/9/port/devsrv.c:244,250 – 1990/11211/sys/src/9/port/devsrv.c:242,248 | ||
| 1990/1110 | if(n <= 0) | |
| 1990/1002 | return 0; | |
| 1990/1110 | if(offset%DIRLEN || n%DIRLEN) | |
| 1990/11211 | error(Ebaddirread); | |
| 1990/1002 | lock(dir); | |
| 1990/1110 | for(e=dir->entries; e; e=e->next) if(offset <= 0){ | |
| 1990/1121/sys/src/9/port/devsrv.c:274,282 – 1990/11211/sys/src/9/port/devsrv.c:272,280 | ||
| 1990/1002 | nexterror(); } | |
| 1990/1110 | if(e->chan) | |
| 1990/0227 |
| |
| 1990/11211 | error(Egreg); | |
| 1990/1110 | if(n >= sizeof buf) | |
| 1990/0227 |
| |
| 1990/11211 | error(Egreg); | |
| 1990/0227 | memcpy(buf, va, n); /* so we can NUL-terminate */ buf[n] = 0; fd = strtoul(buf, 0, 0); | |
| 1990/1121/sys/src/9/port/devsrv.c:286,301 – 1990/11211/sys/src/9/port/devsrv.c:284,287 | ||
| 1990/1002 | unlock(e); poperror(); | |
| 1990/0227 | return n; | |