Noux: add ioctl() to Vfs

File_io_channel now includes ioctl() because pseudo devices which are
implemented as a file-system, e.g. /dev/tty, are controlled via ioctl()
requests. The method is exported to the Vfs through the Vfs_io_channel
class.
This commit is contained in:
Josef Söntgen 2012-11-20 14:44:37 +01:00 committed by Norman Feske
parent c24a95b819
commit 5c413929ef
3 changed files with 12 additions and 0 deletions

View File

@ -27,6 +27,12 @@ namespace Noux {
virtual bool write(Sysio *sysio, Vfs_handle *vfs_handle) = 0;
virtual bool read(Sysio *sysio, Vfs_handle *vfs_handle) = 0;
virtual bool ftruncate(Sysio *sysio, Vfs_handle *vfs_handle) = 0;
/**
* This method is only needed in file-systems which actually implement
* a device and is therefore false by default.
*/
virtual bool ioctl(Sysio *sysio, Vfs_handle *vfs_handle) { return false; }
};
}

View File

@ -79,6 +79,7 @@ namespace Noux {
bool write(Sysio *sysio, Vfs_handle *handle) { return _msg("write"); }
bool read(Sysio *sysio, Vfs_handle *handle) { return _msg("read"); }
bool ftruncate(Sysio *sysio, Vfs_handle *handle) { return _msg("ftruncate"); }
bool ioctl(Sysio *sysio, Vfs_handle *handle) { return _msg("ioctl"); }
};
static Pseudo_file_io_service fs;
return &fs;

View File

@ -136,6 +136,11 @@ namespace Noux {
return 0;
}
bool ioctl(Sysio *sysio)
{
return _fh->fs()->ioctl(sysio, _fh);
}
bool lseek(Sysio *sysio)
{
switch (sysio->lseek_in.whence) {