提交 7834cca6 创建 作者: rsc's avatar rsc

remove _ from pipe; be like file

上级 76f09d7d
...@@ -92,10 +92,10 @@ void irq_enable(int); ...@@ -92,10 +92,10 @@ void irq_enable(int);
void pic_init(void); void pic_init(void);
// pipe.c // pipe.c
int pipe_alloc(struct file**, struct file**); int pipealloc(struct file**, struct file**);
void pipe_close(struct pipe*, int); void pipeclose(struct pipe*, int);
int pipe_read(struct pipe*, char*, int); int piperead(struct pipe*, char*, int);
int pipe_write(struct pipe*, char*, int); int pipewrite(struct pipe*, char*, int);
// proc.c // proc.c
struct proc* copyproc(struct proc*); struct proc* copyproc(struct proc*);
......
...@@ -65,7 +65,7 @@ fileclose(struct file *f) ...@@ -65,7 +65,7 @@ fileclose(struct file *f)
release(&file_table_lock); release(&file_table_lock);
if(ff.type == FD_PIPE) if(ff.type == FD_PIPE)
pipe_close(ff.pipe, ff.writable); pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE) else if(ff.type == FD_INODE)
iput(ff.ip); iput(ff.ip);
else else
...@@ -94,7 +94,7 @@ fileread(struct file *f, char *addr, int n) ...@@ -94,7 +94,7 @@ fileread(struct file *f, char *addr, int n)
if(f->readable == 0) if(f->readable == 0)
return -1; return -1;
if(f->type == FD_PIPE) if(f->type == FD_PIPE)
return pipe_read(f->pipe, addr, n); return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){ if(f->type == FD_INODE){
ilock(f->ip); ilock(f->ip);
if((r = readi(f->ip, addr, f->off, n)) > 0) if((r = readi(f->ip, addr, f->off, n)) > 0)
...@@ -114,7 +114,7 @@ filewrite(struct file *f, char *addr, int n) ...@@ -114,7 +114,7 @@ filewrite(struct file *f, char *addr, int n)
if(f->writable == 0) if(f->writable == 0)
return -1; return -1;
if(f->type == FD_PIPE) if(f->type == FD_PIPE)
return pipe_write(f->pipe, addr, n); return pipewrite(f->pipe, addr, n);
if(f->type == FD_INODE){ if(f->type == FD_INODE){
ilock(f->ip); ilock(f->ip);
if((r = writei(f->ip, addr, f->off, n)) > 0) if((r = writei(f->ip, addr, f->off, n)) > 0)
......
...@@ -18,7 +18,7 @@ struct pipe { ...@@ -18,7 +18,7 @@ struct pipe {
}; };
int int
pipe_alloc(struct file **f0, struct file **f1) pipealloc(struct file **f0, struct file **f1)
{ {
struct pipe *p; struct pipe *p;
...@@ -58,7 +58,7 @@ pipe_alloc(struct file **f0, struct file **f1) ...@@ -58,7 +58,7 @@ pipe_alloc(struct file **f0, struct file **f1)
} }
void void
pipe_close(struct pipe *p, int writable) pipeclose(struct pipe *p, int writable)
{ {
acquire(&p->lock); acquire(&p->lock);
if(writable){ if(writable){
...@@ -76,7 +76,7 @@ pipe_close(struct pipe *p, int writable) ...@@ -76,7 +76,7 @@ pipe_close(struct pipe *p, int writable)
//PAGEBREAK: 20 //PAGEBREAK: 20
int int
pipe_write(struct pipe *p, char *addr, int n) pipewrite(struct pipe *p, char *addr, int n)
{ {
int i; int i;
...@@ -99,7 +99,7 @@ pipe_write(struct pipe *p, char *addr, int n) ...@@ -99,7 +99,7 @@ pipe_write(struct pipe *p, char *addr, int n)
} }
int int
pipe_read(struct pipe *p, char *addr, int n) piperead(struct pipe *p, char *addr, int n)
{ {
int i; int i;
......
...@@ -379,7 +379,7 @@ sys_pipe(void) ...@@ -379,7 +379,7 @@ sys_pipe(void)
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
return -1; return -1;
if(pipe_alloc(&rf, &wf) < 0) if(pipealloc(&rf, &wf) < 0)
return -1; return -1;
fd0 = -1; fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论