µ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_lockable< T, L > Class Template Reference

#include <block-device.h>

+ Inheritance diagram for os::posix::block_device_lockable< T, L >:

Public Types

using blknum_t = std::size_t
 
using lockable_type = L
 
using value_type = T
 
Types & Constants
enum  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_lockable (const char *name, lockable_type &locker, Args &&... args)
 
virtual ~block_device_lockable () override
 
Public Member Functions
virtual int close (void) override
 
virtual ssize_t read (void *buf, std::size_t nbyte) override
 
virtual ssize_t write (const void *buf, std::size_t nbyte) override
 
virtual ssize_t writev (const struct iovec *iov, int iovcnt) override
 
virtual int vfcntl (int cmd, std::va_list args) override
 
virtual int vioctl (int request, std::va_list args) override
 
virtual off_t lseek (off_t offset, int whence) override
 
virtual ssize_t read_block (void *buf, blknum_t blknum, std::size_t nblocks=1) override
 
virtual ssize_t write_block (const void *buf, blknum_t blknum, std::size_t nblocks=1) override
 
virtual void sync (void) override
 
value_typeimpl (void) const
 
Public Member Functions
blknum_t blocks (void)
 
std::size_t block_logical_size_bytes (void)
 
std::size_t block_physical_size_bytes (void)
 
Public Member Functions
int fcntl (int cmd,...)
 
int isatty (void)
 
virtual int fstat (struct stat *buf)
 
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)
 
int ioctl (int request,...)
 
virtual bool match_name (const char *name) const
 
const char * name (void) const
 
static const char * device_prefix (void)
 

Detailed Description

template<typename T, typename L>
class os::posix::block_device_lockable< T, L >

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

Member Typedef Documentation

◆ blknum_t

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

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

◆ lockable_type

template<typename T , typename L >
using os::posix::block_device_lockable< T, L >::lockable_type = L

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

◆ type_t

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

Definition at line 132 of file io.h.

◆ value_type

template<typename T , typename L >
using os::posix::block_device_lockable< T, L >::value_type = T

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

Member Enumeration Documentation

◆ type

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

Definition at line 133 of file io.h.

Constructor & Destructor Documentation

◆ block_device_lockable()

template<typename T , typename L >
template<typename ... Args>
os::posix::block_device_lockable< T, L >::block_device_lockable ( const char *  name,
lockable_type locker,
Args &&...  args 
)

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

◆ ~block_device_lockable()

template<typename T , typename L >
os::posix::block_device_lockable< T, L >::~block_device_lockable
overridevirtual

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

Member Function Documentation

◆ alloc_file_descriptor()

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

Definition at line 201 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 470 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 476 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 464 of file block-device.h.

◆ clear_file_descriptor()

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

Definition at line 435 of file io.h.

◆ close()

template<typename T , typename L >
int os::posix::block_device_lockable< T, L >::close ( void  )
overridevirtual

Reimplemented from os::posix::device.

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

◆ device_prefix()

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

Definition at line 322 of file device.h.

◆ fcntl()

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

Definition at line 375 of file io.cpp.

◆ file_descriptor() [1/2]

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

Definition at line 429 of file io.h.

◆ file_descriptor() [2/2]

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

Definition at line 441 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 422 of file io.cpp.

◆ get_type()

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

Definition at line 423 of file io.h.

◆ impl()

template<typename T , typename L >
block_device_lockable< T, L >::value_type & os::posix::block_device_lockable< T, L >::impl ( void  ) const

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

◆ ioctl()

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

Definition at line 149 of file device.cpp.

◆ is_opened()

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

Definition at line 447 of file io.h.

◆ isatty()

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

Definition at line 412 of file io.cpp.

◆ lseek()

template<typename T , typename L >
off_t os::posix::block_device_lockable< T, L >::lseek ( off_t  offset,
int  whence 
)
overridevirtual

Reimplemented from os::posix::io.

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

◆ match_name()

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

Definition at line 197 of file device.cpp.

◆ name()

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

Definition at line 310 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 75 of file device.cpp.

◆ read()

template<typename T , typename L >
ssize_t os::posix::block_device_lockable< T, L >::read ( void *  buf,
std::size_t  nbyte 
)
overridevirtual

Reimplemented from os::posix::io.

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

◆ read_block()

template<typename T , typename L >
ssize_t os::posix::block_device_lockable< T, L >::read_block ( void *  buf,
blknum_t  blknum,
std::size_t  nblocks = 1 
)
overridevirtual

Reimplemented from os::posix::block_device.

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

◆ sync()

template<typename T , typename L >
void os::posix::block_device_lockable< T, L >::sync ( void  )
overridevirtual

Reimplemented from os::posix::device.

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

◆ vfcntl()

template<typename T , typename L >
int os::posix::block_device_lockable< T, L >::vfcntl ( int  cmd,
std::va_list  args 
)
overridevirtual

Reimplemented from os::posix::io.

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

◆ vioctl()

template<typename T , typename L >
int os::posix::block_device_lockable< T, L >::vioctl ( int  request,
std::va_list  args 
)
overridevirtual

Reimplemented from os::posix::block_device.

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

◆ 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 87 of file device.cpp.

◆ write()

template<typename T , typename L >
ssize_t os::posix::block_device_lockable< T, L >::write ( const void *  buf,
std::size_t  nbyte 
)
overridevirtual

Reimplemented from os::posix::io.

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

◆ write_block()

template<typename T , typename L >
ssize_t os::posix::block_device_lockable< T, L >::write_block ( const void *  buf,
blknum_t  blknum,
std::size_t  nblocks = 1 
)
overridevirtual

Reimplemented from os::posix::block_device.

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

◆ writev()

template<typename T , typename L >
ssize_t os::posix::block_device_lockable< T, L >::writev ( const struct iovec iov,
int  iovcnt 
)
overridevirtual

Reimplemented from os::posix::io.

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


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