int ioctl(int handle, int command, void *buffer) { FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD)); if (descriptor == 0) return E_BAD_HANDLE; int ret = descriptor->Control(command, buffer); descriptor->ReleaseRef(); return ret; }
int rewinddir(int handle) { FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD)); if (descriptor == 0) return E_BAD_HANDLE; int ret = descriptor->RewindDir(); descriptor->ReleaseRef(); return ret; }
off_t lseek(int handle, off_t offs, int whence) { FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD)); if (descriptor == 0) return E_BAD_HANDLE; off_t ret = descriptor->Seek(offs, whence); descriptor->ReleaseRef(); return ret; }
ssize_t write_pos(int handle, off_t offs, const void *in, size_t length) { FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD)); if (descriptor == 0) return E_BAD_HANDLE; size_t ret = descriptor->WriteAt(offs, in, length); descriptor->ReleaseRef(); return ret; }
ssize_t read_pos(int handle, off_t offs, void *out, size_t length) { FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD)); if (descriptor == 0) return E_BAD_HANDLE; ssize_t err = descriptor->ReadAt(offs, out, length); descriptor->ReleaseRef(); return err; }
ssize_t write(int handle, const void *in, size_t length) { FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD)); if (descriptor == 0) return E_BAD_HANDLE; ssize_t err = descriptor->Write(in, length); descriptor->ReleaseRef(); return err; }
status_t readdir(int handle, char out_path[], size_t length) { FileDescriptor *descriptor = static_cast<FileDescriptor*>(GetResource(handle, OBJ_FD)); if (descriptor == 0) return E_BAD_HANDLE; status_t ret = descriptor->ReadDir(out_path, length); descriptor->ReleaseRef(); return ret; }