]> Devi Nivas Git - cs3210-lab0.git/commitdiff
Remove trailing white space with:
authorFrans Kaashoek <kaashoek@mit.edu>
Thu, 25 Aug 2016 13:13:00 +0000 (09:13 -0400)
committerFrans Kaashoek <kaashoek@mit.edu>
Thu, 25 Aug 2016 13:13:00 +0000 (09:13 -0400)
 for f in *.{h,c}; do sed -i .sed 's/[[:blank:]]*$//' $f; done
(Thanks to Nicolás Wolovick)

32 files changed:
bio.c
bootmain.c
console.c
file.c
forktest.c
fs.c
fs.h
grep.c
ide.c
ioapic.c
log.c
ls.c
main.c
memide.c
mkfs.c
mmu.h
proc.c
proc.h
sh.c
spinlock.c
spinlock.h
stressfs.c
string.c
syscall.c
sysproc.c
trap.c
uart.c
ulib.c
usertests.c
vm.c
x86.h
zombie.c

diff --git a/bio.c b/bio.c
index 629bb2c52c850ca17e408ce6e8ee5cebd3be8a21..6c19a64750ae9f63b1d72be77d080b2ee0e19011 100644 (file)
--- a/bio.c
+++ b/bio.c
@@ -4,7 +4,7 @@
 // cached copies of disk block contents.  Caching disk blocks
 // in memory reduces the number of disk reads and also provides
 // a synchronization point for disk blocks used by multiple processes.
-// 
+//
 // Interface:
 // * To get a buffer for a particular disk block, call bread.
 // * After changing buffer data, call bwrite to write it to disk.
 // * Do not use the buffer after calling brelse.
 // * Only one process at a time can use a buffer,
 //     so do not keep them longer than necessary.
-// 
+//
 // The implementation uses three state flags internally:
 // * B_BUSY: the block has been returned from bread
-//     and has not been passed back to brelse.  
+//     and has not been passed back to brelse.
 // * B_VALID: the buffer data has been read from the disk.
 // * B_DIRTY: the buffer data has been modified
 //     and needs to be written to disk.
index 97d525872772955ae85d4f0de78df1aea14ddfaf..1f20e5bdf91630f59b3e76f68b70f3e025866a88 100644 (file)
@@ -1,5 +1,5 @@
 // Boot loader.
-// 
+//
 // Part of the boot block, along with bootasm.S, which calls bootmain().
 // bootasm.S has put the processor into protected 32-bit mode.
 // bootmain() loads an ELF kernel image from the disk starting at
