diff --git a/cpp/Makefile b/cpp/Makefile index d32a6e7d..a9695ad4 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -116,9 +116,9 @@ ifeq ($(BOARD), FULLSPEC) endif DIR_SHARED := shared -DIR_SHARED_PROTOBUF := shared_protobuf -DIR_SHARED_COMMAND := shared_command -DIR_SHARED_INITIATOR := shared_initiator +DIR_SHARED_PROTOBUF := protobuf +DIR_SHARED_COMMAND := command +DIR_SHARED_INITIATOR := initiator DIR_BASE := base DIR_BUSES := buses DIR_CONTROLLERS := controllers @@ -215,9 +215,9 @@ vpath %.cpp $(VPATH) test vpath %.o $(OBJDIR) LIB_SHARED := $(LIBDIR)/libshared.a -LIB_SHARED_PROTOBUF := $(LIBDIR)/libsharedprotobuf.a -LIB_SHARED_COMMAND := $(LIBDIR)/libsharedcommand.a -LIB_SHARED_INITIATOR := $(LIBDIR)/libsharedinitiator.a +LIB_SHARED_PROTOBUF := $(LIBDIR)/libprotobuf.a +LIB_SHARED_COMMAND := $(LIBDIR)/libcommand.a +LIB_SHARED_INITIATOR := $(LIBDIR)/libinitiator.a LIB_BUS := $(LIBDIR)/libbus.a LIB_CONTROLLER := $(LIBDIR)/libcontroller.a LIB_DEVICE := $(LIBDIR)/libdevice.a @@ -339,8 +339,8 @@ $(BINDIR)/$(S2P_TEST): $(LIB_SHARED_COMMAND) $(LIB_SHARED_INITIATOR) $(LIB_BUS) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJ_S2P_CORE) $(OBJ_S2PCTL_CORE) $(OBJ_S2P_TEST) $(LIB_SHARED_COMMAND) \ $(LIB_SHARED_INITIATOR) $(LIB_BUS) $(LIB_CONTROLLER) $(LIB_DEVICE) -lpthread -lpcap -lprotobuf -lgmock -lgtest -$(BINDIR)/$(IN_PROCESS_TEST): $(LIB_SHARED_COMMAND) $(LIB_BUS) $(LIB_CONTROLLER) $(LIB_DEVICE) $(OBJ_S2P_CORE) \ - $(OBJ_S2PCTL_CORE) $(OBJ_IN_PROCESS_TEST) | $(BINDIR) +$(BINDIR)/$(IN_PROCESS_TEST): $(LIB_SHARED_COMMAND) $(LIB_SHARED_INITIATOR) $(LIB_BUS) $(LIB_CONTROLLER) $(LIB_DEVICE) \ + $(OBJ_S2P_CORE) $(OBJ_S2PCTL_CORE) $(OBJ_IN_PROCESS_TEST) | $(BINDIR) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJ_S2P_CORE) $(OBJ_S2PCTL_CORE) $(OBJ_IN_PROCESS_TEST) $(LIB_SHARED_COMMAND) \ $(LIB_SHARED_INITIATOR) $(LIB_BUS) $(LIB_CONTROLLER) $(LIB_DEVICE) -lpthread -lpcap -lprotobuf diff --git a/cpp/shared_command/command_dispatcher.cpp b/cpp/command/command_dispatcher.cpp similarity index 99% rename from cpp/shared_command/command_dispatcher.cpp rename to cpp/command/command_dispatcher.cpp index 55e22492..db284b57 100644 --- a/cpp/shared_command/command_dispatcher.cpp +++ b/cpp/command/command_dispatcher.cpp @@ -10,7 +10,7 @@ #include "controllers/controller_factory.h" #include "shared/s2p_util.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "command_dispatcher.h" using namespace std; diff --git a/cpp/shared_command/command_dispatcher.h b/cpp/command/command_dispatcher.h similarity index 96% rename from cpp/shared_command/command_dispatcher.h rename to cpp/command/command_dispatcher.h index a73244fd..e529f6fb 100644 --- a/cpp/shared_command/command_dispatcher.h +++ b/cpp/command/command_dispatcher.h @@ -8,7 +8,7 @@ #pragma once -#include "shared_protobuf/command_context.h" +#include "protobuf/command_context.h" #include "command_executor.h" #include "image_support.h" #include "command_response.h" diff --git a/cpp/shared_command/command_executor.cpp b/cpp/command/command_executor.cpp similarity index 99% rename from cpp/shared_command/command_executor.cpp rename to cpp/command/command_executor.cpp index ad24228c..afcb98f9 100644 --- a/cpp/shared_command/command_executor.cpp +++ b/cpp/command/command_executor.cpp @@ -11,8 +11,8 @@ #include "shared/s2p_util.h" #include "shared/localizer.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" -#include "shared_protobuf/command_context.h" +#include "protobuf/protobuf_util.h" +#include "protobuf/command_context.h" #include "devices/disk.h" #include "command_executor.h" diff --git a/cpp/shared_command/command_executor.h b/cpp/command/command_executor.h similarity index 100% rename from cpp/shared_command/command_executor.h rename to cpp/command/command_executor.h diff --git a/cpp/shared_command/command_response.cpp b/cpp/command/command_response.cpp similarity index 99% rename from cpp/shared_command/command_response.cpp rename to cpp/command/command_response.cpp index 22a32ee2..7d770792 100644 --- a/cpp/shared_command/command_response.cpp +++ b/cpp/command/command_response.cpp @@ -10,7 +10,7 @@ #include #include "base/property_handler.h" #include "controllers/controller_factory.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "shared/network_util.h" #include "shared/s2p_util.h" #include "shared/s2p_version.h" diff --git a/cpp/shared_command/command_response.h b/cpp/command/command_response.h similarity index 100% rename from cpp/shared_command/command_response.h rename to cpp/command/command_response.h diff --git a/cpp/shared_command/image_support.cpp b/cpp/command/image_support.cpp similarity index 99% rename from cpp/shared_command/image_support.cpp rename to cpp/command/image_support.cpp index 2c81bbc3..3fc90206 100644 --- a/cpp/shared_command/image_support.cpp +++ b/cpp/command/image_support.cpp @@ -11,7 +11,7 @@ #include #include "devices/disk.h" #include "shared/s2p_util.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "image_support.h" using namespace std; diff --git a/cpp/shared_command/image_support.h b/cpp/command/image_support.h similarity index 97% rename from cpp/shared_command/image_support.h rename to cpp/command/image_support.h index 88f487a4..df111901 100644 --- a/cpp/shared_command/image_support.h +++ b/cpp/command/image_support.h @@ -10,7 +10,7 @@ #include // TODO Try to get rid of this dependency -#include "shared_protobuf/command_context.h" +#include "protobuf/command_context.h" using namespace std; using namespace filesystem; diff --git a/cpp/devices/ctapdriver.cpp b/cpp/devices/ctapdriver.cpp index e38107ec..c81b7ded 100644 --- a/cpp/devices/ctapdriver.cpp +++ b/cpp/devices/ctapdriver.cpp @@ -86,7 +86,7 @@ bool CTapDriver::Init(const param_map &const_params) // IFF_NO_PI for no extra packet information ifreq ifr = { }; ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - strncpy(ifr.ifr_name, DEFAULT_BRIDGE_IF.c_str(), IFNAMSIZ - 1); // NOSONAR Using strncpy is safe + strncpy(ifr.ifr_name, BRIDGE_INTERFACE_NAME.c_str(), IFNAMSIZ - 1); // NOSONAR Using strncpy is safe if (const int ret = ioctl(tap_fd, TUNSETIFF, (void*)&ifr); ret == -1) { LogErrno("Can't ioctl TUNSETIFF"); @@ -117,9 +117,9 @@ bool CTapDriver::Init(const param_map &const_params) return false; }; - // Check if the bridge has already been created by checking whether there is a MAC address for the bridge. + // Check if the bridge has already been created by checking whether there is a MAC address for it if (GetMacAddress(BRIDGE_NAME).empty()) { - trace("Checking which interface is available for creating the bridge " + BRIDGE_NAME); + trace("Checking which interface is available for creating bridge " + BRIDGE_NAME); const auto &it = ranges::find_if(interfaces, [](const string &iface) {return IsInterfaceUp(iface);}); if (it == interfaces.end()) { @@ -143,25 +143,27 @@ bool CTapDriver::Init(const param_map &const_params) if (const string error = ip_link(ip_fd, BRIDGE_NAME.c_str(), true); !error.empty()) { return cleanUp(error); } + + bridge_created = true; } else { - info(BRIDGE_NAME + " is already available"); + info(BRIDGE_NAME + " already exists"); } - trace(">ip link set " + DEFAULT_BRIDGE_IF + " up"); - if (const string error = ip_link(ip_fd, DEFAULT_BRIDGE_IF.c_str(), true); !error.empty()) { + trace(">ip link set " + BRIDGE_INTERFACE_NAME + " up"); + if (const string error = ip_link(ip_fd, BRIDGE_INTERFACE_NAME.c_str(), true); !error.empty()) { return cleanUp(error); } - trace(">brctl addif " + BRIDGE_NAME + " " + DEFAULT_BRIDGE_IF); - if (const string error = br_setif(br_socket_fd, BRIDGE_NAME, DEFAULT_BRIDGE_IF, true); !error.empty()) { + trace(">brctl addif " + BRIDGE_NAME + " " + BRIDGE_INTERFACE_NAME); + if (const string error = br_setif(br_socket_fd, BRIDGE_NAME, BRIDGE_INTERFACE_NAME, true); !error.empty()) { return cleanUp(error); } close(ip_fd); close(br_socket_fd); - info("Tap device " + DEFAULT_BRIDGE_IF + " created"); + info("Tap device " + BRIDGE_INTERFACE_NAME + " created"); return true; #endif @@ -169,33 +171,32 @@ bool CTapDriver::Init(const param_map &const_params) void CTapDriver::CleanUp() const { - if (tap_fd != -1) { - if (const int fd = socket(AF_LOCAL, SOCK_STREAM, 0); fd == -1) { - LogErrno("Can't open bridge socket"); - } else { - trace(">brctl delif " + BRIDGE_NAME + " " + DEFAULT_BRIDGE_IF); - if (const string error = br_setif(fd, BRIDGE_NAME, DEFAULT_BRIDGE_IF, false); !error.empty()) { - warn("Removing " + DEFAULT_BRIDGE_IF + " from the bridge failed: " + error); - warn("You may need to manually remove the tap device"); - } + if (tap_fd == -1) { + return; + } - trace(">ip link set dev " + BRIDGE_NAME + " down"); - if (const string error = ip_link(fd, BRIDGE_NAME.c_str(), false); !error.empty()) { - warn(error); - } + if (const int fd = socket(AF_LOCAL, SOCK_STREAM, 0); fd == -1) { + LogErrno("Can't open bridge socket"); + } else { + trace(">brctl delif " + BRIDGE_NAME + " " + BRIDGE_INTERFACE_NAME); + if (const string error = br_setif(fd, BRIDGE_NAME, BRIDGE_INTERFACE_NAME, false); !error.empty()) { + warn("Removing " + BRIDGE_INTERFACE_NAME + " from the bridge failed: " + error); + warn("You may need to manually remove the tap device"); + } -#ifdef __linux__ - trace(">brctl delbr " + BRIDGE_NAME); - if (ioctl(fd, SIOCBRDELBR, BRIDGE_NAME.c_str()) == -1) { - warn("Removing " + BRIDGE_NAME + " failed: " + strerror(errno)); - } -#endif + trace(">ip link set dev " + BRIDGE_NAME + " down"); + if (const string error = ip_link(fd, BRIDGE_NAME.c_str(), false); !error.empty()) { + warn(error); + } - close(fd); + if (const string error = DeleteBridge(fd); !error.empty()) { + warn(error); } - close(tap_fd); + close(fd); } + + close(tap_fd); } param_map CTapDriver::GetDefaultParams() const @@ -299,11 +300,25 @@ string CTapDriver::AddBridge(int fd) return ""; } +string CTapDriver::DeleteBridge(int fd) const +{ +#ifdef __linux__ + if (bridge_created) { + trace(">brctl delbr " + BRIDGE_NAME); + if (ioctl(fd, SIOCBRDELBR, BRIDGE_NAME.c_str()) == -1) { + return "Removing " + BRIDGE_NAME + " failed: " + strerror(errno); + } + } +#endif + + return ""; +} + string CTapDriver::IpLink(bool enable) { const int fd = socket(PF_INET, SOCK_DGRAM, 0); - trace(string(">ip link set " + DEFAULT_BRIDGE_IF + " ") + (enable ? "up" : "down")); - const string result = ip_link(fd, DEFAULT_BRIDGE_IF.c_str(), enable); + trace(string(">ip link set " + BRIDGE_INTERFACE_NAME + " ") + (enable ? "up" : "down")); + const string result = ip_link(fd, BRIDGE_INTERFACE_NAME.c_str(), enable); close(fd); return result; diff --git a/cpp/devices/ctapdriver.h b/cpp/devices/ctapdriver.h index 4fe3bf0a..65d30181 100644 --- a/cpp/devices/ctapdriver.h +++ b/cpp/devices/ctapdriver.h @@ -26,14 +26,12 @@ using namespace std; class CTapDriver { + const inline static string BRIDGE_INTERFACE_NAME = "piscsi0"; const inline static string BRIDGE_NAME = "piscsi_bridge"; const inline static string DEFAULT_IP = "10.10.20.1/24"; // NOSONAR This hardcoded IP address is safe - const inline static string DEFAULT_NETMASK = "255.255.255.0"; // NOSONAR This hardcoded netmask is safe - const inline static string DEFAULT_BRIDGE_IF = "piscsi0"; - public: CTapDriver() = default; @@ -60,8 +58,8 @@ class CTapDriver return BRIDGE_NAME; } - // Add the piscsi_bridge bridge static string AddBridge(int); + string DeleteBridge(int) const; // Enable/Disable the piscsi0 interface static string IpLink(bool); @@ -79,5 +77,7 @@ class CTapDriver vector interfaces; string inet; + + bool bridge_created = false; }; diff --git a/cpp/devices/host_services.cpp b/cpp/devices/host_services.cpp index 3d7b4cd7..ef13f6f3 100644 --- a/cpp/devices/host_services.cpp +++ b/cpp/devices/host_services.cpp @@ -85,7 +85,7 @@ #include #include #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "controllers/scsi_controller.h" #include "base/memory_util.h" #include "host_services.h" diff --git a/cpp/devices/host_services.h b/cpp/devices/host_services.h index 21223f6b..f063a49b 100644 --- a/cpp/devices/host_services.h +++ b/cpp/devices/host_services.h @@ -13,9 +13,9 @@ #include #include #include -#include "shared_protobuf/command_context.h" -#include "shared_command/command_dispatcher.h" -#include "shared_command/image_support.h" +#include "protobuf/command_context.h" +#include "command/command_dispatcher.h" +#include "command/image_support.h" #include "mode_page_device.h" using namespace std; diff --git a/cpp/shared_initiator/initiator_executor.cpp b/cpp/initiator/initiator_executor.cpp similarity index 90% rename from cpp/shared_initiator/initiator_executor.cpp rename to cpp/initiator/initiator_executor.cpp index fd956687..d0a56ae5 100644 --- a/cpp/shared_initiator/initiator_executor.cpp +++ b/cpp/initiator/initiator_executor.cpp @@ -13,35 +13,29 @@ using namespace std; using namespace spdlog; -void InitiatorExecutor::Reset() const +int InitiatorExecutor::Execute(scsi_command cmd, span cdb, span buffer, int length) { - bus.SetDAT(0); - bus.SetBSY(false); - bus.SetSEL(false); - bus.SetATN(false); -} + bus.Reset(); -bool InitiatorExecutor::Execute(scsi_command cmd, span cdb, span buffer, int length, bool sasi) -{ - status = 0; + status = -1; byte_count = 0; if (const auto &command = COMMAND_MAPPING.find(cmd); command != COMMAND_MAPPING.end()) { - trace("Executing command {0} for target {1}:{2}", command->second.second, target_id, target_lun); + trace("Executing command {0} for device {1}:{2}", command->second.second, target_id, target_lun); } else { - trace("Executing command ${0:02x} for target {1}:{2}", static_cast(cmd), target_id, target_lun); + trace("Executing command ${0:02x} for device {1}:{2}", static_cast(cmd), target_id, target_lun); } // There is no arbitration phase with SASI if (!sasi && !Arbitration()) { bus.Reset(); - return false; + return -1; } - if (!Selection(sasi)) { - Reset(); - return false; + if (!Selection()) { + bus.Reset(); + return -1; } // Timeout 3 s @@ -55,19 +49,18 @@ bool InitiatorExecutor::Execute(scsi_command cmd, span cdb, span cdb, span buffer, int length) @@ -112,6 +105,8 @@ bool InitiatorExecutor::Dispatch(scsi_command cmd, span cdb, span((sasi ? 0 : 1 << initiator_id) + (1 << target_id))); @@ -158,7 +155,7 @@ bool InitiatorExecutor::Selection(bool sasi) const } if (!WaitForBusy()) { - trace("SELECTION phase failed"); + trace("Selection failed"); return false; } diff --git a/cpp/shared_initiator/initiator_executor.h b/cpp/initiator/initiator_executor.h similarity index 90% rename from cpp/shared_initiator/initiator_executor.h rename to cpp/initiator/initiator_executor.h index 310cc8a1..44e83890 100644 --- a/cpp/shared_initiator/initiator_executor.h +++ b/cpp/initiator/initiator_executor.h @@ -31,7 +31,12 @@ class InitiatorExecutor ~InitiatorExecutor() = default; void SetTarget(int, int); - bool Execute(scsi_command, span, span, int, bool = false); + int Execute(scsi_command, span, span, int); + + void Sasi(bool b) + { + sasi = b; + } int GetByteCount() const { @@ -40,12 +45,10 @@ class InitiatorExecutor private: - void Reset() const; - bool Dispatch(scsi_command, span, span, int); bool Arbitration() const; - bool Selection(bool) const; + bool Selection() const; void Command(scsi_command, span) const; void Status(); void DataIn(span, int); @@ -56,7 +59,7 @@ class InitiatorExecutor bool WaitForFree() const; bool WaitForBusy() const; - inline void Sleep(const timespec &ns) const + void Sleep(const timespec &ns) const { nanosleep(&ns, nullptr); } @@ -72,6 +75,8 @@ class InitiatorExecutor int byte_count = 0; + bool sasi = false; + bool reject = false; // Timeout values see bus.h diff --git a/cpp/initiator/initiator_util.cpp b/cpp/initiator/initiator_util.cpp new file mode 100644 index 00000000..d00242ec --- /dev/null +++ b/cpp/initiator/initiator_util.cpp @@ -0,0 +1,59 @@ +//--------------------------------------------------------------------------- +// +// SCSI target emulator and SCSI tools for the Raspberry Pi +// +// Copyright (C) 2024 Uwe Seimet +// +//--------------------------------------------------------------------------- + +#include +#include "shared/s2p_util.h" +#include "initiator_util.h" + +using namespace spdlog; +using namespace scsi_defs; +using namespace s2p_util; + +string initiator_util::GetSenseData(InitiatorExecutor &executor) +{ + vector < uint8_t > buf(14); + array < uint8_t, 6 > cdb = { }; + cdb[4] = static_cast(buf.size()); + + if (executor.Execute(scsi_command::cmd_request_sense, cdb, buf, static_cast(buf.size()))) { + return "Can't execute REQUEST SENSE"; + } + + if (executor.GetByteCount() < static_cast(buf.size())) { + return "Device reported an unknown error"; + } + + return FormatSenseData(static_cast(static_cast(buf[2]) & byte { 0x0f }), static_cast(buf[12]), + buf[13]); +} + +void initiator_util::LogStatus(int status) +{ + if (status) { + if (const auto &it_status = STATUS_MAPPING.find(static_cast(status)); it_status + != STATUS_MAPPING.end()) { + warn("Device reported {0} (status code ${1:02x})", it_status->second, status); + } + else { + warn("Device reported unknown status (status code ${0:02x})", status); + } + } +} + +bool initiator_util::SetLogLevel(const string &log_level) +{ + const level::level_enum l = level::from_str(log_level); + // Compensate for spdlog using 'off' for unknown levels + if (to_string_view(l) != log_level) { + return false; + } + + set_level(l); + + return true; +} diff --git a/cpp/shared_initiator/initiator_util.h b/cpp/initiator/initiator_util.h similarity index 79% rename from cpp/shared_initiator/initiator_util.h rename to cpp/initiator/initiator_util.h index 64e8fe6b..4a8923ea 100644 --- a/cpp/shared_initiator/initiator_util.h +++ b/cpp/initiator/initiator_util.h @@ -8,11 +8,13 @@ #pragma once -#include +#include "initiator_executor.h" using namespace std; namespace initiator_util { +string GetSenseData(InitiatorExecutor&); +void LogStatus(int); bool SetLogLevel(const string&); } diff --git a/cpp/shared_protobuf/command_context.cpp b/cpp/protobuf/command_context.cpp similarity index 100% rename from cpp/shared_protobuf/command_context.cpp rename to cpp/protobuf/command_context.cpp diff --git a/cpp/shared_protobuf/command_context.h b/cpp/protobuf/command_context.h similarity index 100% rename from cpp/shared_protobuf/command_context.h rename to cpp/protobuf/command_context.h diff --git a/cpp/shared_protobuf/protobuf_util.cpp b/cpp/protobuf/protobuf_util.cpp similarity index 100% rename from cpp/shared_protobuf/protobuf_util.cpp rename to cpp/protobuf/protobuf_util.cpp diff --git a/cpp/shared_protobuf/protobuf_util.h b/cpp/protobuf/protobuf_util.h similarity index 100% rename from cpp/shared_protobuf/protobuf_util.h rename to cpp/protobuf/protobuf_util.h diff --git a/cpp/s2p/s2p_core.cpp b/cpp/s2p/s2p_core.cpp index ad56a057..72219332 100644 --- a/cpp/s2p/s2p_core.cpp +++ b/cpp/s2p/s2p_core.cpp @@ -19,7 +19,7 @@ #include "shared/s2p_util.h" #include "shared/shared_exceptions.h" #include "shared/s2p_version.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #ifdef BUILD_SCHS #include "devices/host_services.h" #endif diff --git a/cpp/s2p/s2p_core.h b/cpp/s2p/s2p_core.h index 90b119f8..78d8f3bc 100644 --- a/cpp/s2p/s2p_core.h +++ b/cpp/s2p/s2p_core.h @@ -11,11 +11,11 @@ #include "buses/bus_factory.h" #include "controllers/controller_factory.h" #include "base/property_handler.h" -#include "shared_protobuf/command_context.h" -#include "shared_command/command_dispatcher.h" -#include "shared_command/image_support.h" -#include "shared_command/command_response.h" -#include "shared_command/command_executor.h" +#include "protobuf/command_context.h" +#include "command/command_dispatcher.h" +#include "command/image_support.h" +#include "command/command_response.h" +#include "command/command_executor.h" #include "s2p_parser.h" #include "s2p_thread.h" diff --git a/cpp/s2p/s2p_thread.cpp b/cpp/s2p/s2p_thread.cpp index 2611348a..b8e430d4 100644 --- a/cpp/s2p/s2p_thread.cpp +++ b/cpp/s2p/s2p_thread.cpp @@ -14,7 +14,7 @@ #include #include "shared/s2p_util.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/command_context.h" +#include "protobuf/command_context.h" #include "s2p_thread.h" using namespace spdlog; diff --git a/cpp/s2pctl/s2pctl_commands.cpp b/cpp/s2pctl/s2pctl_commands.cpp index 40b3ff7d..2368592a 100644 --- a/cpp/s2pctl/s2pctl_commands.cpp +++ b/cpp/s2pctl/s2pctl_commands.cpp @@ -19,7 +19,7 @@ #include "shared/network_util.h" #include "shared/s2p_util.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "s2pctl_commands.h" using namespace std; diff --git a/cpp/s2pctl/s2pctl_display.cpp b/cpp/s2pctl/s2pctl_display.cpp index d8625162..a1d07032 100644 --- a/cpp/s2pctl/s2pctl_display.cpp +++ b/cpp/s2pctl/s2pctl_display.cpp @@ -13,7 +13,7 @@ #include #include #include "shared/s2p_util.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "s2pctl_display.h" using namespace std; diff --git a/cpp/s2pctl/sp2ctl_core.cpp b/cpp/s2pctl/sp2ctl_core.cpp index 6ddf3ea3..150cc008 100644 --- a/cpp/s2pctl/sp2ctl_core.cpp +++ b/cpp/s2pctl/sp2ctl_core.cpp @@ -17,7 +17,7 @@ #include "shared/s2p_util.h" #include "shared/shared_exceptions.h" #include "shared/s2p_version.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "s2pctl_parser.h" #include "s2pctl_commands.h" #include "s2pctl_core.h" diff --git a/cpp/s2pdump/s2pdump_core.cpp b/cpp/s2pdump/s2pdump_core.cpp index 5417b617..bcc3f0ea 100644 --- a/cpp/s2pdump/s2pdump_core.cpp +++ b/cpp/s2pdump/s2pdump_core.cpp @@ -19,7 +19,7 @@ #include #include "shared/shared_exceptions.h" #include "shared/s2p_util.h" -#include "shared_initiator/initiator_util.h" +#include "initiator/initiator_util.h" #include "s2pdump_core.h" using namespace std; @@ -93,7 +93,7 @@ bool S2pDump::Init(bool in_process) bus = bus_factory->CreateBus(false, in_process); if (bus != nullptr) { - scsi_executor = make_unique(*bus, initiator_id); + executor = make_unique(*bus, initiator_id); } return bus != nullptr; @@ -323,6 +323,8 @@ int S2pDump::Run(span args, bool in_process) return EXIT_FAILURE; } + executor->Sasi(sasi); + if (run_bus_scan) { ScanBus(); } @@ -366,7 +368,7 @@ void S2pDump::ScanBus() continue; } - auto luns = scsi_executor->ReportLuns(); + auto luns = executor->ReportLuns(); // LUN 0 has already been dealt with luns.erase(0); @@ -383,10 +385,10 @@ bool S2pDump::DisplayInquiry(bool check_type) cout << DIVIDER << "\nChecking " << (sasi ? "SASI" : "SCSI") << " target ID:LUN " << target_id << ":" << target_lun << "\n" << flush; - scsi_executor->SetTarget(target_id, target_lun); + executor->SetTarget(target_id, target_lun); vector buf(36); - if (!scsi_executor->Inquiry(buf, sasi)) { + if (!executor->Inquiry(buf)) { return false; } @@ -571,7 +573,7 @@ string S2pDump::DumpRestore() if (restore) { // Ensure that if the target device is also a SCSI2Pi instance its image file becomes complete immediately - scsi_executor->SynchronizeCache(); + executor->SynchronizeCache(); } cout << DIVIDER @@ -592,11 +594,11 @@ string S2pDump::ReadWrite(fstream &fs, int sector_offset, uint32_t sector_count, return "Error reading from file '" + filename + "'"; } - if (!scsi_executor->ReadWrite(buffer, sector_offset, sector_count, sector_count * sector_size, true)) { + if (!executor->ReadWrite(buffer, sector_offset, sector_count, sector_count * sector_size, true)) { return "Error/interrupted while writing to device"; } } else { - if (!scsi_executor->ReadWrite(buffer, sector_offset, sector_count, sector_count * sector_size, false)) { + if (!executor->ReadWrite(buffer, sector_offset, sector_count, sector_count * sector_size, false)) { return "Error/interrupted while reading from device"; } @@ -667,10 +669,10 @@ bool S2pDump::GetDeviceInfo() } // Clear any pending condition, e.g. a medium just having being inserted - scsi_executor->TestUnitReady(); + executor->TestUnitReady(); if (!sasi) { - const auto [capacity, sector_size] = scsi_executor->ReadCapacity(); + const auto [capacity, sector_size] = executor->ReadCapacity(); if (!capacity || !sector_size) { trace("Can't read device capacity"); return false; @@ -734,7 +736,7 @@ void S2pDump::DisplayProperties(int id, int lun) const vector buf(255); - if (!scsi_executor->ModeSense6(buf)) { + if (!executor->ModeSense6(buf)) { cout << "Warning: Can't get mode page data, medium may be missing\n" << flush; return; } diff --git a/cpp/s2pdump/s2pdump_core.h b/cpp/s2pdump/s2pdump_core.h index cfcfbb82..b29b7e4e 100644 --- a/cpp/s2pdump/s2pdump_core.h +++ b/cpp/s2pdump/s2pdump_core.h @@ -60,7 +60,7 @@ class S2pDump unique_ptr bus; - unique_ptr scsi_executor; + unique_ptr executor; scsi_device_info_t scsi_device_info = { }; diff --git a/cpp/s2pdump/s2pdump_executor.cpp b/cpp/s2pdump/s2pdump_executor.cpp index 637fb925..f76813f8 100644 --- a/cpp/s2pdump/s2pdump_executor.cpp +++ b/cpp/s2pdump/s2pdump_executor.cpp @@ -18,16 +18,16 @@ void S2pDumpExecutor::TestUnitReady() const { vector cdb(6); - phase_executor->Execute(scsi_command::cmd_test_unit_ready, cdb, { }, 0); + initiator_executor->Execute(scsi_command::cmd_test_unit_ready, cdb, { }, 0); } -bool S2pDumpExecutor::Inquiry(span buffer, bool sasi) +bool S2pDumpExecutor::Inquiry(span buffer) { vector cdb(6); cdb[3] = static_cast(buffer.size() >> 8); cdb[4] = static_cast(buffer.size()); - return phase_executor->Execute(scsi_command::cmd_inquiry, cdb, buffer, static_cast(buffer.size()), sasi); + return !initiator_executor->Execute(scsi_command::cmd_inquiry, cdb, buffer, static_cast(buffer.size())); } pair S2pDumpExecutor::ReadCapacity() @@ -35,7 +35,7 @@ pair S2pDumpExecutor::ReadCapacity() vector buffer(14); vector cdb(10); - if (!phase_executor->Execute(scsi_command::cmd_read_capacity10, cdb, buffer, 8)) { + if (initiator_executor->Execute(scsi_command::cmd_read_capacity10, cdb, buffer, 8)) { return {0, 0}; } @@ -48,7 +48,7 @@ pair S2pDumpExecutor::ReadCapacity() // READ CAPACITY(16), not READ LONG(16) cdb[1] = 0x10; - if (!phase_executor->Execute(scsi_command::cmd_read_capacity16_read_long16, cdb, buffer, + if (initiator_executor->Execute(scsi_command::cmd_read_capacity16_read_long16, cdb, buffer, static_cast(buffer.size()))) { return {0, 0}; } @@ -72,7 +72,7 @@ bool S2pDumpExecutor::ReadWrite(span buffer, uint32_t bstart, uint32_t cdb[3] = static_cast(bstart); cdb[4] = static_cast(blength); - return phase_executor->Execute(is_write ? scsi_command::cmd_write6 : scsi_command::cmd_read6, cdb, buffer, + return !initiator_executor->Execute(is_write ? scsi_command::cmd_write6 : scsi_command::cmd_read6, cdb, buffer, length); } else { @@ -84,7 +84,8 @@ bool S2pDumpExecutor::ReadWrite(span buffer, uint32_t bstart, uint32_t cdb[7] = static_cast(blength >> 8); cdb[8] = static_cast(blength); - return phase_executor->Execute(is_write ? scsi_command::cmd_write10 : scsi_command::cmd_read10, cdb, buffer, + return !initiator_executor->Execute(is_write ? scsi_command::cmd_write10 : scsi_command::cmd_read10, cdb, + buffer, length); } } @@ -96,14 +97,14 @@ bool S2pDumpExecutor::ModeSense6(span buffer) cdb[2] = 0x3f; cdb[4] = static_cast(buffer.size()); - return phase_executor->Execute(scsi_command::cmd_mode_sense6, cdb, buffer, static_cast(buffer.size())); + return !initiator_executor->Execute(scsi_command::cmd_mode_sense6, cdb, buffer, static_cast(buffer.size())); } void S2pDumpExecutor::SynchronizeCache() { vector cdb(10); - phase_executor->Execute(scsi_command::cmd_synchronize_cache10, cdb, { }, 0); + initiator_executor->Execute(scsi_command::cmd_synchronize_cache10, cdb, { }, 0); } set S2pDumpExecutor::ReportLuns() @@ -114,7 +115,7 @@ set S2pDumpExecutor::ReportLuns() cdb[9] = static_cast(buffer.size()); // Assume 8 LUNs in case REPORT LUNS is not available - if (!phase_executor->Execute(scsi_command::cmd_report_luns, cdb, buffer, static_cast(buffer.size()))) { + if (initiator_executor->Execute(scsi_command::cmd_report_luns, cdb, buffer, static_cast(buffer.size()))) { trace("Target does not support REPORT LUNS"); return {0, 1, 2, 3, 4, 5, 6, 7}; } diff --git a/cpp/s2pdump/s2pdump_executor.h b/cpp/s2pdump/s2pdump_executor.h index 83d91058..68a521fa 100644 --- a/cpp/s2pdump/s2pdump_executor.h +++ b/cpp/s2pdump/s2pdump_executor.h @@ -11,7 +11,7 @@ #include #include #include -#include "shared_initiator/initiator_executor.h" +#include "initiator/initiator_executor.h" using namespace std; @@ -20,23 +20,27 @@ class S2pDumpExecutor public: - S2pDumpExecutor(Bus &bus, int id) + S2pDumpExecutor(Bus &bus, int id) : initiator_executor(make_unique(bus, id)) { - phase_executor = make_unique(bus, id); } ~S2pDumpExecutor() = default; void TestUnitReady() const; - bool Inquiry(span, bool); + bool Inquiry(span); pair ReadCapacity(); bool ReadWrite(span, uint32_t, uint32_t, int, bool); bool ModeSense6(span); void SynchronizeCache(); set ReportLuns(); + void Sasi(bool sasi) + { + initiator_executor->Sasi(sasi); + } + void SetTarget(int id, int lun) { - phase_executor->SetTarget(id, lun); + initiator_executor->SetTarget(id, lun); } private: @@ -44,5 +48,5 @@ class S2pDumpExecutor static uint32_t GetInt32(span, int = 0); static uint64_t GetInt64(span, int = 0); - unique_ptr phase_executor; + unique_ptr initiator_executor; }; diff --git a/cpp/s2pexec/s2pexec_core.cpp b/cpp/s2pexec/s2pexec_core.cpp index 240ec4ef..0e659cea 100644 --- a/cpp/s2pexec/s2pexec_core.cpp +++ b/cpp/s2pexec/s2pexec_core.cpp @@ -14,7 +14,7 @@ #include #include "shared/s2p_util.h" #include "shared/shared_exceptions.h" -#include "shared_initiator/initiator_util.h" +#include "initiator/initiator_util.h" #include "s2pexec_core.h" using namespace std; @@ -82,7 +82,7 @@ bool S2pExec::Init(bool) bus = bus_factory->CreateBus(false); if (bus) { - scsi_executor = make_unique(*bus, initiator_id); + executor = make_unique(*bus, initiator_id); } return bus != nullptr; @@ -265,7 +265,8 @@ int S2pExec::Run(span args, bool in_process) return EXIT_FAILURE; } - scsi_executor->SetTarget(target_id, target_lun); + executor->Sasi(sasi); + executor->SetTarget(target_id, target_lun); int result = EXIT_SUCCESS; if (!command.empty()) { @@ -306,20 +307,12 @@ string S2pExec::ExecuteCommand() debug("Sending {} data bytes", buffer.size()); } - const bool status = scsi_executor->ExecuteCommand(static_cast(cdb[0]), cdb, buffer, sasi); - if (!status) { - if (request_sense) { - warn("Device reported an error, running REQUEST SENSE"); - return scsi_executor->GetSenseData(sasi); - } - else { - warn("Device reported an error"); - return ""; - } + if (executor->ExecuteCommand(static_cast(cdb[0]), cdb, buffer)) { + return request_sense ? executor->GetSenseData() : ""; } if (binary_input_filename.empty() && hex_input_filename.empty()) { - const int count = scsi_executor->GetByteCount(); + const int count = executor->GetByteCount(); debug("Received {} data bytes", count); diff --git a/cpp/s2pexec/s2pexec_core.h b/cpp/s2pexec/s2pexec_core.h index f8e6f4c8..be4a9498 100644 --- a/cpp/s2pexec/s2pexec_core.h +++ b/cpp/s2pexec/s2pexec_core.h @@ -40,7 +40,7 @@ class S2pExec unique_ptr bus; - unique_ptr scsi_executor; + unique_ptr executor; bool version = false; bool help = false; diff --git a/cpp/s2pexec/s2pexec_executor.cpp b/cpp/s2pexec/s2pexec_executor.cpp index 69ed752c..253ef4dd 100644 --- a/cpp/s2pexec/s2pexec_executor.cpp +++ b/cpp/s2pexec/s2pexec_executor.cpp @@ -6,32 +6,17 @@ // //--------------------------------------------------------------------------- -#include "shared/s2p_util.h" +#include "initiator/initiator_util.h" #include "s2pexec_executor.h" using namespace std; -using namespace scsi_defs; -using namespace s2p_util; +using namespace initiator_util; -bool S2pExecExecutor::ExecuteCommand(scsi_command cmd, vector &cdb, vector &buffer, bool sasi) +int S2pExecExecutor::ExecuteCommand(scsi_command cmd, vector &cdb, vector &buffer) { - return initiator_executor->Execute(cmd, cdb, buffer, buffer.size(), sasi); -} - -string S2pExecExecutor::GetSenseData(bool sasi) -{ - vector buf(14); - array cdb = { }; - cdb[4] = buf.size(); + const int status = initiator_executor->Execute(cmd, cdb, buffer, buffer.size()); - if (!initiator_executor->Execute(scsi_command::cmd_request_sense, cdb, buf, buf.size(), sasi)) { - return "Can't execute REQUEST SENSE"; - } + LogStatus(status); - if (initiator_executor->GetByteCount() < static_cast(buf.size())) { - return "Device reported an unknown error"; - } - else { - return FormatSenseData(static_cast(buf[2] & 0x0f), static_cast(buf[12]), buf[13]); - } + return status; } diff --git a/cpp/s2pexec/s2pexec_executor.h b/cpp/s2pexec/s2pexec_executor.h index a09b792c..0c5c6dd4 100644 --- a/cpp/s2pexec/s2pexec_executor.h +++ b/cpp/s2pexec/s2pexec_executor.h @@ -10,14 +10,14 @@ #include #include -#include "shared_initiator/initiator_executor.h" +#include "initiator/initiator_util.h" +#include "initiator/initiator_executor.h" using namespace std; class S2pExecExecutor { - - // The SCSI ExecuteOperation command supports a byte count of up to 65535 bytes + // The SCSI ExecuteOperation custom command supports a byte count of up to 65535 bytes inline static const int BUFFER_SIZE = 65535; public: @@ -29,14 +29,22 @@ class S2pExecExecutor text = 0b100 }; - S2pExecExecutor(Bus &bus, int id) + S2pExecExecutor(Bus &bus, int id) : initiator_executor(make_unique(bus, id)) { - initiator_executor = make_unique(bus, id); } ~S2pExecExecutor() = default; - bool ExecuteCommand(scsi_command, vector&, vector&, bool); - string GetSenseData(bool); + void Sasi(bool sasi) + { + initiator_executor->Sasi(sasi); + } + + int ExecuteCommand(scsi_command, vector&, vector&); + + string GetSenseData() const + { + return initiator_util::GetSenseData(*initiator_executor); + } void SetTarget(int id, int lun) { diff --git a/cpp/s2pproto/s2pproto_core.cpp b/cpp/s2pproto/s2pproto_core.cpp index 9bc0d087..602cd8a6 100644 --- a/cpp/s2pproto/s2pproto_core.cpp +++ b/cpp/s2pproto/s2pproto_core.cpp @@ -15,7 +15,7 @@ #include #include "shared/shared_exceptions.h" #include "shared/s2p_util.h" -#include "shared_initiator/initiator_util.h" +#include "initiator/initiator_util.h" #include "s2pproto_core.h" using namespace std; @@ -81,7 +81,7 @@ bool S2pProto::Init(bool) bus = bus_factory->CreateBus(false); if (bus) { - scsi_executor = make_unique(*bus, initiator_id); + executor = make_unique(*bus, initiator_id); } return bus != nullptr; @@ -238,7 +238,7 @@ int S2pProto::Run(span args, bool in_process) return EXIT_FAILURE; } - scsi_executor->SetTarget(target_id, target_lun); + executor->SetTarget(target_id, target_lun); int result = GenerateOutput(input_format, protobuf_input_filename, output_format, protobuf_output_filename); @@ -251,7 +251,7 @@ int S2pProto::GenerateOutput(S2pProtoExecutor::protobuf_format input_format, con S2pProtoExecutor::protobuf_format output_format, const string &output_filename) { PbResult result; - if (string error = scsi_executor->Execute(input_filename, input_format, result); !error.empty()) { + if (string error = executor->Execute(input_filename, input_format, result); !error.empty()) { cerr << "Error: " << error << endl; return EXIT_FAILURE; diff --git a/cpp/s2pproto/s2pproto_core.h b/cpp/s2pproto/s2pproto_core.h index 4ad522be..d67e882c 100644 --- a/cpp/s2pproto/s2pproto_core.h +++ b/cpp/s2pproto/s2pproto_core.h @@ -38,7 +38,7 @@ class S2pProto unique_ptr bus; - unique_ptr scsi_executor; + unique_ptr executor; bool version = false; bool help = false; diff --git a/cpp/s2pproto/s2pproto_executor.cpp b/cpp/s2pproto/s2pproto_executor.cpp index 1aed4298..4d6cc119 100644 --- a/cpp/s2pproto/s2pproto_executor.cpp +++ b/cpp/s2pproto/s2pproto_executor.cpp @@ -62,14 +62,14 @@ string S2pProtoExecutor::Execute(const string &filename, protobuf_format input_f cdb[7] = static_cast(length >> 8); cdb[8] = static_cast(length); - if (!initiator_executor->Execute(scsi_command::cmd_execute_operation, cdb, buffer, length)) { + if (initiator_executor->Execute(scsi_command::cmd_execute_operation, cdb, buffer, length)) { return "Can't execute operation"; } cdb[7] = static_cast(buffer.size() >> 8); cdb[8] = static_cast(buffer.size()); - if (!initiator_executor->Execute(scsi_command::cmd_receive_operation_results, cdb, buffer, buffer.size())) { + if (initiator_executor->Execute(scsi_command::cmd_receive_operation_results, cdb, buffer, buffer.size())) { return "Can't read operation result"; } @@ -104,8 +104,3 @@ string S2pProtoExecutor::Execute(const string &filename, protobuf_format input_f return ""; } - -bool S2pProtoExecutor::ExecuteCommand(scsi_command cmd, vector &cdb, vector &buffer, bool sasi) -{ - return initiator_executor->Execute(cmd, cdb, buffer, buffer.size(), sasi); -} diff --git a/cpp/s2pproto/s2pproto_executor.h b/cpp/s2pproto/s2pproto_executor.h index c0621e3c..9282f327 100644 --- a/cpp/s2pproto/s2pproto_executor.h +++ b/cpp/s2pproto/s2pproto_executor.h @@ -10,7 +10,7 @@ #include #include -#include "shared_initiator/initiator_executor.h" +#include "initiator/initiator_executor.h" #include "generated/s2p_interface.pb.h" using namespace std; @@ -31,14 +31,12 @@ class S2pProtoExecutor text = 0b100 }; - S2pProtoExecutor(Bus &bus, int id) + S2pProtoExecutor(Bus &bus, int id) : initiator_executor(make_unique(bus, id)) { - initiator_executor = make_unique(bus, id); } ~S2pProtoExecutor() = default; string Execute(const string&, protobuf_format, PbResult&); - bool ExecuteCommand(scsi_command, vector&, vector&, bool); void SetTarget(int id, int lun) { diff --git a/cpp/shared_initiator/initiator_util.cpp b/cpp/shared_initiator/initiator_util.cpp deleted file mode 100644 index aa8177d5..00000000 --- a/cpp/shared_initiator/initiator_util.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//--------------------------------------------------------------------------- -// -// SCSI target emulator and SCSI tools for the Raspberry Pi -// -// Copyright (C) 2024 Uwe Seimet -// -//--------------------------------------------------------------------------- - -#include -#include "initiator_util.h" - -using namespace spdlog; - -bool initiator_util::SetLogLevel(const string &log_level) -{ - const level::level_enum l = level::from_str(log_level); - // Compensate for spdlog using 'off' for unknown levels - if (to_string_view(l) != log_level) { - return false; - } - - set_level(l); - - return true; -} diff --git a/cpp/test/command_context_test.cpp b/cpp/test/command_context_test.cpp index 8b0e1db9..5d2d137d 100644 --- a/cpp/test/command_context_test.cpp +++ b/cpp/test/command_context_test.cpp @@ -10,8 +10,8 @@ #include #include #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" -#include "shared_protobuf/command_context.h" +#include "protobuf/protobuf_util.h" +#include "protobuf/command_context.h" #include "test_shared.h" using namespace testing; diff --git a/cpp/test/command_executor_test.cpp b/cpp/test/command_executor_test.cpp index fc25450a..da987b89 100644 --- a/cpp/test/command_executor_test.cpp +++ b/cpp/test/command_executor_test.cpp @@ -9,9 +9,9 @@ #include #include "mocks.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/command_context.h" -#include "shared_protobuf/protobuf_util.h" -#include "shared_command/command_response.h" +#include "protobuf/command_context.h" +#include "protobuf/protobuf_util.h" +#include "command/command_response.h" #include "controllers/controller_factory.h" #include "base/device_factory.h" diff --git a/cpp/test/command_response_test.cpp b/cpp/test/command_response_test.cpp index 3b0fbd71..218839e2 100644 --- a/cpp/test/command_response_test.cpp +++ b/cpp/test/command_response_test.cpp @@ -8,8 +8,8 @@ #include "mocks.h" #include "shared/s2p_version.h" -#include "shared_command/command_response.h" -#include "shared_protobuf/protobuf_util.h" +#include "command/command_response.h" +#include "protobuf/protobuf_util.h" #include "controllers/controller_factory.h" #include "base/device_factory.h" diff --git a/cpp/test/image_support_test.cpp b/cpp/test/image_support_test.cpp index 7e61d1a6..6872d763 100644 --- a/cpp/test/image_support_test.cpp +++ b/cpp/test/image_support_test.cpp @@ -7,8 +7,8 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared_protobuf/protobuf_util.h" -#include "shared_command/image_support.h" +#include "protobuf/protobuf_util.h" +#include "command/image_support.h" using namespace s2p_interface; using namespace protobuf_util; diff --git a/cpp/test/mocks.h b/cpp/test/mocks.h index 664a68c8..9470e493 100644 --- a/cpp/test/mocks.h +++ b/cpp/test/mocks.h @@ -9,7 +9,7 @@ #pragma once #include -#include "shared_command/command_executor.h" +#include "command/command_executor.h" #include "buses/in_process_bus.h" #include "controllers/scsi_controller.h" #include "devices/sasi_hd.h" diff --git a/cpp/test/protobuf_util_test.cpp b/cpp/test/protobuf_util_test.cpp index 17978364..f38db41c 100644 --- a/cpp/test/protobuf_util_test.cpp +++ b/cpp/test/protobuf_util_test.cpp @@ -9,7 +9,7 @@ #include #include "mocks.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "generated/s2p_interface.pb.h" using namespace s2p_interface; diff --git a/cpp/test/s2p_thread_test.cpp b/cpp/test/s2p_thread_test.cpp index 8d84e92c..e8abf2fa 100644 --- a/cpp/test/s2p_thread_test.cpp +++ b/cpp/test/s2p_thread_test.cpp @@ -16,8 +16,8 @@ #include #include "shared/network_util.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" -#include "shared_protobuf/command_context.h" +#include "protobuf/protobuf_util.h" +#include "protobuf/command_context.h" #include "s2p/s2p_thread.h" using namespace s2p_interface; diff --git a/cpp/test/s2pctl_commands_test.cpp b/cpp/test/s2pctl_commands_test.cpp index a02ff426..7e3ed564 100644 --- a/cpp/test/s2pctl_commands_test.cpp +++ b/cpp/test/s2pctl_commands_test.cpp @@ -12,7 +12,7 @@ #include #include "test/test_shared.h" #include "shared/shared_exceptions.h" -#include "shared_protobuf/protobuf_util.h" +#include "protobuf/protobuf_util.h" #include "s2pctl/s2pctl_commands.h" using namespace testing;