diff --git a/features/filesystem/bd/BlockDevice.h b/features/filesystem/bd/BlockDevice.h index 5a0a283f8d..a45dfee298 100644 --- a/features/filesystem/bd/BlockDevice.h +++ b/features/filesystem/bd/BlockDevice.h @@ -117,7 +117,7 @@ public: * * @return Size of the underlying device in bytes */ - virtual bd_size_t size() = 0; + virtual bd_size_t size() const = 0; /** Convenience function for checking block read validity * @@ -125,7 +125,7 @@ public: * @param size Size to read in bytes * @return True if read is valid for underlying block device */ - bool is_valid_read(bd_addr_t addr, bd_size_t size) + bool is_valid_read(bd_addr_t addr, bd_size_t size) const { return ( addr % get_read_size() == 0 && @@ -139,7 +139,7 @@ public: * @param size Size to write in bytes * @return True if program is valid for underlying block device */ - bool is_valid_program(bd_addr_t addr, bd_size_t size) + bool is_valid_program(bd_addr_t addr, bd_size_t size) const { return ( addr % get_program_size() == 0 && @@ -153,7 +153,7 @@ public: * @param size Size to erase in bytes * @return True if erase is valid for underlying block device */ - bool is_valid_erase(bd_addr_t addr, bd_size_t size) + bool is_valid_erase(bd_addr_t addr, bd_size_t size) const { return ( addr % get_erase_size() == 0 && diff --git a/features/filesystem/bd/ChainingBlockDevice.cpp b/features/filesystem/bd/ChainingBlockDevice.cpp index 76f8214c3f..9dcfbae562 100644 --- a/features/filesystem/bd/ChainingBlockDevice.cpp +++ b/features/filesystem/bd/ChainingBlockDevice.cpp @@ -190,7 +190,7 @@ bd_size_t ChainingBlockDevice::get_erase_size() const return _erase_size; } -bd_size_t ChainingBlockDevice::size() +bd_size_t ChainingBlockDevice::size() const { return _size; } diff --git a/features/filesystem/bd/ChainingBlockDevice.h b/features/filesystem/bd/ChainingBlockDevice.h index 6b0e394c15..9547c4f701 100644 --- a/features/filesystem/bd/ChainingBlockDevice.h +++ b/features/filesystem/bd/ChainingBlockDevice.h @@ -140,7 +140,7 @@ public: * * @return Size of the underlying device in bytes */ - virtual bd_size_t size(); + virtual bd_size_t size() const; protected: BlockDevice **_bds; diff --git a/features/filesystem/bd/HeapBlockDevice.cpp b/features/filesystem/bd/HeapBlockDevice.cpp index b05e3ead8b..9d95d18b89 100644 --- a/features/filesystem/bd/HeapBlockDevice.cpp +++ b/features/filesystem/bd/HeapBlockDevice.cpp @@ -77,7 +77,7 @@ bd_size_t HeapBlockDevice::get_erase_size() const return _erase_size; } -bd_size_t HeapBlockDevice::size() +bd_size_t HeapBlockDevice::size() const { return _count * _erase_size; } diff --git a/features/filesystem/bd/HeapBlockDevice.h b/features/filesystem/bd/HeapBlockDevice.h index 53e17f406d..9144319383 100644 --- a/features/filesystem/bd/HeapBlockDevice.h +++ b/features/filesystem/bd/HeapBlockDevice.h @@ -119,7 +119,7 @@ public: * * @return Size of the underlying device in bytes */ - virtual bd_size_t size(); + virtual bd_size_t size() const; private: bd_size_t _read_size; diff --git a/features/filesystem/bd/SlicingBlockDevice.cpp b/features/filesystem/bd/SlicingBlockDevice.cpp index d0f2888464..f7b3482d06 100644 --- a/features/filesystem/bd/SlicingBlockDevice.cpp +++ b/features/filesystem/bd/SlicingBlockDevice.cpp @@ -108,7 +108,7 @@ bd_size_t SlicingBlockDevice::get_erase_size() const return _bd->get_erase_size(); } -bd_size_t SlicingBlockDevice::size() +bd_size_t SlicingBlockDevice::size() const { return _stop - _start; } diff --git a/features/filesystem/bd/SlicingBlockDevice.h b/features/filesystem/bd/SlicingBlockDevice.h index 2904d68c72..74103dabcd 100644 --- a/features/filesystem/bd/SlicingBlockDevice.h +++ b/features/filesystem/bd/SlicingBlockDevice.h @@ -138,7 +138,7 @@ public: * * @return Size of the underlying device in bytes */ - virtual bd_size_t size(); + virtual bd_size_t size() const; protected: BlockDevice *_bd;