Skip to content

Commit 84e3110

Browse files
committed
Replace second SlicingBD ctor with default arg
Replace second ctor in SlicingBlockDevice with default parameter for the end address in first ctor
1 parent 1566395 commit 84e3110

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

features/filesystem/bd/SlicingBlockDevice.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,6 @@
1717
#include "SlicingBlockDevice.h"
1818

1919

20-
SlicingBlockDevice::SlicingBlockDevice(BlockDevice *bd, bd_addr_t start)
21-
: _bd(bd)
22-
, _start_from_end(false), _start(start)
23-
, _stop_from_end(true), _stop(0)
24-
{
25-
if ((int64_t)_start < 0) {
26-
_start_from_end = true;
27-
_start = -_start;
28-
}
29-
}
30-
3120
SlicingBlockDevice::SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t stop)
3221
: _bd(bd)
3322
, _start_from_end(false), _start(start)
@@ -38,7 +27,7 @@ SlicingBlockDevice::SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr
3827
_start = -_start;
3928
}
4029

41-
if ((int64_t)_stop < 0) {
30+
if ((int64_t)_stop <= 0) {
4231
_stop_from_end = true;
4332
_stop = -_stop;
4433
}

features/filesystem/bd/SlicingBlockDevice.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,17 @@
4949
class SlicingBlockDevice : public BlockDevice
5050
{
5151
public:
52-
/** Lifetime of the memory block device
53-
*
54-
* @param bd Block device to back the SlicingBlockDevice
55-
* @param start Start block address to map to block 0, negative addresses
56-
* are calculated from the end of the underlying block device
57-
* @note This is the same as SlicingBlockDevice(bd, start, bd->size())
58-
*/
59-
SlicingBlockDevice(BlockDevice *bd, bd_addr_t start);
60-
6152
/** Lifetime of the memory block device
6253
*
6354
* @param bd Block device to back the SlicingBlockDevice
6455
* @param start Start block address to map to block 0, negative addresses
6556
* are calculated from the end of the underlying block device
6657
* @param end End block address to mark the end of the block device,
6758
* this block is not mapped, negative addresses are
68-
* calculated from the end of the underlying block device
59+
* calculated from the end of the underlying block device.
60+
* The default stops at end of the underlying block device.
6961
*/
70-
SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t end);
62+
SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t end = 0);
7163

7264
/** Lifetime of a block device
7365
*/

0 commit comments

Comments
 (0)