GearsOSにおけるinodeを用いたFileSystemの設計 |
又吉 雄斗
河野研
|
__code mkdir(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
struct FTree* newDirectory = createFileSystemTree(context, gearsDirectory->currentDirectory);
Node* inode = new Node();
inode->key = gearsDirectory->INodeNumber;
inode->value = newDirectory;
struct FTree* cDirectory = new FTree();
cDirectory = gearsDirectory->iNodeTree;
goto cDirectory->put(inode, mkdir2);
}
__code mkdir2(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
Node* dir = new Node();
dir->key = name->value;
Integer* iNum = new Integer();
iNum->value = gearsDirectory->INodeNumber;
dir->value = iNum;
gearsDirectory->INodeNumber = gearsDirectory->INodeNumber + 1;
struct FTree* cDirectory = new FTree();
cDirectory = gearsDirectory->currentDirectory;
goto cDirectory->put(dir, next(...));
}
__code ls(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
Node* dir = new Node();
dir->key = name->value;
struct FTree* cDirectory = new FTree();
cDirectory = gearsDirectory->currentDirectory;
goto cDirectory->get(dir, ls2);
}
__code ls2(struct GearsDirectoryImpl* gearsDirectory, struct Node* node, __code next(...)) {
printf("%d\n", node->key);
goto next(...);
}
__code cd2Child(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
struct FTree* cDirectory = new FTree();
cDirectory = gearsDirectory->currentDirectory;
struct Node* node = new Node();
node->key = name->value;
goto cDirectory->get(node, cd2Child2);
}
__code cd2Child2(struct GearsDirectoryImpl* gearsDirectory, struct Node* node, __code next(...)) {
struct FTree* iNodeTree = new FTree();
iNodeTree = gearsDirectory->iNodeTree;
goto iNodeTree->get(node->value, cd2Child3);
}
__code cd2Child3(struct GearsDirectoryImpl* gearsDirectory, struct Node* node, __code next(...)) {
gearsDirectory->currentDirectory = node->value;
goto next(...);
}