Skip to content

Commit e36cd00

Browse files
author
deepikabhavnani
committed
Move BlockDevice classes inside mbed namespace.
1 parent 546dafb commit e36cd00

27 files changed

+122
-30
lines changed

features/filesystem/FileSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "platform/FileHandle.h"
2424
#include "platform/DirHandle.h"
2525
#include "platform/FileSystemLike.h"
26-
#include "BlockDevice.h"
26+
#include "bd/BlockDevice.h"
2727

2828
namespace mbed {
2929
/** \addtogroup filesystem */

features/filesystem/bd/BlockDevice.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
#ifndef MBED_BLOCK_DEVICE_H
1818
#define MBED_BLOCK_DEVICE_H
1919

20+
#include "platform/platform.h"
2021
#include <stdint.h>
2122

23+
namespace mbed {
24+
/** \addtogroup filesystem */
25+
/** @{*/
2226

2327
/** Enum of standard error codes
2428
*
@@ -219,5 +223,7 @@ class BlockDevice
219223
}
220224
};
221225

226+
/** @}*/
227+
} // namespace mbed
222228

223229
#endif

features/filesystem/bd/BufferedBlockDevice.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <algorithm>
2121
#include <string.h>
2222

23+
namespace mbed {
24+
2325
static inline uint32_t align_down(bd_size_t val, bd_size_t size)
2426
{
2527
return val / size * size;
@@ -239,3 +241,5 @@ bd_size_t BufferedBlockDevice::size() const
239241
{
240242
return _bd->size();
241243
}
244+
245+
} // namespace mbed

features/filesystem/bd/BufferedBlockDevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
#include "BlockDevice.h"
2626

27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
2730

2831
/** Block device for allowing minimal read and program sizes (of 1) for the underlying BD,
2932
* using a buffer on the heap.
@@ -163,5 +166,7 @@ class BufferedBlockDevice : public BlockDevice {
163166

164167
};
165168

169+
/** @}*/
170+
} // namespace mbed
166171

167172
#endif

features/filesystem/bd/ChainingBlockDevice.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
*/
1616

1717
#include "ChainingBlockDevice.h"
18-
#include "mbed_critical.h"
18+
#include "platform/mbed_critical.h"
19+
#include "platform/mbed_assert.h"
1920

21+
namespace mbed {
2022

2123
ChainingBlockDevice::ChainingBlockDevice(BlockDevice **bds, size_t bd_count)
2224
: _bds(bds), _bd_count(bd_count)
@@ -249,3 +251,5 @@ bd_size_t ChainingBlockDevice::size() const
249251
{
250252
return _size;
251253
}
254+
255+
} // namespace mbed

features/filesystem/bd/ChainingBlockDevice.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
#define MBED_CHAINING_BLOCK_DEVICE_H
2424

2525
#include "BlockDevice.h"
26-
#include "mbed.h"
2726

27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
2830

2931
/** Block device for chaining multiple block devices
3032
* with the similar block sizes at sequential addresses
@@ -178,5 +180,7 @@ class ChainingBlockDevice : public BlockDevice
178180
uint32_t _init_ref_count;
179181
};
180182

183+
/** @}*/
184+
} // namespace mbed
181185

182186
#endif

features/filesystem/bd/ExhaustibleBlockDevice.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
*/
1616

1717
#include "ExhaustibleBlockDevice.h"
18-
#include "mbed.h"
19-
#include "mbed_critical.h"
18+
#include "platform/mbed_critical.h"
19+
#include "platform/mbed_assert.h"
2020

21+
namespace mbed {
2122

2223
ExhaustibleBlockDevice::ExhaustibleBlockDevice(BlockDevice *bd, uint32_t erase_cycles)
2324
: _bd(bd), _erase_array(NULL), _erase_cycles(erase_cycles), _init_ref_count(0)
@@ -141,3 +142,5 @@ bd_size_t ExhaustibleBlockDevice::size() const
141142
{
142143
return _bd->size();
143144
}
145+
146+
} // namespace mbed

features/filesystem/bd/ExhaustibleBlockDevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
#include "BlockDevice.h"
2626

27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
2730

