diff --git a/defs.h b/defs.h
index 8731c27b92aefdfc00bd0b4a1b80d7975d0beb00..1491a8e80ba47fdbea03a14dc5bffc868be7336e 100644
--- a/defs.h
+++ b/defs.h
@@ -84,8 +84,8 @@ void load_icode(struct proc*, uchar*, uint);
 
 // pipe.c
 struct pipe;
-struct fd;
-int pipe_alloc(struct fd**, struct fd**);
+struct file;
+int pipe_alloc(struct file**, struct file**);
 void pipe_close(struct pipe*, int);
 int pipe_write(struct pipe*, char*, int);
 int pipe_read(struct pipe*, char*, int);
@@ -94,12 +94,12 @@ int pipe_read(struct pipe*, char*, int);
 struct stat;
 void fd_init(void);
 int fd_ualloc(void);
-struct fd* fd_alloc(void);
-void fd_close(struct fd*);
-int fd_read(struct fd*, char*, int n);
-int fd_write(struct fd*, char*, int n);
-int fd_stat(struct fd*, struct stat*);
-void fd_incref(struct fd*);
+struct file* fd_alloc(void);
+void fd_close(struct file*);
+int fd_read(struct file*, char*, int n);
+int fd_write(struct file*, char*, int n);
+int fd_stat(struct file*, struct stat*);
+void fd_incref(struct file*);
 
 // ide.c
 void ide_init(void);
diff --git a/fd.c b/fd.c
index 7e7502fee63eade0ce022194d21a60738d033f44..9ec3038bd620d3acf3eeaa972c81ec1cd9d1d971 100644
--- a/fd.c
+++ b/fd.c
@@ -14,7 +14,7 @@
 struct spinlock fd_table_lock;
 struct devsw devsw[NDEV];
 
-struct fd fds[NFD];
+struct file file[NFILE];
 
 void
 fd_init(void)
@@ -29,24 +29,24 @@ fd_ualloc(void)
   int fd;
   struct proc *p = curproc[cpu()];
   for(fd = 0; fd < NOFILE; fd++)
-    if(p->fds[fd] == 0)
+    if(p->ofile[fd] == 0)
       return fd;
   return -1;
 }
 
 // Allocate a file descriptor structure
