Skip to content

Commit e798c53

Browse files
committed
bd: Changed BlockDevice erase to default as no-op
This should help with confusion around devices that don't have a physical erase operation, such as SD cards and spinny disks.
1 parent 94fb4a3 commit e798c53

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

features/filesystem/bd/BlockDevice.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ class BlockDevice
9191
* @param size Size to erase in bytes, must be a multiple of erase block size
9292
* @return 0 on success, negative error code on failure
9393
*/
94-
virtual int erase(bd_addr_t addr, bd_size_t size) = 0;
94+
virtual int erase(bd_addr_t addr, bd_size_t size)
95+
{
96+
return 0;
97+
}
9598

9699
/** Get the size of a readable block
97100
*
@@ -111,7 +114,10 @@ class BlockDevice
111114
* @return Size of a eraseable block in bytes
112115
* @note Must be a multiple of the program size
113116
*/
114-
virtual bd_size_t get_erase_size() const = 0;
117+
virtual bd_size_t get_erase_size() const
118+
{
119+
return get_program_size();
120+
}
115121

116122
/** Get the total size of the underlying device
117123
*

0 commit comments

Comments
 (0)