| 1342 | } |
| 1343 | |
| 1344 | ssize_t Ext2Volume::ReadLink(Ext2Node* node, char* pathBuffer, size_t bufSize){ |
| 1345 | if((node->flags & S_IFMT) != S_IFLNK){ |
| 1346 | return -EINVAL; // Not a symbolic link |
| 1347 | } |
| 1348 | |
| 1349 | if(node->size <= 60){ |
| 1350 | size_t copySize = MIN(bufSize, node->size); |
| 1351 | strncpy(pathBuffer, (const char*)node->e2inode.blocks, copySize); // Symlinks up to 60 bytes are stored in the blocklist |
| 1352 | |
| 1353 | return copySize; |
| 1354 | } else { |
| 1355 | return this->Read(node, 0, bufSize, (uint8_t*)pathBuffer); |
| 1356 | } |
| 1357 | } |
| 1358 | |
| 1359 | int Ext2Volume::Link(Ext2Node* node, Ext2Node* file, DirectoryEntry* ent){ |
| 1360 | ent->inode = file->inode; |
no test coverage detected