ref: 323184d775b92c50bb37fa0b3ae73a16138f8b7e
parent: ff03b72ed5f365a2ca052218e055fac678cf0e23
author: cinap_lenrek <[email protected]>
date: Thu Jul 23 18:34:58 EDT 2015
kernel: simplify syspipe()
--- a/sys/src/9/port/sysfile.c
+++ b/sys/src/9/port/sysfile.c
@@ -189,10 +189,9 @@
uintptr
syspipe(va_list list)
{
+ static char *datastr[] = {"data", "data1"};
int fd[2], *ufd;
Chan *c[2];
- Dev *d;
- static char *datastr[] = {"data", "data1"};
ufd = va_arg(list, int*);
validaddr((uintptr)ufd, sizeof(fd), 1);
@@ -199,7 +198,6 @@
evenaddr((uintptr)ufd);
ufd[0] = ufd[1] = fd[0] = fd[1] = -1;
- d = devtab[devno('|', 0)];
c[0] = namec("#|", Atodir, 0, 0);
c[1] = nil;
if(waserror()){
@@ -213,8 +211,8 @@
error(Egreg);
if(walk(&c[1], datastr+1, 1, 1, nil) < 0)
error(Egreg);
- c[0] = d->open(c[0], ORDWR);
- c[1] = d->open(c[1], ORDWR);
+ c[0] = devtab[c[0]->type]->open(c[0], ORDWR);
+ c[1] = devtab[c[1]->type]->open(c[1], ORDWR);
if(newfd2(fd, c) < 0)
error(Enofd);
ufd[0] = fd[0];