From 5c413929ef458e51449dc7f077e33c9509e67f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Tue, 20 Nov 2012 14:44:37 +0100 Subject: [PATCH] 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. --- ports/src/noux/file_io_service.h | 6 ++++++ ports/src/noux/vfs_handle.h | 1 + ports/src/noux/vfs_io_channel.h | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/ports/src/noux/file_io_service.h b/ports/src/noux/file_io_service.h index 2147c2260c..17e833c44a 100644 --- a/ports/src/noux/file_io_service.h +++ b/ports/src/noux/file_io_service.h @@ -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; } }; } diff --git a/ports/src/noux/vfs_handle.h b/ports/src/noux/vfs_handle.h index 0c655291f0..594925141d 100644 --- a/ports/src/noux/vfs_handle.h +++ b/ports/src/noux/vfs_handle.h @@ -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; diff --git a/ports/src/noux/vfs_io_channel.h b/ports/src/noux/vfs_io_channel.h index 1161b1820c..0bc40fc86e 100644 --- a/ports/src/noux/vfs_io_channel.h +++ b/ports/src/noux/vfs_io_channel.h @@ -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) {