2831
/** Heap backed block device which simulates failures
2932
*
@@ -157,5 +160,7 @@ class ExhaustibleBlockDevice : public BlockDevice
157160
uint32_t _init_ref_count;
158161
};
159162

163+
/** @}*/
164+
} // namespace mbed
160165

161166
#endif

features/filesystem/bd/FlashSimBlockDevice.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
*/
1616

1717
#include "FlashSimBlockDevice.h"
18-
#include "mbed_assert.h"
19-
#include "mbed_critical.h"
18+
#include "platform/mbed_critical.h"
19+
#include "platform/mbed_assert.h"
20+
2021
#include <algorithm>
2122
#include <stdlib.h>
2223
#include <string.h>
2324

25+
namespace mbed {
26+
2427
static const bd_size_t min_blank_buf_size = 32;
2528

2629
static inline uint32_t align_up(bd_size_t val, bd_size_t size)
@@ -160,3 +163,5 @@ int FlashSimBlockDevice::get_erase_value() const
160163
{
161164
return _erase_value;
162165
}
166+
167+
} // namespace mbed

features/filesystem/bd/FlashSimBlockDevice.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424

2525
#include "BlockDevice.h"
2626

27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
30+
2731
enum {
2832
BD_ERROR_NOT_ERASED = -3201,
2933
};
@@ -138,4 +142,7 @@ class FlashSimBlockDevice : public BlockDevice {
138142
uint32_t _init_ref_count;
139143
};
140144

145+
/** @}*/
146+
} // namespace mbed
147+
141148
#endif

features/filesystem/bd/HeapBlockDevice.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
*/
1616

1717
#include "HeapBlockDevice.h"
18-
#include "mbed_critical.h"
18+
#include "platform/mbed_critical.h"
19+
#include "platform/mbed_assert.h"
20+
#include <stdlib.h>
1921

22+
namespace mbed {
2023

2124
HeapBlockDevice::HeapBlockDevice(bd_size_t size, bd_size_t block)
2225
: _read_size(block), _program_size(block), _erase_size(block)
@@ -166,3 +169,4 @@ int HeapBlockDevice::erase(bd_addr_t addr, bd_size_t size)
166169
return 0;
167170
}
168171

172+
} // namespace mbed

features/filesystem/bd/HeapBlockDevice.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
#define MBED_MEM_BLOCK_DEVICE_H
2424

2525
#include "BlockDevice.h"
26-
#include "mbed.h"
26+
27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
30+
2731

2832

2933
/** Lazily allocated heap-backed block device
@@ -153,5 +157,7 @@ class HeapBlockDevice : public BlockDevice
153157
uint32_t _init_ref_count;
154158
};
155159

160+
/** @}*/
161+
} // namespace mbed
156162

157163
#endif

features/filesystem/bd/MBRBlockDevice.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
*/
1616

1717
#include "MBRBlockDevice.h"
18-
#include "mbed_critical.h"
18+
#include "platform/mbed_critical.h"
19+
#include "platform/mbed_assert.h"
1920
#include <algorithm>
2021

22+
namespace mbed {
2123

2224
// On disk structures, all entries are little endian
2325
MBED_PACKED(struct) mbr_entry {
@@ -340,3 +342,5 @@ int MBRBlockDevice::get_partition_number() const
340342
{
341343
return _part;
342344
}
345+
346+
} // namespace mbed

features/filesystem/bd/MBRBlockDevice.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
#define MBED_MBR_BLOCK_DEVICE_H
2424

2525
#include "BlockDevice.h"
26-
#include "mbed.h"
2726

27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
2830

2931
/** Additional error codes used for MBR records
3032
*/
@@ -255,5 +257,7 @@ class MBRBlockDevice : public BlockDevice
255257
uint32_t _init_ref_count;
256258
};
257259

260+
/** @}*/
261+
} // namespace mbed
258262

259263
#endif

features/filesystem/bd/ObservingBlockDevice.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
#include "ObservingBlockDevice.h"
2424
#include "ReadOnlyBlockDevice.h"
25-
#include "mbed.h"
2625

