Created
November 15, 2017 02:35
-
-
Save 2016rshah/5a383cbd5dade1646f67514b7221e7bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdint.h" | |
#include "debug.h" | |
#include "thread.h" | |
#include "ide.h" | |
#include "bobfs.h" | |
void check(const char* name, StrongPtr<Node> f) { | |
if (f.isNull()) { | |
Debug::printf("*** 0 %s is null\n",name); | |
return; | |
} | |
if (f->isFile()) { | |
Debug::printf("*** 0 %s is a file\n",name); | |
} | |
if (f->isDirectory()) { | |
Debug::printf("*** 0 %s is a directory\n",name); | |
} | |
Debug::printf("*** 0 %s has %d bytes\n",name,f->getSize()); | |
Debug::printf("*** 0 %s has %d links\n",name,f->getLinks()); | |
} | |
StrongPtr<Node> find(StrongPtr<Node> d, const char* name) { | |
StrongPtr<Node> f = d->findNode(name); | |
check(name,f); | |
return f; | |
} | |
void kernelStart(void) { | |
} | |
void kernelMain(void) { | |
StrongPtr<Ide> disk { new Ide(3) }; | |
StrongPtr<BobFS> fs = BobFS::mkfs(disk); | |
StrongPtr<Node> root = BobFS::root(fs); | |
// check("root",root); | |
// auto ocs = root->newFile("ocs"); | |
auto soc = root->newFile("soc"); | |
// auto osc = root->newFile("osc"); | |
auto ptr = new uint32_t[500]; | |
for (int i=0; i<500; i++) { | |
ptr[i] = i; | |
} | |
soc->writeAll(0, ptr, 100); | |
auto data = new uint32_t[100]; | |
soc->readAll(0,data,100); | |
for (uint32_t i=0; i<100; i++) { | |
if (data[i] != i) { | |
Debug::printf("*** 0 data[%d] == %d\n",i,data[i]); | |
// break; | |
} | |
} | |
Debug::printf("Success!\n"); | |
Debug::shutdown(); | |
return; | |
} | |
void kernelTerminate(void) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment