µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::posix::block_device_implementable< T > Class Template Reference

#include <block-device.h>

+ Inheritance diagram for os::posix::block_device_implementable< T >:

Public Types

using blknum_t = std::size_t
 
using value_type = T
 
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
template<typename ... Args>
 block_device_implementable (const char *name, Args &&... args)
 
virtual ~block_device_implementable () override
 
Public Member Functions
value_typeimpl (void) const
 
Public Member Functions
virtual int vioctl (int request, std::va_list args) override
 
virtual ssize_t read_block (void *buf, blknum_t blknum, std::size_t nblocks=1)
 
virtual ssize_t write_block (const void *buf, blknum_t blknum, std::size_t nblocks=1)
 
blknum_t blocks (void)
 
std::size_t block_logical_size_bytes (void)
 
std::size_t block_physical_size_bytes (void)
 
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)
 
ioalloc_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 void sync (void)
 
virtual bool match_name (const char *name) const
 
const char * name (void) const
 
static const char * device_prefix (void)
 

Detailed Description

template<typename T>
class os::posix::block_device_implementable< T >

Definition at line 263 of file block-device.h.

Member Typedef Documentation

◆ blknum_t

using os::posix::block_device::blknum_t = std::size_t
inherited

Definition at line 67 of file block-device.h.

◆ type_t

using os::posix::io::type_t = unsigned int
inherited

Definition at line 127 of file io.h.

◆ value_type

template<typename T >
using os::posix::block_device_implementable< T >::value_type = T

Definition at line 269 of file block-device.h.

Member Enumeration Documentation

◆ type

enum class os::posix::io::type : type_t
stronginherited
Enumerator
unknown 
not_set 
char_device 
block_device 
tty 
file 
socket 

Definition at line 128 of file io.h.

Constructor & Destructor Documentation

◆ block_device_implementable()

template<typename T >
template<typename ... Args>
os::posix::block_device_implementable< T >::block_device_implementable ( const char *  name,
Args &&...  args 
)

Definition at line 493 of file block-device.h.

◆ ~block_device_implementable()

template<typename T >
os::posix::block_device_implementable< T >::~block_device_implementable
overridevirtual

Definition at line 512 of file block-device.h.

Member Function Documentation

◆ alloc_file_descriptor()

io * os::posix::io::alloc_file_descriptor ( void  )
protectedinherited

Definition at line 190 of file io.cpp.

◆ block_logical_size_bytes()

std::size_t os::posix::block_device::block_logical_size_bytes ( void  )
inlineinherited
Returns
The number of bytes in a block.

Definition at line 472 of file block-device.h.

◆ block_physical_size_bytes()

std::size_t os::posix::block_device::block_physical_size_bytes ( void  )
inlineinherited

Definition at line 478 of file block-device.h.

◆ blocks()

block_device::blknum_t os::posix::block_device::blocks ( void  )
inlineinherited
Returns
The number of blocks.

Definition at line 466 of file block-device.h.

◆ clear_file_descriptor()

void os::posix::io::clear_file_descriptor ( void  )
inlineprotectedinherited

Definition at line 450 of file io.h.

◆ close()

int os::posix::device::close ( void  )
overridevirtualinherited

Reimplemented from os::posix::io.

Reimplemented in os::posix::block_device_lockable< T, L >.

Definition at line 114 of file device.cpp.

◆ device_prefix()

const char * os::posix::device::device_prefix ( void  )
inlinestaticinherited

Definition at line 319 of file device.h.

◆ fcntl()

int os::posix::io::fcntl ( int  cmd,
  ... 
)
inherited

Definition at line 364 of file io.cpp.

◆ file_descriptor() [1/2]

void os::posix::io::file_descriptor ( file_descriptor_t  fildes)
inlineprotectedinherited

Definition at line 444 of file io.h.

◆ file_descriptor() [2/2]

file_descriptor_t os::posix::io::file_descriptor ( void  ) const
inlineinherited

Definition at line 456 of file io.h.

◆ fstat()

int os::posix::io::fstat ( struct stat buf)
virtualinherited

Reimplemented in os::posix::file_lockable< T, L >.

Definition at line 417 of file io.cpp.

◆ get_type()

io::type_t os::posix::io::get_type ( void  ) const
inlineinherited

Definition at line 438 of file io.h.

◆ impl()

template<typename T >
block_device_implementable< T >::value_type & os::posix::block_device_implementable< T >::impl ( void  ) const

Definition at line 523 of file block-device.h.

◆ ioctl()

int os::posix::device::ioctl ( int  request,
  ... 
)
inherited

Definition at line 138 of file device.cpp.

◆ is_opened()

bool os::posix::io::is_opened ( void  )
inlineinherited

Definition at line 462 of file io.h.

◆ isatty()

int os::posix::io::isatty ( void  )
inherited

Definition at line 407 of file io.cpp.

◆ lseek()

off_t os::posix::io::lseek ( off_t  offset,
int  whence 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 448 of file io.cpp.

◆ match_name()

bool os::posix::device::match_name ( const char *  name) const
virtualinherited

Definition at line 192 of file device.cpp.

◆ name()

const char * os::posix::device::name ( void  ) const
inlineinherited

Definition at line 307 of file device.h.

◆ open()

int os::posix::device::open ( const char *  path = nullptr,
int  oflag = 0,
  ... 
)
inherited
Parameters
pathMay be nullptr.
oflagOutput flags
Returns
non-negative file descriptor, -1 on failure

Definition at line 64 of file device.cpp.

◆ read()

ssize_t os::posix::io::read ( void *  buf,
std::size_t  nbyte 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 218 of file io.cpp.

◆ read_block()

ssize_t os::posix::block_device::read_block ( void *  buf,
blknum_t  blknum,
std::size_t  nblocks = 1 
)
virtualinherited

◆ sync()

void os::posix::device::sync ( void  )
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >.

Definition at line 174 of file device.cpp.

◆ vfcntl()

int os::posix::io::vfcntl ( int  cmd,
std::va_list  args 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 381 of file io.cpp.

◆ vioctl()

int os::posix::block_device::vioctl ( int  request,
std::va_list  args 
)
overridevirtualinherited

◆ vopen()

int os::posix::device::vopen ( const char *  path,
int  oflag,
std::va_list  args 
)
inherited
Parameters
pathMay be nullptr.
oflagOutput flags
argsArguments
Returns
non-negative file descriptor, -1 on failure

Definition at line 76 of file device.cpp.

◆ write()

ssize_t os::posix::io::write ( const void *  buf,
std::size_t  nbyte 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 269 of file io.cpp.

◆ write_block()

ssize_t os::posix::block_device::write_block ( const void *  buf,
blknum_t  blknum,
std::size_t  nblocks = 1 
)
virtualinherited

◆ writev()

ssize_t os::posix::io::writev ( const iovec iov,
int  iovcnt 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 322 of file io.cpp.


The documentation for this class was generated from the following file: