remove _ from pipe; be like file
This commit is contained in:
parent
76f09d7dd0
commit
7834cca604
4 changed files with 12 additions and 12 deletions
8
defs.h
8
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*);
|
||||
|
|
6
file.c
6
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)
|
||||
|
|
8
pipe.c
8
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;
|
||||
|
||||
|
|
|
@ -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){
|
||||
|
|
Loading…
Reference in a new issue