-struct fd*
+struct file*
 fd_alloc(void)
 {
   int i;
 
   acquire(&fd_table_lock);
-  for(i = 0; i < NFD; i++){
-    if(fds[i].type == FD_CLOSED){
-      fds[i].type = FD_NONE;
-      fds[i].ref = 1;
+  for(i = 0; i < NFILE; i++){
+    if(file[i].type == FD_CLOSED){
+      file[i].type = FD_NONE;
+      file[i].ref = 1;
       release(&fd_table_lock);
-      return fds + i;
+      return file + i;
     }
   }
   release(&fd_table_lock);
@@ -56,7 +56,7 @@ fd_alloc(void)
 // Write to file descriptor;
 // addr is a kernel address, pointing into some process's p->mem.
 int
-fd_write(struct fd *fd, char *addr, int n)
+fd_write(struct file *fd, char *addr, int n)
 {
   if(fd->writable == 0)
     return -1;
@@ -78,7 +78,7 @@ fd_write(struct fd *fd, char *addr, int n)
 
 // Read from file descriptor.
 int
-fd_read(struct fd *fd, char *addr, int n)
+fd_read(struct file *fd, char *addr, int n)
 {
   if(fd->readable == 0)
     return -1;
@@ -99,7 +99,7 @@ fd_read(struct fd *fd, char *addr, int n)
 
 // Close file descriptor.
 void
-fd_close(struct fd *fd)
+fd_close(struct file *fd)
 {
   acquire(&fd_table_lock);
 
@@ -107,7 +107,7 @@ fd_close(struct fd *fd)
     panic("fd_close");
 
   if(--fd->ref == 0){
-    struct fd dummy = *fd;
+    struct file dummy = *fd;
 
     fd->ref = 0;
     fd->type = FD_CLOSED;
@@ -127,7 +127,7 @@ fd_close(struct fd *fd)
 
 // Get metadata about file descriptor.
 int
-fd_stat(struct fd *fd, struct stat *st)
+fd_stat(struct file *fd, struct stat *st)
 {
   if(fd->type == FD_FILE){
     ilock(fd->ip);
@@ -140,7 +140,7 @@ fd_stat(struct fd *fd, struct stat *st)
 
 // Increment file descriptor reference count.
 void
-fd_incref(struct fd *fd)
+fd_incref(struct file *fd)
 {
   acquire(&fd_table_lock);
   if(fd->ref < 1 || fd->type == FD_CLOSED)
diff --git a/fd.h b/fd.h
index 93f43bb72251c30ce9c6a88050ba186eeded4907..15d6b7898940f54e6ab8ef0ee0a3dda60f61dab3 100644
--- a/fd.h
+++ b/fd.h
@@ -1,4 +1,4 @@
-struct fd {
+struct file {
   enum { FD_CLOSED, FD_NONE, FD_PIPE, FD_FILE } type;
   int ref; // reference count
   char readable;
@@ -7,5 +7,3 @@ struct fd {
   struct inode *ip;
   uint off;
 };
-
-extern struct fd fds[NFD];
diff --git a/param.h b/param.h
index 35307c2aa1b5ff1249aa53c9d6d9b136cb8fe462..d80ef7579fb64c500cae090f714b1be00f40f218 100644
--- a/param.h
+++ b/param.h
@@ -2,8 +2,8 @@
 #define PAGE       4096  // granularity of user-space memory allocation
 #define KSTACKSIZE PAGE  // size of per-process kernel stack
 #define NCPU          8  // maximum number of CPUs
-#define NOFILE       16  // file descriptors per process
-#define NFD         100  // file descriptors per system
+#define NOFILE       16  // open files per process
+#define NFILE       100  // open files per system
 #define NREQUEST    100  // outstanding disk requests
 #define NBUF         10  // size of disk block cache
 #define NINODE      100  // maximum number of active i-nodes
diff --git a/pipe.c b/pipe.c
index a1c900159267aa6edbe036d2ed356dd540bb8802..2864432536bf07d78f4472087cfaf33b1958e42c 100644
--- a/pipe.c
+++ b/pipe.c
@@ -19,7 +19,7 @@ struct pipe {
 };
 
 int
-pipe_alloc(struct fd **fd1, struct fd **fd2)
+pipe_alloc(struct file **fd1, struct file **fd2)
 {
   *fd1 = *fd2 = 0;
   struct pipe *p = 0;
diff --git a/proc.c b/proc.c
index aa8bd8f7d4208ca3831459dc175997616b3bb9a5..066ac770d7930827286bc08f7510dc430eadc01c 100644
--- a/proc.c
+++ b/proc.c
@@ -125,9 +125,9 @@ copyproc(struct proc *p)
 
   // Copy file descriptors
   for(i = 0; i < NOFILE; i++){
-    np->fds[i] = p->fds[i];
-    if(np->fds[i])
-      fd_incref(np->fds[i]);
+    np->ofile[i] = p->ofile[i];
+    if(np->ofile[i])
+      fd_incref(np->ofile[i]);
   }
 
   np->cwd = p->cwd;
@@ -328,9 +328,9 @@ proc_exit(void)
 
   // Close all open files.
   for(fd = 0; fd < NOFILE; fd++){
-    if(cp->fds[fd]){
-      fd_close(cp->fds[fd]);
-      cp->fds[fd] = 0;
+    if(cp->ofile[fd]){
+      fd_close(cp->ofile[fd]);
+      cp->ofile[fd] = 0;
     }
   }
 
diff --git a/proc.h b/proc.h
index e3f8cc299b1b124f3520a3787a91a8eb63f82531..d29f7651453fc28e06154dc6bb4bcdea556ef01d 100644
--- a/proc.h
+++ b/proc.h
@@ -39,7 +39,7 @@ struct proc{
   int ppid;
   void *chan; // sleep
   int killed;
-  struct fd *fds[NOFILE];
+  struct file *ofile[NOFILE];
   struct inode *cwd;
   struct jmpbuf jmpbuf;
   struct trapframe *tf; // points into kstack, used to find user regs
diff --git a/syscall.h b/syscall.h
index f77c8885fbeaa49646111c5cb6f5809e37ce8c9f..a0279ae635e9c4bf18978d9a20869b4c72a3b242 100644
--- a/syscall.h
+++ b/syscall.h
@@ -17,4 +17,3 @@
 #define SYS_dup    17
 #define SYS_getpid 18
 #define SYS_sbrk   19
-
diff --git a/sysfile.c b/sysfile.c
index f533e0115405335ed6f9c2f121a43f7030001a79..d123a96dc5f04b69a83852187f8bf38a1aebb15b 100644
--- a/sysfile.c
+++ b/sysfile.c
@@ -18,7 +18,7 @@
 int
 sys_pipe(void)
 {
-  struct fd *rfd = 0, *wfd = 0;
+  struct file *rfd = 0, *wfd = 0;
   int f1 = -1, f2 = -1;
   struct proc *p = curproc[cpu()];
   uint fdp;
@@ -27,10 +27,10 @@ sys_pipe(void)
     goto oops;
   if((f1 = fd_ualloc()) < 0)
     goto oops;
-  p->fds[f1] = rfd;
+  p->ofile[f1] = rfd;
   if((f2 = fd_ualloc()) < 0)
     goto oops;
-  p->fds[f2] = wfd;
+  p->ofile[f2] = wfd;
   if(fetcharg(0, &fdp) < 0)
     goto oops;
   if(putint(p, fdp, f1) < 0)
@@ -45,9 +45,9 @@ sys_pipe(void)
   if(wfd)
     fd_close(wfd);
   if(f1 >= 0)
-    p->fds[f1] = 0;
+    p->ofile[f1] = 0;
   if(f2 >= 0)
-    p->fds[f2] = 0;
+    p->ofile[f2] = 0;
   return -1;
 }
 
@@ -62,12 +62,12 @@ sys_write(void)
     return -1;
   if(fd < 0 || fd >= NOFILE)
     return -1;
-  if(p->fds[fd] == 0)
+  if(p->ofile[fd] == 0)
     return -1;
   if(addr + n > p->sz)
     return -1;
 
-  ret = fd_write(p->fds[fd], p->mem + addr, n);
+  ret = fd_write(p->ofile[fd], p->mem + addr, n);
   return ret;
 }
 
@@ -82,11 +82,11 @@ sys_read(void)
     return -1;
   if(fd < 0 || fd >= NOFILE)
     return -1;
-  if(p->fds[fd] == 0)
+  if(p->ofile[fd] == 0)
     return -1;
   if(addr + n > p->sz)
     return -1;
-  ret = fd_read(p->fds[fd], p->mem + addr, n);
+  ret = fd_read(p->ofile[fd], p->mem + addr, n);
   return ret;
 }
 
@@ -100,10 +100,10 @@ sys_close(void)
     return -1;
   if(fd < 0 || fd >= NOFILE)
     return -1;
-  if(p->fds[fd] == 0)
+  if(p->ofile[fd] == 0)
     return -1;
-  fd_close(p->fds[fd]);
-  p->fds[fd] = 0;
+  fd_close(p->ofile[fd]);
+  p->ofile[fd] = 0;
   return 0;
 }
 
@@ -114,7 +114,7 @@ sys_open(void)
   struct inode *ip, *dp;
   uint arg0, arg1;
   int ufd;
-  struct fd *fd;
+  struct file *fd;
   int l;
   char *last;
 
@@ -170,7 +170,7 @@ sys_open(void)
   }
   fd->ip = ip;
   fd->off = 0;
-  cp->fds[ufd] = fd;
+  cp->ofile[ufd] = fd;
 
   return ufd;
 }
@@ -306,11 +306,11 @@ sys_fstat(void)
     return -1;
   if(fd < 0 || fd >= NOFILE)
     return -1;
-  if(cp->fds[fd] == 0)
+  if(cp->ofile[fd] == 0)
     return -1;
   if(addr + sizeof(struct stat) > cp->sz)
     return -1;
-  r = fd_stat(cp->fds[fd], (struct stat*)(cp->mem + addr));
+  r = fd_stat(cp->ofile[fd], (struct stat*)(cp->mem + addr));
   return r;
 }
 
@@ -324,12 +324,12 @@ sys_dup(void)
     return -1;
   if(fd < 0 || fd >= NOFILE)
     return -1;
-  if(cp->fds[fd] == 0)
+  if(cp->ofile[fd] == 0)
     return -1;
   if((ufd1 = fd_ualloc()) < 0)
     return -1;
-  cp->fds[ufd1] = cp->fds[fd];
-  fd_incref(cp->fds[ufd1]);
+  cp->ofile[ufd1] = cp->ofile[fd];
+  fd_incref(cp->ofile[ufd1]);
   return ufd1;
 }