28#ifndef CMSIS_PLUS_POSIX_IO_BLOCK_DEVICE_PARTITION_H_
29#define CMSIS_PLUS_POSIX_IO_BLOCK_DEVICE_PARTITION_H_
33#if defined(__cplusplus)
37#if defined(OS_USE_OS_APP_CONFIG_H)
38#include <cmsis-plus/os-app-config.h>
45#pragma GCC diagnostic push
48#pragma clang diagnostic ignored "-Wc++98-compat"
59 class block_device_partition_impl;
128#pragma GCC diagnostic push
129#pragma GCC diagnostic ignored "-Wpadded"
180 do_vioctl (
int request, std::va_list args)
override;
183 do_vopen (
const char* path,
int oflag, std::va_list args)
override;
216 blknum_t partition_offset_blocks_ = 0;
223#pragma GCC diagnostic pop
227 template<
typename T = block_device_partition_impl>
245 template<
typename ... Args>
309 template<
typename T,
typename L>
328 template<
typename ... Args>
366 vioctl (
int request, std::va_list args)
override;
405#pragma GCC diagnostic push
406#if defined(__clang__)
407#pragma clang diagnostic ignored "-Wweak-template-vtables"
409#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
415#pragma GCC diagnostic pop
429 inline block_device_partition_impl&
438 template<
typename ... Args>
440 const char* name,
block_device& parent, Args&&... args) :
442 { impl_instance_,
name },
444 { parent, std::forward<Args>(args)... }
446#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
448 "block_device_partition_implementable::%s(\"%s\")=@%p\n",
449 __func__, name_,
this);
456#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
457 trace::printf (
"block_device_partition_implementable::%s() @%p %s\n",
458 __func__,
this, name_);
471 template<
typename T,
typename L>
472 template<
typename ... Args>
477 { impl_instance_,
name },
479 { parent, std::forward<Args>(args)... },
482#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
483 trace::printf (
"block_device_partition_lockable::%s(\"%s\")=@%p\n",
484 __func__, name_,
this);
489 template<
typename T,
typename L>
492#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
493 trace::printf (
"block_device_partition_lockable::%s() @%p %s\n",
494 __func__,
this, name_);
500 template<
typename T,
typename L>
505#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
506 trace::printf (
"block_device_partition_lockable::%s(%d) @%p\n",
507 __func__, request,
this);
510 std::lock_guard<L> lock
516 template<
typename T,
typename L>
522#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
523 trace::printf (
"block_device_partition_lockable::%s(%p, %u, %u) @%p\n",
524 __func__, buf, blknum, nblocks,
this);
527 std::lock_guard<L> lock
533 template<
typename T,
typename L>
539#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
540 trace::printf (
"block_device_partition_lockable::%s(%p, %u, %u) @%p\n",
541 __func__, buf, blknum, nblocks,
this);
544 std::lock_guard<L> lock
550 template<
typename T,
typename L>
561#pragma GCC diagnostic pop
block_device::blknum_t blknum_t
virtual int do_vopen(const char *path, int oflag, std::va_list args) override
virtual int do_close(void) override
virtual ~block_device_partition_impl() override
virtual void do_sync(void) override
friend block_device_partition
virtual int do_vioctl(int request, std::va_list args) override
virtual ssize_t do_write_block(const void *buf, blknum_t blknum, std::size_t nblocks) override
void configure(blknum_t offset, blknum_t nblocks)
virtual ssize_t do_read_block(void *buf, blknum_t blknum, std::size_t nblocks) override
block_device_partition_implementable(const char *name, block_device &parent, Args &&... args)
virtual ~block_device_partition_implementable() override
value_type & impl(void) const
virtual ssize_t read_block(void *buf, blknum_t blknum, std::size_t nblocks=1) override
block_device_partition_lockable(const char *name, block_device &parent, lockable_type &locker, Args &&... args)
virtual ssize_t write_block(const void *buf, blknum_t blknum, std::size_t nblocks=1) override
virtual ~block_device_partition_lockable() override
virtual int vioctl(int request, std::va_list args) override
value_type & impl(void) const
Block device partition class.
block_device_partition_impl & impl(void) const
virtual ~block_device_partition() override
void configure(blknum_t offset, blknum_t nblocks)
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)
const char * name(void) const
int printf(const char *format,...)
Write a formatted string to the trace device.