nvme: modernize std::shared_ptr and boost calls Change-Id: I3fcb34a629873fd05bd27942416ee6700db5d97b Signed-off-by: Ramon Rakow <rakow@google.com>
diff --git a/src/NVMeController.cpp b/src/NVMeController.cpp index 61c4029..3befc25 100644 --- a/src/NVMeController.cpp +++ b/src/NVMeController.cpp
@@ -261,45 +261,43 @@ ControllerLogPageMetric<NVME_LOG_LID_TELEMETRY_HOST, SchedulerClockType>; - // NOLINTBEGIN(modernize-make-shared) - auto identify = std::shared_ptr<IdentifyMetric>(new IdentifyMetric( + auto identify = std::make_shared<IdentifyMetric>( this->shared_from_this(), scheduler, // Metigate solution before Knuckle FW fix for b/404610159 - std::chrono::seconds(60))); + std::chrono::seconds(60)); - auto errorInfo = std::shared_ptr<ErrorInfoMetric>(new ErrorInfoMetric( + auto errorInfo = std::make_shared<ErrorInfoMetric>( this->weak_from_this(), scheduler, // TODO: configurable interval std::chrono::duration_cast<SchedulerClockType::duration>( - std::chrono::seconds(60)))); + std::chrono::seconds(60))); - auto smart = std::shared_ptr<SMARTMetric>(new SMARTMetric( + auto smart = std::make_shared<SMARTMetric>( this->weak_from_this(), scheduler, // TODO: configurable interval std::chrono::duration_cast<SchedulerClockType::duration>( - std::chrono::seconds(60)))); + std::chrono::seconds(60))); - auto fwSlot = std::shared_ptr<FwSlotMetric>(new FwSlotMetric( + auto fwSlot = std::make_shared<FwSlotMetric>( this->weak_from_this(), scheduler, // TODO: configurable interval std::chrono::duration_cast<SchedulerClockType::duration>( - std::chrono::seconds(60)))); + std::chrono::seconds(60))); - auto selfTest = std::shared_ptr<SelfTestMetric>(new SelfTestMetric( + auto selfTest = std::make_shared<SelfTestMetric>( this->weak_from_this(), scheduler, // TODO: configurable interval std::chrono::duration_cast<SchedulerClockType::duration>( - std::chrono::seconds(60)))); + std::chrono::seconds(60))); auto pluginName = findPluginName(config); auto hostTelemetry = (!pluginName || pluginName != "OCP") - ? std::shared_ptr<HostTelemetryMetric>(new HostTelemetryMetric( + ? std::make_shared<HostTelemetryMetric>( this->weak_from_this(), scheduler, // TODO: configurable interval std::chrono::duration_cast<SchedulerClockType::duration>( - std::chrono::seconds(900)))) + std::chrono::seconds(900))) : std::shared_ptr<HostTelemetryMetric>(); - // NOLINTEND(modernize-make-shared) this->metricStore.emplace( this->NVMeController::io, this->NVMeController::conn,
diff --git a/src/NVMeSubsys.cpp b/src/NVMeSubsys.cpp index e4eb2ab..9087d32 100644 --- a/src/NVMeSubsys.cpp +++ b/src/NVMeSubsys.cpp
@@ -394,7 +394,8 @@ // create scheduler assert(schedulers.find(path) == schedulers.end() && "scheduler should exsit only between [Intiatilzing, Terminating)"); - schedulers.emplace(path, new Scheduler<SchedulerClockType>(io)); + schedulers.emplace(path, + std::make_shared<Scheduler<SchedulerClockType>>(io)); markAvailable(toggle);
diff --git a/src/NVMeVolume.cpp b/src/NVMeVolume.cpp index 91fef79..a1caa78 100644 --- a/src/NVMeVolume.cpp +++ b/src/NVMeVolume.cpp
@@ -41,13 +41,11 @@ using IdentifyMetric = IdentifyMetric<NVME_IDENTIFY_CNS_NS, SchedulerClockType>; - // NOLINTBEGIN(modernize-make-shared) - auto identify = std::shared_ptr<IdentifyMetric>( - new IdentifyMetric(this->shared_from_this(), scheduler, - // Identify info is persist throughout the namespace - // lifecycle i.e. from start() to stop() - IdentifyMetric::ClockType::duration::max())); - // NOLINTEND(modernize-make-shared) + auto identify = std::make_shared<IdentifyMetric>( + this->shared_from_this(), scheduler, + // Identify info is persist throughout the namespace + // lifecycle i.e. from start() to stop() + IdentifyMetric::ClockType::duration::max()); metricStore.emplace(conn->get_io_context(), conn, path, std::move(identify));