From 6cc3d4f7deb3fbf6129e4f641f17bb47b4bd5757 Mon Sep 17 00:00:00 2001
From: Frans Kaashoek <kaashoek@mit.edu>
Date: Fri, 26 Jul 2024 19:43:03 -0400
Subject: [PATCH] Thanks phosphagos@github

---
 kernel/ramdisk.c | 45 ---------------------------------------------
 1 file changed, 45 deletions(-)
 delete mode 100644 kernel/ramdisk.c

diff --git a/kernel/ramdisk.c b/kernel/ramdisk.c
deleted file mode 100644
index eb60ee7..0000000
--- a/kernel/ramdisk.c
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// ramdisk that uses the disk image loaded by qemu -initrd fs.img
-//
-
-#include "types.h"
-#include "riscv.h"
-#include "defs.h"
-#include "param.h"
-#include "memlayout.h"
-#include "spinlock.h"
-#include "sleeplock.h"
-#include "fs.h"
-#include "buf.h"
-
-void
-ramdiskinit(void)
-{
-}
-
-// 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
-ramdiskrw(struct buf *b)
-{
-  if(!holdingsleep(&b->lock))
-    panic("ramdiskrw: buf not locked");
-  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
-    panic("ramdiskrw: nothing to do");
-
-  if(b->blockno >= FSSIZE)
-    panic("ramdiskrw: blockno too big");
-
-  uint64 diskaddr = b->blockno * BSIZE;
-  char *addr = (char *)RAMDISK + diskaddr;
-
-  if(b->flags & B_DIRTY){
-    // write
-    memmove(addr, b->data, BSIZE);
-    b->flags &= ~B_DIRTY;
-  } else {
-    // read
-    memmove(b->data, addr, BSIZE);
-    b->flags |= B_VALID;
-  }
-}