]> Devi Nivas Git - cs3210-lab0.git/commitdiff
remove _ from pipe; be like file
authorrsc <rsc>
Tue, 28 Aug 2007 04:22:35 +0000 (04:22 +0000)
committerrsc <rsc>
Tue, 28 Aug 2007 04:22:35 +0000 (04:22 +0000)
defs.h
file.c
pipe.c
sysfile.c

diff --git a/defs.h b/defs.h
index 40f34b16ba996a91407914d4f1526d70056b395c..a86a9be8fa1fb0578f67179b7e0a7bd9ea1ebcdd 100644 (file)
--- 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 7f17b659d4ba565d3083318237fcf5a1913010b9..f4fe2adc3a0f92f090513abd1a0ae05f90e27246 100644 (file)
--- 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 83afb352e7a7ff098e79c2caecff2ee8e69ff14d..737c75aec8b0139deaa813ac32e188930e6e77b2 100644 (file)
--- 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;
 
index d18aa1b0db46ca7073bcf81c690b4364aad7eb1e..0b7cb9e4a85df04ff96812b45b720c8147e96d01 100644 (file)
--- 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){