diff --git a/defs.h b/defs.h index 40f34b1..a86a9be 100644 --- a/defs.h +++ b/defs.h @@ -92,10 +92,10 @@ void irq_enable(int); void pic_init(void); // pipe.c -int pipe_alloc(struct file**, struct file**); -void pipe_close(struct pipe*, int); -int pipe_read(struct pipe*, char*, int); -int pipe_write(struct pipe*, char*, int); +int pipealloc(struct file**, struct file**); +void pipeclose(struct pipe*, int); +int piperead(struct pipe*, char*, int); +int pipewrite(struct pipe*, char*, int); // proc.c struct proc* copyproc(struct proc*); diff --git a/file.c b/file.c index 7f17b65..f4fe2ad 100644 --- a/file.c +++ b/file.c @@ -65,7 +65,7 @@ fileclose(struct file *f) release(&file_table_lock); if(ff.type == FD_PIPE) - pipe_close(ff.pipe, ff.writable); + pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE) iput(ff.ip); else @@ -94,7 +94,7 @@ fileread(struct file *f, char *addr, int n) if(f->readable == 0) return -1; if(f->type == FD_PIPE) - return pipe_read(f->pipe, addr, n); + return piperead(f->pipe, addr, n); if(f->type == FD_INODE){ ilock(f->ip); if((r = readi(f->ip, addr, f->off, n)) > 0) @@ -114,7 +114,7 @@ filewrite(struct file *f, char *addr, int n) if(f->writable == 0) return -1; if(f->type == FD_PIPE) - return pipe_write(f->pipe, addr, n); + return pipewrite(f->pipe, addr, n); if(f->type == FD_INODE){ ilock(f->ip); if((r = writei(f->ip, addr, f->off, n)) > 0) diff --git a/pipe.c b/pipe.c index 83afb35..737c75a 100644 --- a/pipe.c +++ b/pipe.c @@ -18,7 +18,7 @@ struct pipe { }; int -pipe_alloc(struct file **f0, struct file **f1) +pipealloc(struct file **f0, struct file **f1) { struct pipe *p; @@ -58,7 +58,7 @@ pipe_alloc(struct file **f0, struct file **f1) } void -pipe_close(struct pipe *p, int writable) +pipeclose(struct pipe *p, int writable) { acquire(&p->lock); if(writable){ @@ -76,7 +76,7 @@ pipe_close(struct pipe *p, int writable) //PAGEBREAK: 20 int -pipe_write(struct pipe *p, char *addr, int n) +pipewrite(struct pipe *p, char *addr, int n) { int i; @@ -99,7 +99,7 @@ pipe_write(struct pipe *p, char *addr, int n) } int -pipe_read(struct pipe *p, char *addr, int n) +piperead(struct pipe *p, char *addr, int n) { int i; diff --git a/sysfile.c b/sysfile.c index d18aa1b..0b7cb9e 100644 --- a/sysfile.c +++ b/sysfile.c @@ -379,7 +379,7 @@ sys_pipe(void) if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) return -1; - if(pipe_alloc(&rf, &wf) < 0) + if(pipealloc(&rf, &wf) < 0) return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){