20#include "Ext2Symlink.h"
21#include "pedigree/kernel/LockGuard.h"
22#include "pedigree/kernel/Log.h"
23#include "pedigree/kernel/processor/types.h"
24#include "pedigree/kernel/syscallError.h"
25#include "pedigree/kernel/utilities/utility.h"
27#include "Ext2Filesystem.h"
35 :
Symlink(name, LITTLE_TO_HOST32(inode->i_atime), LITTLE_TO_HOST32(inode->i_mtime),
36 LITTLE_TO_HOST32(inode->i_ctime), inode_num, static_cast<
Filesystem*>(pFs),
37 LITTLE_TO_HOST32(inode->i_size),
40 uint32_t mode = LITTLE_TO_HOST32(inode->i_mode);
50 if (!m_State->allocationValid || !size || location >= getSize())
52 const uint64_t remaining = getSize() - location;
56 if (isInlineSymlink()) {
57 MemoryCopy(
reinterpret_cast<void*
>(buffer), adjust_pointer(m_pInode->i_block, location), size);
62 WARNING(
"Ext2: rather large symlink found, not handled yet");
66 uintptr_t block = Ext2Node::readBlock(location);
70 MemoryCopy(
reinterpret_cast<void*
>(buffer),
reinterpret_cast<void*
>(block), size);
71 Ext2Node::unpinBlock(location);
80 SYSCALL_ERROR(FileTooLarge);
87 uintptr_t block = Ext2Node::readBlock(location);
89 SYSCALL_ERROR(IoError);
92 MemoryCopy(
reinterpret_cast<void*
>(block),
reinterpret_cast<void*
>(buffer), size);
93 Ext2Node::writeBlock(location);
94 Ext2Node::unpinBlock(location);
106 LITTLE_TO_HOST32(m_pInode->i_mtime),
107 LITTLE_TO_HOST32(m_pInode->i_ctime));
111 return inodeAttributes();
114void Ext2Symlink::updateAttributes(
const Attributes& attributes, uint32_t mask) {
115 updateInodeAttributes(attributes, mask);
bool wipe(bool allocationLockHeld=false)
bool ensureLargeEnough(size_t size, uint64_t location, uint64_t opsize, bool onlyBlocks=false, bool nozeroblocks=false)
void fileAttributeChanged(size_t size, size_t atime, size_t mtime, size_t ctime)
void fileAttributeChanged()
Ext2Symlink(const Ext2Symlink &file)
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool canBlock)
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool canBlock)
void setGidOnly(size_t gid)
void setPermissionsOnly(uint32_t perms)
void setUidOnly(size_t uid)