コード例 #1
0
ファイル: FSNode-sc.proto.cpp プロジェクト: Alexis211/Melon
u32int FSNode::scall(u8int wat, u32int a, u32int b, u32int c, u32int d) {
	if (wat == FNIF_SGETRFN) return VFS::getRootNode()->resId();
	if (wat == FNIF_SGETCWD) return Task::currProcess()->getCwd()->resId();
	if (wat == FNIF_SFIND) {
		String* path = (String*)a;
		FSNode* n;
		if (b == 0) {
			n = VFS::find(*path);
		} else {
			n = VFS::find(*path, Res::get<DirectoryNode>(b, FNIF_OBJTYPE));
		}
		if (n != 0) return n->resId();
	}
	if (wat == FNIF_SMKDIR) {
		String* path = (String*)a;
		FSNode* n;
		if (b == 0) {
			n = VFS::createDirectory(*path, 0, true);
		} else {
			n = VFS::createDirectory(*path, Res::get<DirectoryNode>(b, FNIF_OBJTYPE), true);
		}
		if (n != 0) return n->resId();
	}
	return (u32int) - 1;
}