26+
namespace mbed {
2727

2828
ObservingBlockDevice::ObservingBlockDevice(BlockDevice *bd)
2929
: _bd(bd)
@@ -110,3 +110,5 @@ bd_size_t ObservingBlockDevice::size() const
110110
{
111111
return _bd->size();
112112
}
113+
114+
} // namespace mbed

features/filesystem/bd/ObservingBlockDevice.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "PlatformMutex.h"
2727
#include "Callback.h"
2828

29+
namespace mbed {
30+
/** \addtogroup filesystem */
31+
/** @{*/
2932

3033
class ObservingBlockDevice : public BlockDevice
3134
{
@@ -141,6 +144,7 @@ class ObservingBlockDevice : public BlockDevice
141144
mbed::Callback<void(BlockDevice *)> _change;
142145
};
143146

144-
147+
/** @}*/
148+
} // namespace mbed
145149

146150
#endif

features/filesystem/bd/ProfilingBlockDevice.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "ProfilingBlockDevice.h"
1818

19+
namespace mbed {
1920

2021
ProfilingBlockDevice::ProfilingBlockDevice(BlockDevice *bd)
2122
: _bd(bd)
@@ -118,3 +119,5 @@ bd_size_t ProfilingBlockDevice::get_erase_count() const
118119
{
119120
return _erase_count;
120121
}
122+
123+
} // namespace mbed

features/filesystem/bd/ProfilingBlockDevice.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
#define MBED_PROFILING_BLOCK_DEVICE_H
2424

2525
#include "BlockDevice.h"
26-
#include "mbed.h"
2726

27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
2830

2931
/** Block device for measuring storage operations of another block device
3032
*
@@ -182,5 +184,7 @@ class ProfilingBlockDevice : public BlockDevice
182184
bd_size_t _erase_count;
183185
};
184186

187+
/** @}*/
188+
} // namespace mbed
185189

186190
#endif

features/filesystem/bd/ReadOnlyBlockDevice.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
*/
2222

2323
#include "ReadOnlyBlockDevice.h"
24-
#include "mbed_error.h"
24+
#include "platform/mbed_error.h"
2525

26+
namespace mbed {
2627

2728
ReadOnlyBlockDevice::ReadOnlyBlockDevice(BlockDevice *bd)
2829
: _bd(bd)
@@ -96,3 +97,5 @@ bd_size_t ReadOnlyBlockDevice::size() const
9697
{
9798
return _bd->size();
9899
}
100+
101+
} // namespace mbed

features/filesystem/bd/ReadOnlyBlockDevice.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include "BlockDevice.h"
2626
#include "PlatformMutex.h"
2727

28+
namespace mbed {
29+
/** \addtogroup filesystem */
30+
/** @{*/
2831

2932
class ReadOnlyBlockDevice : public BlockDevice
3033
{
@@ -133,6 +136,7 @@ class ReadOnlyBlockDevice : public BlockDevice
133136
BlockDevice *_bd;
134137
};
135138

136-
139+
/** @}*/
140+
} // namespace mbed
137141

138142
#endif

features/filesystem/bd/SlicingBlockDevice.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616

1717
#include "SlicingBlockDevice.h"
18+
#include "platform/mbed_assert.h"
1819

20+
namespace mbed {
1921

2022
SlicingBlockDevice::SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t stop)
2123
: _bd(bd)
@@ -116,3 +118,5 @@ bd_size_t SlicingBlockDevice::size() const
116118
{
117119
return _stop - _start;
118120
}
121+
122+
} // namespace mbed

features/filesystem/bd/SlicingBlockDevice.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
#define MBED_SLICING_BLOCK_DEVICE_H
2424

2525
#include "BlockDevice.h"
26-
#include "mbed.h"
26+
27+
namespace mbed {
28+
/** \addtogroup filesystem */
29+
/** @{*/
2730

2831

2932
/** Block device for mapping to a slice of another block device
@@ -167,5 +170,7 @@ class SlicingBlockDevice : public BlockDevice
167170
bd_size_t _stop;
168171
};
169172

173+
/** @}*/
174+
} // namespace mbed
170175

171176
#endif

0 commit comments

Comments
 (0)