Replace second SlicingBD ctor with default arg

Replace second ctor in SlicingBlockDevice with default parameter for the end address in first ctor
pull/5385/head
Kevin Gilbert 2017-10-25 13:55:39 -05:00
parent 1566395323
commit 84e3110b6f
2 changed files with 4 additions and 23 deletions

View File

@ -17,17 +17,6 @@
#include "SlicingBlockDevice.h"
SlicingBlockDevice::SlicingBlockDevice(BlockDevice *bd, bd_addr_t start)
: _bd(bd)
, _start_from_end(false), _start(start)
, _stop_from_end(true), _stop(0)
{
if ((int64_t)_start < 0) {
_start_from_end = true;
_start = -_start;
}
}
SlicingBlockDevice::SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t stop)
: _bd(bd)
, _start_from_end(false), _start(start)
@ -38,7 +27,7 @@ SlicingBlockDevice::SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr
_start = -_start;
}
if ((int64_t)_stop < 0) {
if ((int64_t)_stop <= 0) {
_stop_from_end = true;
_stop = -_stop;
}

View File

@ -49,15 +49,6 @@
class SlicingBlockDevice : public BlockDevice
{
public:
/** Lifetime of the memory block device
*
* @param bd Block device to back the SlicingBlockDevice
* @param start Start block address to map to block 0, negative addresses
* are calculated from the end of the underlying block device
* @note This is the same as SlicingBlockDevice(bd, start, bd->size())
*/
SlicingBlockDevice(BlockDevice *bd, bd_addr_t start);
/** Lifetime of the memory block device
*
* @param bd Block device to back the SlicingBlockDevice
@ -65,9 +56,10 @@ public:
* are calculated from the end of the underlying block device
* @param end End block address to mark the end of the block device,
* this block is not mapped, negative addresses are
* calculated from the end of the underlying block device
* calculated from the end of the underlying block device.
* The default stops at end of the underlying block device.
*/
SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t end);
SlicingBlockDevice(BlockDevice *bd, bd_addr_t start, bd_addr_t end = 0);
/** Lifetime of a block device
*/