index 35f221d105327d3ba4520eb8d9dfa29e19db35de..298a6e76e87116edcb4ad8cc022644a1d1c72d02 100644 (file)
--- a/console.c
+++ b/console.c
@@ -107,7 +107,7 @@ panic(char *s)
 {
   int i;
   uint pcs[10];
-  
+
   cli();
   cons.locking = 0;
   cprintf("cpu%d: panic: ", cpu->id);
@@ -130,7 +130,7 @@ static void
 cgaputc(int c)
 {
   int pos;
-  
+
   // Cursor position: col + 80*row.
   outb(CRTPORT, 14);
   pos = inb(CRTPORT+1) << 8;
@@ -146,13 +146,13 @@ cgaputc(int c)
 
   if(pos < 0 || pos > 25*80)
     panic("pos under/overflow");
-  
+
   if((pos/80) >= 24){  // Scroll up.
     memmove(crt, crt+80, sizeof(crt[0])*23*80);
     pos -= 80;
     memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
   }
-  
+
   outb(CRTPORT, 14);
   outb(CRTPORT+1, pos>>8);
   outb(CRTPORT, 15);
diff --git a/file.c b/file.c
index 98cad1e9a122ee0b83fa6e18a6d91bcc6bc6fee6..85bb4034a50b593f4f8dfddd6af288ee918b535e 100644 (file)
--- a/file.c
+++ b/file.c
@@ -68,7 +68,7 @@ fileclose(struct file *f)
   f->ref = 0;
   f->type = FD_NONE;
   release(&ftable.lock);
-  
+
   if(ff.type == FD_PIPE)
     pipeclose(ff.pipe, ff.writable);
   else if(ff.type == FD_INODE){
index bb286e657ff6cacf0fd7b22748438db7b9a30dca..73f2fe8e76cf6bc5bdbea8e765380f31765fb685 100644 (file)
@@ -27,24 +27,24 @@ forktest(void)
     if(pid == 0)
       exit();
   }
-  
+
   if(n == N){
     printf(1, "fork claimed to work N times!\n", N);
     exit();
   }
-  
+
   for(; n > 0; n--){
     if(wait() < 0){
       printf(1, "wait stopped early\n");
       exit();
     }
   }
-  
+
   if(wait() != -1){
     printf(1, "wait got too many\n");
     exit();
   }
-  
+
   printf(1, "fork test OK\n");
 }
 
diff --git a/fs.c b/fs.c
index 025b326c4d91e027df472a8d668cdd549a806aa7..f800b77721d4248b92445aab8d991b3fceb339b4 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -5,7 +5,7 @@
 //   + Directories: inode with special contents (list of other inodes!)
 //   + Names: paths like /usr/rtm/xv6/fs.c for convenient naming.
 //
-// This file contains the low-level file system manipulation 
+// This file contains the low-level file system manipulation
 // routines.  The (higher-level) system call implementations
 // are in sysfile.c.
 
@@ -29,7 +29,7 @@ void
 readsb(int dev, struct superblock *sb)
 {
   struct buf *bp;
-  
+
   bp = bread(dev, 1);
   memmove(sb, bp->data, sizeof(*sb));
   brelse(bp);
@@ -40,14 +40,14 @@ static void
 bzero(int dev, int bno)
 {
   struct buf *bp;
-  
+
   bp = bread(dev, bno);
   memset(bp->data, 0, BSIZE);
   log_write(bp);
   brelse(bp);
 }
 
-// Blocks. 
+// Blocks.
 
 // Allocate a zeroed disk block.
 static uint
@@ -348,7 +348,7 @@ iunlockput(struct inode *ip)
 //
 // The content (data) associated with each inode is stored
 // in blocks on the disk. The first NDIRECT block numbers
-// are listed in ip->addrs[].  The next NINDIRECT blocks are 
+// are listed in ip->addrs[].  The next NINDIRECT blocks are
 // listed in block ip->addrs[NDIRECT].
 
 // Return the disk block address of the nth block in inode ip.
@@ -401,7 +401,7 @@ itrunc(struct inode *ip)
       ip->addrs[i] = 0;
     }
   }
-  
+
   if(ip->addrs[NDIRECT]){
     bp = bread(ip->dev, ip->addrs[NDIRECT]);
     a = (uint*)bp->data;
@@ -554,7 +554,7 @@ dirlink(struct inode *dp, char *name, uint inum)
   de.inum = inum;
   if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
     panic("dirlink");
-  
+
   return 0;
 }
 
diff --git a/fs.h b/fs.h
index e1d7d09c3a32c61df0152383fb855b84cec5d1d1..e64ecc0ad507a00743d4c18e2edfbcfe1eaf1f6d 100644 (file)
--- a/fs.h
+++ b/fs.h
@@ -1,4 +1,4 @@
-// On-disk file system format. 
+// On-disk file system format.
 // Both the kernel and user programs use this header file.
 
 
