| 38 | } |
| 39 | |
| 40 | FsOpenNode* FsVirtualNode::open(U32 flags) { |
| 41 | if ((flags & K_O_ACCMODE)==K_O_RDONLY) { |
| 42 | if (!this->canRead()) |
| 43 | return nullptr; |
| 44 | } else if ((flags & K_O_ACCMODE)==K_O_WRONLY) { |
| 45 | if (!this->canWrite()) |
| 46 | return nullptr; |
| 47 | } else { |
| 48 | if (!this->canWrite()) |
| 49 | return nullptr; |
| 50 | if (!this->canRead()) |
| 51 | return nullptr; |
| 52 | } |
| 53 | if (flags & K_O_CREAT) { |
| 54 | //return 0; |
| 55 | } |
| 56 | if (flags & K_O_EXCL) { |
| 57 | kdebug("What about exclusive virtual files"); |
| 58 | } |
| 59 | if (flags & K_O_TRUNC) { |
| 60 | kdebug("What about truncating a virtual file"); |
| 61 | } |
| 62 | if (flags & K_O_APPEND) { |
| 63 | kdebug("What about appending a virtual file"); |
| 64 | } |
| 65 | std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(B(""), this->path, true); |
| 66 | return this->openFunc(node, flags, this->openData); |
| 67 | } |
| 68 | |
| 69 | U32 FsVirtualNode::getType(bool checkForLink) { |
| 70 | if (this->isDirectory()) { |