diff --git a/src/applib/command_executor_factory.h b/src/applib/command_executor_factory.h index d90f574..f69d507 100644 --- a/src/applib/command_executor_factory.h +++ b/src/applib/command_executor_factory.h @@ -55,7 +55,7 @@ class CommandExecutorFactory { /// A reference-counting pointer to CommandExecutorFactory -using ExecutorFactoryPtr = std::shared_ptr; +using CommandExecutorFactoryPtr = std::shared_ptr; diff --git a/src/applib/storage_detector.cpp b/src/applib/storage_detector.cpp index a0aec9d..da89c34 100644 --- a/src/applib/storage_detector.cpp +++ b/src/applib/storage_detector.cpp @@ -28,18 +28,18 @@ Copyright: -std::string StorageDetector::detect(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +std::string StorageDetector::detect(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Starting drive detection.\n"); std::vector all_detected; - std::string error_msg; + std::string error_message; // Try each one and move to next if it fails. #if defined CONFIG_KERNEL_LINUX - error_msg = detect_drives_linux(all_detected, ex_factory); // linux /proc/partitions as fallback. + error_message = detect_drives_linux(all_detected, ex_factory); // linux /proc/partitions as fallback. #elif defined CONFIG_KERNEL_FAMILY_WINDOWS @@ -53,7 +53,7 @@ std::string StorageDetector::detect(std::vector& drives, const if (all_detected.empty()) { debug_out_warn("app", DBG_FUNC_MSG << "Cannot detect drives: None of the drive detection methods returned any drives.\n"); - return error_msg; // last error message should be ok. + return error_message; // last error message should be ok. } for (auto& drive : all_detected) { @@ -96,7 +96,7 @@ std::string StorageDetector::detect(std::vector& drives, const std::string StorageDetector::fetch_basic_data(std::vector& drives, - const ExecutorFactoryPtr& ex_factory, bool return_first_error) + const CommandExecutorFactoryPtr& ex_factory, bool return_first_error) { fetch_data_errors_.clear(); fetch_data_error_outputs_.clear(); @@ -144,7 +144,7 @@ std::string StorageDetector::fetch_basic_data(std::vector& dri std::string StorageDetector::detect_and_fetch_basic_data(std::vector& put_drives_here, - const ExecutorFactoryPtr& ex_factory) + const CommandExecutorFactoryPtr& ex_factory) { std::string error_msg = detect(put_drives_here, ex_factory); diff --git a/src/applib/storage_detector.h b/src/applib/storage_detector.h index 75dd3b2..4823993 100644 --- a/src/applib/storage_detector.h +++ b/src/applib/storage_detector.h @@ -27,20 +27,20 @@ class StorageDetector { /// Detects a list of drives. Returns detection error message if error occurs. std::string detect(std::vector& drives, - const ExecutorFactoryPtr& ex_factory); + const CommandExecutorFactoryPtr& ex_factory); /// For each drive, fetch basic data and parse it. /// If \c return_first_error is true, the function returns on the first error. /// \return An empty string. Or, if return_first_error is true, the first error that occurs. std::string fetch_basic_data(std::vector& drives, - const ExecutorFactoryPtr& ex_factory, bool return_first_error = false); + const CommandExecutorFactoryPtr& ex_factory, bool return_first_error = false); /// Run detect() and fetch_basic_data(). /// \return An error if such occurs. std::string detect_and_fetch_basic_data(std::vector& put_drives_here, - const ExecutorFactoryPtr& ex_factory); + const CommandExecutorFactoryPtr& ex_factory); // void add_match_patterns(std::vector& patterns) diff --git a/src/applib/storage_detector_helpers.h b/src/applib/storage_detector_helpers.h index eaf15a2..482760f 100644 --- a/src/applib/storage_detector_helpers.h +++ b/src/applib/storage_detector_helpers.h @@ -28,7 +28,7 @@ Copyright: /// Find and execute tw_cli with specified options, return its output through \c output. /// \return error message -inline std::string execute_tw_cli(const ExecutorFactoryPtr& ex_factory, const std::string& command_options, std::string& output) +inline std::string execute_tw_cli(const CommandExecutorFactoryPtr& ex_factory, const std::string& command_options, std::string& output) { std::shared_ptr executor = ex_factory->create_executor(CommandExecutorFactory::ExecutorType::TwCli); @@ -73,7 +73,7 @@ inline std::string execute_tw_cli(const ExecutorFactoryPtr& ex_factory, const st /// Get the drives on a 3ware controller using tw_cli. /// Note that the drives are inserted in the order they are detected. inline std::string tw_cli_get_drives(const std::string& dev, int controller, - std::vector& drives, const ExecutorFactoryPtr& ex_factory, bool use_tw_cli_dev) + std::vector& drives, const CommandExecutorFactoryPtr& ex_factory, bool use_tw_cli_dev) { debug_out_info("app", "Getting available 3ware drives (ports) for controller " << controller << " through tw_cli...\n"); @@ -114,7 +114,7 @@ inline std::string tw_cli_get_drives(const std::string& dev, int controller, /// Return 3ware SCSI host numbers (same as /c switch to tw_cli). /// \return error string on error -inline std::string tw_cli_get_controllers(const ExecutorFactoryPtr& ex_factory, std::vector& controllers) +inline std::string tw_cli_get_controllers(const CommandExecutorFactoryPtr& ex_factory, std::vector& controllers) { debug_out_info("app", "Getting available 3ware controllers through tw_cli...\n"); @@ -153,7 +153,7 @@ inline std::string tw_cli_get_controllers(const ExecutorFactoryPtr& ex_factory, /// one of the gives an error. \c type contains a printf-formatted string with %d. /// \return an error message on error. inline std::string smartctl_scan_drives_sequentially(const std::string& dev, const std::string& type, - int from, int to, std::vector& drives, const ExecutorFactoryPtr& ex_factory, std::string& last_output) + int from, int to, std::vector& drives, const CommandExecutorFactoryPtr& ex_factory, std::string& last_output) { std::shared_ptr smartctl_ex = ex_factory->create_executor(CommandExecutorFactory::ExecutorType::Smartctl); diff --git a/src/applib/storage_detector_linux.cpp b/src/applib/storage_detector_linux.cpp index e357f38..93bbc2b 100644 --- a/src/applib/storage_detector_linux.cpp +++ b/src/applib/storage_detector_linux.cpp @@ -367,7 +367,7 @@ major minor #blocks name 254 8 1966080 mmcblk1 254 9 2007032 mmcblk1p1 */ -inline std::string detect_drives_linux_proc_partitions(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +inline std::string detect_drives_linux_proc_partitions(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives through partitions file (/proc/partitions by default; set \"system/linux_proc_partitions_path\" config key to override).\n"); @@ -466,7 +466,7 @@ Implementation notes: it seems that twe uses "3ware" and twa uses "AMCC" We can't handle a situation with mixed twa/twe/twl systems, since we don't know how they will be ordered for tw_cli. */ -inline std::string detect_drives_linux_3ware(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +inline std::string detect_drives_linux_3ware(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives behind 3ware controller(s)...\n"); @@ -600,7 +600,7 @@ using "id > 0" requirement (the third column of /proc/scsi/sg/devices. Try "-d sat" by default. If it fails ("Device Read Identity Failed:" ? not sure how to detect the failure), fall back to "-d scsi". */ -inline std::string detect_drives_linux_adaptec(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +inline std::string detect_drives_linux_adaptec(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives behind Adaptec controller(s)...\n"); @@ -730,7 +730,7 @@ Notification: If /sys/bus/scsi/devices/hostN/scsi_host/hostN/host_fw_version is older than "V1.46 2009-01-06", (1.51 for enclosure-having cards) notify the user (maybe its better to grep the smartctl output for that on port 0?). NOT IMPLEMENTED YET. */ -inline std::string detect_drives_linux_areca(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +inline std::string detect_drives_linux_areca(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives behind Areca controller(s)...\n"); @@ -881,7 +881,7 @@ Detection: Note: We're not sure how to differentiate the outputs of free / non-existent ports, so scan them until 15, just in case. */ -inline std::string detect_drives_linux_cciss(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +inline std::string detect_drives_linux_cciss(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives behind HP RAID (CCISS) controller(s)...\n"); @@ -969,7 +969,7 @@ Detection: Run smartctl -i -d cciss,[0-127] /dev/cciss/cNd0 until "No such device or address" or "VALID ARGUMENTS ARE" is encountered in output. */ -inline std::string detect_drives_linux_hpsa(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +inline std::string detect_drives_linux_hpsa(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives behind HP RAID (hpsa/hpahcisr) controller(s)...\n"); @@ -1058,7 +1058,7 @@ inline std::string detect_drives_linux_hpsa(std::vector& drive -std::string detect_drives_linux(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +std::string detect_drives_linux(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { clear_read_file_cache(); diff --git a/src/applib/storage_detector_linux.h b/src/applib/storage_detector_linux.h index f49f73b..f0882e0 100644 --- a/src/applib/storage_detector_linux.h +++ b/src/applib/storage_detector_linux.h @@ -26,7 +26,7 @@ Copyright: /// Detect drives in Linux -std::string detect_drives_linux(std::vector& drives, const ExecutorFactoryPtr& ex_factory); +std::string detect_drives_linux(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory); diff --git a/src/applib/storage_detector_other.cpp b/src/applib/storage_detector_other.cpp index 5f4043a..f79ff2a 100644 --- a/src/applib/storage_detector_other.cpp +++ b/src/applib/storage_detector_other.cpp @@ -30,7 +30,7 @@ Copyright: std::string detect_drives_other(std::vector& drives, - [[maybe_unused]] const ExecutorFactoryPtr& ex_factory) + [[maybe_unused]] const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives through /dev...\n"); diff --git a/src/applib/storage_detector_other.h b/src/applib/storage_detector_other.h index eadaeae..2510d2a 100644 --- a/src/applib/storage_detector_other.h +++ b/src/applib/storage_detector_other.h @@ -20,13 +20,13 @@ Copyright: #include #include -#include "executor_factory.h" +#include "command_executor_factory.h" #include "storage_device.h" /// Detect drives in FreeBSD, Solaris, etc... (all except Linux and Windows). -std::string detect_drives_other(std::vector& drives, const ExecutorFactoryPtr& ex_factory); +std::string detect_drives_other(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory); diff --git a/src/applib/storage_detector_win32.cpp b/src/applib/storage_detector_win32.cpp index ebda0e3..333a572 100644 --- a/src/applib/storage_detector_win32.cpp +++ b/src/applib/storage_detector_win32.cpp @@ -170,7 +170,7 @@ std::map win32_get_drive_letter_map() /// a port parameter. We don't pick the others because the may /// conflict with pd* devices, and we like pd* better than sd*. std::string get_scan_open_multiport_devices(std::vector& drives, - const ExecutorFactoryPtr& ex_factory, + const CommandExecutorFactoryPtr& ex_factory, const std::map& drive_letter_map, std::set& equivalent_pds) { @@ -258,7 +258,7 @@ std::string get_scan_open_multiport_devices(std::vector& drive /// Find and execute areca cli with specified options, return its output through \c output. /// \return error message -inline std::string execute_areca_cli(const ExecutorFactoryPtr& ex_factory, const std::string& cli_binary, +inline std::string execute_areca_cli(const CommandExecutorFactoryPtr& ex_factory, const std::string& cli_binary, const std::string& command_options, std::string& output) { std::shared_ptr executor = ex_factory->create_executor(CommandExecutorFactory::ExecutorType::ArecaCli); @@ -364,7 +364,7 @@ GuiErrMsg<0x00>: Success. ------------------------------------------------------------ */ inline std::string areca_cli_get_drives(const std::string& cli_binary, const std::string& dev, int controller, - std::vector& drives, const ExecutorFactoryPtr& ex_factory) + std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", "Getting available Areca drives (ports) for controller " << controller << " through Areca CLI...\n"); @@ -486,7 +486,7 @@ If CLI is not installed, do the brute-force way: -d areca,[1-128]/[1-8] /dev/arcmsrN It's 2-3 drives a second on an empty port, so some limits are set in config. */ -inline std::string detect_drives_win32_areca(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +inline std::string detect_drives_win32_areca(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { debug_out_info("app", DBG_FUNC_MSG << "Detecting drives behind Areca controller(s)...\n"); @@ -647,7 +647,7 @@ inline std::string detect_drives_win32_areca(std::vector& driv // (or /dev/pdN, /dev/ being optional) where N comes from // "\\.\PhysicalDriveN" (winnt only). // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx -std::string detect_drives_win32(std::vector& drives, const ExecutorFactoryPtr& ex_factory) +std::string detect_drives_win32(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory) { std::vector error_msgs; std::string error_message; diff --git a/src/applib/storage_detector_win32.h b/src/applib/storage_detector_win32.h index da43c3e..dbe8984 100644 --- a/src/applib/storage_detector_win32.h +++ b/src/applib/storage_detector_win32.h @@ -20,13 +20,13 @@ Copyright: #include #include -#include "executor_factory.h" +#include "command_executor_factory.h" #include "storage_device.h" /// Detect drives in Windows -std::string detect_drives_win32(std::vector& drives, const ExecutorFactoryPtr& ex_factory); +std::string detect_drives_win32(std::vector& drives, const CommandExecutorFactoryPtr& ex_factory);