diff --git a/grep.c b/grep.c
index 28ff11a8da3f5a2c505c7e4ccf82370e6ed31843..adc48355665d4259f98c2632916cf3710462455a 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -12,7 +12,7 @@ grep(char *pattern, int fd)
 {
   int n, m;
   char *p, *q;
-  
+
   m = 0;
   while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
     m += n;
@@ -40,13 +40,13 @@ main(int argc, char *argv[])
 {
   int fd, i;
   char *pattern;
-  
+
   if(argc <= 1){
     printf(2, "usage: grep pattern [file ...]\n");
     exit();
   }
   pattern = argv[1];
-  
+
   if(argc <= 2){
     grep(pattern, 0);
     exit();
diff --git a/ide.c b/ide.c
index 2606b9e82800009008e84ea5a57c38795fd7b2ff..7fad55d24d3e24b99885c2fc7241519e09052cfd 100644 (file)
--- a/ide.c
+++ b/ide.c
@@ -39,7 +39,7 @@ idewait(int checkerr)
 {
   int r;
 
-  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 
+  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
     ;
   if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
     return -1;
@@ -50,12 +50,12 @@ void
 ideinit(void)
 {
   int i;
-  
+
   initlock(&idelock, "ide");
   picenable(IRQ_IDE);
   ioapicenable(IRQ_IDE, ncpu - 1);
   idewait(0);
-  
+
   // Check if disk 1 is present
   outb(0x1f6, 0xe0 | (1<<4));
   for(i=0; i<1000; i++){
@@ -64,7 +64,7 @@ ideinit(void)
       break;
     }
   }
-  
+
   // Switch back to disk 0.
   outb(0x1f6, 0xe0 | (0<<4));
 }
@@ -81,9 +81,9 @@ idestart(struct buf *b)
   int sector = b->blockno * sector_per_block;
   int read_cmd = (sector_per_block == 1) ? IDE_CMD_READ :  IDE_CMD_RDMUL;
   int write_cmd = (sector_per_block == 1) ? IDE_CMD_WRITE : IDE_CMD_WRMUL;
+
   if (sector_per_block > 7) panic("idestart");
-  
+
   idewait(0);
   outb(0x3f6, 0);  // generate interrupt
   outb(0x1f2, sector_per_block);  // number of sectors
@@ -117,12 +117,12 @@ ideintr(void)
   // Read data if needed.
   if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
     insl(0x1f0, b->data, BSIZE/4);
-  
+
   // Wake process waiting for this buf.
   b->flags |= B_VALID;
   b->flags &= ~B_DIRTY;
   wakeup(b);
-  
+
   // Start disk on next buf in queue.
   if(idequeue != 0)
     idestart(idequeue);
@@ -131,7 +131,7 @@ ideintr(void)
 }
 
 //PAGEBREAK!
-// Sync buf with disk. 
+// Sync buf with disk.
 // If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
 // Else if B_VALID is not set, read buf from disk, set B_VALID.
 void
@@ -153,11 +153,11 @@ iderw(struct buf *b)
   for(pp=&idequeue; *pp; pp=&(*pp)->qnext)  //DOC:insert-queue
     ;
   *pp = b;
-  
+
   // Start disk if necessary.
   if(idequeue == b)
     idestart(b);
-  
+
   // Wait for request to finish.
   while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
     sleep(b, &idelock);
index d34361199c2c3b8ea99a5e689039b765f1783287..0e9116f9a5567095848c451a9bba6e262ba45ba6 100644 (file)
--- a/ioapic.c
+++ b/ioapic.c
@@ -13,7 +13,7 @@
 #define REG_TABLE  0x10  // Redirection table base
 
 // The redirection table starts at REG_TABLE and uses
-// two registers to configure each interrupt.  
+// two registers to configure each interrupt.
 // The first (low) register in a pair contains configuration bits.
 // The second (high) register contains a bitmask telling which
 // CPUs can serve that interrupt.
diff --git a/log.c b/log.c
index 12db8caec88f83a4779d7381dfcfb1daa7137c13..a2f1b5700a48ee0576208d3842d9590f0036c8d2 100644 (file)
--- a/log.c
+++ b/log.c
@@ -31,7 +31,7 @@
 // Contents of the header block, used for both the on-disk header block
 // and to keep track in memory of logged block# before commit.
 struct logheader {
-  int n;   
+  int n;
   int block[LOGSIZE];
 };
 
@@ -65,7 +65,7 @@ initlog(int dev)
 }
 
 // Copy committed blocks from log to their home location
-static void 
+static void
 install_trans(void)
 {
   int tail;
@@ -75,7 +75,7 @@ install_trans(void)
     struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
     memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
     bwrite(dbuf);  // write dst to disk
-    brelse(lbuf); 
+    brelse(lbuf);
     brelse(dbuf);
   }
 }
@@ -114,7 +114,7 @@ write_head(void)
 static void
 recover_from_log(void)
 {
-  read_head();      
+  read_head();
   install_trans(); // if committed, copy from log to disk
   log.lh.n = 0;
   write_head(); // clear the log
@@ -171,7 +171,7 @@ end_op(void)
 }
 
 // Copy modified blocks from cache to log.
-static void 
+static void
 write_log(void)
 {
   int tail;
@@ -181,7 +181,7 @@ write_log(void)
     struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
     memmove(to->data, from->data, BSIZE);
     bwrite(to);  // write the log
-    brelse(from); 
+    brelse(from);
     brelse(to);
   }
 }
@@ -193,7 +193,7 @@ commit()
     write_log();     // Write modified blocks from cache to log
     write_head();    // Write header to disk -- the real commit
     install_trans(); // Now install writes to home locations
