Base device class. More...
#include <cmsis-plus/posix-io/device.h>
Inheritance diagram for os::posix::device:Public Types | |
Types & Constants | |
| enum class | type : type_t { unknown = 0 , not_set = 1 << 0 , char_device = 1 << 1 , block_device = 1 << 2 , tty = 1 << 3 , file = 1 << 4 , socket = 1 << 5 } |
| using | type_t = unsigned int |
Public Member Functions | |
Constructors & Destructor | |
| device (device_impl &impl, type t, const char *name) | |
| virtual | ~device () override |
Public Member Functions | |
| virtual ssize_t | read (void *buf, std::size_t nbyte) |
| virtual ssize_t | write (const void *buf, std::size_t nbyte) |
| virtual ssize_t | writev (const iovec *iov, int iovcnt) |
| int | fcntl (int cmd,...) |
| virtual int | vfcntl (int cmd, std::va_list args) |
| int | isatty (void) |
| virtual int | fstat (struct stat *buf) |
| virtual off_t | lseek (off_t offset, int whence) |
| type_t | get_type (void) const |
| file_descriptor_t | file_descriptor (void) const |
| bool | is_opened (void) |
Protected Member Functions | |
Private Member Functions | |
| void | file_descriptor (file_descriptor_t fildes) |
| void | clear_file_descriptor (void) |
| io * | alloc_file_descriptor (void) |
Public Member Functions | |
| int | open (const char *path=nullptr, int oflag=0,...) |
| int | vopen (const char *path, int oflag, std::va_list args) |
| virtual int | close (void) override |
| int | ioctl (int request,...) |
| virtual int | vioctl (int request, std::va_list args) |
| virtual void | sync (void) |
| virtual bool | match_name (const char *name) const |
| const char * | name (void) const |
| device_impl & | impl (void) const |
| static const char * | device_prefix (void) |
|
inherited |
|
stronginherited |
| Enumerator | |
|---|---|
| unknown | |
| not_set | |
| char_device | |
| block_device | |
| tty | |
| file | |
| socket | |
Definition at line 126 of file io.h.
| os::posix::device::device | ( | device_impl & | impl, |
| type | t, | ||
| const char * | name | ||
| ) |
Definition at line 39 of file device.cpp.
References os::trace::printf().
|
overridevirtual |
Definition at line 48 of file device.cpp.
References os::trace::printf().
|
protectedinherited |
Definition at line 189 of file io.cpp.
References os::posix::file_descriptors_manager::allocate(), os::posix::io::clear_file_descriptor(), os::posix::io_impl::do_close(), os::posix::io::impl(), and os::trace::printf().
Referenced by os::posix::socket::accept(), os::posix::socket(), vopen(), and os::posix::file_system::vopen().
|
inlineprotectedinherited |
Definition at line 446 of file io.h.
References os::posix::no_file_descriptor.
Referenced by os::posix::io::alloc_file_descriptor().
|
overridevirtual |
Reimplemented from os::posix::io.
Reimplemented in os::posix::block_device_lockable< T, L >.
Definition at line 111 of file device.cpp.
References os::posix::io::close(), impl(), and os::trace::printf().
Referenced by os::posix::block_device_lockable< T, L >::close().
|
inlinestatic |
|
inherited |
Definition at line 363 of file io.cpp.
References os::posix::io::vfcntl().
|
inlineprotectedinherited |
|
inlineinherited |
Definition at line 452 of file io.h.
Referenced by os::posix::file_descriptors_manager::allocate(), os::posix::file_descriptors_manager::assign(), vopen(), and os::posix::vopen().
|
virtualinherited |
Reimplemented in os::posix::file_lockable< T, L >.
Definition at line 416 of file io.cpp.
References os::posix::io_impl::do_fstat(), os::posix::io::impl(), and os::trace::printf().
Referenced by os::posix::file_lockable< T, L >::fstat().
|
inlineinherited |
Definition at line 434 of file io.h.
Referenced by os::posix::file_descriptors_manager::socket().
|
inline |
| int os::posix::device::ioctl | ( | int | request, |
| ... | |||
| ) |
Definition at line 135 of file device.cpp.
References vioctl().
|
inlineinherited |
Definition at line 458 of file io.h.
References os::posix::io_impl::do_is_opened(), and os::posix::io::impl().
|
inherited |
Definition at line 406 of file io.cpp.
References os::posix::io_impl::do_isatty(), and os::posix::io::impl().
|
virtualinherited |
Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.
Definition at line 447 of file io.cpp.
References os::posix::io_impl::do_lseek(), os::posix::io::impl(), and os::trace::printf().
Referenced by os::posix::block_device_lockable< T, L >::lseek(), and os::posix::file_lockable< T, L >::lseek().
|
virtual |
Definition at line 189 of file device.cpp.
References name().
|
inline |
Definition at line 304 of file device.h.
Referenced by os::posix::device_registry< T >::link(), and match_name().
| int os::posix::device::open | ( | const char * | path = nullptr, |
| int | oflag = 0, |
||
| ... | |||
| ) |
| path | May be nullptr. |
| oflag | Output flags |
Definition at line 62 of file device.cpp.
References vopen().
|
virtualinherited |
Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.
Definition at line 217 of file io.cpp.
References os::posix::io_impl::do_read(), os::posix::io::impl(), and os::trace::printf().
Referenced by os::posix::block_device_lockable< T, L >::read(), and os::posix::file_lockable< T, L >::read().
|
virtual |
Reimplemented in os::posix::block_device_lockable< T, L >.
Definition at line 171 of file device.cpp.
References os::posix::device_impl::do_sync(), impl(), and os::trace::printf().
Referenced by os::posix::block_device_lockable< T, L >::sync().
|
virtualinherited |
Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.
Definition at line 380 of file io.cpp.
References os::posix::io_impl::do_vfcntl(), os::posix::io::impl(), and os::trace::printf().
Referenced by os::posix::io::fcntl(), os::posix::block_device_lockable< T, L >::vfcntl(), and os::posix::file_lockable< T, L >::vfcntl().
|
virtual |
Reimplemented in os::posix::block_device_partition_lockable< T, L >, os::posix::block_device, and os::posix::block_device_lockable< T, L >.
Definition at line 152 of file device.cpp.
References os::posix::device_impl::do_vioctl(), impl(), and os::trace::printf().
Referenced by ioctl().
| int os::posix::device::vopen | ( | const char * | path, |
| int | oflag, | ||
| std::va_list | args | ||
| ) |
| path | May be nullptr. |
| oflag | Output flags |
| args | Arguments |
Definition at line 74 of file device.cpp.
References os::posix::io::alloc_file_descriptor(), os::posix::device_impl::do_vopen(), os::posix::io::file_descriptor(), impl(), and os::trace::printf().
Referenced by open().
|
virtualinherited |
Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.
Definition at line 268 of file io.cpp.
References os::posix::io_impl::do_write(), os::posix::io::impl(), and os::trace::printf().
Referenced by os::posix::block_device_lockable< T, L >::write(), and os::posix::file_lockable< T, L >::write().
|
virtualinherited |
Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.
Definition at line 321 of file io.cpp.
References os::posix::io_impl::do_writev(), os::posix::io::impl(), and os::trace::printf().
Referenced by os::posix::block_device_lockable< T, L >::writev(), and os::posix::file_lockable< T, L >::writev().