diff options
author | rsc <rsc> | 2006-09-08 13:44:42 +0000 |
---|---|---|
committer | rsc <rsc> | 2006-09-08 13:44:42 +0000 |
commit | 2cbb4b18424833d7135ea4002d38ecd1d97dcfa9 (patch) | |
tree | 474c20a78f2a6d1c5a87e846d4c79a407f39deb2 /pipe.c | |
parent | 5692823b1f7014121f15e6579415c93012543531 (diff) | |
download | xv6-labs-2cbb4b18424833d7135ea4002d38ecd1d97dcfa9.tar.gz xv6-labs-2cbb4b18424833d7135ea4002d38ecd1d97dcfa9.tar.bz2 xv6-labs-2cbb4b18424833d7135ea4002d38ecd1d97dcfa9.zip |
stop using fd to name files
Diffstat (limited to 'pipe.c')
-rw-r--r-- | pipe.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -19,14 +19,14 @@ struct pipe { }; int -pipe_alloc(struct file **fd1, struct file **fd2) +pipe_alloc(struct file **f0, struct file **f1) { - *fd1 = *fd2 = 0; + *f0 = *f1 = 0; struct pipe *p = 0; - if((*fd1 = filealloc()) == 0) + if((*f0 = filealloc()) == 0) goto oops; - if((*fd2 = filealloc()) == 0) + if((*f1 = filealloc()) == 0) goto oops; if((p = (struct pipe*) kalloc(PAGE)) == 0) goto oops; @@ -35,25 +35,25 @@ pipe_alloc(struct file **fd1, struct file **fd2) p->writep = 0; p->readp = 0; initlock(&p->lock, "pipe"); - (*fd1)->type = FD_PIPE; - (*fd1)->readable = 1; - (*fd1)->writable = 0; - (*fd1)->pipe = p; - (*fd2)->type = FD_PIPE; - (*fd2)->readable = 0; - (*fd2)->writable = 1; - (*fd2)->pipe = p; + (*f0)->type = FD_PIPE; + (*f0)->readable = 1; + (*f0)->writable = 0; + (*f0)->pipe = p; + (*f1)->type = FD_PIPE; + (*f1)->readable = 0; + (*f1)->writable = 1; + (*f1)->pipe = p; return 0; oops: if(p) kfree((char*) p, PAGE); - if(*fd1){ - (*fd1)->type = FD_NONE; - fileclose(*fd1); + if(*f0){ + (*f0)->type = FD_NONE; + fileclose(*f0); } - if(*fd2){ - (*fd2)->type = FD_NONE; - fileclose(*fd2); + if(*f1){ + (*f1)->type = FD_NONE; + fileclose(*f1); } return -1; } |