-    log.lh.n = 0; 
+    log.lh.n = 0;
     write_head();    // Erase the transaction from the log
   }
 }
diff --git a/ls.c b/ls.c
index b6ddd7f8586ea5a2f2f3cd439195467e9a15ea35..28629135140cbc850985871f98cb20ac800bc99b 100644 (file)
--- a/ls.c
+++ b/ls.c
@@ -8,12 +8,12 @@ fmtname(char *path)
 {
   static char buf[DIRSIZ+1];
   char *p;
-  
+
   // Find first character after last slash.
   for(p=path+strlen(path); p >= path && *p != '/'; p--)
     ;
   p++;
-  
+
   // Return blank-padded name.
   if(strlen(p) >= DIRSIZ)
     return p;
@@ -29,23 +29,23 @@ ls(char *path)
   int fd;
   struct dirent de;
   struct stat st;
-  
+
   if((fd = open(path, 0)) < 0){
     printf(2, "ls: cannot open %s\n", path);
     return;
   }
-  
+
   if(fstat(fd, &st) < 0){
     printf(2, "ls: cannot stat %s\n", path);
     close(fd);
     return;
   }
-  
+
   switch(st.type){
   case T_FILE:
     printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
     break;
-  
+
   case T_DIR:
     if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
       printf(1, "ls: path too long\n");
diff --git a/main.c b/main.c
index 74e61fbfabdfbab6cd7b1f902ff7b4abb8f02c96..2972b216a3f9cf7191a14afd0c8cbe04dc617712 100644 (file)
--- a/main.c
+++ b/main.c
@@ -44,7 +44,7 @@ main(void)
 static void
 mpenter(void)
 {
-  switchkvm(); 
+  switchkvm();
   seginit();
   lapicinit();
   mpmain();
@@ -81,7 +81,7 @@ startothers(void)
     if(c == cpus+cpunum())  // We've started already.
       continue;
 
-    // Tell entryother.S what stack to use, where to enter, and what 
+    // Tell entryother.S what stack to use, where to enter, and what
     // pgdir to use. We cannot use kpgdir yet, because the AP processor
     // is running in low  memory, so we use entrypgdir for the APs too.
     stack = kalloc();
@@ -99,7 +99,7 @@ startothers(void)
 
 // The boot page table used in entry.S and entryother.S.
 // Page directories (and page tables) must start on page boundaries,
-// hence the __aligned__ attribute.  
+// hence the __aligned__ attribute.
 // PTE_PS in a page directory entry enables 4Mbyte pages.
 
 __attribute__((__aligned__(PGSIZE)))
index 91b7f92a3d1ff0b26f5421cc71777de1ea775bc2..38be9a46b49dd31734c945d582b99664f588cf01 100644 (file)
--- a/memide.c
+++ b/memide.c
@@ -31,7 +31,7 @@ ideintr(void)
   // no-op
 }
 
-// Sync buf with disk. 
+// Sync buf with disk.
 // If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
 // Else if B_VALID is not set, read buf from disk, set B_VALID.
 void
@@ -49,7 +49,7 @@ iderw(struct buf *b)
     panic("iderw: block out of range");
 
   p = memdisk + b->blockno*BSIZE;
-  
+
   if(b->flags & B_DIRTY){
     b->flags &= ~B_DIRTY;
     memmove(p, b->data, BSIZE);
diff --git a/mkfs.c b/mkfs.c
index 0a1075427d071a1b4b56eb70fee4510418629810..8e011a785e24170744714dcc2c0caa48ae35d91b 100644 (file)
--- a/mkfs.c
+++ b/mkfs.c
@@ -22,7 +22,7 @@
 
 int nbitmap = FSSIZE/(BSIZE*8) + 1;
 int ninodeblocks = NINODES / IPB + 1;
-int nlog = LOGSIZE;  
+int nlog = LOGSIZE;
 int nmeta;    // Number of meta blocks (boot, sb, nlog, inode, bitmap)
 int nblocks;  // Number of data blocks
 
@@ -134,7 +134,7 @@ main(int argc, char *argv[])
       perror(argv[i]);
       exit(1);
     }
-    
+
     // Skip leading _ in name when writing to file system.
     // The binaries are named _rm, _cat, etc. to keep the
     // build operating system from trying to execute them
diff --git a/mmu.h b/mmu.h
index 310d5de80af5f83015dd5d461a0227ac74d55cdc..e732ccdcfaab8d40f705a479e985768ce92dcd31 100644 (file)
--- a/mmu.h
+++ b/mmu.h
@@ -1,4 +1,4 @@
-// This file contains definitions for the 
+// This file contains definitions for the
 // x86 memory management unit (MMU).
 
 // Eflags register
@@ -110,7 +110,7 @@ struct segdesc {
 // | Page Directory |   Page Table   | Offset within Page  |
 // |      Index     |      Index     |                     |
 // +----------------+----------------+---------------------+
-//  \--- PDX(va) --/ \--- PTX(va) --/ 
+//  \--- PDX(va) --/ \--- PTX(va) --/
 
 // page directory index
 #define PDX(va)         (((uint)(va) >> PDXSHIFT) & 0x3FF)
diff --git a/proc.c b/proc.c
index 85f3f1755de064bffc5cdaa3807981051673ecdb..751d886926185af383b6d521f258de216e84c28a 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -53,11 +53,11 @@ found:
     return 0;
   }
   sp = p->kstack + KSTACKSIZE;
-  
+
   // Leave room for trap frame.
   sp -= sizeof *p->tf;
   p->tf = (struct trapframe*)sp;
-  
+
   // Set up new context to start executing at forkret,
   // which returns to trapret.
   sp -= 4;
@@ -78,7 +78,7 @@ userinit(void)
 {
   struct proc *p;
   extern char _binary_initcode_start[], _binary_initcode_size[];
-  
+
   acquire(&ptable.lock);
 
   p = allocproc();
@@ -110,7 +110,7 @@ int
 growproc(int n)
 {
   uint sz;
-  
+
   sz = proc->sz;
   if(n > 0){
     if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
@@ -162,13 +162,13 @@ fork(void)
   np->cwd = idup(proc->cwd);
 
   safestrcpy(np->name, proc->name, sizeof(proc->name));
+
   pid = np->pid;
 
   np->state = RUNNABLE;
 
   release(&ptable.lock);
-  
+
   return pid;
 }
 
@@ -342,13 +342,13 @@ forkret(void)
 
   if (first) {
     // Some initialization functions must be run in the context
-    // of a regular process (e.g., they call sleep), and thus cannot 
+    // of a regular process (e.g., they call sleep), and thus cannot
     // be run from main().
     first = 0;
     iinit(ROOTDEV);
     initlog(ROOTDEV);
   }
-  
+
   // Return to "caller", actually trapret (see allocproc).
 }
 
@@ -453,7 +453,7 @@ procdump(void)
   struct proc *p;
   char *state;
   uint pc[10];
-  
+
   for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
     if(p->state == UNUSED)
       continue;
diff --git a/proc.h b/proc.h
index 33a955848af21c7da0829c1c0c7926daead22140..d1597cf6823b70aad1b459676a4a645771058b9b 100644 (file)
--- a/proc.h
+++ b/proc.h
@@ -7,7 +7,7 @@ struct cpu {
   volatile uint started;       // Has the CPU started?
   int ncli;                    // Depth of pushcli nesting.
   int intena;                  // Were interrupts enabled before pushcli?
-  
+
   // Cpu-local storage variables; see below
   struct cpu *cpu;
   struct proc *proc;           // The currently-running process.
diff --git a/sh.c b/sh.c
index 3ac6f5bd30fb3d6cd17aa7fd6250ad91f72e5d42..054bab92b3a036cde28789923685d35c604ff4ae 100644 (file)
--- a/sh.c
+++ b/sh.c
@@ -66,7 +66,7 @@ runcmd(struct cmd *cmd)
 
   if(cmd == 0)
     exit();
-  
+
   switch(cmd->type){
   default:
     panic("runcmd");
@@ -120,7 +120,7 @@ runcmd(struct cmd *cmd)
     wait();
     wait();
     break;
-    
+
   case BACK:
     bcmd = (struct backcmd*)cmd;
     if(fork1() == 0)
@@ -146,7 +146,7 @@ main(void)
 {
   static char buf[100];
   int fd;
-  
+
   // Ensure that three file descriptors are open.
   while((fd = open("console", O_RDWR)) >= 0){
     if(fd >= 3){
@@ -154,7 +154,7 @@ main(void)
       break;
     }
   }
-  
+
   // Read and run input commands.
   while(getcmd(buf, sizeof(buf)) >= 0){
     if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){
@@ -182,7 +182,7 @@ int
 fork1(void)
 {
   int pid;
-  
+
   pid = fork();
   if(pid == -1)
     panic("fork");
@@ -267,7 +267,7 @@ gettoken(char **ps, char *es, char **q, char **eq)
 {
   char *s;
   int ret;
-  
+
   s = *ps;
   while(s < es && strchr(whitespace, *s))
     s++;
@@ -300,7 +300,7 @@ gettoken(char **ps, char *es, char **q, char **eq)
   }
   if(eq)
     *eq = s;
-  
+
   while(s < es && strchr(whitespace, *s))
     s++;
   *ps = s;
@@ -311,7 +311,7 @@ int
 peek(char **ps, char *es, char *toks)
 {
   char *s;
-  
+
   s = *ps;
   while(s < es && strchr(whitespace, *s))
     s++;
@@ -419,7 +419,7 @@ parseexec(char **ps, char *es)
   int tok, argc;
   struct execcmd *cmd;
   struct cmd *ret;
-  
+
   if(peek(ps, es, "("))
     return parseblock(ps, es);
 
@@ -458,7 +458,7 @@ nulterminate(struct cmd *cmd)
 
   if(cmd == 0)
     return 0;
-  
+
   switch(cmd->type){
   case EXEC:
     ecmd = (struct execcmd*)cmd;
@@ -477,7 +477,7 @@ nulterminate(struct cmd *cmd)
     nulterminate(pcmd->left);
     nulterminate(pcmd->right);
     break;
-    
+
   case LIST:
     lcmd = (struct listcmd*)cmd;
     nulterminate(lcmd->left);
index 1517171bc8922b8af7ecc2c370d7e4057b3f258b..a5f0b2118b62afd626d8690186fbea7130e25a37 100644 (file)
@@ -71,7 +71,7 @@ getcallerpcs(void *v, uint pcs[])
 {
   uint *ebp;
   int i;
-  
+
   ebp = (uint*)v - 2;
   for(i = 0; i < 10; i++){
     if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
@@ -99,7 +99,7 @@ void
 pushcli(void)
 {
   int eflags;
-  
+
   eflags = readeflags();
   cli();
   if(cpu->ncli++ == 0)
index fdda016b3bf2fe7601ae132a3bab47df35f8cc54..0a9d8e23a718d0650cd10385032286de1ff7c696 100644 (file)
@@ -1,7 +1,7 @@
 // Mutual exclusion lock.
 struct spinlock {
   uint locked;       // Is the lock held?
-  
+
   // For debugging:
   char *name;        // Name of lock.
   struct cpu *cpu;   // The cpu holding the lock.
index 63694004b90282e071d3113f5f2212289ba27a2a..c0a474375a624b247dcd6eeb20db06075de15888 100644 (file)
@@ -44,6 +44,6 @@ main(int argc, char *argv[])
   close(fd);
 
   wait();
-  
+
   exit();
 }
index d066c18ac7c9c712a9764bba5d2e3d9e0b9a3dbe..a7cc61fa66272cf288215d92cfe171b50e8992a0 100644 (file)
--- a/string.c
+++ b/string.c
@@ -16,7 +16,7 @@ int
 memcmp(const void *v1, const void *v2, uint n)
 {
   const uchar *s1, *s2;
-  
+
   s1 = v1;
   s2 = v2;
   while(n-- > 0){
@@ -69,7 +69,7 @@ char*
 strncpy(char *s, const char *t, int n)
 {
   char *os;
-  
+
   os = s;
   while(n-- > 0 && (*s++ = *t++) != 0)
     ;
@@ -83,7 +83,7 @@ char*
 safestrcpy(char *s, const char *t, int n)
 {
   char *os;
-  
+
   os = s;
   if(n <= 0)
     return os;
index 799ebc2fa1ae5d7226ad4066881171de1907d061..5d3be9d0019975f2bac2ccecb5e13cfa83b9d9b0 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -55,7 +55,7 @@ int
 argptr(int n, char **pp, int size)
 {
   int i;
-  
+
   if(argint(n, &i) < 0)
     return -1;
   if((uint)i >= proc->sz || (uint)i+size > proc->sz)
index 027a5e51dd012da5ae94336cf818444abf65f042..6b585e002bf6ab215bd1deb91bd1472c06e13bee 100644 (file)
--- a/sysproc.c
+++ b/sysproc.c
@@ -61,7 +61,7 @@ sys_sleep(void)
 {
   int n;
   uint ticks0;
-  
+
   if(argint(0, &n) < 0)
     return -1;
   acquire(&tickslock);
@@ -83,7 +83,7 @@ int
 sys_uptime(void)
 {
   uint xticks;
-  
+
   acquire(&tickslock);
   xticks = ticks;
   release(&tickslock);
diff --git a/trap.c b/trap.c
index 3f80145f128452f6343ee2ba81258d84459d03df..20ae62d3fea95ccb0d911b467240c45745c17a2a 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -22,7 +22,7 @@ tvinit(void)
   for(i = 0; i < 256; i++)
     SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
   SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
-  
+
   initlock(&tickslock, "time");
 }
 
@@ -77,7 +77,7 @@ trap(struct trapframe *tf)
             cpu->id, tf->cs, tf->eip);
     lapiceoi();
     break;
-   
+
   //PAGEBREAK: 13
   default:
     if(proc == 0 || (tf->cs&3) == 0){
@@ -89,13 +89,13 @@ trap(struct trapframe *tf)
     // In user space, assume process misbehaved.
     cprintf("pid %d %s: trap %d err %d on cpu %d "
             "eip 0x%x addr 0x%x--kill proc\n",
-            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
+            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
             rcr2());
     proc->killed = 1;
   }
 
   // Force process exit if it has been killed and is in user space.
-  // (If it is still executing in the kernel, let it keep running 
+  // (If it is still executing in the kernel, let it keep running
   // until it gets to the regular system call return.)
   if(proc && proc->killed && (tf->cs&3) == DPL_USER)
     exit();
diff --git a/uart.c b/uart.c
index 576e254db9b3be297510b49911f02e8fa3c482cd..257384ac0d91c7c8c68ea8c76da7c1c81a920f1f 100644 (file)
--- a/uart.c
+++ b/uart.c
@@ -22,7 +22,7 @@ uartinit(void)
 
   // Turn off the FIFO
   outb(COM1+2, 0);
-  
+
   // 9600 baud, 8 data bits, 1 stop bit, parity off.
   outb(COM1+3, 0x80);    // Unlock divisor
   outb(COM1+0, 115200/9600);
@@ -42,7 +42,7 @@ uartinit(void)
   inb(COM1+0);
   picenable(IRQ_COM1);
   ioapicenable(IRQ_COM1, 0);
-  
+
   // Announce that we're here.
   for(p="xv6...\n"; *p; p++)
     uartputc(*p);
diff --git a/ulib.c b/ulib.c
index dbbcfcfb655bbacd3ce10ade020bfee4618ca49e..51a9e74d0b87c463c7614e439436e992b050ef40 100644 (file)
--- a/ulib.c
+++ b/ulib.c
@@ -96,7 +96,7 @@ void*
 memmove(void *vdst, void *vsrc, int n)
 {
   char *dst, *src;
-  
+
   dst = vdst;
   src = vsrc;
   while(n-- > 0)
index 22a7bfbd5d393ffd9398054d8bc08e9623a6bbc2..458f8edcfa5362fad506db2b0d85d2746610cc72 100644 (file)
@@ -539,7 +539,7 @@ fourfiles(void)
         printf(1, "create failed\n");
         exit();
       }
-      
+
       memset(buf, '0'+pi, 512);
       for(i = 0; i < 12; i++){
         if((n = write(fd, buf, 500)) != 500){
@@ -882,7 +882,7 @@ linkunlink()
 
   if(pid)
     wait();
-  else 
+  else
     exit();
 
   printf(1, "linkunlink ok\n");
@@ -951,7 +951,7 @@ subdir(void)
   }
   write(fd, "ff", 2);
   close(fd);
-  
+
   if(unlink("dd") >= 0){
     printf(1, "unlink dd (non-empty dir) succeeded!\n");
     exit();
@@ -1390,24 +1390,24 @@ forktest(void)
     if(pid == 0)
       exit();
   }
-  
+
   if(n == 1000){
     printf(1, "fork claimed to work 1000 times!\n");
     exit();
   }
-  
+
   for(; n > 0; n--){
     if(wait() < 0){
       printf(1, "wait stopped early\n");
       exit();
     }
   }
-  
+
   if(wait() != -1){
     printf(1, "wait got too many\n");
     exit();
   }
-  
+
   printf(1, "fork test OK\n");
 }
 
@@ -1424,7 +1424,7 @@ sbrktest(void)
   // can one sbrk() less than a page?
   a = sbrk(0);
   int i;
-  for(i = 0; i < 5000; i++){ 
+  for(i = 0; i < 5000; i++){
     b = sbrk(1);
     if(b != a){
       printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
@@ -1453,7 +1453,7 @@ sbrktest(void)
   a = sbrk(0);
   amt = (BIG) - (uint)a;
   p = sbrk(amt);
-  if (p != a) { 
+  if (p != a) {
     printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
     exit();
   }
@@ -1492,7 +1492,7 @@ sbrktest(void)
     printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
     exit();
   }
-  
+
   // can we read the kernel's memory?
   for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
     ppid = getpid();
diff --git a/vm.c b/vm.c
index 6c42ae580d4c7835a3c7e2fa8614c2fcfdad297a..16fb03bc7f14449cd63bca27ebbae5a9ecc70da4 100644 (file)
--- a/vm.c
+++ b/vm.c
@@ -32,7 +32,7 @@ seginit(void)
 
   lgdt(c->gdt, sizeof(c->gdt));
   loadgs(SEG_KCPU << 3);
-  
+
   // Initialize cpu-local storage.
   cpu = c;
   proc = 0;
@@ -56,7 +56,7 @@ walkpgdir(pde_t *pgdir, const void *va, int alloc)
     // Make sure all those PTE_P bits are zero.
     memset(pgtab, 0, PGSIZE);
     // The permissions here are overly generous, but they can
-    // be further restricted by the permissions in the page table 
+    // be further restricted by the permissions in the page table
     // entries, if necessary.
     *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
   }
@@ -71,7 +71,7 @@ mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
 {
   char *a, *last;
   pte_t *pte;
-  
+
   a = (char*)PGROUNDDOWN((uint)va);
   last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
   for(;;){
@@ -93,7 +93,7 @@ mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
 // current process's page table during system calls and interrupts;
 // page protection bits prevent user code from using the kernel's
 // mappings.
-// 
+//
 // setupkvm() and exec() set up every page table like this:
 //
 //   0..KERNBASE: user memory (text+data+stack+heap), mapped to
@@ -101,7 +101,7 @@ mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
 //   KERNBASE..KERNBASE+EXTMEM: mapped to 0..EXTMEM (for I/O space)
 //   KERNBASE+EXTMEM..data: mapped to EXTMEM..V2P(data)
 //                for the kernel's instructions and r/o data
-//   data..KERNBASE+PHYSTOP: mapped to V2P(data)..PHYSTOP, 
+//   data..KERNBASE+PHYSTOP: mapped to V2P(data)..PHYSTOP,
 //                                  rw data + free physical memory
 //   0xfe000000..0: mapped direct (devices such as ioapic)
 //
@@ -136,7 +136,7 @@ setupkvm(void)
   if (P2V(PHYSTOP) > (void*)DEVSPACE)
     panic("PHYSTOP too high");
   for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
-    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
+    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
                 (uint)k->phys_start, k->perm) < 0)
       return 0;
   return pgdir;
@@ -181,7 +181,7 @@ void
 inituvm(pde_t *pgdir, char *init, uint sz)
 {
   char *mem;
-  
+
   if(sz >= PGSIZE)
     panic("inituvm: more than a page");
   mem = kalloc();
diff --git a/x86.h b/x86.h
index 3949900bc8eb7e9afb334ca862a921ad63a6ea24..07312a539fee1cc7dfb11cc09a9fcbccc0150875 100644 (file)
--- a/x86.h
+++ b/x86.h
@@ -121,7 +121,7 @@ static inline uint
 xchg(volatile uint *addr, uint newval)
 {
   uint result;
-  
+
   // The + in "+m" denotes a read-modify-write operand.
   asm volatile("lock; xchgl %0, %1" :
                "+m" (*addr), "=a" (result) :
@@ -139,7 +139,7 @@ rcr2(void)
 }
 
 static inline void
-lcr3(uint val) 
+lcr3(uint val)
 {
   asm volatile("movl %0,%%cr3" : : "r" (val));
 }
index 077c02c886a8df2697f19e3cb05c92b990a2d30e..ee817da89c3082f31f300eca783d4125ed59567a 100644 (file)
--- a/zombie.c
+++ b/zombie.c
@@ -1,4 +1,4 @@
-// Create a zombie process that 
+// Create a zombie process that
 // must be reparented at exit.
 
 #include "types.h"