Skip to content

SlicingBD: replace second constructor with default parameter #5385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions features/filesystem/bd/SlicingBlockDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down
14 changes: 3 additions & 11 deletions features/filesystem/bd/SlicingBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,17 @@
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
* @param start Start block address to map to block 0, negative addresses
* 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
*/
Expand Down