13#ifndef CMSIS_PLUS_POSIX_IO_BLOCK_DEVICE_PARTITION_H_
14#define CMSIS_PLUS_POSIX_IO_BLOCK_DEVICE_PARTITION_H_
18#if defined(__cplusplus)
22#if defined(OS_USE_OS_APP_CONFIG_H)
23#include <cmsis-plus/os-app-config.h>
30#pragma GCC diagnostic push
32#pragma clang diagnostic ignored "-Wc++98-compat"
43 class block_device_partition_impl;
112#pragma GCC diagnostic push
113#if defined(__clang__)
114#pragma clang diagnostic ignored "-Wpadded"
115#elif defined(__GNUC__)
116#pragma GCC diagnostic ignored "-Wpadded"
168 do_vioctl (
int request, std::va_list args)
override;
171 do_vopen (
const char* path,
int oflag, std::va_list args)
override;
204 blknum_t partition_offset_blocks_ = 0;
211#pragma GCC diagnostic pop
215 template<
typename T = block_device_partition_impl>
233 template<
typename ... Args>
297 template<
typename T,
typename L>
316 template<
typename ... Args>
354 vioctl (
int request, std::va_list args)
override;
393#pragma GCC diagnostic push
394#if defined(__clang__)
395#pragma clang diagnostic ignored "-Wweak-template-vtables"
397#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
403#pragma GCC diagnostic pop
417 inline block_device_partition_impl&
426 template<
typename ... Args>
428 const char* name,
block_device& parent, Args&&... args) :
430 { impl_instance_,
name },
432 { parent, std::forward<Args>(args)... }
434#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
436 "block_device_partition_implementable::%s(\"%s\")=@%p\n",
437 __func__, name_,
this);
444#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
445 trace::printf (
"block_device_partition_implementable::%s() @%p %s\n",
446 __func__,
this, name_);
459 template<
typename T,
typename L>
460 template<
typename ... Args>
465 { impl_instance_,
name },
467 { parent, std::forward<Args>(args)... },
470#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
471 trace::printf (
"block_device_partition_lockable::%s(\"%s\")=@%p\n",
472 __func__, name_,
this);
477 template<
typename T,
typename L>
480#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
481 trace::printf (
"block_device_partition_lockable::%s() @%p %s\n",
482 __func__,
this, name_);
488 template<
typename T,
typename L>
493#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
494 trace::printf (
"block_device_partition_lockable::%s(%d) @%p\n",
495 __func__, request,
this);
498 std::lock_guard<L> lock
504 template<
typename T,
typename L>
510#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
511 trace::printf (
"block_device_partition_lockable::%s(%p, %u, %u) @%p\n",
512 __func__, buf, blknum, nblocks,
this);
515 std::lock_guard<L> lock
521 template<
typename T,
typename L>
527#if defined(OS_TRACE_POSIX_IO_BLOCK_DEVICE_PARTITION)
528 trace::printf (
"block_device_partition_lockable::%s(%p, %u, %u) @%p\n",
529 __func__, buf, blknum, nblocks,
this);
532 std::lock_guard<L> lock
538 template<
typename T,
typename L>
549#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.