diff --git a/rpcsx/io-device.cpp b/rpcsx/io-device.cpp index 1c4eb9391..adbd34ea7 100644 --- a/rpcsx/io-device.cpp +++ b/rpcsx/io-device.cpp @@ -30,7 +30,6 @@ struct HostFile : orbis::File { bool closeOnExit = true; - bool alignTruncate = false; ~HostFile() { if (hostFd > 0 && closeOnExit) { @@ -438,12 +437,10 @@ static orbis::ErrorCode host_truncate(orbis::File *file, std::uint64_t len, return orbis::ErrorCode::ISDIR; } - if (hostFile->alignTruncate) { - len = rx::alignUp(len, vm::kPageSize); - } - if (::ftruncate(hostFile->hostFd, len)) { - return convertErrno(); + auto result = convertErrno(); + ORBIS_LOG_ERROR("host_truncate", hostFile->hostFd, len); + return result; } return {}; @@ -937,13 +934,11 @@ orbis::ErrorCode HostFsDevice::rename(const char *from, const char *to, return convertErrorCode(ec); } -orbis::File *createHostFile(int hostFd, orbis::Ref device, - bool alignTruncate) { +orbis::File *createHostFile(int hostFd, orbis::Ref device) { auto newFile = orbis::knew(); newFile->hostFd = hostFd; newFile->ops = &hostOps; - newFile->device = device; - newFile->alignTruncate = alignTruncate; + newFile->device = std::move(device); return newFile; } diff --git a/rpcsx/io-device.hpp b/rpcsx/io-device.hpp index 26f6937e9..567e30017 100644 --- a/rpcsx/io-device.hpp +++ b/rpcsx/io-device.hpp @@ -74,5 +74,5 @@ IoDevice *createHostIoDevice(orbis::kstring hostPath, orbis::kstring virtualPath orbis::Ref wrapSocket(int hostFd, orbis::kstring name, int dom, int type, int prot); orbis::ErrorCode createSocket(orbis::Ref *file, orbis::kstring name, int dom, int type, int prot); -orbis::File *createHostFile(int hostFd, orbis::Ref device, bool alignTruncate = false); +orbis::File *createHostFile(int hostFd, orbis::Ref device); IoDevice *createFdWrapDevice(int fd); diff --git a/rpcsx/iodev/shm.cpp b/rpcsx/iodev/shm.cpp index ba02cfa34..0d7be91f7 100644 --- a/rpcsx/iodev/shm.cpp +++ b/rpcsx/iodev/shm.cpp @@ -35,7 +35,7 @@ orbis::ErrorCode ShmDevice::open(orbis::Ref *file, return convertErrno(); } - auto hostFile = createHostFile(fd, this, true); + auto hostFile = createHostFile(fd, this); *file = hostFile; return {}; }