From 52c2aa474f3571d37101a96e6a5a6ab284a62663 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Mon, 5 Dec 2022 09:58:23 -0800 Subject: [PATCH] Rebrand project to PiSCSI (#1016) * Rebrand project to PiSCSI - rascsi ->piscsi - rasctl -> scsictl - rasdump -> scsidump - ras* -> piscsi* (rasutil -> piscsi_util, etc.) * Refined the formatting and wording of the app startup banner * Kept some references to rascsi and rasctl where backwards compatibility is concerned * Point to the new github repo URL Co-authored-by: nucleogenic Co-authored-by: Uwe Seimet --- .dockerignore | 6 +- .github/ISSUE_TEMPLATE.md | 2 +- .github/workflows/arm_cross_compile.yml | 4 +- .github/workflows/build_code.yml | 12 +- .github/workflows/cpp.yml | 12 +- .github/workflows/rpi_image_creation.yml.old | 12 +- .gitignore | 1 + LICENSE | 2 +- README.md | 14 +- cpp/.gitignore | 2 +- cpp/Makefile | 140 ++-- cpp/controllers/abstract_controller.cpp | 4 +- cpp/controllers/abstract_controller.h | 8 +- cpp/controllers/controller_manager.cpp | 2 +- cpp/controllers/controller_manager.h | 2 +- cpp/controllers/phase_handler.h | 2 +- cpp/controllers/scsi_controller.cpp | 16 +- cpp/controllers/scsi_controller.h | 6 +- cpp/devices/cd_track.cpp | 2 +- cpp/devices/cd_track.h | 2 +- cpp/devices/cfilesystem.cpp | 2 +- cpp/devices/cfilesystem.h | 2 +- cpp/devices/ctapdriver.cpp | 34 +- cpp/devices/ctapdriver.h | 8 +- cpp/devices/device.cpp | 6 +- cpp/devices/device.h | 8 +- cpp/devices/device_factory.cpp | 12 +- cpp/devices/device_factory.h | 6 +- cpp/devices/device_logger.cpp | 2 +- cpp/devices/device_logger.h | 2 +- cpp/devices/disk.cpp | 2 +- cpp/devices/host_services.cpp | 14 +- cpp/devices/host_services.h | 2 +- cpp/devices/interfaces/byte_writer.h | 2 +- cpp/devices/interfaces/scsi_block_commands.h | 2 +- cpp/devices/interfaces/scsi_mmc_commands.h | 2 +- .../interfaces/scsi_primary_commands.h | 4 +- .../interfaces/scsi_printer_commands.h | 2 +- cpp/devices/mode_page_device.cpp | 4 +- cpp/devices/mode_page_device.h | 2 +- cpp/devices/primary_device.cpp | 6 +- cpp/devices/primary_device.h | 2 +- cpp/devices/scsi_command_util.cpp | 8 +- cpp/devices/scsi_command_util.h | 2 +- cpp/devices/scsi_daynaport.cpp | 8 +- cpp/devices/scsi_daynaport.h | 4 +- cpp/devices/scsi_host_bridge.cpp | 4 +- cpp/devices/scsi_host_bridge.h | 2 +- cpp/devices/scsi_printer.cpp | 4 +- cpp/devices/scsi_printer.h | 4 +- cpp/devices/scsicd.cpp | 4 +- cpp/devices/scsicd.h | 2 +- cpp/devices/scsihd.cpp | 4 +- cpp/devices/scsihd.h | 2 +- cpp/devices/scsihd_nec.cpp | 8 +- cpp/devices/scsihd_nec.h | 2 +- cpp/devices/scsimo.cpp | 4 +- cpp/devices/scsimo.h | 2 +- cpp/devices/storage_device.cpp | 6 +- cpp/devices/storage_device.h | 2 +- cpp/hal/connection_type/connection_aibom.h | 4 +- cpp/hal/connection_type/connection_fullspec.h | 4 +- .../connection_type/connection_gamernium.h | 2 +- cpp/hal/connection_type/connection_standard.h | 4 +- cpp/hal/data_sample.cpp | 2 +- cpp/hal/data_sample.h | 2 +- cpp/hal/data_sample_bananam2p.cpp | 2 +- cpp/hal/data_sample_bananam2p.h | 2 +- cpp/hal/data_sample_raspberry.cpp | 2 +- cpp/hal/data_sample_raspberry.h | 2 +- cpp/hal/gpiobus.cpp | 4 +- cpp/hal/gpiobus.h | 4 +- cpp/hal/gpiobus_bananam2p.cpp | 8 +- cpp/hal/gpiobus_bananam2p.h | 2 +- cpp/hal/gpiobus_factory.cpp | 2 +- cpp/hal/gpiobus_factory.h | 2 +- cpp/hal/gpiobus_raspberry.cpp | 8 +- cpp/hal/gpiobus_raspberry.h | 2 +- cpp/hal/gpiobus_virtual.cpp | 2 +- cpp/hal/gpiobus_virtual.h | 2 +- cpp/hal/pin_control.h | 2 +- cpp/hal/sbc_version.cpp | 2 +- cpp/hal/sbc_version.h | 2 +- cpp/hal/sunxi_utils.cpp | 2 +- cpp/hal/sunxi_utils.h | 2 +- cpp/hal/systimer.cpp | 2 +- cpp/hal/systimer.h | 2 +- cpp/hal/systimer_allwinner.cpp | 4 +- cpp/hal/systimer_allwinner.h | 2 +- cpp/hal/systimer_raspberry.cpp | 2 +- cpp/hal/systimer_raspberry.h | 2 +- cpp/monitor/sm_core.cpp | 10 +- cpp/monitor/sm_core.h | 2 +- cpp/monitor/sm_html_report.cpp | 10 +- cpp/monitor/sm_json_report.cpp | 2 +- cpp/monitor/sm_reports.h | 2 +- cpp/monitor/sm_vcd_report.cpp | 2 +- cpp/os_integration/piscsi.conf | 2 + .../{rascsi.service => piscsi.service} | 12 +- .../{rascsi_bridge => piscsi_bridge} | 6 +- cpp/os_integration/rascsi.conf | 2 - cpp/{rasctl.cpp => piscsi.cpp} | 6 +- cpp/{rascsi => piscsi}/command_context.cpp | 6 +- cpp/{rascsi => piscsi}/command_context.h | 6 +- cpp/{rascsi => piscsi}/localizer.cpp | 2 +- cpp/{rascsi => piscsi}/localizer.h | 2 +- .../piscsi_core.cpp} | 96 +-- .../rascsi_core.h => piscsi/piscsi_core.h} | 30 +- .../piscsi_executor.cpp} | 81 +-- .../piscsi_executor.h} | 18 +- .../piscsi_image.cpp} | 36 +- .../rascsi_image.h => piscsi/piscsi_image.h} | 12 +- .../piscsi_response.cpp} | 66 +- .../piscsi_response.h} | 12 +- .../piscsi_service.cpp} | 24 +- .../piscsi_service.h} | 14 +- ...interface.proto => piscsi_interface.proto} | 33 +- cpp/{rascsi.cpp => scsictl.cpp} | 6 +- .../scsictl_commands.cpp} | 98 +-- .../scsictl_commands.h} | 16 +- .../scsictl_core.cpp} | 44 +- .../rasctl_core.h => scsictl/scsictl_core.h} | 12 +- .../scsictl_display.cpp} | 50 +- .../scsictl_display.h} | 12 +- .../scsictl_parser.cpp} | 8 +- .../scsictl_parser.h} | 12 +- cpp/{rasdump.cpp => scsidump.cpp} | 4 +- .../scsidump_core.cpp} | 24 +- .../scsidump_core.h} | 2 +- cpp/scsiloop.cpp | 2 +- cpp/scsiloop/scsiloop_core.cpp | 14 +- cpp/scsiloop/scsiloop_core.h | 2 +- cpp/scsiloop/scsiloop_cout.cpp | 2 +- cpp/scsiloop/scsiloop_cout.h | 2 +- cpp/scsiloop/scsiloop_gpio.cpp | 2 +- cpp/scsiloop/scsiloop_gpio.h | 2 +- cpp/scsiloop/scsiloop_timer.cpp | 2 +- cpp/scsiloop/scsiloop_timer.h | 2 +- cpp/scsimon.cpp | 2 +- cpp/shared/config.h | 6 +- cpp/shared/log.h | 2 +- ...ascsi_exceptions.h => piscsi_exceptions.h} | 2 +- cpp/shared/{rasutil.cpp => piscsi_util.cpp} | 22 +- cpp/shared/{rasutil.h => piscsi_util.h} | 4 +- ...{rascsi_version.cpp => piscsi_version.cpp} | 18 +- .../{rascsi_version.h => piscsi_version.h} | 10 +- cpp/shared/protobuf_serializer.cpp | 8 +- cpp/shared/protobuf_serializer.h | 2 +- cpp/shared/protobuf_util.cpp | 8 +- cpp/shared/protobuf_util.h | 6 +- cpp/test/abstract_controller_test.cpp | 4 +- cpp/test/bus_test.cpp | 2 +- cpp/test/command_context_test.cpp | 4 +- cpp/test/controller_manager_test.cpp | 2 +- cpp/test/ctapdriver_test.cpp | 2 +- cpp/test/device_factory_test.cpp | 28 +- cpp/test/device_test.cpp | 4 +- cpp/test/disk_test.cpp | 4 +- cpp/test/gpiobus_raspberry_test.cpp | 6 +- cpp/test/host_services_test.cpp | 12 +- cpp/test/linux_os_stubs.cpp | 2 +- cpp/test/linux_os_stubs.h | 2 +- cpp/test/localizer_test.cpp | 4 +- cpp/test/mocks.h | 22 +- cpp/test/mode_page_device_test.cpp | 4 +- cpp/test/phase_handler_test.cpp | 2 +- ...ns_test.cpp => piscsi_exceptions_test.cpp} | 10 +- ...utor_test.cpp => piscsi_executor_test.cpp} | 122 ++-- ...i_image_test.cpp => piscsi_image_test.cpp} | 36 +- ...onse_test.cpp => piscsi_response_test.cpp} | 66 +- ...rvice_test.cpp => piscsi_service_test.cpp} | 8 +- ...{rasutil_test.cpp => piscsi_util_test.cpp} | 20 +- cpp/test/primary_device_test.cpp | 4 +- cpp/test/protobuf_serializer_test.cpp | 8 +- cpp/test/protobuf_util_test.cpp | 6 +- cpp/test/scsi_command_util_test.cpp | 4 +- cpp/test/scsi_controller_test.cpp | 12 +- cpp/test/scsi_daynaport_test.cpp | 4 +- cpp/test/scsi_host_bridge_test.cpp | 4 +- cpp/test/scsi_printer_test.cpp | 6 +- cpp/test/scsicd_test.cpp | 8 +- ...nds_test.cpp => scsictl_commands_test.cpp} | 20 +- ...play_test.cpp => scsictl_display_test.cpp} | 48 +- ...arser_test.cpp => scsictl_parser_test.cpp} | 12 +- cpp/test/scsihd_nec_test.cpp | 6 +- cpp/test/scsihd_test.cpp | 8 +- cpp/test/scsimo_test.cpp | 4 +- cpp/test/storage_device_test.cpp | 4 +- cpp/test/test_setup.cpp | 4 +- cpp/test/test_shared.cpp | 23 +- cpp/test/test_shared.h | 10 +- doc/{rascsi.1 => piscsi.1} | 48 +- doc/piscsi_man_page.txt | 118 ++++ doc/rascsi_man_page.txt | 148 ----- doc/rasctl_man_page.txt | 170 ----- doc/rasdump_man_page.txt | 42 -- doc/{rasctl.1 => scsictl.1} | 46 +- doc/scsictl_man_page.txt | 151 +++++ doc/{rasdump.1 => scsidump.1} | 16 +- doc/scsidump_man_page.txt | 41 ++ doc/scsiloop.1 | 10 +- doc/scsiloop_man_page.txt | 18 +- doc/scsimon.1 | 8 +- doc/scsimon_man_page.txt | 8 +- docker/README.md | 32 +- docker/backend/Dockerfile | 10 +- docker/backend/piscsi_wrapper.sh | 11 + docker/backend/rascsi_wrapper.sh | 11 - docker/docker-compose.ci.yml | 4 +- docker/docker-compose.override.yml.example | 2 +- docker/docker-compose.yml | 30 +- docker/web/Dockerfile | 16 +- docker/web/start.sh | 22 - docker/web/web_start_wrapper.sh | 22 + easyinstall.sh | 617 +++++++++--------- python/.flake8 | 2 +- python/.pylintrc | 4 +- python/README.md | 4 +- python/common/src/README.md | 16 +- .../common/src/{rascsi => piscsi}/__init__.py | 0 .../src/{rascsi => piscsi}/common_settings.py | 6 +- .../src/{rascsi => piscsi}/exceptions.py | 6 +- .../src/{rascsi => piscsi}/file_cmds.py | 62 +- .../ractl_cmds.py => piscsi/piscsi_cmds.py} | 24 +- .../src/{rascsi => piscsi}/return_codes.py | 4 +- .../src/{rascsi => piscsi}/socket_cmds.py | 18 +- .../common/src/{rascsi => piscsi}/sys_cmds.py | 6 +- python/ctrlboard/README.md | 2 +- .../service-infra/piscsi-ctrlboard.service | 14 + .../service-infra/rascsi-ctrlboard.service | 14 - python/ctrlboard/src/config.py | 12 +- .../ctrlboard_menu_update_event_handler.py | 70 +- .../ctrlboard_print_event_handler.py | 4 +- ...ile_cycler.py => piscsi_profile_cycler.py} | 6 +- ...wn_cycler.py => piscsi_shutdown_cycler.py} | 12 +- .../src/ctrlboard_hw/ctrlboard_hw.py | 16 +- .../ctrlboard_hw/ctrlboard_hw_constants.py | 4 +- .../ctrlboard/src/ctrlboard_menu_builder.py | 28 +- python/ctrlboard/src/main.py | 62 +- python/ctrlboard/src/menu/cycler.py | 8 +- ...ontroller.py => piscsi_menu_controller.py} | 6 +- python/ctrlboard/start.sh | 6 +- python/loopback_test/test.py | 72 +- python/oled/README.md | 6 +- ...ascsi-oled.service => piscsi-oled.service} | 10 +- ...oled_monitor.py => piscsi_oled_monitor.py} | 26 +- python/oled/start.sh | 8 +- python/web/README.md | 18 +- python/web/mock/bin/brctl | 4 +- python/web/mock/bin/journalctl | 2 +- python/web/mock/bin/systemctl | 2 +- python/web/service-infra/502.html | 6 +- python/web/service-infra/nginx-default.conf | 6 +- ...{rascsi-web.service => piscsi-web.service} | 6 +- python/web/src/drive_properties.json | 2 +- python/web/src/pwa/manifest.json | 2 +- python/web/src/return_code_mapper.py | 2 +- python/web/src/settings.py | 10 +- python/web/src/socket_cmds_flask.py | 18 +- python/web/src/static/themes/modern/style.css | 2 +- python/web/src/templates/base.html | 8 +- python/web/src/templates/drives.html | 2 +- python/web/src/templates/index.html | 38 +- .../translations/de/LC_MESSAGES/messages.po | 76 +-- .../translations/es/LC_MESSAGES/messages.po | 68 +- .../translations/fr/LC_MESSAGES/messages.po | 76 +-- .../translations/sv/LC_MESSAGES/messages.po | 66 +- python/web/src/web.py | 116 ++-- python/web/src/web_utils.py | 8 +- python/web/start.sh | 20 +- python/web/tests/api/test_auth.py | 8 +- python/web/tests/api/test_misc.py | 4 +- python/web/tests/api/test_settings.py | 4 +- python/web/tests/conftest.py | 10 +- 274 files changed, 2341 insertions(+), 2380 deletions(-) create mode 100644 cpp/os_integration/piscsi.conf rename cpp/os_integration/{rascsi.service => piscsi.service} (64%) rename cpp/os_integration/{rascsi_bridge => piscsi_bridge} (70%) delete mode 100644 cpp/os_integration/rascsi.conf rename cpp/{rasctl.cpp => piscsi.cpp} (76%) rename cpp/{rascsi => piscsi}/command_context.cpp (93%) rename cpp/{rascsi => piscsi}/command_context.h (90%) rename cpp/{rascsi => piscsi}/localizer.cpp (99%) rename cpp/{rascsi => piscsi}/localizer.h (97%) rename cpp/{rascsi/rascsi_core.cpp => piscsi/piscsi_core.cpp} (85%) rename cpp/{rascsi/rascsi_core.h => piscsi/piscsi_core.h} (72%) rename cpp/{rascsi/rascsi_executor.cpp => piscsi/piscsi_executor.cpp} (89%) rename cpp/{rascsi/rascsi_executor.h => piscsi/piscsi_executor.h} (88%) rename cpp/{rascsi/rascsi_image.cpp => piscsi/piscsi_image.cpp} (92%) rename cpp/{rascsi/rascsi_image.h => piscsi/piscsi_image.h} (89%) rename cpp/{rascsi/rascsi_response.cpp => piscsi/piscsi_response.cpp} (91%) rename cpp/{rascsi/rascsi_response.h => piscsi/piscsi_response.h} (93%) rename cpp/{rascsi/rascsi_service.cpp => piscsi/piscsi_service.cpp} (83%) rename cpp/{rascsi/rascsi_service.h => piscsi/piscsi_service.h} (74%) rename cpp/{rascsi_interface.proto => piscsi_interface.proto} (93%) rename cpp/{rascsi.cpp => scsictl.cpp} (76%) rename cpp/{rasctl/rasctl_commands.cpp => scsictl/scsictl_commands.cpp} (64%) rename cpp/{rasctl/rasctl_commands.h => scsictl/scsictl_commands.h} (81%) rename cpp/{rasctl/rasctl_core.cpp => scsictl/scsictl_core.cpp} (86%) rename cpp/{rasctl/rasctl_core.h => scsictl/scsictl_core.h} (69%) rename cpp/{rasctl/rasctl_display.cpp => scsictl/scsictl_display.cpp} (82%) rename cpp/{rasctl/rasctl_display.h => scsictl/scsictl_display.h} (87%) rename cpp/{rasctl/rasctl_parser.cpp => scsictl/scsictl_parser.cpp} (77%) rename cpp/{rasctl/rasctl_parser.h => scsictl/scsictl_parser.h} (80%) rename cpp/{rasdump.cpp => scsidump.cpp} (82%) rename cpp/{rasdump/rasdump_core.cpp => scsidump/scsidump_core.cpp} (95%) rename cpp/{rasdump/rasdump_core.h => scsidump/scsidump_core.h} (97%) rename cpp/shared/{rascsi_exceptions.h => piscsi_exceptions.h} (96%) rename cpp/shared/{rasutil.cpp => piscsi_util.cpp} (76%) rename cpp/shared/{rasutil.h => piscsi_util.h} (90%) rename cpp/shared/{rascsi_version.cpp => piscsi_version.cpp} (52%) rename cpp/shared/{rascsi_version.h => piscsi_version.h} (53%) rename cpp/test/{rascsi_exceptions_test.cpp => piscsi_exceptions_test.cpp} (81%) rename cpp/test/{rascsi_executor_test.cpp => piscsi_executor_test.cpp} (89%) rename cpp/test/{rascsi_image_test.cpp => piscsi_image_test.cpp} (85%) rename cpp/test/{rascsi_response_test.cpp => piscsi_response_test.cpp} (81%) rename cpp/test/{rascsi_service_test.cpp => piscsi_service_test.cpp} (79%) rename cpp/test/{rasutil_test.cpp => piscsi_util_test.cpp} (87%) rename cpp/test/{rasctl_commands_test.cpp => scsictl_commands_test.cpp} (88%) rename cpp/test/{rasctl_display_test.cpp => scsictl_display_test.cpp} (90%) rename cpp/test/{rasctl_parser_test.cpp => scsictl_parser_test.cpp} (89%) rename doc/{rascsi.1 => piscsi.1} (78%) create mode 100644 doc/piscsi_man_page.txt delete mode 100644 doc/rascsi_man_page.txt delete mode 100644 doc/rasctl_man_page.txt delete mode 100644 doc/rasdump_man_page.txt rename doc/{rasctl.1 => scsictl.1} (81%) create mode 100644 doc/scsictl_man_page.txt rename doc/{rasdump.1 => scsidump.1} (71%) create mode 100644 doc/scsidump_man_page.txt create mode 100644 docker/backend/piscsi_wrapper.sh delete mode 100644 docker/backend/rascsi_wrapper.sh delete mode 100644 docker/web/start.sh create mode 100644 docker/web/web_start_wrapper.sh rename python/common/src/{rascsi => piscsi}/__init__.py (100%) rename python/common/src/{rascsi => piscsi}/common_settings.py (83%) rename python/common/src/{rascsi => piscsi}/exceptions.py (61%) rename python/common/src/{rascsi => piscsi}/file_cmds.py (95%) rename python/common/src/{rascsi/ractl_cmds.py => piscsi/piscsi_cmds.py} (97%) rename python/common/src/{rascsi => piscsi}/return_codes.py (89%) rename python/common/src/{rascsi => piscsi}/socket_cmds.py (88%) rename python/common/src/{rascsi => piscsi}/sys_cmds.py (98%) create mode 100644 python/ctrlboard/service-infra/piscsi-ctrlboard.service delete mode 100644 python/ctrlboard/service-infra/rascsi-ctrlboard.service rename python/ctrlboard/src/ctrlboard_event_handler/{rascsi_profile_cycler.py => piscsi_profile_cycler.py} (81%) rename python/ctrlboard/src/ctrlboard_event_handler/{rascsi_shutdown_cycler.py => piscsi_shutdown_cycler.py} (72%) rename python/ctrlboard/src/{rascsi_menu_controller.py => piscsi_menu_controller.py} (89%) rename python/oled/service-infra/{rascsi-oled.service => piscsi-oled.service} (51%) rename python/oled/src/{rascsi_oled_monitor.py => piscsi_oled_monitor.py} (92%) mode change 100755 => 100644 rename python/web/service-infra/{rascsi-web.service => piscsi-web.service} (50%) diff --git a/.dockerignore b/.dockerignore index 2b3a49cd..5fdb9235 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,8 +2,8 @@ /* # Paths to include -!/docker/backend/rascsi_wrapper.sh -!/docker/web/start.sh +!/docker/backend/piscsi_wrapper.sh +!/docker/web/web_start_wrapper.sh !/doc !/python !/cpp @@ -22,7 +22,7 @@ **/*.pyc **/__pycache__ **/.pytest_cache -**/rascsi_interface_pb2.py +**/piscsi_interface_pb2.py **/report.xml **/.idea diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index cba112f5..0dc35b82 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -3,7 +3,7 @@ - Which version of Pi are you using: - Which github revision of software: - Which board version: -- Which computer is the RaSCSI connected to: +- Which computer is the PiSCSI connected to: # Describe the issue diff --git a/.github/workflows/arm_cross_compile.yml b/.github/workflows/arm_cross_compile.yml index e69318a4..1d3e8b23 100644 --- a/.github/workflows/arm_cross_compile.yml +++ b/.github/workflows/arm_cross_compile.yml @@ -53,10 +53,10 @@ jobs: # supports .ZIP files. # This is workaround for https://github.com/actions/upload-artifact/issues/38 - name: Tar binary output - run: tar -czvf ${{ env.debug_flag_filename }}rascsi-${{ inputs.connect-type }}.tar.gz ./bin + run: tar -czvf ${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz ./bin - name: Upload binaries uses: actions/upload-artifact@v3 with: name: ${{ env.debug_flag_filename }}arm-binaries-${{ inputs.connect-type }}.tar.gz - path: cpp/${{ env.debug_flag_filename }}rascsi-${{ inputs.connect-type }}.tar.gz + path: cpp/${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index 1d5b98ad..0970e9f5 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -10,28 +10,28 @@ on: jobs: fullspec: - uses: akuker/RASCSI/.github/workflows/arm_cross_compile.yml@develop + uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop with: connect-type: "FULLSPEC" standard: - uses: akuker/RASCSI/.github/workflows/arm_cross_compile.yml@develop + uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop with: connect-type: "STANDARD" aibom: - uses: akuker/RASCSI/.github/workflows/arm_cross_compile.yml@develop + uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop with: connect-type: "AIBOM" gamernium: - uses: akuker/RASCSI/.github/workflows/arm_cross_compile.yml@develop + uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop with: connect-type: "GAMERNIUM" # The fullspec connection board is the most common debug-fullspec: - uses: akuker/RASCSI/.github/workflows/arm_cross_compile.yml@develop + uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop with: connect-type: "FULLSPEC" - debug-flag: true \ No newline at end of file + debug-flag: true diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index f393c5e6..b70855fb 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -26,25 +26,25 @@ jobs: run: make -j $(nproc) test - name: Run unit tests - run: (set -o pipefail && bin/fullspec/rascsi_test | tee rascsi_test_log.txt) + run: (set -o pipefail && bin/fullspec/piscsi_test | tee piscsi_test_log.txt) - name: Upload logs uses: actions/upload-artifact@v3 with: - name: rascsi_test_log.txt - path: cpp/rascsi_test_log.txt + name: piscsi_test_log.txt + path: cpp/piscsi_test_log.txt sonarcloud: runs-on: ubuntu-22.04 - if: github.repository == 'akuker/RASCSI' + if: github.repository == 'PiSCSI/piscsi' env: SOURCES: cpp BUILD_WRAPPER_OUT_DIR: "$HOME/.build_wrapper_out" # Directory where build-wrapper output will be placed SONAR_SCANNER_VERSION: 4.7.0.2747 SONAR_SERVER_URL: "https://sonarcloud.io" SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_PROJECT_KEY: "akuker_RASCSI" - SONAR_ORGANIZATION: "rascsi" + SONAR_PROJECT_KEY: "akuker_PISCSI" + SONAR_ORGANIZATION: "piscsi" steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/rpi_image_creation.yml.old b/.github/workflows/rpi_image_creation.yml.old index 873223d9..5b66388d 100644 --- a/.github/workflows/rpi_image_creation.yml.old +++ b/.github/workflows/rpi_image_creation.yml.old @@ -1,4 +1,4 @@ -name: Generate a RaSCSI OS image, based upon the official Rapsberry Pi OS +name: Generate a PiSCSI OS image, based upon the official Rapsberry Pi OS # Controls when the workflow will run on: @@ -22,13 +22,13 @@ jobs: # TODO: I don't think this step is needed.... steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Checkout RaSCSI + - name: Checkout PiSCSI uses: actions/checkout@v2 with: - path: RASCSI + path: PISCSI # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Checkout RaSCSI + - name: Checkout PiSCSI uses: actions/checkout@v2 with: repository: akuker/pi-gen @@ -40,8 +40,8 @@ jobs: - name: Configure the build run: | echo ----------------------------------------------------- - echo "IMG_NAME=RaSCSI-$GITHUB_RUN_ID" > config - echo "TARGET_HOSTNAME=rascsi" >> config + echo "IMG_NAME=PiSCSI-$GITHUB_RUN_ID" > config + echo "TARGET_HOSTNAME=piscsi" >> config echo "ENABLE_SSH=1" >> config echo "LOCALE_DEFAULT=en_US.UTF-8" >> config echo "KEYBOARD_KEYMAP=us" >> config diff --git a/.gitignore b/.gitignore index 69cd97f5..fe12e53b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ core __pycache__ current rascsi_interface_pb2.py +piscsi_interface_pb2.py messages.pot messages.mo report.xml diff --git a/LICENSE b/LICENSE index 3960dd7b..47b870cb 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ BSD 3-Clause License Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) Copyright (C) 2014-2020 GIMONS Copyright (c) 2020-2021 akuker -Copyright (c) RaSCSI project contributors (github.com/akuker/rascsi) +Copyright (c) PiSCSI project contributors (github.com/PiSCSI/piscsi) All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index f11b784f..bda9ca1b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# What is RaSCSI Reloaded? -RaSCSI Reloaded is a virtual SCSI device emulator that runs on a Raspberry Pi. It runs in userspace, and can emulate several SCSI devices at one time. There is a control interface to attach / detach drives during runtime, as well as insert and eject removable media. This project is aimed at users of vintage Macintosh and Atari computers and more (see [compatibility list](https://github.com/akuker/RASCSI/wiki/Compatibility)) from the 1980's and 1990's. +# What is PiSCSI? +PiSCSI is a virtual SCSI device emulator that runs on a Raspberry Pi. It runs in userspace, and can emulate several SCSI devices at one time. There is a control interface to attach / detach drives during runtime, as well as insert and eject removable media. This project is aimed at users of vintage Macintosh and Atari computers and more (see [compatibility list](https://github.com/PiSCSI/piscsi/wiki/Compatibility)) from the 1980's and 1990's. -Please check out the full story with much more detail on the [wiki](https://github.com/akuker/RASCSI/wiki)! +Please check out the full story with much more detail on the [wiki](https://github.com/PiSCSI/piscsi/wiki)! # How do I contribute? -RaSCSI Reloaded is using the Gitflow Workflow. A quick overview: +PiSCSI is using the Gitflow Workflow. A quick overview: - The *master* branch should always reflect the contents of the last stable release - The *develop* branch should contain the latest tested & approved updates. Pull requests should be used to merge changes into develop. @@ -13,11 +13,11 @@ RaSCSI Reloaded is using the GitHub Forking and Pull Request workflow to create your own fork where you can make changes, and then contribute it back to the project. Please remember to always make Pull Requests against the *develop* branch. +When you are ready to contribute code to PiSCSI, follow the GitHub Forking and Pull Request workflow to create your own fork where you can make changes, and then contribute it back to the project. Please remember to always make Pull Requests against the *develop* branch. -If you want to add a new translation, or improve upon an existing one, please follow the instructions in the Web Interface README. Once the translation is complete, please use the same workflow as above to contribute it to the project. +If you want to add a new translation, or improve upon an existing one, please follow the instructions in the Web Interface README. Once the translation is complete, please use the same workflow as above to contribute it to the project. -I sell on Tindie[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=akuker_RASCSI) +I sell on Tindie[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=akuker_PISCSI) # GitHub Sponsors Thank you to all of the GitHub sponsors who support the development community! diff --git a/cpp/.gitignore b/cpp/.gitignore index 813de54d..4efdbaa3 100644 --- a/cpp/.gitignore +++ b/cpp/.gitignore @@ -7,7 +7,7 @@ *.vcd *.json *.html -rascsi.dat +piscsi.dat obj bin coverage diff --git a/cpp/Makefile b/cpp/Makefile index 4640b41f..e700a5e6 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -41,7 +41,7 @@ ifeq "$(GCCVERSION10)" "1" endif -## CONNECT_TYPE=FULLSPEC : Specify the type of RaSCSI board type +## CONNECT_TYPE=FULLSPEC : Specify the type of PiSCSI board type ## that you are using. The typical options are ## STANDARD or FULLSPEC. The default is FULLSPEC ## * THIS IS TYPICALLY THE ONLY COMPILE OPTION YOU @@ -53,90 +53,90 @@ ifdef CONNECT_TYPE CXXFLAGS += -DCONNECT_TYPE_$(CONNECT_TYPE) endif -RASCSI = rascsi -RASCTL = rasctl -RASDUMP = rasdump +PISCSI = piscsi +SCSICTL = scsictl +SCSIDUMP = scsidump SCSIMON = scsimon -RASCSI_TEST = rascsi_test +PISCSI_TEST = piscsi_test SCSILOOP = scsiloop -SYSTEMD_CONF = /etc/systemd/system/rascsi.service -RSYSLOG_CONF = /etc/rsyslog.d/rascsi.conf -RSYSLOG_LOG = /var/log/rascsi.log +SYSTEMD_CONF = /etc/systemd/system/piscsi.service +RSYSLOG_CONF = /etc/rsyslog.d/piscsi.conf +RSYSLOG_LOG = /var/log/piscsi.log USR_LOCAL_BIN = /usr/local/bin MAN_PAGE_DIR = /usr/local/man/man1 DOC_DIR = ../doc COVERAGE_DIR = coverage -COVERAGE_FILE = rascsi.dat +COVERAGE_FILE = piscsi.dat OS_FILES = os_integration OBJDIR := obj/$(shell echo $(CONNECT_TYPE) | tr '[:upper:]' '[:lower:]') BINDIR := bin/$(shell echo $(CONNECT_TYPE) | tr '[:upper:]' '[:lower:]') BIN_ALL = \ - $(BINDIR)/$(RASCSI) \ - $(BINDIR)/$(RASCTL) \ + $(BINDIR)/$(PISCSI) \ + $(BINDIR)/$(SCSICTL) \ $(BINDIR)/$(SCSIMON) \ - $(BINDIR)/$(RASDUMP) \ + $(BINDIR)/$(SCSIDUMP) \ $(BINDIR)/$(SCSILOOP) -SRC_PROTOC = rascsi_interface.proto +SRC_PROTOC = piscsi_interface.proto -SRC_GENERATED = $(GENERATED_DIR)/rascsi_interface.pb.cpp +SRC_GENERATED = $(GENERATED_DIR)/piscsi_interface.pb.cpp SRC_PROTOBUF = \ shared/protobuf_util.cpp \ shared/protobuf_serializer.cpp SRC_SHARED = \ - shared/rascsi_version.cpp \ - shared/rasutil.cpp + shared/piscsi_version.cpp \ + shared/piscsi_util.cpp -SRC_RASCSI_CORE = $(shell find ./rascsi -name '*.cpp') -SRC_RASCSI_CORE += $(shell find ./controllers -name '*.cpp') -SRC_RASCSI_CORE += $(shell find ./devices -name '*.cpp') -SRC_RASCSI_CORE += $(shell find ./hal -name '*.cpp') +SRC_PISCSI_CORE = $(shell find ./piscsi -name '*.cpp') +SRC_PISCSI_CORE += $(shell find ./controllers -name '*.cpp') +SRC_PISCSI_CORE += $(shell find ./devices -name '*.cpp') +SRC_PISCSI_CORE += $(shell find ./hal -name '*.cpp') -SRC_RASCSI = rascsi.cpp +SRC_PISCSI = piscsi.cpp SRC_SCSIMON = scsimon.cpp SRC_SCSIMON += $(shell find ./monitor -name '*.cpp') SRC_SCSIMON += $(shell find ./hal -name '*.cpp') -SRC_RASCTL_CORE = $(shell find ./rasctl -name '*.cpp') +SRC_SCSICTL_CORE = $(shell find ./scsictl -name '*.cpp') -SRC_RASCTL = rasctl.cpp +SRC_SCSICTL = scsictl.cpp -SRC_RASDUMP = rasdump.cpp -SRC_RASDUMP += $(shell find ./rasdump -name '*.cpp') -SRC_RASDUMP += $(shell find ./hal -name '*.cpp') +SRC_SCSIDUMP = scsidump.cpp +SRC_SCSIDUMP += $(shell find ./scsidump -name '*.cpp') +SRC_SCSIDUMP += $(shell find ./hal -name '*.cpp') -SRC_RASCSI_TEST = $(shell find ./test -name '*.cpp') -SRC_RASCSI_TEST += $(shell find ./rasdump -name '*.cpp') -SRC_RASCSI_TEST += $(shell find ./monitor -name '*.cpp') +SRC_PISCSI_TEST = $(shell find ./test -name '*.cpp') +SRC_PISCSI_TEST += $(shell find ./scsidump -name '*.cpp') +SRC_PISCSI_TEST += $(shell find ./monitor -name '*.cpp') SRC_SCSILOOP = scsiloop.cpp SRC_SCSILOOP += $(shell find ./scsiloop -name '*.cpp') SRC_SCSILOOP += $(shell find ./hal -name '*.cpp') vpath %.h ./ ./shared ./controllers ./devices ./monitor ./hal \ - ./hal/boards ./hal/pi_defs ./rascsi ./rasctl ./rasdump \ + ./hal/boards ./hal/pi_defs ./piscsi ./scsictl ./scsidump \ ./scsiloop vpath %.cpp ./ ./shared ./controllers ./devices ./monitor ./hal \ - ./hal/boards ./hal/pi_defs ./rascsi ./rasctl ./rasdump \ + ./hal/boards ./hal/pi_defs ./piscsi ./scsictl ./scsidump \ ./scsiloop ./test vpath %.o ./$(OBJDIR) vpath ./$(BINDIR) -OBJ_RASCSI_CORE := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCSI_CORE:%.cpp=%.o))) -OBJ_RASCSI := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCSI:%.cpp=%.o))) -OBJ_RASCTL_CORE := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCTL_CORE:%.cpp=%.o))) -OBJ_RASCTL := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCTL:%.cpp=%.o))) -OBJ_RASDUMP := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASDUMP:%.cpp=%.o))) +OBJ_PISCSI_CORE := $(addprefix $(OBJDIR)/,$(notdir $(SRC_PISCSI_CORE:%.cpp=%.o))) +OBJ_PISCSI := $(addprefix $(OBJDIR)/,$(notdir $(SRC_PISCSI:%.cpp=%.o))) +OBJ_SCSICTL_CORE := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SCSICTL_CORE:%.cpp=%.o))) +OBJ_SCSICTL := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SCSICTL:%.cpp=%.o))) +OBJ_SCSIDUMP := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SCSIDUMP:%.cpp=%.o))) OBJ_SCSIMON := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SCSIMON:%.cpp=%.o))) -OBJ_RASCSI_TEST := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCSI_TEST:%.cpp=%.o))) +OBJ_PISCSI_TEST := $(addprefix $(OBJDIR)/,$(notdir $(SRC_PISCSI_TEST:%.cpp=%.o))) OBJ_SCSILOOP := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SCSILOOP:%.cpp=%.o))) OBJ_SHARED := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SHARED:%.cpp=%.o))) OBJ_PROTOBUF := $(addprefix $(OBJDIR)/,$(notdir $(SRC_PROTOBUF:%.cpp=%.o))) @@ -151,7 +151,7 @@ TEST_WRAPS = -Wl,--wrap=fopen64 # The following will include all of the auto-generated dependency files (*.d) # if they exist. This will trigger a rebuild of a source file if a header changes -ALL_DEPS := $(patsubst %.o,%.d,$(OBJ_RASCSI_CORE) $(OBJ_RASCTL_CORE) $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SCSIMON) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_RASCSI_TEST) $(OBJ_SCSILOOP)) +ALL_DEPS := $(patsubst %.o,%.d,$(OBJ_PISCSI_CORE) $(OBJ_SCSICTL_CORE) $(OBJ_PISCSI) $(OBJ_SCSICTL) $(OBJ_SCSIDUMP) $(OBJ_SCSIMON) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_PISCSI_TEST) $(OBJ_SCSILOOP)) -include $(ALL_DEPS) $(OBJDIR) $(BINDIR): @@ -165,7 +165,7 @@ $(SRC_GENERATED) : $(SRC_PROTOC) @echo "-- Generating protobuf-based source files" mkdir -p $(GENERATED_DIR) protoc --cpp_out=$(GENERATED_DIR) $(SRC_PROTOC) - mv $(GENERATED_DIR)/rascsi_interface.pb.cc $@ + mv $(GENERATED_DIR)/piscsi_interface.pb.cc $@ $(OBJ_GENERATED) : $(SRC_GENERATED) $(CXX) $(CXXFLAGS) -c $< -o $@ @@ -183,46 +183,46 @@ $(OBJ_GENERATED) : $(SRC_GENERATED) .PHONY: all ALL docs test coverage lcov all: $(BIN_ALL) docs -test: $(BINDIR)/$(RASCSI_TEST) - $(BINDIR)/$(RASCSI_TEST) +test: $(BINDIR)/$(PISCSI_TEST) + $(BINDIR)/$(PISCSI_TEST) coverage: CXXFLAGS += --coverage coverage: test lcov: CXXFLAGS += --coverage lcov: test - lcov -q -c -d . --include '*/cpp/*' -o $(COVERAGE_FILE) --exclude '*/test/*' --exclude '*/interfaces/*' --exclude '*/rascsi_interface.pb*' + lcov -q -c -d . --include '*/cpp/*' -o $(COVERAGE_FILE) --exclude '*/test/*' --exclude '*/interfaces/*' --exclude '*/piscsi_interface.pb*' genhtml -q -o $(COVERAGE_DIR) --legend $(COVERAGE_FILE) -docs: $(DOC_DIR)/rascsi_man_page.txt $(DOC_DIR)/rasctl_man_page.txt $(DOC_DIR)/scsimon_man_page.txt $(DOC_DIR)/rasdump_man_page.txt $(DOC_DIR)/scsiloop_man_page.txt +docs: $(DOC_DIR)/piscsi_man_page.txt $(DOC_DIR)/scsictl_man_page.txt $(DOC_DIR)/scsimon_man_page.txt $(DOC_DIR)/scsidump_man_page.txt $(DOC_DIR)/scsiloop_man_page.txt -$(SRC_RASCSI_CORE) $(SRC_RASCTL_CORE) : $(OBJ_GENERATED) +$(SRC_PISCSI_CORE) $(SRC_SCSICTL_CORE) : $(OBJ_GENERATED) -$(BINDIR)/$(RASCSI): $(SRC_GENERATED) $(OBJ_RASCSI_CORE) $(OBJ_RASCSI) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) | $(BINDIR) - $(CXX) $(CXXFLAGS) -o $@ $(OBJ_RASCSI_CORE) $(OBJ_RASCSI) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) -lpthread -lpcap -lprotobuf -lstdc++fs +$(BINDIR)/$(PISCSI): $(SRC_GENERATED) $(OBJ_PISCSI_CORE) $(OBJ_PISCSI) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) | $(BINDIR) + $(CXX) $(CXXFLAGS) -o $@ $(OBJ_PISCSI_CORE) $(OBJ_PISCSI) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) -lpthread -lpcap -lprotobuf -lstdc++fs -$(BINDIR)/$(RASCTL): $(SRC_GENERATED) $(OBJ_RASCTL_CORE) $(OBJ_RASCTL) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) | $(BINDIR) - $(CXX) $(CXXFLAGS) -o $@ $(OBJ_RASCTL_CORE) $(OBJ_RASCTL) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) -lpthread -lprotobuf +$(BINDIR)/$(SCSICTL): $(SRC_GENERATED) $(OBJ_SCSICTL_CORE) $(OBJ_SCSICTL) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) | $(BINDIR) + $(CXX) $(CXXFLAGS) -o $@ $(OBJ_SCSICTL_CORE) $(OBJ_SCSICTL) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) -lpthread -lprotobuf -$(BINDIR)/$(RASDUMP): $(OBJ_RASDUMP) $(OBJ_SHARED) | $(BINDIR) - $(CXX) $(CXXFLAGS) -o $@ $(OBJ_RASDUMP) $(OBJ_SHARED) +$(BINDIR)/$(SCSIDUMP): $(OBJ_SCSIDUMP) $(OBJ_SHARED) | $(BINDIR) + $(CXX) $(CXXFLAGS) -o $@ $(OBJ_SCSIDUMP) $(OBJ_SHARED) $(BINDIR)/$(SCSIMON): $(OBJ_SCSIMON) $(OBJ_SHARED) | $(BINDIR) $(CXX) $(CXXFLAGS) -o $@ $(OBJ_SCSIMON) $(OBJ_SHARED) -$(BINDIR)/$(RASCSI_TEST): $(SRC_GENERATED) $(OBJ_RASCSI_CORE) $(OBJ_RASCTL_CORE) $(OBJ_RASCSI_TEST) $(OBJ_RASCTL_TEST) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) | $(BINDIR) - $(CXX) $(CXXFLAGS) $(TEST_WRAPS) -o $@ $(OBJ_RASCSI_CORE) $(OBJ_RASCTL_CORE) $(OBJ_RASCSI_TEST) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) -lpthread -lpcap -lprotobuf -lstdc++fs -lgmock -lgtest +$(BINDIR)/$(PISCSI_TEST): $(SRC_GENERATED) $(OBJ_PISCSI_CORE) $(OBJ_SCSICTL_CORE) $(OBJ_PISCSI_TEST) $(OBJ_SCSICTL_TEST) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) | $(BINDIR) + $(CXX) $(CXXFLAGS) $(TEST_WRAPS) -o $@ $(OBJ_PISCSI_CORE) $(OBJ_SCSICTL_CORE) $(OBJ_PISCSI_TEST) $(OBJ_SHARED) $(OBJ_PROTOBUF) $(OBJ_GENERATED) -lpthread -lpcap -lprotobuf -lstdc++fs -lgmock -lgtest $(BINDIR)/$(SCSILOOP): $(OBJ_SHARED) $(OBJ_SCSILOOP) | $(BINDIR) $(CXX) $(CXXFLAGS) -o $@ $(OBJ_SHARED) $(OBJ_SCSILOOP) # Phony rules for building individual utilities -.PHONY: $(RASCSI) $(RASCTL) $(RASDUMP) $(SCSIMON) $(RASCSI_TEST) $(SCSILOOP) -$(RASCSI) : $(BINDIR)/$(RASCSI) -$(RASCTL) : $(BINDIR)/$(RASCTL) -$(RASDUMP) : $(BINDIR)/$(RASDUMP) +.PHONY: $(PISCSI) $(SCSICTL) $(SCSIDUMP) $(SCSIMON) $(PISCSI_TEST) $(SCSILOOP) +$(PISCSI) : $(BINDIR)/$(PISCSI) +$(SCSICTL) : $(BINDIR)/$(SCSICTL) +$(SCSIDUMP) : $(BINDIR)/$(SCSIDUMP) $(SCSIMON) : $(BINDIR)/$(SCSIMON) -$(RASCSI_TEST): $(BINDIR)/$(RASCSI_TEST) +$(PISCSI_TEST): $(BINDIR)/$(PISCSI_TEST) $(SCSILOOP) : $(BINDIR)/$(SCSILOOP) ## clean : Remove all of the object files, intermediate @@ -233,28 +233,28 @@ clean: ## install : Copies all of the man pages to the correct location ## Copies the binaries to a global install location -## Configures the Systemd and RSyslog services to auto-run RaSCSI +## Configures the Systemd and RSyslog services to auto-run PiSCSI ## * This target needs to be run with sudo (ex: sudo make install) -## * Before running this, you need to stop the rascsi service if +## * Before running this, you need to stop the piscsi service if ## * it is already running: -## * sudo systemctl stop rascsi +## * sudo systemctl stop piscsi ## * After running this, you will need to reboot or run: ## * sudo systemctl daemon-reload ## * sudo systemctl restart rsyslog -## * sudo systemctl enable rascsi -## * sudo systemctl start rascsi +## * sudo systemctl enable piscsi +## * sudo systemctl start piscsi .PHONY: install install: \ - $(MAN_PAGE_DIR)/rascsi.1 \ - $(MAN_PAGE_DIR)/rasctl.1 \ + $(MAN_PAGE_DIR)/piscsi.1 \ + $(MAN_PAGE_DIR)/scsictl.1 \ $(MAN_PAGE_DIR)/scsimon.1 \ $(MAN_PAGE_DIR)/scsiloop.1 \ - $(MAN_PAGE_DIR)/rasdump.1 \ - $(USR_LOCAL_BIN)/$(RASCTL) \ - $(USR_LOCAL_BIN)/$(RASCSI) \ + $(MAN_PAGE_DIR)/scsidump.1 \ + $(USR_LOCAL_BIN)/$(SCSICTL) \ + $(USR_LOCAL_BIN)/$(PISCSI) \ $(USR_LOCAL_BIN)/$(SCSIMON) \ $(USR_LOCAL_BIN)/$(SCSILOOP) \ - $(USR_LOCAL_BIN)/$(RASDUMP) \ + $(USR_LOCAL_BIN)/$(SCSIDUMP) \ $(SYSTEMD_CONF) \ $(RSYSLOG_CONF) \ $(RSYSLOG_LOG) @@ -283,8 +283,8 @@ $(RSYSLOG_CONF) : $(OS_FILES)/$(notdir $(RSYSLOG_CONF)) $(RSYSLOG_LOG) : @echo "-- Creating $@" - touch /var/log/rascsi.log - chown root:adm /var/log/rascsi.log + touch /var/log/piscsi.log + chown root:adm /var/log/piscsi.log $(MAN_PAGE_DIR)/: echo "-- Creating directory $@" diff --git a/cpp/controllers/abstract_controller.cpp b/cpp/controllers/abstract_controller.cpp index 8b26e9e3..17e91984 100644 --- a/cpp/controllers/abstract_controller.cpp +++ b/cpp/controllers/abstract_controller.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/primary_device.h" #include "abstract_controller.h" diff --git a/cpp/controllers/abstract_controller.h b/cpp/controllers/abstract_controller.h index 3e282225..ae718bbf 100644 --- a/cpp/controllers/abstract_controller.h +++ b/cpp/controllers/abstract_controller.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -30,9 +30,9 @@ public: static inline const int UNKNOWN_INITIATOR_ID = -1; - enum class rascsi_shutdown_mode { + enum class piscsi_shutdown_mode { NONE, - STOP_RASCSI, + STOP_PISCSI, STOP_PI, RESTART_PI }; @@ -49,7 +49,7 @@ public: // Get requested LUN based on IDENTIFY message, with LUN from the CDB as fallback virtual int GetEffectiveLun() const = 0; - virtual void ScheduleShutdown(rascsi_shutdown_mode) = 0; + virtual void ScheduleShutdown(piscsi_shutdown_mode) = 0; int GetTargetId() const { return target_id; } int GetMaxLuns() const { return max_luns; } diff --git a/cpp/controllers/controller_manager.cpp b/cpp/controllers/controller_manager.cpp index a5cbba86..9f877cdb 100644 --- a/cpp/controllers/controller_manager.cpp +++ b/cpp/controllers/controller_manager.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/controllers/controller_manager.h b/cpp/controllers/controller_manager.h index ff55d6c2..dd145e07 100644 --- a/cpp/controllers/controller_manager.h +++ b/cpp/controllers/controller_manager.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/controllers/phase_handler.h b/cpp/controllers/phase_handler.h index 2952aa79..a50adf39 100644 --- a/cpp/controllers/phase_handler.h +++ b/cpp/controllers/phase_handler.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/controllers/scsi_controller.cpp b/cpp/controllers/scsi_controller.cpp index 81bb2891..20aaa136 100644 --- a/cpp/controllers/scsi_controller.cpp +++ b/cpp/controllers/scsi_controller.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) @@ -13,7 +13,7 @@ // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "hal/gpiobus.h" #include "hal/systimer.h" #include "devices/interfaces/byte_writer.h" @@ -108,29 +108,29 @@ void ScsiController::BusFree() SetByteTransfer(false); - if (shutdown_mode != rascsi_shutdown_mode::NONE) { + if (shutdown_mode != piscsi_shutdown_mode::NONE) { // Prepare the shutdown by flushing all caches for (const auto& device : GetControllerManager()->GetAllDevices()) { device->FlushCache(); } } - // When the bus is free RaSCSI or the Pi may be shut down. + // When the bus is free PiSCSI or the Pi may be shut down. // This code has to be executed in the bus free phase and thus has to be located in the controller. switch(shutdown_mode) { - case rascsi_shutdown_mode::STOP_RASCSI: - logger.Info("RaSCSI shutdown requested"); + case piscsi_shutdown_mode::STOP_PISCSI: + logger.Info("PiSCSI shutdown requested"); exit(EXIT_SUCCESS); break; - case rascsi_shutdown_mode::STOP_PI: + case piscsi_shutdown_mode::STOP_PI: logger.Info("Raspberry Pi shutdown requested"); if (system("init 0") == -1) { logger.Error("Raspberry Pi shutdown failed: " + string(strerror(errno))); } break; - case rascsi_shutdown_mode::RESTART_PI: + case piscsi_shutdown_mode::RESTART_PI: logger.Info("Raspberry Pi restart requested"); if (system("init 6") == -1) { logger.Error("Raspberry Pi restart failed: " + string(strerror(errno))); diff --git a/cpp/controllers/scsi_controller.h b/cpp/controllers/scsi_controller.h index 07e339d1..fd5093bc 100644 --- a/cpp/controllers/scsi_controller.h +++ b/cpp/controllers/scsi_controller.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) @@ -83,7 +83,7 @@ public: // e.g. by using ifdef __arm__. Currently the unit tests require this method to be public. virtual void Execute(); - void ScheduleShutdown(rascsi_shutdown_mode mode) override { shutdown_mode = mode; } + void ScheduleShutdown(piscsi_shutdown_mode mode) override { shutdown_mode = mode; } private: @@ -117,6 +117,6 @@ private: scsi_t scsi = {}; - AbstractController::rascsi_shutdown_mode shutdown_mode = AbstractController::rascsi_shutdown_mode::NONE; + AbstractController::piscsi_shutdown_mode shutdown_mode = AbstractController::piscsi_shutdown_mode::NONE; }; diff --git a/cpp/devices/cd_track.cpp b/cpp/devices/cd_track.cpp index 1a389f3b..43852df3 100644 --- a/cpp/devices/cd_track.cpp +++ b/cpp/devices/cd_track.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) diff --git a/cpp/devices/cd_track.h b/cpp/devices/cd_track.h index a980333e..cd712484 100644 --- a/cpp/devices/cd_track.h +++ b/cpp/devices/cd_track.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) diff --git a/cpp/devices/cfilesystem.cpp b/cpp/devices/cfilesystem.cpp index d0cd7e4d..7531c70a 100644 --- a/cpp/devices/cfilesystem.cpp +++ b/cpp/devices/cfilesystem.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/devices/cfilesystem.h b/cpp/devices/cfilesystem.h index 4f893593..8c4c8703 100644 --- a/cpp/devices/cfilesystem.h +++ b/cpp/devices/cfilesystem.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/devices/ctapdriver.cpp b/cpp/devices/ctapdriver.cpp index 10ee7803..2c868e51 100644 --- a/cpp/devices/ctapdriver.cpp +++ b/cpp/devices/ctapdriver.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -10,8 +10,8 @@ //--------------------------------------------------------------------------- #include "shared/log.h" -#include "shared/rasutil.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_util.h" +#include "shared/piscsi_exceptions.h" #include #include #include @@ -28,7 +28,7 @@ #endif using namespace std; -using namespace ras_util; +using namespace piscsi_util; //--------------------------------------------------------------------------- // @@ -60,10 +60,10 @@ CTapDriver::~CTapDriver() if (int br_socket_fd; (br_socket_fd = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0) { LOGERROR("Can't open bridge socket: %s", strerror(errno)) } else { - LOGDEBUG("brctl delif %s ras0", BRIDGE_NAME) - if (!br_setif(br_socket_fd, BRIDGE_NAME, "ras0", false)) { //NOSONAR No exception is raised here - LOGWARN("Warning: Removing ras0 from the bridge failed.") - LOGWARN("You may need to manually remove the ras0 tap device from the bridge") + LOGDEBUG("brctl delif %s piscsi0", BRIDGE_NAME) + if (!br_setif(br_socket_fd, BRIDGE_NAME, "piscsi0", false)) { //NOSONAR No exception is raised here + LOGWARN("Warning: Removing piscsi0 from the bridge failed.") + LOGWARN("You may need to manually remove the piscsi0 tap device from the bridge") } close(br_socket_fd); } @@ -148,7 +148,7 @@ bool CTapDriver::Init(const unordered_map& const_params) // IFF_NO_PI for no extra packet information ifreq ifr = {}; ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - string dev = "ras0"; + string dev = "piscsi0"; strncpy(ifr.ifr_name, dev.c_str(), IFNAMSIZ - 1); LOGTRACE("Going to open %s", ifr.ifr_name) @@ -315,18 +315,18 @@ bool CTapDriver::Init(const unordered_map& const_params) LOGINFO("%s is already available", BRIDGE_NAME) } - LOGTRACE("ip link set ras0 up") + LOGTRACE("ip link set piscsi0 up") - if (!ip_link(ip_fd, "ras0", true)) { + if (!ip_link(ip_fd, "piscsi0", true)) { close(m_hTAP); close(ip_fd); close(br_socket_fd); return false; } - LOGTRACE("brctl addif %s ras0", BRIDGE_NAME) + LOGTRACE("brctl addif %s piscsi0", BRIDGE_NAME) - if (!br_setif(br_socket_fd, BRIDGE_NAME, "ras0", true)) { + if (!br_setif(br_socket_fd, BRIDGE_NAME, "piscsi0", true)) { close(m_hTAP); close(ip_fd); close(br_socket_fd); @@ -378,8 +378,8 @@ void CTapDriver::OpenDump(const string& path) { bool CTapDriver::Enable() const { const int fd = socket(PF_INET, SOCK_DGRAM, 0); - LOGDEBUG("%s: ip link set ras0 up", __PRETTY_FUNCTION__) - const bool result = ip_link(fd, "ras0", true); + LOGDEBUG("%s: ip link set piscsi0 up", __PRETTY_FUNCTION__) + const bool result = ip_link(fd, "piscsi0", true); close(fd); return result; } @@ -387,8 +387,8 @@ bool CTapDriver::Enable() const bool CTapDriver::Disable() const { const int fd = socket(PF_INET, SOCK_DGRAM, 0); - LOGDEBUG("%s: ip link set ras0 down", __PRETTY_FUNCTION__) - const bool result = ip_link(fd, "ras0", false); + LOGDEBUG("%s: ip link set piscsi0 down", __PRETTY_FUNCTION__) + const bool result = ip_link(fd, "piscsi0", false); close(fd); return result; } diff --git a/cpp/devices/ctapdriver.h b/cpp/devices/ctapdriver.h index 40bb928a..bb3bc371 100644 --- a/cpp/devices/ctapdriver.h +++ b/cpp/devices/ctapdriver.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -22,7 +22,7 @@ using namespace std; class CTapDriver { - static constexpr const char *BRIDGE_NAME = "rascsi_bridge"; + static constexpr const char *BRIDGE_NAME = "piscsi_bridge"; public: @@ -37,8 +37,8 @@ public: int Receive(uint8_t *buf); int Send(const uint8_t *buf, int len); bool PendingPackets() const; // Check if there are IP packets available - bool Enable() const; // Enable the ras0 interface - bool Disable() const; // Disable the ras0 interface + bool Enable() const; // Enable the piscsi0 interface + bool Disable() const; // Disable the piscsi0 interface void Flush(); // Purge all of the packets that are waiting to be processed static uint32_t Crc32(const uint8_t *, int); diff --git a/cpp/devices/device.cpp b/cpp/devices/device.cpp index b692b57c..2aedf5d9 100644 --- a/cpp/devices/device.cpp +++ b/cpp/devices/device.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "shared/rascsi_version.h" +#include "shared/piscsi_version.h" #include "device.h" #include #include @@ -18,7 +18,7 @@ using namespace std; Device::Device(PbDeviceType type, int lun) : type(type), lun(lun) { ostringstream os; - os << setw(2) << setfill('0') << rascsi_major_version << setw(2) << setfill('0') << rascsi_minor_version; + os << setw(2) << setfill('0') << piscsi_major_version << setw(2) << setfill('0') << piscsi_minor_version; revision = os.str(); } diff --git a/cpp/devices/device.h b/cpp/devices/device.h index 1d554bf9..f971bc9d 100644 --- a/cpp/devices/device.h +++ b/cpp/devices/device.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -10,16 +10,16 @@ #pragma once #include "shared/log.h" -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; class Device //NOSONAR The number of fields and methods is justified, the complexity is low { - const string DEFAULT_VENDOR = "RaSCSI"; + const string DEFAULT_VENDOR = "PiSCSI"; PbDeviceType type; diff --git a/cpp/devices/device_factory.cpp b/cpp/devices/device_factory.cpp index a16f0ab2..85e978ed 100644 --- a/cpp/devices/device_factory.cpp +++ b/cpp/devices/device_factory.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "shared/rasutil.h" +#include "shared/piscsi_util.h" #include "scsihd.h" #include "scsihd_nec.h" #include "scsimo.h" @@ -24,8 +24,8 @@ #include using namespace std; -using namespace rascsi_interface; -using namespace ras_util; +using namespace piscsi_interface; +using namespace piscsi_util; DeviceFactory::DeviceFactory() { @@ -139,7 +139,7 @@ shared_ptr DeviceFactory::CreateDevice(PbDeviceType type, int lun case SCHS: device = make_shared(lun); // Since this is an emulation for a specific device the full INQUIRY data have to be set accordingly - device->SetVendor("RaSCSI"); + device->SetVendor("PiSCSI"); device->SetProduct("Host Services"); break; @@ -179,7 +179,7 @@ vector DeviceFactory::GetNetworkInterfaces() const while (tmp) { if (tmp->ifa_addr && tmp->ifa_addr->sa_family == AF_PACKET && - strcmp(tmp->ifa_name, "lo") && strcmp(tmp->ifa_name, "rascsi_bridge")) { + strcmp(tmp->ifa_name, "lo") && strcmp(tmp->ifa_name, "piscsi_bridge")) { const int fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); ifreq ifr = {}; diff --git a/cpp/devices/device_factory.h b/cpp/devices/device_factory.h index 5ae023f7..a2865d88 100644 --- a/cpp/devices/device_factory.h +++ b/cpp/devices/device_factory.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -15,10 +15,10 @@ #include #include #include -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; class PrimaryDevice; diff --git a/cpp/devices/device_logger.cpp b/cpp/devices/device_logger.cpp index 2fc739b9..98c6d8d3 100644 --- a/cpp/devices/device_logger.cpp +++ b/cpp/devices/device_logger.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/devices/device_logger.h b/cpp/devices/device_logger.h index 0f699b73..fb5b8f7a 100644 --- a/cpp/devices/device_logger.h +++ b/cpp/devices/device_logger.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/devices/disk.cpp b/cpp/devices/disk.cpp index 3e2c906e..63574ad3 100644 --- a/cpp/devices/disk.cpp +++ b/cpp/devices/disk.cpp @@ -14,7 +14,7 @@ // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "disk.h" #include diff --git a/cpp/devices/host_services.cpp b/cpp/devices/host_services.cpp index bd5aa10a..5cb74b9a 100644 --- a/cpp/devices/host_services.cpp +++ b/cpp/devices/host_services.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -14,13 +14,13 @@ // // 1. Vendor-specific mode page 0x20 returns the current date and time, see mode_page_datetime // -// 2. START/STOP UNIT shuts down RaSCSI or shuts down/reboots the Raspberry Pi -// a) !start && !load (STOP): Shut down RaSCSI +// 2. START/STOP UNIT shuts down PiSCSI or shuts down/reboots the Raspberry Pi +// a) !start && !load (STOP): Shut down PiSCSI // b) !start && load (EJECT): Shut down the Raspberry Pi // c) start && load (LOAD): Reboot the Raspberry Pi // -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/scsi_controller.h" #include "scsi_command_util.h" #include "host_services.h" @@ -59,14 +59,14 @@ void HostServices::StartStopUnit() const if (!start) { if (load) { - GetController()->ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_PI); + GetController()->ScheduleShutdown(AbstractController::piscsi_shutdown_mode::STOP_PI); } else { - GetController()->ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_RASCSI); + GetController()->ScheduleShutdown(AbstractController::piscsi_shutdown_mode::STOP_PISCSI); } } else if (load) { - GetController()->ScheduleShutdown(AbstractController::rascsi_shutdown_mode::RESTART_PI); + GetController()->ScheduleShutdown(AbstractController::piscsi_shutdown_mode::RESTART_PI); } else { throw scsi_exception(sense_key::ILLEGAL_REQUEST, asc::INVALID_FIELD_IN_CDB); diff --git a/cpp/devices/host_services.h b/cpp/devices/host_services.h index 5beb7b47..a269b2ac 100644 --- a/cpp/devices/host_services.h +++ b/cpp/devices/host_services.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/devices/interfaces/byte_writer.h b/cpp/devices/interfaces/byte_writer.h index f23a1725..bfbfa5ee 100644 --- a/cpp/devices/interfaces/byte_writer.h +++ b/cpp/devices/interfaces/byte_writer.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/devices/interfaces/scsi_block_commands.h b/cpp/devices/interfaces/scsi_block_commands.h index 7441ce8e..6fa8550f 100644 --- a/cpp/devices/interfaces/scsi_block_commands.h +++ b/cpp/devices/interfaces/scsi_block_commands.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet diff --git a/cpp/devices/interfaces/scsi_mmc_commands.h b/cpp/devices/interfaces/scsi_mmc_commands.h index d8f161e3..08a41c30 100644 --- a/cpp/devices/interfaces/scsi_mmc_commands.h +++ b/cpp/devices/interfaces/scsi_mmc_commands.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet diff --git a/cpp/devices/interfaces/scsi_primary_commands.h b/cpp/devices/interfaces/scsi_primary_commands.h index 1a9ca6dd..558a0353 100644 --- a/cpp/devices/interfaces/scsi_primary_commands.h +++ b/cpp/devices/interfaces/scsi_primary_commands.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -24,7 +24,7 @@ public: virtual void Inquiry() = 0; virtual void ReportLuns() = 0; - // Optional commands implemented by all RaSCSI device types + // Optional commands implemented by all PiSCSI device types virtual void RequestSense() = 0; virtual void ReleaseUnit() = 0; virtual void ReserveUnit() = 0; diff --git a/cpp/devices/interfaces/scsi_printer_commands.h b/cpp/devices/interfaces/scsi_printer_commands.h index 178e0745..b3442ad5 100644 --- a/cpp/devices/interfaces/scsi_printer_commands.h +++ b/cpp/devices/interfaces/scsi_printer_commands.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet diff --git a/cpp/devices/mode_page_device.cpp b/cpp/devices/mode_page_device.cpp index 6803b149..bb292097 100644 --- a/cpp/devices/mode_page_device.cpp +++ b/cpp/devices/mode_page_device.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,7 +9,7 @@ // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "mode_page_device.h" #include diff --git a/cpp/devices/mode_page_device.h b/cpp/devices/mode_page_device.h index ac8cd07e..e8fc06d7 100644 --- a/cpp/devices/mode_page_device.h +++ b/cpp/devices/mode_page_device.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/devices/primary_device.cpp b/cpp/devices/primary_device.cpp index e7d49595..10989167 100644 --- a/cpp/devices/primary_device.cpp +++ b/cpp/devices/primary_device.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "primary_device.h" #include @@ -24,7 +24,7 @@ bool PrimaryDevice::Init(const unordered_map& params) AddCommand(scsi_command::eCmdInquiry, [this] { Inquiry(); }); AddCommand(scsi_command::eCmdReportLuns, [this] { ReportLuns(); }); - // Optional commands supported by all RaSCSI devices + // Optional commands supported by all PiSCSI devices AddCommand(scsi_command::eCmdRequestSense, [this] { RequestSense(); }); AddCommand(scsi_command::eCmdReserve6, [this] { ReserveUnit(); }); AddCommand(scsi_command::eCmdRelease6, [this] { ReleaseUnit(); }); diff --git a/cpp/devices/primary_device.h b/cpp/devices/primary_device.h index ade76347..e8b10bf1 100644 --- a/cpp/devices/primary_device.h +++ b/cpp/devices/primary_device.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/devices/scsi_command_util.cpp b/cpp/devices/scsi_command_util.cpp index c8f1e48f..346bdf6f 100644 --- a/cpp/devices/scsi_command_util.cpp +++ b/cpp/devices/scsi_command_util.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "device_logger.h" #include "scsi_command_util.h" #include @@ -54,9 +54,9 @@ void scsi_command_util::ModeSelect(const DeviceLogger& logger, scsi_command cmd, // drives support this, e.g FUJITSU M2624S // We are fine as long as the current sector size remains unchanged if (GetInt16(buf, offset + 12) != sector_size) { - // With rascsi it is not possible to permanently (by formatting) change the sector size, + // With piscsi it is not possible to permanently (by formatting) change the sector size, // because the size is an externally configurable setting only - logger.Warn("In order to change the sector size use the -b option when launching rascsi"); + logger.Warn("In order to change the sector size use the -b option when launching piscsi"); throw scsi_exception(sense_key::ILLEGAL_REQUEST, asc::INVALID_FIELD_IN_PARAMETER_LIST); } diff --git a/cpp/devices/scsi_command_util.h b/cpp/devices/scsi_command_util.h index 3aef09ae..bc688252 100644 --- a/cpp/devices/scsi_command_util.h +++ b/cpp/devices/scsi_command_util.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/devices/scsi_daynaport.cpp b/cpp/devices/scsi_daynaport.cpp index 7374f9c2..1fab6e6e 100644 --- a/cpp/devices/scsi_daynaport.cpp +++ b/cpp/devices/scsi_daynaport.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2020 akuker @@ -19,12 +19,12 @@ // // Additional documentation and clarification is available at the // following link: -// - https://github.com/akuker/RASCSI/wiki/Dayna-Port-SCSI-Link +// - https://github.com/PiSCSI/piscsi/wiki/Dayna-Port-SCSI-Link // // Note: This requires a DaynaPort SCSI Link driver. //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "scsi_daynaport.h" #include @@ -208,7 +208,7 @@ int SCSIDaynaPort::Read(const vector& cdb, vector& buf, uint64_t) // } int size = rx_packet_size; if (size < 64) { - // A frame must have at least 64 bytes (see https://github.com/akuker/RASCSI/issues/619) + // A frame must have at least 64 bytes (see https://github.com/PiSCSI/piscsi/issues/619) // Note that this work-around breaks the checksum. As currently there are no known drivers // that care for the checksum, and the Daynaport driver for the Atari expects frames of // 64 bytes it was decided to accept the broken checksum. If a driver should pop up that diff --git a/cpp/devices/scsi_daynaport.h b/cpp/devices/scsi_daynaport.h index 64630133..f0ca53f4 100644 --- a/cpp/devices/scsi_daynaport.h +++ b/cpp/devices/scsi_daynaport.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2020 akuker @@ -107,7 +107,7 @@ private: }; scsi_resp_link_stats_t m_scsi_link_stats = { - // TODO Remove this hard-coded MAC address, see https://github.com/akuker/RASCSI/issues/598 + // TODO Remove this hard-coded MAC address, see https://github.com/PiSCSI/piscsi/issues/598 .mac_address = { byte{0x00}, byte{0x80}, byte{0x19}, byte{0x10}, byte{0x98}, byte{0xe3} }, .frame_alignment_errors = 0, .crc_errors = 0, diff --git a/cpp/devices/scsi_host_bridge.cpp b/cpp/devices/scsi_host_bridge.cpp index beb921cd..6e2038c8 100644 --- a/cpp/devices/scsi_host_bridge.cpp +++ b/cpp/devices/scsi_host_bridge.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) @@ -16,7 +16,7 @@ // work with the Sharp X68000 operating system. //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "scsi_host_bridge.h" #include diff --git a/cpp/devices/scsi_host_bridge.h b/cpp/devices/scsi_host_bridge.h index 92a8b24a..e5f2dbcd 100644 --- a/cpp/devices/scsi_host_bridge.h +++ b/cpp/devices/scsi_host_bridge.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) diff --git a/cpp/devices/scsi_printer.cpp b/cpp/devices/scsi_printer.cpp index 29b21587..23046ee4 100644 --- a/cpp/devices/scsi_printer.cpp +++ b/cpp/devices/scsi_printer.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -29,7 +29,7 @@ // With STOP PRINT printing can be cancelled before SYNCHRONIZE BUFFER was sent. // -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "scsi_printer.h" #include diff --git a/cpp/devices/scsi_printer.h b/cpp/devices/scsi_printer.h index 43a6c62b..bbad49d1 100644 --- a/cpp/devices/scsi_printer.h +++ b/cpp/devices/scsi_printer.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -22,7 +22,7 @@ class SCSIPrinter : public PrimaryDevice, private ScsiPrinterCommands { static const int NOT_RESERVED = -2; - static constexpr const char *PRINTER_FILE_PATTERN = "/rascsi_sclp-XXXXXX"; + static constexpr const char *PRINTER_FILE_PATTERN = "/piscsi_sclp-XXXXXX"; public: diff --git a/cpp/devices/scsicd.cpp b/cpp/devices/scsicd.cpp index 3cd74178..a39d3a66 100644 --- a/cpp/devices/scsicd.cpp +++ b/cpp/devices/scsicd.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) @@ -14,7 +14,7 @@ // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "scsicd.h" #include diff --git a/cpp/devices/scsicd.h b/cpp/devices/scsicd.h index ab29e690..1263a14e 100644 --- a/cpp/devices/scsicd.h +++ b/cpp/devices/scsicd.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) diff --git a/cpp/devices/scsihd.cpp b/cpp/devices/scsihd.cpp index 6ad819a7..9a8fb216 100644 --- a/cpp/devices/scsihd.cpp +++ b/cpp/devices/scsihd.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) @@ -13,7 +13,7 @@ // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsihd.h" #include "scsi_command_util.h" diff --git a/cpp/devices/scsihd.h b/cpp/devices/scsihd.h index a3c747be..44cef7ed 100644 --- a/cpp/devices/scsihd.h +++ b/cpp/devices/scsihd.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) diff --git a/cpp/devices/scsihd_nec.cpp b/cpp/devices/scsihd_nec.cpp index bd002d46..4a50d8a0 100644 --- a/cpp/devices/scsihd_nec.cpp +++ b/cpp/devices/scsihd_nec.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) @@ -12,13 +12,13 @@ // //--------------------------------------------------------------------------- -#include "shared/rasutil.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_util.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "scsihd_nec.h" #include -using namespace ras_util; +using namespace piscsi_util; using namespace scsi_command_util; void SCSIHD_NEC::Open() diff --git a/cpp/devices/scsihd_nec.h b/cpp/devices/scsihd_nec.h index 423ecdcb..ce710347 100644 --- a/cpp/devices/scsihd_nec.h +++ b/cpp/devices/scsihd_nec.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) diff --git a/cpp/devices/scsimo.cpp b/cpp/devices/scsimo.cpp index 3329bea1..2eed267d 100644 --- a/cpp/devices/scsimo.cpp +++ b/cpp/devices/scsimo.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) @@ -12,7 +12,7 @@ // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "scsi_command_util.h" #include "scsimo.h" diff --git a/cpp/devices/scsimo.h b/cpp/devices/scsimo.h index d6b24546..c3253efc 100644 --- a/cpp/devices/scsimo.h +++ b/cpp/devices/scsimo.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) diff --git a/cpp/devices/storage_device.cpp b/cpp/devices/storage_device.cpp index aecad900..991c1073 100644 --- a/cpp/devices/storage_device.cpp +++ b/cpp/devices/storage_device.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "storage_device.h" #include #include @@ -36,7 +36,7 @@ void StorageDevice::ValidateFile() throw io_exception("Drive capacity cannot exceed 2 TiB"); } - // TODO Check for duplicate handling of these properties (-> rascsi_executor.cpp) + // TODO Check for duplicate handling of these properties (-> piscsi_executor.cpp) if (access(filename.c_str(), W_OK)) { // Permanently write-protected SetReadOnly(true); diff --git a/cpp/devices/storage_device.h b/cpp/devices/storage_device.h index 83f40fbd..10c6b37a 100644 --- a/cpp/devices/storage_device.h +++ b/cpp/devices/storage_device.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/hal/connection_type/connection_aibom.h b/cpp/hal/connection_type/connection_aibom.h index ad7723e4..0dd3c314 100644 --- a/cpp/hal/connection_type/connection_aibom.h +++ b/cpp/hal/connection_type/connection_aibom.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -84,4 +84,4 @@ const static int BPI_PIN_MSG = BPI_M2P_21; // MSG const static int BPI_PIN_CD = BPI_M2P_23; // CD const static int BPI_PIN_IO = BPI_M2P_16; // IO const static int BPI_PIN_BSY = BPI_M2P_18; // BSY -const static int BPI_PIN_SEL = BPI_M2P_24; // SEL \ No newline at end of file +const static int BPI_PIN_SEL = BPI_M2P_24; // SEL diff --git a/cpp/hal/connection_type/connection_fullspec.h b/cpp/hal/connection_type/connection_fullspec.h index 298d3f77..b5e706f2 100644 --- a/cpp/hal/connection_type/connection_fullspec.h +++ b/cpp/hal/connection_type/connection_fullspec.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -14,7 +14,7 @@ #include // -// RaSCSI standard (SCSI logic, standard pin assignment) +// PiSCSI standard (SCSI logic, standard pin assignment) // const std::string CONNECT_DESC = "FULLSPEC"; // Startup message diff --git a/cpp/hal/connection_type/connection_gamernium.h b/cpp/hal/connection_type/connection_gamernium.h index 452fd0ac..eeeb4a5d 100644 --- a/cpp/hal/connection_type/connection_gamernium.h +++ b/cpp/hal/connection_type/connection_gamernium.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/connection_type/connection_standard.h b/cpp/hal/connection_type/connection_standard.h index d3c2ed0d..fdde2784 100644 --- a/cpp/hal/connection_type/connection_standard.h +++ b/cpp/hal/connection_type/connection_standard.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -14,7 +14,7 @@ #include // -// RaSCSI standard (SCSI logic, standard pin assignment) +// PiSCSI standard (SCSI logic, standard pin assignment) // const std::string CONNECT_DESC = "STANDARD"; // Startup message diff --git a/cpp/hal/data_sample.cpp b/cpp/hal/data_sample.cpp index 9582e995..fd9dfaeb 100644 --- a/cpp/hal/data_sample.cpp +++ b/cpp/hal/data_sample.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/data_sample.h b/cpp/hal/data_sample.h index f3361029..189c519d 100644 --- a/cpp/hal/data_sample.h +++ b/cpp/hal/data_sample.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/data_sample_bananam2p.cpp b/cpp/hal/data_sample_bananam2p.cpp index 2e329f83..8e00c15b 100644 --- a/cpp/hal/data_sample_bananam2p.cpp +++ b/cpp/hal/data_sample_bananam2p.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/data_sample_bananam2p.h b/cpp/hal/data_sample_bananam2p.h index 983f2acb..35f04ee6 100644 --- a/cpp/hal/data_sample_bananam2p.h +++ b/cpp/hal/data_sample_bananam2p.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/data_sample_raspberry.cpp b/cpp/hal/data_sample_raspberry.cpp index 523e1f87..9634a912 100644 --- a/cpp/hal/data_sample_raspberry.cpp +++ b/cpp/hal/data_sample_raspberry.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/data_sample_raspberry.h b/cpp/hal/data_sample_raspberry.h index 9a40a958..a0b5e1e7 100644 --- a/cpp/hal/data_sample_raspberry.h +++ b/cpp/hal/data_sample_raspberry.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/gpiobus.cpp b/cpp/hal/gpiobus.cpp index 2e36dc2e..e028883c 100644 --- a/cpp/hal/gpiobus.cpp +++ b/cpp/hal/gpiobus.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -87,7 +87,7 @@ int GPIOBUS::CommandHandShake(vector &buf) // UltraSatan or GigaFile) that can directly be connected to the Atari's ACSI port also support ICD // semantics. I fact, these semantics have become a standard in the Atari world. - // RaSCSI becomes ICD compatible by ignoring the prepended $1F byte before processing the CDB. + // PiSCSI becomes ICD compatible by ignoring the prepended $1F byte before processing the CDB. if (buf[0] == 0x1F) { SetREQ(ON); diff --git a/cpp/hal/gpiobus.h b/cpp/hal/gpiobus.h index cb8086c1..f7f927b4 100644 --- a/cpp/hal/gpiobus.h +++ b/cpp/hal/gpiobus.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -74,7 +74,7 @@ using namespace std; // False : 3.3V -> (CONVERT) -> Open collector output // // 2:Positive logic specification (when using the conversion board for positive logic -> SCSI logic) -// RaSCSI Adapter Rev.C @132sync etc. +// PiSCSI Adapter Rev.C @132sync etc. // // True : 3.3V -> (CONVERT) -> 0V // False : 0V -> (CONVERT) -> Open collector output diff --git a/cpp/hal/gpiobus_bananam2p.cpp b/cpp/hal/gpiobus_bananam2p.cpp index b497589a..9ff30ac8 100644 --- a/cpp/hal/gpiobus_bananam2p.cpp +++ b/cpp/hal/gpiobus_bananam2p.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi (And Banana Pi) // // Copyright (c) 2012-2015 Ben Croston @@ -277,13 +277,13 @@ bool GPIOBUS_BananaM2p::SetupSelEvent() int gpio_fd = open(gpio_dev.c_str(), 0); if (gpio_fd == -1) { - LOGERROR("Unable to open /dev/gpiochip0. Is RaSCSI already running?") + LOGERROR("Unable to open /dev/gpiochip0. Is PiSCSI or RaSCSI already running?") return false; } // Event request setting LOGTRACE("%s Event request setting (pin sel: %d)", __PRETTY_FUNCTION__, gpio_pin) - strncpy(selevreq.consumer_label, "RaSCSI", ARRAY_SIZE(selevreq.consumer_label)); + strncpy(selevreq.consumer_label, "PiSCSI", ARRAY_SIZE(selevreq.consumer_label)); selevreq.lineoffset = gpio_pin; selevreq.handleflags = GPIOHANDLE_REQUEST_INPUT; #if SIGNAL_CONTROL_MODE < 2 @@ -297,7 +297,7 @@ bool GPIOBUS_BananaM2p::SetupSelEvent() // Get event request if (ioctl(gpio_fd, GPIO_GET_LINEEVENT_IOCTL, &selevreq) == -1) { LOGERROR("selevreq.fd = %d %08X", selevreq.fd, (unsigned int)selevreq.fd) - LOGERROR("Unable to register event request. Is RaSCSI already running?") + LOGERROR("Unable to register event request. Is PiSCSI or RaSCSI already running?") LOGERROR("[%08X] %s", errno, strerror(errno)) close(gpio_fd); return false; diff --git a/cpp/hal/gpiobus_bananam2p.h b/cpp/hal/gpiobus_bananam2p.h index 629950fa..db99364f 100644 --- a/cpp/hal/gpiobus_bananam2p.h +++ b/cpp/hal/gpiobus_bananam2p.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/gpiobus_factory.cpp b/cpp/hal/gpiobus_factory.cpp index 46a442ee..30293e31 100644 --- a/cpp/hal/gpiobus_factory.cpp +++ b/cpp/hal/gpiobus_factory.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/gpiobus_factory.h b/cpp/hal/gpiobus_factory.h index 6e173ad7..837d9c4d 100644 --- a/cpp/hal/gpiobus_factory.h +++ b/cpp/hal/gpiobus_factory.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/gpiobus_raspberry.cpp b/cpp/hal/gpiobus_raspberry.cpp index d020bcdb..757edc3b 100644 --- a/cpp/hal/gpiobus_raspberry.cpp +++ b/cpp/hal/gpiobus_raspberry.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -183,12 +183,12 @@ bool GPIOBUS_Raspberry::Init(mode_e mode) // GPIO chip open fd = open("/dev/gpiochip0", 0); if (fd == -1) { - LOGERROR("Unable to open /dev/gpiochip0. Is RaSCSI already running?") + LOGERROR("Unable to open /dev/gpiochip0. Is PiSCSI or RaSCSI already running?") return false; } // Event request setting - strcpy(selevreq.consumer_label, "RaSCSI"); + strcpy(selevreq.consumer_label, "PiSCSI"); selevreq.lineoffset = PIN_SEL; selevreq.handleflags = GPIOHANDLE_REQUEST_INPUT; #if SIGNAL_CONTROL_MODE < 2 @@ -199,7 +199,7 @@ bool GPIOBUS_Raspberry::Init(mode_e mode) // Get event request if (ioctl(fd, GPIO_GET_LINEEVENT_IOCTL, &selevreq) == -1) { - LOGERROR("Unable to register event request. Is RaSCSI already running?") + LOGERROR("Unable to register event request. Is PiSCSI or RaSCSI already running?") close(fd); return false; } diff --git a/cpp/hal/gpiobus_raspberry.h b/cpp/hal/gpiobus_raspberry.h index 0e037672..3ebd0175 100644 --- a/cpp/hal/gpiobus_raspberry.h +++ b/cpp/hal/gpiobus_raspberry.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/gpiobus_virtual.cpp b/cpp/hal/gpiobus_virtual.cpp index 4dc98f14..5f396d18 100644 --- a/cpp/hal/gpiobus_virtual.cpp +++ b/cpp/hal/gpiobus_virtual.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/gpiobus_virtual.h b/cpp/hal/gpiobus_virtual.h index feec3d8c..dbfcd83a 100644 --- a/cpp/hal/gpiobus_virtual.h +++ b/cpp/hal/gpiobus_virtual.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/pin_control.h b/cpp/hal/pin_control.h index 70ce6365..902a5de7 100644 --- a/cpp/hal/pin_control.h +++ b/cpp/hal/pin_control.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/sbc_version.cpp b/cpp/hal/sbc_version.cpp index 2d5237ca..211d8c46 100644 --- a/cpp/hal/sbc_version.cpp +++ b/cpp/hal/sbc_version.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/sbc_version.h b/cpp/hal/sbc_version.h index 34f12a6c..d55bdf21 100644 --- a/cpp/hal/sbc_version.h +++ b/cpp/hal/sbc_version.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/sunxi_utils.cpp b/cpp/hal/sunxi_utils.cpp index 16ad4ecc..8c103d00 100644 --- a/cpp/hal/sunxi_utils.cpp +++ b/cpp/hal/sunxi_utils.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/sunxi_utils.h b/cpp/hal/sunxi_utils.h index 26a1016b..14e7d8f7 100644 --- a/cpp/hal/sunxi_utils.h +++ b/cpp/hal/sunxi_utils.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/systimer.cpp b/cpp/hal/systimer.cpp index 7804a1e9..8ae8635f 100644 --- a/cpp/hal/systimer.cpp +++ b/cpp/hal/systimer.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/systimer.h b/cpp/hal/systimer.h index f1cbd49e..0479ec5c 100644 --- a/cpp/hal/systimer.h +++ b/cpp/hal/systimer.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/systimer_allwinner.cpp b/cpp/hal/systimer_allwinner.cpp index 8cbe64fa..b698c405 100644 --- a/cpp/hal/systimer_allwinner.cpp +++ b/cpp/hal/systimer_allwinner.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker @@ -99,7 +99,7 @@ void SysTimer_AllWinner::disable_hs_timer() uint32_t SysTimer_AllWinner::GetTimerLow() { - // RaSCSI expects the timer to count UP, but the Allwinner HS timer counts + // PiSCSI expects the timer to count UP, but the Allwinner HS timer counts // down. So, we subtract the current timer value from UINT32_MAX return UINT32_MAX - (hsitimer_regs->hs_tmr_curnt_lo_reg / 200); } diff --git a/cpp/hal/systimer_allwinner.h b/cpp/hal/systimer_allwinner.h index ffd81b19..8378e1ac 100644 --- a/cpp/hal/systimer_allwinner.h +++ b/cpp/hal/systimer_allwinner.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/hal/systimer_raspberry.cpp b/cpp/hal/systimer_raspberry.cpp index 5d2966db..6ae647a4 100644 --- a/cpp/hal/systimer_raspberry.cpp +++ b/cpp/hal/systimer_raspberry.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/hal/systimer_raspberry.h b/cpp/hal/systimer_raspberry.h index 7efa125c..809d8229 100644 --- a/cpp/hal/systimer_raspberry.h +++ b/cpp/hal/systimer_raspberry.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/monitor/sm_core.cpp b/cpp/monitor/sm_core.cpp index df90390f..dbb12fff 100644 --- a/cpp/monitor/sm_core.cpp +++ b/cpp/monitor/sm_core.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -15,8 +15,8 @@ #include "hal/gpiobus_factory.h" #include "monitor/sm_reports.h" #include "shared/log.h" -#include "shared/rascsi_version.h" -#include "shared/rasutil.h" +#include "shared/piscsi_version.h" +#include "shared/piscsi_util.h" #include #include #include @@ -25,7 +25,7 @@ #include using namespace std; -using namespace ras_util; +using namespace piscsi_util; void ScsiMon::KillHandler(int) { @@ -155,7 +155,7 @@ int ScsiMon::run(const vector &args) #endif spdlog::set_pattern("%^[%l]%$ %v"); - ras_util::Banner("SCSI Monitor Capture Tool"); + piscsi_util::Banner("(SCSI Monitor Capture Tool)"); ParseArguments(args); diff --git a/cpp/monitor/sm_core.h b/cpp/monitor/sm_core.h index 2d1ba464..1ee25675 100644 --- a/cpp/monitor/sm_core.h +++ b/cpp/monitor/sm_core.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/monitor/sm_html_report.cpp b/cpp/monitor/sm_html_report.cpp index 8fcbe2da..7b7481f6 100644 --- a/cpp/monitor/sm_html_report.cpp +++ b/cpp/monitor/sm_html_report.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -10,7 +10,7 @@ //--------------------------------------------------------------------------- #include "shared/log.h" -#include "shared/rascsi_version.h" +#include "shared/piscsi_version.h" #include "sm_reports.h" #include #include @@ -66,11 +66,11 @@ pre { static void print_copyright_info(ofstream& html_fp) { html_fp << "" << endl \ - << "

RaSCSI scsimon Capture Tool

" << endl \ - << "
Version " << rascsi_get_version_string() \
+            << "

PiSCSI scsimon Capture Tool

" << endl \ + << "
Version " << piscsi_get_version_string() \
             << __DATE__ << " " << __TIME__ << endl \
             << "Copyright (C) 2016-2020 GIMONS" << endl \
-            << "Copyright (C) 2020-2021 Contributors to the RaSCSI project" << endl \
+            << "Copyright (C) 2020-2021 Contributors to the PiSCSI project" << endl \
             << "
" << endl \ << "
" << endl; } diff --git a/cpp/monitor/sm_json_report.cpp b/cpp/monitor/sm_json_report.cpp index 770e9ba2..de06215e 100644 --- a/cpp/monitor/sm_json_report.cpp +++ b/cpp/monitor/sm_json_report.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/monitor/sm_reports.h b/cpp/monitor/sm_reports.h index 61373cd2..fe38331a 100644 --- a/cpp/monitor/sm_reports.h +++ b/cpp/monitor/sm_reports.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2020-2021 akuker diff --git a/cpp/monitor/sm_vcd_report.cpp b/cpp/monitor/sm_vcd_report.cpp index 1cea97f1..5f8f1d68 100644 --- a/cpp/monitor/sm_vcd_report.cpp +++ b/cpp/monitor/sm_vcd_report.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2020-2021 akuker diff --git a/cpp/os_integration/piscsi.conf b/cpp/os_integration/piscsi.conf new file mode 100644 index 00000000..8187c276 --- /dev/null +++ b/cpp/os_integration/piscsi.conf @@ -0,0 +1,2 @@ +if $programname == 'PISCSI' then /var/log/piscsi.log +& stop diff --git a/cpp/os_integration/rascsi.service b/cpp/os_integration/piscsi.service similarity index 64% rename from cpp/os_integration/rascsi.service rename to cpp/os_integration/piscsi.service index 30a2a5bf..5fafde04 100644 --- a/cpp/os_integration/rascsi.service +++ b/cpp/os_integration/piscsi.service @@ -1,23 +1,23 @@ [Unit] -Description=RaSCSI service +Description=PiSCSI service After=network.target [Service] Type=simple Restart=always -ExecStart=/usr/local/bin/rascsi -r 7 +ExecStart=/usr/local/bin/piscsi -r 7 # Example 1: If you want to automatically attach a hard disk at startup, # say an image called harddisk.hds on SCSI ID 1, change the ExecStart line to: # -# ExecStart=/usr/local/bin/rascsi -ID1 /home/pi/images/harddisk.hds +# ExecStart=/usr/local/bin/piscsi -ID1 /home/pi/images/harddisk.hds # # Example 2: If you want to reserve SCSI IDs to prevent usage, add '-r' followed by # comma-separated SCSI ID numbers; for instance IDs 0 and 7: # -# ExecStart=/usr/local/bin/rascsi -r 0,7 +# ExecStart=/usr/local/bin/piscsi -r 0,7 # -ExecStop=/usr/local/bin/rasctl -X -SyslogIdentifier=RASCSI +ExecStop=/usr/local/bin/scsictl -X +SyslogIdentifier=PISCSI [Install] WantedBy=multi-user.target diff --git a/cpp/os_integration/rascsi_bridge b/cpp/os_integration/piscsi_bridge similarity index 70% rename from cpp/os_integration/rascsi_bridge rename to cpp/os_integration/piscsi_bridge index 923fb35e..6f112f8d 100644 --- a/cpp/os_integration/rascsi_bridge +++ b/cpp/os_integration/piscsi_bridge @@ -1,5 +1,5 @@ # -# Defines the 'rascsi_bridge' bridge that connects the RaSCSI network +# Defines the 'piscsi_bridge' bridge that connects the PiSCSI network # interface (ex DaynaPort SCSI/Link) to the outside world. # # Depending upon your system configuration, you may need to update this @@ -7,7 +7,7 @@ # # This file should be place in /etc/network/interfaces.d -auto rascsi_bridge -iface rascsi_bridge inet dhcp +auto piscsi_bridge +iface piscsi_bridge inet dhcp bridge_ports eth0 diff --git a/cpp/os_integration/rascsi.conf b/cpp/os_integration/rascsi.conf deleted file mode 100644 index 5b3b4b3f..00000000 --- a/cpp/os_integration/rascsi.conf +++ /dev/null @@ -1,2 +0,0 @@ -if $programname == 'RASCSI' then /var/log/rascsi.log -& stop diff --git a/cpp/rasctl.cpp b/cpp/piscsi.cpp similarity index 76% rename from cpp/rasctl.cpp rename to cpp/piscsi.cpp index 4cae2663..ab8a674c 100644 --- a/cpp/rasctl.cpp +++ b/cpp/piscsi.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "rasctl/rasctl_core.h" +#include "piscsi/piscsi_core.h" using namespace std; @@ -15,5 +15,5 @@ int main(int argc, char *argv[]) { const vector args(argv, argv + argc); - return RasCtl().run(args); + return Piscsi().run(args); } diff --git a/cpp/rascsi/command_context.cpp b/cpp/piscsi/command_context.cpp similarity index 93% rename from cpp/rascsi/command_context.cpp rename to cpp/piscsi/command_context.cpp index ec76e496..ce11e6ef 100644 --- a/cpp/rascsi/command_context.cpp +++ b/cpp/piscsi/command_context.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -8,12 +8,12 @@ //--------------------------------------------------------------------------- #include "shared/log.h" -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include "command_context.h" #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; void CommandContext::Cleanup() { diff --git a/cpp/rascsi/command_context.h b/cpp/piscsi/command_context.h similarity index 90% rename from cpp/rascsi/command_context.h rename to cpp/piscsi/command_context.h index 8b919460..3fcc4e20 100644 --- a/cpp/rascsi/command_context.h +++ b/cpp/piscsi/command_context.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -9,13 +9,13 @@ #pragma once -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include "localizer.h" #include "shared/protobuf_serializer.h" #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; class CommandContext { diff --git a/cpp/rascsi/localizer.cpp b/cpp/piscsi/localizer.cpp similarity index 99% rename from cpp/rascsi/localizer.cpp rename to cpp/piscsi/localizer.cpp index 82a842d1..eb1fd982 100644 --- a/cpp/rascsi/localizer.cpp +++ b/cpp/piscsi/localizer.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet diff --git a/cpp/rascsi/localizer.h b/cpp/piscsi/localizer.h similarity index 97% rename from cpp/rascsi/localizer.h rename to cpp/piscsi/localizer.h index c44e2168..68fc4648 100644 --- a/cpp/rascsi/localizer.h +++ b/cpp/piscsi/localizer.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet diff --git a/cpp/rascsi/rascsi_core.cpp b/cpp/piscsi/piscsi_core.cpp similarity index 85% rename from cpp/rascsi/rascsi_core.cpp rename to cpp/piscsi/piscsi_core.cpp index 54d08ac6..a4e0f375 100644 --- a/cpp/rascsi/rascsi_core.cpp +++ b/cpp/piscsi/piscsi_core.cpp @@ -1,21 +1,21 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. // Copyright (C) 2016-2020 GIMONS -// Copyright (C) 2020-2022 Contributors to the RaSCSI project +// Copyright (C) 2020-2022 Contributors to the PiSCSI project // //--------------------------------------------------------------------------- #include "shared/config.h" #include "shared/log.h" -#include "shared/rasutil.h" +#include "shared/piscsi_util.h" #include "shared/protobuf_serializer.h" #include "shared/protobuf_util.h" -#include "shared/rascsi_exceptions.h" -#include "shared/rascsi_version.h" +#include "shared/piscsi_exceptions.h" +#include "shared/piscsi_version.h" #include "controllers/controller_manager.h" #include "controllers/scsi_controller.h" #include "devices/device_factory.h" @@ -23,8 +23,8 @@ #include "hal/gpiobus_factory.h" #include "hal/gpiobus.h" #include "hal/systimer.h" -#include "rascsi/rascsi_executor.h" -#include "rascsi/rascsi_core.h" +#include "piscsi/piscsi_executor.h" +#include "piscsi/piscsi_core.h" #include "spdlog/sinks/stdout_color_sinks.h" #include #include @@ -38,15 +38,15 @@ using namespace std; using namespace filesystem; using namespace spdlog; -using namespace rascsi_interface; -using namespace ras_util; +using namespace piscsi_interface; +using namespace piscsi_util; using namespace protobuf_util; using namespace scsi_defs; -void Rascsi::Banner(const vector& args) const +void Piscsi::Banner(const vector& args) const { - cout << ras_util::Banner("Reloaded"); - cout << "Connect type: " << CONNECT_DESC << '\n' << flush; + cout << piscsi_util::Banner("(Backend Service)"); + cout << "Connection type: " << CONNECT_DESC << '\n' << flush; if ((args.size() > 1 && strcmp(args[1], "-h") == 0) || (args.size() > 1 && strcmp(args[1], "--help") == 0)){ cout << "\nUsage: " << args[0] << " [-idID[:LUN] FILE] ...\n\n"; @@ -68,7 +68,7 @@ void Rascsi::Banner(const vector& args) const } } -bool Rascsi::InitBus() const +bool Piscsi::InitBus() const { bus = GPIOBUS_Factory::Create(BUS::mode_e::TARGET); if (bus == nullptr) { @@ -78,12 +78,12 @@ bool Rascsi::InitBus() const auto b = bus; controller_manager = make_shared(*b); auto c = controller_manager; - executor = make_shared(rascsi_image, *c); + executor = make_shared(piscsi_image, *c); return true; } -void Rascsi::Cleanup() +void Piscsi::Cleanup() { executor->DetachAll(); @@ -92,7 +92,7 @@ void Rascsi::Cleanup() bus->Cleanup(); } -void Rascsi::ReadAccessToken(const string& filename) const +void Piscsi::ReadAccessToken(const string& filename) const { struct stat st; if (stat(filename.c_str(), &st) || !S_ISREG(st.st_mode)) { @@ -124,7 +124,7 @@ void Rascsi::ReadAccessToken(const string& filename) const } } -void Rascsi::LogDevices(string_view devices) const +void Piscsi::LogDevices(string_view devices) const { stringstream ss(devices.data()); string line; @@ -134,7 +134,7 @@ void Rascsi::LogDevices(string_view devices) const } } -PbDeviceType Rascsi::ParseDeviceType(const string& value) const +PbDeviceType Piscsi::ParseDeviceType(const string& value) const { string t = value; PbDeviceType type; @@ -146,14 +146,14 @@ PbDeviceType Rascsi::ParseDeviceType(const string& value) const return type; } -void Rascsi::TerminationHandler(int signum) +void Piscsi::TerminationHandler(int signum) { Cleanup(); exit(signum); } -Rascsi::optargs_type Rascsi::ParseArguments(const vector& args, int& port) const +Piscsi::optargs_type Piscsi::ParseArguments(const vector& args, int& port) const { optargs_type optargs; int block_size = 0; @@ -203,7 +203,7 @@ Rascsi::optargs_type Rascsi::ParseArguments(const vector& args, int& por continue; case 'v': - cout << rascsi_get_version_string() << endl; + cout << piscsi_get_version_string() << endl; exit(0); case 1: @@ -226,7 +226,7 @@ Rascsi::optargs_type Rascsi::ParseArguments(const vector& args, int& por return optargs; } -void Rascsi::CreateInitialDevices(const optargs_type& optargs) const +void Piscsi::CreateInitialDevices(const optargs_type& optargs) const { PbCommand command; PbDeviceType type = UNDEFINED; @@ -257,7 +257,7 @@ void Rascsi::CreateInitialDevices(const optargs_type& optargs) const continue; case 'F': - if (const string error = rascsi_image.SetDefaultFolder(value); !error.empty()) { + if (const string error = piscsi_image.SetDefaultFolder(value); !error.empty()) { throw parser_exception(error); } continue; @@ -267,7 +267,7 @@ void Rascsi::CreateInitialDevices(const optargs_type& optargs) const if (!GetAsUnsignedInt(value, depth)) { throw parser_exception("Invalid image file scan depth " + value); } - rascsi_image.SetDepth(depth); + piscsi_image.SetDepth(depth); continue; case 'n': @@ -322,14 +322,14 @@ void Rascsi::CreateInitialDevices(const optargs_type& optargs) const // Display and log the device list PbServerInfo server_info; - rascsi_response.GetDevices(controller_manager->GetAllDevices(), server_info, rascsi_image.GetDefaultFolder()); + piscsi_response.GetDevices(controller_manager->GetAllDevices(), server_info, piscsi_image.GetDefaultFolder()); const list& devices = { server_info.devices_info().devices().begin(), server_info.devices_info().devices().end() }; const string device_list = ListDevices(devices); LogDevices(device_list); cout << device_list << flush; } -bool Rascsi::ExecuteCommand(const CommandContext& context, const PbCommand& command) +bool Piscsi::ExecuteCommand(const CommandContext& context, const PbCommand& command) { if (!access_token.empty() && access_token != GetParam(command, "token")) { return context.ReturnLocalizedError(LocalizationKey::ERROR_AUTHENTICATION, UNAUTHORIZED); @@ -361,7 +361,7 @@ bool Rascsi::ExecuteCommand(const CommandContext& context, const PbCommand& comm } case DEFAULT_FOLDER: { - if (const string status = rascsi_image.SetDefaultFolder(GetParam(command, "folder")); !status.empty()) { + if (const string status = piscsi_image.SetDefaultFolder(GetParam(command, "folder")); !status.empty()) { context.ReturnStatus(false, status); } else { @@ -371,43 +371,43 @@ bool Rascsi::ExecuteCommand(const CommandContext& context, const PbCommand& comm } case DEVICES_INFO: { - rascsi_response.GetDevicesInfo(controller_manager->GetAllDevices(), result, command, - rascsi_image.GetDefaultFolder()); + piscsi_response.GetDevicesInfo(controller_manager->GetAllDevices(), result, command, + piscsi_image.GetDefaultFolder()); serializer.SerializeMessage(context.GetFd(), result); break; } case DEVICE_TYPES_INFO: { - result.set_allocated_device_types_info(rascsi_response.GetDeviceTypesInfo(result).release()); + result.set_allocated_device_types_info(piscsi_response.GetDeviceTypesInfo(result).release()); serializer.SerializeMessage(context.GetFd(), result); break; } case SERVER_INFO: { - result.set_allocated_server_info(rascsi_response.GetServerInfo(controller_manager->GetAllDevices(), - result, executor->GetReservedIds(), current_log_level, rascsi_image.GetDefaultFolder(), + result.set_allocated_server_info(piscsi_response.GetServerInfo(controller_manager->GetAllDevices(), + result, executor->GetReservedIds(), current_log_level, piscsi_image.GetDefaultFolder(), GetParam(command, "folder_pattern"), GetParam(command, "file_pattern"), - rascsi_image.GetDepth()).release()); + piscsi_image.GetDepth()).release()); serializer.SerializeMessage(context.GetFd(), result); break; } case VERSION_INFO: { - result.set_allocated_version_info(rascsi_response.GetVersionInfo(result).release()); + result.set_allocated_version_info(piscsi_response.GetVersionInfo(result).release()); serializer.SerializeMessage(context.GetFd(), result); break; } case LOG_LEVEL_INFO: { - result.set_allocated_log_level_info(rascsi_response.GetLogLevelInfo(result, current_log_level).release()); + result.set_allocated_log_level_info(piscsi_response.GetLogLevelInfo(result, current_log_level).release()); serializer.SerializeMessage(context.GetFd(), result); break; } case DEFAULT_IMAGE_FILES_INFO: { - result.set_allocated_image_files_info(rascsi_response.GetAvailableImages(result, - rascsi_image.GetDefaultFolder(), GetParam(command, "folder_pattern"), - GetParam(command, "file_pattern"), rascsi_image.GetDepth()).release()); + result.set_allocated_image_files_info(piscsi_response.GetAvailableImages(result, + piscsi_image.GetDefaultFolder(), GetParam(command, "folder_pattern"), + GetParam(command, "file_pattern"), piscsi_image.GetDepth()).release()); serializer.SerializeMessage(context.GetFd(), result); break; } @@ -418,7 +418,7 @@ bool Rascsi::ExecuteCommand(const CommandContext& context, const PbCommand& comm } else { auto image_file = make_unique(); - const bool status = rascsi_response.GetImageFile(*image_file.get(), rascsi_image.GetDefaultFolder(), filename); + const bool status = piscsi_response.GetImageFile(*image_file.get(), piscsi_image.GetDefaultFolder(), filename); if (status) { result.set_status(true); result.set_allocated_image_file_info(image_file.get()); @@ -432,26 +432,26 @@ bool Rascsi::ExecuteCommand(const CommandContext& context, const PbCommand& comm } case NETWORK_INTERFACES_INFO: { - result.set_allocated_network_interfaces_info(rascsi_response.GetNetworkInterfacesInfo(result).release()); + result.set_allocated_network_interfaces_info(piscsi_response.GetNetworkInterfacesInfo(result).release()); serializer.SerializeMessage(context.GetFd(), result); break; } case MAPPING_INFO: { - result.set_allocated_mapping_info(rascsi_response.GetMappingInfo(result).release()); + result.set_allocated_mapping_info(piscsi_response.GetMappingInfo(result).release()); serializer.SerializeMessage(context.GetFd(), result); break; } case OPERATION_INFO: { - result.set_allocated_operation_info(rascsi_response.GetOperationInfo(result, - rascsi_image.GetDepth()).release()); + result.set_allocated_operation_info(piscsi_response.GetOperationInfo(result, + piscsi_image.GetDepth()).release()); serializer.SerializeMessage(context.GetFd(), result); break; } case RESERVED_IDS_INFO: { - result.set_allocated_reserved_ids_info(rascsi_response.GetReservedIds(result, + result.set_allocated_reserved_ids_info(piscsi_response.GetReservedIds(result, executor->GetReservedIds()).release()); serializer.SerializeMessage(context.GetFd(), result); break; @@ -479,7 +479,7 @@ bool Rascsi::ExecuteCommand(const CommandContext& context, const PbCommand& comm return true; } -int Rascsi::run(const vector& args) +int Piscsi::run(const vector& args) { GOOGLE_PROTOBUF_VERIFY_VERSION; @@ -500,7 +500,7 @@ int Rascsi::run(const vector& args) executor->SetLogLevel(current_log_level); // Create a thread-safe stdout logger to process the log messages - const auto logger = stdout_color_mt("rascsi stdout logger"); + const auto logger = stdout_color_mt("piscsi stdout logger"); if (!InitBus()) { cerr << "Error: Can't initialize bus" << endl; @@ -542,7 +542,7 @@ int Rascsi::run(const vector& args) schparam.sched_priority = sched_get_priority_max(SCHED_FIFO); sched_setscheduler(0, SCHED_FIFO, &schparam); #else - cout << "Note: No RaSCSI hardware support, only client interface calls are supported" << endl; + cout << "Note: No PiSCSI hardware support, only client interface calls are supported" << endl; #endif // Start execution @@ -644,7 +644,7 @@ int Rascsi::run(const vector& args) return EXIT_SUCCESS; } -void Rascsi::WaitForNotBusy() const +void Piscsi::WaitForNotBusy() const { if (bus->GetBSY()) { const uint32_t now = SysTimer::GetTimerLow(); diff --git a/cpp/rascsi/rascsi_core.h b/cpp/piscsi/piscsi_core.h similarity index 72% rename from cpp/rascsi/rascsi_core.h rename to cpp/piscsi/piscsi_core.h index fd62067a..22cb158b 100644 --- a/cpp/rascsi/rascsi_core.h +++ b/cpp/piscsi/piscsi_core.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -10,11 +10,11 @@ #pragma once #include "devices/device_logger.h" -#include "rascsi/command_context.h" -#include "rascsi/rascsi_service.h" -#include "rascsi/rascsi_image.h" -#include "rascsi/rascsi_response.h" -#include "generated/rascsi_interface.pb.h" +#include "piscsi/command_context.h" +#include "piscsi/piscsi_service.h" +#include "piscsi/piscsi_image.h" +#include "piscsi/piscsi_response.h" +#include "generated/piscsi_interface.pb.h" #include #include @@ -22,9 +22,9 @@ using namespace std; class BUS; class ControllerManager; -class RascsiExecutor; +class PiscsiExecutor; -class Rascsi +class Piscsi { using optargs_type = vector>; @@ -32,8 +32,8 @@ class Rascsi public: - Rascsi() = default; - ~Rascsi() = default; + Piscsi() = default; + ~Piscsi() = default; int run(const vector&); @@ -50,7 +50,7 @@ private: void CreateInitialDevices(const optargs_type&) const; void WaitForNotBusy() const; - // TODO Should not be static and should be moved to RascsiService + // TODO Should not be static and should be moved to PiscsiService static bool ExecuteCommand(const CommandContext&, const PbCommand&); DeviceLogger device_logger; @@ -60,15 +60,15 @@ private: // TODO These fields should not be static - static inline RascsiService service; + static inline PiscsiService service; - static inline RascsiImage rascsi_image; + static inline PiscsiImage piscsi_image; - const static inline RascsiResponse rascsi_response; + const static inline PiscsiResponse piscsi_response; static inline shared_ptr controller_manager; - static inline shared_ptr executor; + static inline shared_ptr executor; // Processing flag static inline volatile bool active; diff --git a/cpp/rascsi/rascsi_executor.cpp b/cpp/piscsi/piscsi_executor.cpp similarity index 89% rename from cpp/rascsi/rascsi_executor.cpp rename to cpp/piscsi/piscsi_executor.cpp index c5843bee..4b51c529 100644 --- a/cpp/rascsi/rascsi_executor.cpp +++ b/cpp/piscsi/piscsi_executor.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -8,27 +8,27 @@ //--------------------------------------------------------------------------- #include "shared/log.h" -#include "shared/rasutil.h" +#include "shared/piscsi_util.h" #include "shared/protobuf_util.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/controller_manager.h" #include "controllers/scsi_controller.h" #include "devices/device_logger.h" #include "devices/device_factory.h" #include "devices/primary_device.h" #include "devices/disk.h" -#include "rascsi_service.h" -#include "rascsi_image.h" +#include "piscsi_service.h" +#include "piscsi_image.h" #include "localizer.h" #include "command_context.h" -#include "rascsi_executor.h" +#include "piscsi_executor.h" #include using namespace spdlog; using namespace protobuf_util; -using namespace ras_util; +using namespace piscsi_util; -bool RascsiExecutor::ProcessDeviceCmd(const CommandContext& context, const PbDeviceDefinition& pb_device, +bool PiscsiExecutor::ProcessDeviceCmd(const CommandContext& context, const PbDeviceDefinition& pb_device, const PbCommand& command, bool dryRun) { PrintCommand(command, pb_device, dryRun); @@ -92,7 +92,7 @@ bool RascsiExecutor::ProcessDeviceCmd(const CommandContext& context, const PbDev return true; } -bool RascsiExecutor::ProcessCmd(const CommandContext& context, const PbCommand& command) +bool PiscsiExecutor::ProcessCmd(const CommandContext& context, const PbCommand& command) { switch (command.operation()) { case DETACH_ALL: @@ -109,20 +109,20 @@ bool RascsiExecutor::ProcessCmd(const CommandContext& context, const PbCommand& } case CREATE_IMAGE: - return rascsi_image.CreateImage(context, command); + return piscsi_image.CreateImage(context, command); case DELETE_IMAGE: - return rascsi_image.DeleteImage(context, command); + return piscsi_image.DeleteImage(context, command); case RENAME_IMAGE: - return rascsi_image.RenameImage(context, command); + return piscsi_image.RenameImage(context, command); case COPY_IMAGE: - return rascsi_image.CopyImage(context, command); + return piscsi_image.CopyImage(context, command); case PROTECT_IMAGE: case UNPROTECT_IMAGE: - return rascsi_image.SetImagePermissions(context, command); + return piscsi_image.SetImagePermissions(context, command); default: // This is a device-specific command handled below @@ -157,8 +157,8 @@ bool RascsiExecutor::ProcessCmd(const CommandContext& context, const PbCommand& // A new command with an empty device list is required here in order to return data for all devices PbCommand cmd; PbResult result; - rascsi_response.GetDevicesInfo(controller_manager.GetAllDevices(), result, cmd, - rascsi_image.GetDefaultFolder()); + piscsi_response.GetDevicesInfo(controller_manager.GetAllDevices(), result, cmd, + piscsi_image.GetDefaultFolder()); serializer.SerializeMessage(context.GetFd(), result); return true; } @@ -166,7 +166,7 @@ bool RascsiExecutor::ProcessCmd(const CommandContext& context, const PbCommand& return context.ReturnStatus(); } -bool RascsiExecutor::SetLogLevel(const string& log_level) const +bool PiscsiExecutor::SetLogLevel(const string& log_level) const { int id = -1; int lun = -1; @@ -215,7 +215,7 @@ bool RascsiExecutor::SetLogLevel(const string& log_level) const return true; } -bool RascsiExecutor::Start(PrimaryDevice& device, bool dryRun) const +bool PiscsiExecutor::Start(PrimaryDevice& device, bool dryRun) const { if (!dryRun) { LOGINFO("Start requested for %s ID %d, unit %d", device.GetTypeString(), device.GetId(), device.GetLun()) @@ -228,7 +228,7 @@ bool RascsiExecutor::Start(PrimaryDevice& device, bool dryRun) const return true; } -bool RascsiExecutor::Stop(PrimaryDevice& device, bool dryRun) const +bool PiscsiExecutor::Stop(PrimaryDevice& device, bool dryRun) const { if (!dryRun) { LOGINFO("Stop requested for %s ID %d, unit %d", device.GetTypeString(), device.GetId(), device.GetLun()) @@ -239,7 +239,7 @@ bool RascsiExecutor::Stop(PrimaryDevice& device, bool dryRun) const return true; } -bool RascsiExecutor::Eject(PrimaryDevice& device, bool dryRun) const +bool PiscsiExecutor::Eject(PrimaryDevice& device, bool dryRun) const { if (!dryRun) { LOGINFO("Eject requested for %s ID %d, unit %d", device.GetTypeString(), device.GetId(), device.GetLun()) @@ -252,7 +252,7 @@ bool RascsiExecutor::Eject(PrimaryDevice& device, bool dryRun) const return true; } -bool RascsiExecutor::Protect(PrimaryDevice& device, bool dryRun) const +bool PiscsiExecutor::Protect(PrimaryDevice& device, bool dryRun) const { if (!dryRun) { LOGINFO("Write protection requested for %s ID %d, unit %d", device.GetTypeString(), device.GetId(), @@ -264,7 +264,7 @@ bool RascsiExecutor::Protect(PrimaryDevice& device, bool dryRun) const return true; } -bool RascsiExecutor::Unprotect(PrimaryDevice& device, bool dryRun) const +bool PiscsiExecutor::Unprotect(PrimaryDevice& device, bool dryRun) const { if (!dryRun) { LOGINFO("Write unprotection requested for %s ID %d, unit %d", device.GetTypeString(), device.GetId(), @@ -276,7 +276,7 @@ bool RascsiExecutor::Unprotect(PrimaryDevice& device, bool dryRun) const return true; } -bool RascsiExecutor::Attach(const CommandContext& context, const PbDeviceDefinition& pb_device, bool dryRun) +bool PiscsiExecutor::Attach(const CommandContext& context, const PbDeviceDefinition& pb_device, bool dryRun) { const int id = pb_device.id(); const int lun = pb_device.unit(); @@ -338,7 +338,7 @@ bool RascsiExecutor::Attach(const CommandContext& context, const PbDeviceDefinit unordered_map params = { pb_device.params().begin(), pb_device.params().end() }; if (!device->SupportsFile()) { - // Clients like rasctl might have sent both "file" and "interfaces" + // Clients like scsictl might have sent both "file" and "interfaces" params.erase("file"); } @@ -368,7 +368,7 @@ bool RascsiExecutor::Attach(const CommandContext& context, const PbDeviceDefinit return true; } -bool RascsiExecutor::Insert(const CommandContext& context, const PbDeviceDefinition& pb_device, +bool PiscsiExecutor::Insert(const CommandContext& context, const PbDeviceDefinition& pb_device, const shared_ptr& device, bool dryRun) const { auto storage_device = dynamic_pointer_cast(device); @@ -413,7 +413,7 @@ bool RascsiExecutor::Insert(const CommandContext& context, const PbDeviceDefinit return true; } -bool RascsiExecutor::Detach(const CommandContext& context, const shared_ptr& device, bool dryRun) const +bool PiscsiExecutor::Detach(const CommandContext& context, const shared_ptr& device, bool dryRun) const { auto controller = controller_manager.FindController(device->GetId()); if (controller == nullptr) { @@ -449,7 +449,7 @@ bool RascsiExecutor::Detach(const CommandContext& context, const shared_ptr ids_to_reserve; stringstream ss(ids.data()); @@ -558,7 +559,7 @@ string RascsiExecutor::SetReservedIds(string_view ids) return ""; } -bool RascsiExecutor::ValidateImageFile(const CommandContext& context, StorageDevice& storage_device, +bool PiscsiExecutor::ValidateImageFile(const CommandContext& context, StorageDevice& storage_device, const string& filename, string& full_path) const { if (filename.empty()) { @@ -574,7 +575,7 @@ bool RascsiExecutor::ValidateImageFile(const CommandContext& context, StorageDev if (!StorageDevice::FileExists(filename)) { // If the file does not exist search for it in the default image folder - effective_filename = rascsi_image.GetDefaultFolder() + "/" + filename; + effective_filename = piscsi_image.GetDefaultFolder() + "/" + filename; if (const auto [id2, lun2] = StorageDevice::GetIdsForReservedFile(effective_filename); id2 != -1 || lun2 != -1) { return context.ReturnLocalizedError(LocalizationKey::ERROR_IMAGE_IN_USE, filename, @@ -605,7 +606,7 @@ bool RascsiExecutor::ValidateImageFile(const CommandContext& context, StorageDev return true; } -void RascsiExecutor::PrintCommand(const PbCommand& command, const PbDeviceDefinition& pb_device, bool dryRun) const +void PiscsiExecutor::PrintCommand(const PbCommand& command, const PbDeviceDefinition& pb_device, bool dryRun) const { const map> params = { command.params().begin(), command.params().end() }; @@ -646,7 +647,7 @@ void RascsiExecutor::PrintCommand(const PbCommand& command, const PbDeviceDefini LOGINFO("%s", s.str().c_str()) } -string RascsiExecutor::ValidateLunSetup(const PbCommand& command) const +string PiscsiExecutor::ValidateLunSetup(const PbCommand& command) const { // Mapping of available LUNs (bit vector) to devices unordered_map luns; @@ -671,7 +672,7 @@ string RascsiExecutor::ValidateLunSetup(const PbCommand& command) const return ""; } -bool RascsiExecutor::VerifyExistingIdAndLun(const CommandContext& context, int id, int lun) const +bool PiscsiExecutor::VerifyExistingIdAndLun(const CommandContext& context, int id, int lun) const { if (controller_manager.FindController(id) == nullptr) { return context.ReturnLocalizedError(LocalizationKey::ERROR_NON_EXISTING_DEVICE, to_string(id)); @@ -684,7 +685,7 @@ bool RascsiExecutor::VerifyExistingIdAndLun(const CommandContext& context, int i return true; } -shared_ptr RascsiExecutor::CreateDevice(const CommandContext& context, const PbDeviceType type, +shared_ptr PiscsiExecutor::CreateDevice(const CommandContext& context, const PbDeviceType type, int lun, const string& filename) const { auto device = device_factory.CreateDevice(type, lun, filename); @@ -700,7 +701,7 @@ shared_ptr RascsiExecutor::CreateDevice(const CommandContext& con return device; } -bool RascsiExecutor::SetSectorSize(const CommandContext& context, shared_ptr device, int block_size) const +bool PiscsiExecutor::SetSectorSize(const CommandContext& context, shared_ptr device, int block_size) const { if (block_size) { auto disk = dynamic_pointer_cast(device); @@ -718,7 +719,7 @@ bool RascsiExecutor::SetSectorSize(const CommandContext& context, shared_ptr #include -class RascsiImage; +class PiscsiImage; class DeviceFactory; class ControllerManager; class PrimaryDevice; @@ -23,13 +23,13 @@ class CommandContext; using namespace spdlog; -class RascsiExecutor +class PiscsiExecutor { public: - RascsiExecutor(RascsiImage& rascsi_image, ControllerManager& controller_manager) - : rascsi_image(rascsi_image), controller_manager(controller_manager) {} - ~RascsiExecutor() = default; + PiscsiExecutor(PiscsiImage& piscsi_image, ControllerManager& controller_manager) + : piscsi_image(piscsi_image), controller_manager(controller_manager) {} + ~PiscsiExecutor() = default; unordered_set GetReservedIds() const { return reserved_ids; } @@ -60,9 +60,9 @@ public: private: - const RascsiResponse rascsi_response; + const PiscsiResponse piscsi_response; - RascsiImage& rascsi_image; + PiscsiImage& piscsi_image; ControllerManager& controller_manager; diff --git a/cpp/rascsi/rascsi_image.cpp b/cpp/piscsi/piscsi_image.cpp similarity index 92% rename from cpp/rascsi/rascsi_image.cpp rename to cpp/piscsi/piscsi_image.cpp index 02e21f90..6f32c78d 100644 --- a/cpp/rascsi/rascsi_image.cpp +++ b/cpp/piscsi/piscsi_image.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -11,7 +11,7 @@ #include "shared/protobuf_util.h" #include "devices/disk.h" #include "command_context.h" -#include "rascsi_image.h" +#include "piscsi_image.h" #include #include #include @@ -21,21 +21,21 @@ using namespace std; using namespace filesystem; -using namespace rascsi_interface; +using namespace piscsi_interface; using namespace protobuf_util; -RascsiImage::RascsiImage() +PiscsiImage::PiscsiImage() { // ~/images is the default folder for device image files, for the root user it is /home/pi/images default_folder = GetHomeDir() + "/images"; } -bool RascsiImage::CheckDepth(string_view filename) const +bool PiscsiImage::CheckDepth(string_view filename) const { return count(filename.begin(), filename.end(), '/') <= depth; } -bool RascsiImage::CreateImageFolder(const CommandContext& context, const string& filename) const +bool PiscsiImage::CreateImageFolder(const CommandContext& context, const string& filename) const { if (const size_t filename_start = filename.rfind('/'); filename_start != string::npos) { const auto folder = path(filename.substr(0, filename_start)); @@ -58,7 +58,7 @@ bool RascsiImage::CreateImageFolder(const CommandContext& context, const string& return true; } -string RascsiImage::SetDefaultFolder(const string& f) +string PiscsiImage::SetDefaultFolder(const string& f) { if (f.empty()) { return "Can't set default image folder: Missing folder name"; @@ -93,7 +93,7 @@ string RascsiImage::SetDefaultFolder(const string& f) return ""; } -bool RascsiImage::CreateImage(const CommandContext& context, const PbCommand& command) const +bool PiscsiImage::CreateImage(const CommandContext& context, const PbCommand& command) const { const string filename = GetParam(command, "file"); if (filename.empty()) { @@ -158,7 +158,7 @@ bool RascsiImage::CreateImage(const CommandContext& context, const PbCommand& co return context.ReturnStatus(); } -bool RascsiImage::DeleteImage(const CommandContext& context, const PbCommand& command) const +bool PiscsiImage::DeleteImage(const CommandContext& context, const PbCommand& command) const { const string filename = GetParam(command, "file"); if (filename.empty()) { @@ -207,7 +207,7 @@ bool RascsiImage::DeleteImage(const CommandContext& context, const PbCommand& co return context.ReturnStatus(); } -bool RascsiImage::RenameImage(const CommandContext& context, const PbCommand& command) const +bool PiscsiImage::RenameImage(const CommandContext& context, const PbCommand& command) const { string from; string to; @@ -237,7 +237,7 @@ bool RascsiImage::RenameImage(const CommandContext& context, const PbCommand& co return context.ReturnStatus(); } -bool RascsiImage::CopyImage(const CommandContext& context, const PbCommand& command) const +bool PiscsiImage::CopyImage(const CommandContext& context, const PbCommand& command) const { string from; string to; @@ -293,7 +293,7 @@ bool RascsiImage::CopyImage(const CommandContext& context, const PbCommand& comm return context.ReturnStatus(); } -bool RascsiImage::SetImagePermissions(const CommandContext& context, const PbCommand& command) const +bool PiscsiImage::SetImagePermissions(const CommandContext& context, const PbCommand& command) const { string filename = GetParam(command, "file"); if (filename.empty()) { @@ -332,7 +332,7 @@ bool RascsiImage::SetImagePermissions(const CommandContext& context, const PbCom return context.ReturnStatus(); } -bool RascsiImage::ValidateParams(const CommandContext& context, const PbCommand& command, const string& operation, +bool PiscsiImage::ValidateParams(const CommandContext& context, const PbCommand& command, const string& operation, string& from, string& to) const { from = GetParam(command, "from"); @@ -366,14 +366,14 @@ bool RascsiImage::ValidateParams(const CommandContext& context, const PbCommand& return true; } -bool RascsiImage::IsValidSrcFilename(const string& filename) +bool PiscsiImage::IsValidSrcFilename(const string& filename) { // Source file must exist and must be a regular file or a symlink path file(filename); return is_regular_file(file) || is_symlink(file); } -bool RascsiImage::IsValidDstFilename(const string& filename) +bool PiscsiImage::IsValidDstFilename(const string& filename) { // Destination file must not yet exist try { @@ -384,7 +384,7 @@ bool RascsiImage::IsValidDstFilename(const string& filename) } } -bool RascsiImage::ChangeOwner(const CommandContext& context, const path& filename, bool read_only) +bool PiscsiImage::ChangeOwner(const CommandContext& context, const path& filename, bool read_only) { const auto [uid, gid] = GetUidAndGid(); if (chown(filename.c_str(), uid, gid)) { @@ -405,7 +405,7 @@ bool RascsiImage::ChangeOwner(const CommandContext& context, const path& filenam return true; } -string RascsiImage::GetHomeDir() +string PiscsiImage::GetHomeDir() { const auto [uid, gid] = GetUidAndGid(); @@ -421,7 +421,7 @@ string RascsiImage::GetHomeDir() } } -pair RascsiImage::GetUidAndGid() +pair PiscsiImage::GetUidAndGid() { int uid = getuid(); if (const char *sudo_user = getenv("SUDO_UID"); sudo_user != nullptr) { diff --git a/cpp/rascsi/rascsi_image.h b/cpp/piscsi/piscsi_image.h similarity index 89% rename from cpp/rascsi/rascsi_image.h rename to cpp/piscsi/piscsi_image.h index 12f4d4ff..4a820835 100644 --- a/cpp/rascsi/rascsi_image.h +++ b/cpp/piscsi/piscsi_image.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -9,21 +9,21 @@ #pragma once -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include "command_context.h" #include #include using namespace std; using namespace filesystem; -using namespace rascsi_interface; +using namespace piscsi_interface; -class RascsiImage +class PiscsiImage { public: - RascsiImage(); - ~RascsiImage() = default; + PiscsiImage(); + ~PiscsiImage() = default; void SetDepth(int d) { depth = d; } int GetDepth() const { return depth; } diff --git a/cpp/rascsi/rascsi_response.cpp b/cpp/piscsi/piscsi_response.cpp similarity index 91% rename from cpp/rascsi/rascsi_response.cpp rename to cpp/piscsi/piscsi_response.cpp index 9930aa81..35f3ec51 100644 --- a/cpp/rascsi/rascsi_response.cpp +++ b/cpp/piscsi/piscsi_response.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -9,19 +9,19 @@ #include "shared/log.h" #include "shared/protobuf_util.h" -#include "shared/rascsi_version.h" +#include "shared/piscsi_version.h" #include "devices/disk.h" #include "devices/device_factory.h" -#include "generated/rascsi_interface.pb.h" -#include "rascsi_response.h" +#include "generated/piscsi_interface.pb.h" +#include "piscsi_response.h" #include using namespace std; using namespace filesystem; -using namespace rascsi_interface; +using namespace piscsi_interface; using namespace protobuf_util; -unique_ptr RascsiResponse::GetDeviceProperties(const Device& device) const +unique_ptr PiscsiResponse::GetDeviceProperties(const Device& device) const { auto properties = make_unique(); @@ -49,7 +49,7 @@ unique_ptr RascsiResponse::GetDeviceProperties(const Device& return properties; } -void RascsiResponse::GetDeviceTypeProperties(PbDeviceTypesInfo& device_types_info, PbDeviceType type) const +void PiscsiResponse::GetDeviceTypeProperties(PbDeviceTypesInfo& device_types_info, PbDeviceType type) const { auto type_properties = device_types_info.add_properties(); type_properties->set_type(type); @@ -57,7 +57,7 @@ void RascsiResponse::GetDeviceTypeProperties(PbDeviceTypesInfo& device_types_inf type_properties->set_allocated_properties(GetDeviceProperties(*device).release()); } //NOSONAR The allocated memory is managed by protobuf -void RascsiResponse::GetAllDeviceTypeProperties(PbDeviceTypesInfo& device_types_info) const +void PiscsiResponse::GetAllDeviceTypeProperties(PbDeviceTypesInfo& device_types_info) const { // Start with 2 instead of 1. 1 was the removed SASI drive type. int ordinal = 2; @@ -69,7 +69,7 @@ void RascsiResponse::GetAllDeviceTypeProperties(PbDeviceTypesInfo& device_types_ } } -void RascsiResponse::GetDevice(const Device& device, PbDevice& pb_device, const string& default_folder) const +void PiscsiResponse::GetDevice(const Device& device, PbDevice& pb_device, const string& default_folder) const { pb_device.set_id(device.GetId()); pb_device.set_unit(device.GetLun()); @@ -106,7 +106,7 @@ void RascsiResponse::GetDevice(const Device& device, PbDevice& pb_device, const } } //NOSONAR The allocated memory is managed by protobuf -bool RascsiResponse::GetImageFile(PbImageFile& image_file, const string& default_folder, const string& filename) const +bool PiscsiResponse::GetImageFile(PbImageFile& image_file, const string& default_folder, const string& filename) const { if (!filename.empty()) { image_file.set_name(filename); @@ -126,7 +126,7 @@ bool RascsiResponse::GetImageFile(PbImageFile& image_file, const string& default return false; } -void RascsiResponse::GetAvailableImages(PbImageFilesInfo& image_files_info, const string& default_folder, +void PiscsiResponse::GetAvailableImages(PbImageFilesInfo& image_files_info, const string& default_folder, const string& folder, const string& folder_pattern, const string& file_pattern, int scan_depth) const { if (scan_depth-- < 0) { @@ -177,7 +177,7 @@ void RascsiResponse::GetAvailableImages(PbImageFilesInfo& image_files_info, cons closedir(d); } -unique_ptr RascsiResponse::GetAvailableImages(PbResult& result, const string& default_folder, +unique_ptr PiscsiResponse::GetAvailableImages(PbResult& result, const string& default_folder, const string& folder_pattern, const string& file_pattern, int scan_depth) const { auto image_files_info = make_unique(); @@ -193,7 +193,7 @@ unique_ptr RascsiResponse::GetAvailableImages(PbResult& result return image_files_info; } -void RascsiResponse::GetAvailableImages(PbResult& result, PbServerInfo& server_info, const string& default_folder, +void PiscsiResponse::GetAvailableImages(PbResult& result, PbServerInfo& server_info, const string& default_folder, const string& folder_pattern, const string& file_pattern, int scan_depth) const { auto image_files_info = GetAvailableImages(result, default_folder, folder_pattern, file_pattern, scan_depth); @@ -203,7 +203,7 @@ void RascsiResponse::GetAvailableImages(PbResult& result, PbServerInfo& server_i result.set_status(true); //NOSONAR The allocated memory is managed by protobuf } -unique_ptr RascsiResponse::GetReservedIds(PbResult& result, const unordered_set& ids) const +unique_ptr PiscsiResponse::GetReservedIds(PbResult& result, const unordered_set& ids) const { auto reserved_ids_info = make_unique(); for (const int id : ids) { @@ -215,7 +215,7 @@ unique_ptr RascsiResponse::GetReservedIds(PbResult& result, c return reserved_ids_info; } -void RascsiResponse::GetDevices(const unordered_set>& devices, PbServerInfo& server_info, +void PiscsiResponse::GetDevices(const unordered_set>& devices, PbServerInfo& server_info, const string& default_folder) const { for (const auto& device : devices) { @@ -224,7 +224,7 @@ void RascsiResponse::GetDevices(const unordered_set>& } } -void RascsiResponse::GetDevicesInfo(const unordered_set>& devices, PbResult& result, +void PiscsiResponse::GetDevicesInfo(const unordered_set>& devices, PbResult& result, const PbCommand& command, const string& default_folder) const { set id_sets; @@ -258,7 +258,7 @@ void RascsiResponse::GetDevicesInfo(const unordered_set RascsiResponse::GetDeviceTypesInfo(PbResult& result) const +unique_ptr PiscsiResponse::GetDeviceTypesInfo(PbResult& result) const { auto device_types_info = make_unique(); @@ -269,7 +269,7 @@ unique_ptr RascsiResponse::GetDeviceTypesInfo(PbResult& resul return device_types_info; } -unique_ptr RascsiResponse::GetServerInfo(const unordered_set>& devices, +unique_ptr PiscsiResponse::GetServerInfo(const unordered_set>& devices, PbResult& result, const unordered_set& reserved_ids, const string& current_log_level, const string& default_folder, const string& folder_pattern, const string& file_pattern, int scan_depth) const { @@ -290,20 +290,20 @@ unique_ptr RascsiResponse::GetServerInfo(const unordered_set RascsiResponse::GetVersionInfo(PbResult& result) const +unique_ptr PiscsiResponse::GetVersionInfo(PbResult& result) const { auto version_info = make_unique(); - version_info->set_major_version(rascsi_major_version); - version_info->set_minor_version(rascsi_minor_version); - version_info->set_patch_version(rascsi_patch_version); + version_info->set_major_version(piscsi_major_version); + version_info->set_minor_version(piscsi_minor_version); + version_info->set_patch_version(piscsi_patch_version); result.set_status(true); return version_info; } -unique_ptr RascsiResponse::GetLogLevelInfo(PbResult& result, const string& current_log_level) const +unique_ptr PiscsiResponse::GetLogLevelInfo(PbResult& result, const string& current_log_level) const { auto log_level_info = make_unique(); @@ -318,7 +318,7 @@ unique_ptr RascsiResponse::GetLogLevelInfo(PbResult& result, con return log_level_info; } -unique_ptr RascsiResponse::GetNetworkInterfacesInfo(PbResult& result) const +unique_ptr PiscsiResponse::GetNetworkInterfacesInfo(PbResult& result) const { auto network_interfaces_info = make_unique(); @@ -331,7 +331,7 @@ unique_ptr RascsiResponse::GetNetworkInterfacesInfo(PbR return network_interfaces_info; } -unique_ptr RascsiResponse::GetMappingInfo(PbResult& result) const +unique_ptr PiscsiResponse::GetMappingInfo(PbResult& result) const { auto mapping_info = make_unique(); @@ -344,7 +344,7 @@ unique_ptr RascsiResponse::GetMappingInfo(PbResult& result) const return mapping_info; } -unique_ptr RascsiResponse::GetOperationInfo(PbResult& result, int depth) const +unique_ptr PiscsiResponse::GetOperationInfo(PbResult& result, int depth) const { auto operation_info = make_unique(); @@ -373,14 +373,14 @@ unique_ptr RascsiResponse::GetOperationInfo(PbResult& result, i CreateOperation(*operation_info, UNPROTECT, "Unprotect medium, device-specific parameters are required").release(); - operation = CreateOperation(*operation_info, SERVER_INFO, "Get rascsi server information"); + operation = CreateOperation(*operation_info, SERVER_INFO, "Get piscsi server information"); if (depth) { AddOperationParameter(*operation, "folder_pattern", "Pattern for filtering image folder names").release(); } AddOperationParameter(*operation, "file_pattern", "Pattern for filtering image file names").release(); operation.release(); - CreateOperation(*operation_info, VERSION_INFO, "Get rascsi server version").release(); + CreateOperation(*operation_info, VERSION_INFO, "Get piscsi server version").release(); CreateOperation(*operation_info, DEVICES_INFO, "Get information on attached devices").release(); @@ -419,7 +419,7 @@ unique_ptr RascsiResponse::GetOperationInfo(PbResult& result, i operation = CreateOperation(*operation_info, SHUT_DOWN, "Shut down or reboot"); auto parameter = AddOperationParameter(*operation, "mode", "Shutdown mode", "", true).release(); - parameter->add_permitted_values("rascsi"); + parameter->add_permitted_values("piscsi"); // System shutdown/reboot requires root permissions if (!getuid()) { parameter->add_permitted_values("system"); @@ -471,7 +471,7 @@ unique_ptr RascsiResponse::GetOperationInfo(PbResult& result, i return operation_info; } -unique_ptr RascsiResponse::CreateOperation(PbOperationInfo& operation_info, const PbOperation& operation, +unique_ptr PiscsiResponse::CreateOperation(PbOperationInfo& operation_info, const PbOperation& operation, const string& description) const { auto meta_data = make_unique(); @@ -482,7 +482,7 @@ unique_ptr RascsiResponse::CreateOperation(PbOperationInfo& return unique_ptr(&(*operation_info.mutable_operations())[ordinal]); } -unique_ptr RascsiResponse::AddOperationParameter(PbOperationMetaData& meta_data, +unique_ptr PiscsiResponse::AddOperationParameter(PbOperationMetaData& meta_data, const string& name, const string& description, const string& default_value, bool is_mandatory) const { auto parameter = unique_ptr(meta_data.add_parameters()); @@ -494,7 +494,7 @@ unique_ptr RascsiResponse::AddOperationParameter(PbOperati return parameter; } -set RascsiResponse::MatchDevices(const unordered_set>& devices, PbResult& result, +set PiscsiResponse::MatchDevices(const unordered_set>& devices, PbResult& result, const PbCommand& command) const { set id_sets; @@ -522,7 +522,7 @@ set RascsiResponse::MatchDevices(const unordered_setd_type != DT_REG && dir->d_type != DT_DIR && dir->d_type != DT_LNK && dir->d_type != DT_BLK) diff --git a/cpp/rascsi/rascsi_response.h b/cpp/piscsi/piscsi_response.h similarity index 93% rename from cpp/rascsi/rascsi_response.h rename to cpp/piscsi/piscsi_response.h index 5389627c..16a9b95f 100644 --- a/cpp/rascsi/rascsi_response.h +++ b/cpp/piscsi/piscsi_response.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -11,22 +11,22 @@ #include "devices/device_factory.h" #include "devices/primary_device.h" -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; -class RascsiResponse +class PiscsiResponse { using id_set = pair; public: - RascsiResponse() = default; - ~RascsiResponse() = default; + PiscsiResponse() = default; + ~PiscsiResponse() = default; bool GetImageFile(PbImageFile&, const string&, const string&) const; unique_ptr GetAvailableImages(PbResult&, const string&, const string&, const string&, int) const; diff --git a/cpp/rascsi/rascsi_service.cpp b/cpp/piscsi/piscsi_service.cpp similarity index 83% rename from cpp/rascsi/rascsi_service.cpp rename to cpp/piscsi/piscsi_service.cpp index fdd859f5..661b5f92 100644 --- a/cpp/rascsi/rascsi_service.cpp +++ b/cpp/piscsi/piscsi_service.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,19 +8,19 @@ //--------------------------------------------------------------------------- #include "shared/log.h" -#include "shared/rasutil.h" +#include "shared/piscsi_util.h" #include "shared/protobuf_serializer.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "command_context.h" #include "localizer.h" -#include "rascsi_service.h" +#include "piscsi_service.h" #include #include -using namespace rascsi_interface; -using namespace ras_util; +using namespace piscsi_interface; +using namespace piscsi_util; -void RascsiService::Cleanup() const +void PiscsiService::Cleanup() const { running = false; @@ -29,7 +29,7 @@ void RascsiService::Cleanup() const } } -bool RascsiService::Init(const callback& cb, int port) +bool PiscsiService::Init(const callback& cb, int port) { if (port <= 0 || port > 65535) { return false; @@ -55,13 +55,13 @@ bool RascsiService::Init(const callback& cb, int port) signal(SIGPIPE, SIG_IGN); if (bind(service_socket, (sockaddr *)&server, sizeof(sockaddr_in)) < 0) { - cerr << "Error: Port " << port << " is in use, is rascsi already running?" << endl; + cerr << "Error: Port " << port << " is in use, is piscsi or rascsi already running?" << endl; return false; } execute = cb; - monthread = thread(&RascsiService::Execute, this); + monthread = thread(&PiscsiService::Execute, this); monthread.detach(); // Interrupt handler settings @@ -69,7 +69,7 @@ bool RascsiService::Init(const callback& cb, int port) && signal(SIGTERM, KillHandler) != SIG_ERR; } -void RascsiService::Execute() const +void PiscsiService::Execute() const { #ifdef __linux__ // Scheduler Settings @@ -109,7 +109,7 @@ void RascsiService::Execute() const } } -PbCommand RascsiService::ReadCommand(CommandContext& context) const +PbCommand PiscsiService::ReadCommand(CommandContext& context) const { // Wait for connection sockaddr client = {}; diff --git a/cpp/rascsi/rascsi_service.h b/cpp/piscsi/piscsi_service.h similarity index 74% rename from cpp/rascsi/rascsi_service.h rename to cpp/piscsi/piscsi_service.h index da092c12..a880c6c8 100644 --- a/cpp/rascsi/rascsi_service.h +++ b/cpp/piscsi/piscsi_service.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,18 +9,18 @@ #pragma once -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include class CommandContext; using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; -class RascsiService +class PiscsiService { - using callback = function; + using callback = function; callback execute; @@ -32,8 +32,8 @@ class RascsiService public: - RascsiService() = default; - ~RascsiService() = default; + PiscsiService() = default; + ~PiscsiService() = default; bool Init(const callback&, int); void Cleanup() const; diff --git a/cpp/rascsi_interface.proto b/cpp/piscsi_interface.proto similarity index 93% rename from cpp/rascsi_interface.proto rename to cpp/piscsi_interface.proto index 36a979dd..d99ead12 100644 --- a/cpp/rascsi_interface.proto +++ b/cpp/piscsi_interface.proto @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -8,17 +8,17 @@ //--------------------------------------------------------------------------- // -// Each rascsi message sent to the rascsi server is preceded by the magic string "RASCSI". +// Each piscsi message sent to the piscsi server is preceded by the magic string "RASCSI". // A message starts with a little endian 32 bit header which contains the protobuf message size. // Unless explicitly specified the order of repeated data returned is undefined. // All operations accept an optional access token, specified by the "token" parameter. // All operations also accept an optional locale, specified with the "locale" parameter. If there is -// a localized error message rascsi returns it, with English being the fallback language. +// a localized error message piscsi returns it, with English being the fallback language. // syntax = "proto3"; -package rascsi_interface; +package piscsi_interface; // The available device types enum PbDeviceType { @@ -43,7 +43,7 @@ enum PbDeviceType { SCLP = 9; } -// rascsi remote operations, returning PbResult +// piscsi remote operations, returning PbResult enum PbOperation { NO_OPERATION = 0; @@ -89,7 +89,7 @@ enum PbOperation { // "file_pattern": Optional filter, only filenames containing the case-insensitive pattern are returned SERVER_INFO = 10; - // Get rascsi server version (PbVersionInfo) + // Get piscsi server version (PbVersionInfo) VERSION_INFO = 11; // Get information on attached devices (PbDevicesInfo) @@ -138,9 +138,12 @@ enum PbOperation { // "ids": A comma-separated list of IDs to reserve, or an empty string in order not to reserve any ID. RESERVE_IDS = 22; - // Shut down the rascsi process or shut down/reboot the Raspberry Pi + // Shut down the piscsi process or shut down/reboot the Pi // Parameters: - // "mode": The shutdown mode, one of "rascsi", "system", "reboot" + // "mode": The shutdown mode, one of + // "rascsi": Shuts down the piscsi process ("rascsi" instead of "piscsi" for backwards compatibility) + // "system": Shuts down the Pi + // "reboot": Reboots the Pi SHUT_DOWN = 23; // Create an image file. The image file must not yet exist. @@ -181,7 +184,7 @@ enum PbOperation { UNPROTECT_IMAGE = 29; // Check whether an authentication token is valid. A client can use this operation in order to - // find out whether rascsi authentication is enable or to use rascsi authentication for securing + // find out whether piscsi authentication is enable or to use piscsi authentication for securing // client-internal operations. CHECK_AUTHENTICATION = 30; @@ -216,7 +219,7 @@ message PbOperationInfo { map operations = 1; } -// rascsi special purpose error codes for cases where a textual error message may not be not sufficient. +// piscsi special purpose error codes for cases where a textual error message may not be not sufficient. // The client may react on this code, e.g. by prompting the user for an authentication token. enum PbErrorCode { // No error code available @@ -354,16 +357,16 @@ message PbReservedIdsInfo { repeated int32 ids = 1; } -// Rascsi server version information +// Piscsi server version information message PbVersionInfo { - // The rascsi version + // The piscsi version int32 major_version = 1; int32 minor_version = 2; // < 0 for a development version, = 0 if there is no patch yet int32 patch_version = 3; } -// Commands rascsi can execute and their parameters +// Commands piscsi can execute and their parameters message PbCommand { PbOperation operation = 1; // The non-empty list of devices for this command @@ -407,9 +410,9 @@ message PbResult { } } -// The rascsi server information. All data can also be requested with individual commands. +// The piscsi server information. All data can also be requested with individual commands. message PbServerInfo { - // The rascsi server version data + // The piscsi server version data PbVersionInfo version_info = 1; // The available log levels and the current log level PbLogLevelInfo log_level_info = 2; diff --git a/cpp/rascsi.cpp b/cpp/scsictl.cpp similarity index 76% rename from cpp/rascsi.cpp rename to cpp/scsictl.cpp index 3871afe7..5d3b8237 100644 --- a/cpp/rascsi.cpp +++ b/cpp/scsictl.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "rascsi/rascsi_core.h" +#include "scsictl/scsictl_core.h" using namespace std; @@ -15,5 +15,5 @@ int main(int argc, char *argv[]) { const vector args(argv, argv + argc); - return Rascsi().run(args); + return ScsiCtl().run(args); } diff --git a/cpp/rasctl/rasctl_commands.cpp b/cpp/scsictl/scsictl_commands.cpp similarity index 64% rename from cpp/rasctl/rasctl_commands.cpp rename to cpp/scsictl/scsictl_commands.cpp index 4968b138..99adb09e 100644 --- a/cpp/rasctl/rasctl_commands.cpp +++ b/cpp/scsictl/scsictl_commands.cpp @@ -1,27 +1,27 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "shared/rasutil.h" +#include "shared/piscsi_util.h" #include "shared/protobuf_util.h" -#include "shared/rascsi_exceptions.h" -#include "rasctl_commands.h" +#include "shared/piscsi_exceptions.h" +#include "scsictl_commands.h" #include #include #include #include using namespace std; -using namespace rascsi_interface; -using namespace ras_util; +using namespace piscsi_interface; +using namespace piscsi_util; using namespace protobuf_util; -bool RasctlCommands::Execute(const string& log_level, const string& default_folder, const string& reserved_ids, +bool ScsictlCommands::Execute(const string& log_level, const string& default_folder, const string& reserved_ids, const string& image_params, const string& filename) { switch(command.operation()) { @@ -86,7 +86,7 @@ bool RasctlCommands::Execute(const string& log_level, const string& default_fold return false; } -bool RasctlCommands::SendCommand() +bool ScsictlCommands::SendCommand() { sockaddr_in server_addr = {}; if (!ResolveHostName(hostname, &server_addr)) { @@ -102,7 +102,7 @@ bool RasctlCommands::SendCommand() if (connect(fd, (sockaddr *)&server_addr, sizeof(server_addr)) < 0) { close(fd); - throw io_exception("Can't connect to rascsi on host '" + hostname + "', port " + to_string(port) + throw io_exception("Can't connect to piscsi on host '" + hostname + "', port " + to_string(port) + ": " + strerror(errno)); } @@ -128,30 +128,30 @@ bool RasctlCommands::SendCommand() return true; } -bool RasctlCommands::CommandDevicesInfo() +bool ScsictlCommands::CommandDevicesInfo() { SendCommand(); - cout << rasctl_display.DisplayDevicesInfo(result.devices_info()) << flush; + cout << scsictl_display.DisplayDevicesInfo(result.devices_info()) << flush; return true; } -bool RasctlCommands::CommandLogLevel(const string& log_level) +bool ScsictlCommands::CommandLogLevel(const string& log_level) { SetParam(command, "level", log_level); return SendCommand(); } -bool RasctlCommands::CommandReserveIds(const string& reserved_ids) +bool ScsictlCommands::CommandReserveIds(const string& reserved_ids) { SetParam(command, "ids", reserved_ids); return SendCommand(); } -bool RasctlCommands::CommandCreateImage(const string& image_params) +bool ScsictlCommands::CommandCreateImage(const string& image_params) { if (const size_t separator_pos = image_params.find(COMPONENT_SEPARATOR); separator_pos != string::npos) { SetParam(command, "file", string_view(image_params).substr(0, separator_pos)); @@ -168,14 +168,14 @@ bool RasctlCommands::CommandCreateImage(const string& image_params) return SendCommand(); } -bool RasctlCommands::CommandDeleteImage(const string& filename) +bool ScsictlCommands::CommandDeleteImage(const string& filename) { SetParam(command, "file", filename); return SendCommand(); } -bool RasctlCommands::CommandRenameImage(const string& image_params) +bool ScsictlCommands::CommandRenameImage(const string& image_params) { if (const size_t separator_pos = image_params.find(COMPONENT_SEPARATOR); separator_pos != string::npos) { SetParam(command, "from", string_view(image_params).substr(0, separator_pos)); @@ -190,7 +190,7 @@ bool RasctlCommands::CommandRenameImage(const string& image_params) return SendCommand(); } -bool RasctlCommands::CommandCopyImage(const string& image_params) +bool ScsictlCommands::CommandCopyImage(const string& image_params) { if (const size_t separator_pos = image_params.find(COMPONENT_SEPARATOR); separator_pos != string::npos) { SetParam(command, "from", string_view(image_params).substr(0, separator_pos)); @@ -205,19 +205,19 @@ bool RasctlCommands::CommandCopyImage(const string& image_params) return SendCommand(); } -bool RasctlCommands::CommandDefaultImageFolder(const string& folder) +bool ScsictlCommands::CommandDefaultImageFolder(const string& folder) { SetParam(command, "folder", folder); return SendCommand(); } -bool RasctlCommands::CommandDeviceInfo() +bool ScsictlCommands::CommandDeviceInfo() { SendCommand(); for (const auto& device : result.devices_info().devices()) { - cout << rasctl_display.DisplayDeviceInfo(device); + cout << scsictl_display.DisplayDeviceInfo(device); } cout << flush; @@ -225,38 +225,38 @@ bool RasctlCommands::CommandDeviceInfo() return true; } -bool RasctlCommands::CommandDeviceTypesInfo() +bool ScsictlCommands::CommandDeviceTypesInfo() { SendCommand(); - cout << rasctl_display.DisplayDeviceTypesInfo(result.device_types_info()) << flush; + cout << scsictl_display.DisplayDeviceTypesInfo(result.device_types_info()) << flush; return true; } -bool RasctlCommands::CommandVersionInfo() +bool ScsictlCommands::CommandVersionInfo() { SendCommand(); - cout << rasctl_display.DisplayVersionInfo(result.version_info()) << flush; + cout << scsictl_display.DisplayVersionInfo(result.version_info()) << flush; return true; } -bool RasctlCommands::CommandServerInfo() +bool ScsictlCommands::CommandServerInfo() { SendCommand(); PbServerInfo server_info = result.server_info(); - cout << rasctl_display.DisplayVersionInfo(server_info.version_info()); - cout << rasctl_display.DisplayLogLevelInfo(server_info.log_level_info()); - cout << rasctl_display.DisplayImageFilesInfo(server_info.image_files_info()); - cout << rasctl_display.DisplayMappingInfo(server_info.mapping_info()); - cout << rasctl_display.DisplayNetworkInterfaces(server_info.network_interfaces_info()); - cout << rasctl_display.DisplayDeviceTypesInfo(server_info.device_types_info()); - cout << rasctl_display.DisplayReservedIdsInfo(server_info.reserved_ids_info()); - cout << rasctl_display.DisplayOperationInfo(server_info.operation_info()); + cout << scsictl_display.DisplayVersionInfo(server_info.version_info()); + cout << scsictl_display.DisplayLogLevelInfo(server_info.log_level_info()); + cout << scsictl_display.DisplayImageFilesInfo(server_info.image_files_info()); + cout << scsictl_display.DisplayMappingInfo(server_info.mapping_info()); + cout << scsictl_display.DisplayNetworkInterfaces(server_info.network_interfaces_info()); + cout << scsictl_display.DisplayDeviceTypesInfo(server_info.device_types_info()); + cout << scsictl_display.DisplayReservedIdsInfo(server_info.reserved_ids_info()); + cout << scsictl_display.DisplayOperationInfo(server_info.operation_info()); if (server_info.devices_info().devices_size()) { list sorted_devices = { server_info.devices_info().devices().begin(), server_info.devices_info().devices().end() }; @@ -265,7 +265,7 @@ bool RasctlCommands::CommandServerInfo() cout << "Attached devices:\n"; for (const auto& device : sorted_devices) { - cout << rasctl_display.DisplayDeviceInfo(device); + cout << scsictl_display.DisplayDeviceInfo(device); } } @@ -274,72 +274,72 @@ bool RasctlCommands::CommandServerInfo() return true; } -bool RasctlCommands::CommandDefaultImageFilesInfo() +bool ScsictlCommands::CommandDefaultImageFilesInfo() { SendCommand(); - cout << rasctl_display.DisplayImageFilesInfo(result.image_files_info()) << flush; + cout << scsictl_display.DisplayImageFilesInfo(result.image_files_info()) << flush; return true; } -bool RasctlCommands::CommandImageFileInfo(const string& filename) +bool ScsictlCommands::CommandImageFileInfo(const string& filename) { SetParam(command, "file", filename); SendCommand(); - cout << rasctl_display.DisplayImageFile(result.image_file_info()) << flush; + cout << scsictl_display.DisplayImageFile(result.image_file_info()) << flush; return true; } -bool RasctlCommands::CommandNetworkInterfacesInfo() +bool ScsictlCommands::CommandNetworkInterfacesInfo() { SendCommand(); - cout << rasctl_display.DisplayNetworkInterfaces(result.network_interfaces_info()) << flush; + cout << scsictl_display.DisplayNetworkInterfaces(result.network_interfaces_info()) << flush; return true; } -bool RasctlCommands::CommandLogLevelInfo() +bool ScsictlCommands::CommandLogLevelInfo() { SendCommand(); - cout << rasctl_display.DisplayLogLevelInfo(result.log_level_info()) << flush; + cout << scsictl_display.DisplayLogLevelInfo(result.log_level_info()) << flush; return true; } -bool RasctlCommands::CommandReservedIdsInfo() +bool ScsictlCommands::CommandReservedIdsInfo() { SendCommand(); - cout << rasctl_display.DisplayReservedIdsInfo(result.reserved_ids_info()) << flush; + cout << scsictl_display.DisplayReservedIdsInfo(result.reserved_ids_info()) << flush; return true; } -bool RasctlCommands::CommandMappingInfo() +bool ScsictlCommands::CommandMappingInfo() { SendCommand(); - cout << rasctl_display.DisplayMappingInfo(result.mapping_info()) << flush; + cout << scsictl_display.DisplayMappingInfo(result.mapping_info()) << flush; return true; } -bool RasctlCommands::CommandOperationInfo() +bool ScsictlCommands::CommandOperationInfo() { SendCommand(); - cout << rasctl_display.DisplayOperationInfo(result.operation_info()) << flush; + cout << scsictl_display.DisplayOperationInfo(result.operation_info()) << flush; return true; } -bool RasctlCommands::ResolveHostName(const string& host, sockaddr_in *addr) +bool ScsictlCommands::ResolveHostName(const string& host, sockaddr_in *addr) { addrinfo hints = {}; hints.ai_family = AF_INET; diff --git a/cpp/rasctl/rasctl_commands.h b/cpp/scsictl/scsictl_commands.h similarity index 81% rename from cpp/rasctl/rasctl_commands.h rename to cpp/scsictl/scsictl_commands.h index 6c39b409..b9e80963 100644 --- a/cpp/rasctl/rasctl_commands.h +++ b/cpp/scsictl/scsictl_commands.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -10,21 +10,21 @@ #pragma once #include "shared/protobuf_serializer.h" -#include "generated/rascsi_interface.pb.h" -#include "rasctl_display.h" +#include "generated/piscsi_interface.pb.h" +#include "scsictl_display.h" #include -using namespace rascsi_interface; +using namespace piscsi_interface; struct sockaddr_in; -class RasctlCommands +class ScsictlCommands { public: - RasctlCommands(PbCommand& command, const string& hostname, int port) + ScsictlCommands(PbCommand& command, const string& hostname, int port) : command(command), hostname(hostname), port(port) {} - ~RasctlCommands() = default; + ~ScsictlCommands() = default; bool Execute(const string&, const string&, const string&, const string&, const string&); @@ -61,5 +61,5 @@ private: PbResult result; - RasctlDisplay rasctl_display; + ScsictlDisplay scsictl_display; }; diff --git a/cpp/rasctl/rasctl_core.cpp b/cpp/scsictl/scsictl_core.cpp similarity index 86% rename from cpp/rasctl/rasctl_core.cpp rename to cpp/scsictl/scsictl_core.cpp index 3617a774..06b04829 100644 --- a/cpp/rasctl/rasctl_core.cpp +++ b/cpp/scsictl/scsictl_core.cpp @@ -1,36 +1,36 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. // Copyright (C) 2016-2020 GIMONS -// Copyright (C) 2020-2022 Contributors to the RaSCSI project +// Copyright (C) 2020-2022 Contributors to the PiSCSI project // //--------------------------------------------------------------------------- #include "controllers/scsi_controller.h" -#include "shared/rasutil.h" +#include "shared/piscsi_util.h" #include "shared/protobuf_util.h" -#include "shared/rascsi_exceptions.h" -#include "shared/rascsi_version.h" -#include "generated/rascsi_interface.pb.h" -#include "rasctl/rasctl_parser.h" -#include "rasctl/rasctl_commands.h" -#include "rasctl/rasctl_core.h" +#include "shared/piscsi_exceptions.h" +#include "shared/piscsi_version.h" +#include "generated/piscsi_interface.pb.h" +#include "scsictl/scsictl_parser.h" +#include "scsictl/scsictl_commands.h" +#include "scsictl/scsictl_core.h" #include #include #include using namespace std; -using namespace rascsi_interface; -using namespace ras_util; +using namespace piscsi_interface; +using namespace piscsi_util; using namespace protobuf_util; -void RasCtl::Banner(const vector& args) const +void ScsiCtl::Banner(const vector& args) const { if (args.size() < 2) { - cout << ras_util::Banner("Controller"); + cout << piscsi_util::Banner("(Controller App)"); cout << "\nUsage: " << args[0] << " -i ID[:LUN] [-c CMD] [-C FILE] [-t TYPE] [-b BLOCK_SIZE] [-n NAME] [-f FILE|PARAM] "; cout << "[-F IMAGE_FOLDER] [-L LOG_LEVEL] [-h HOST] [-p PORT] [-r RESERVED_IDS] "; @@ -44,8 +44,8 @@ void RasCtl::Banner(const vector& args) const cout << " NAME := name of device to attach (VENDOR:PRODUCT:REVISION)\n"; cout << " FILE|PARAM := image file path or device-specific parameter\n"; cout << " IMAGE_FOLDER := default location for image files, default is '~/images'\n"; - cout << " HOST := rascsi host to connect to, default is 'localhost'\n"; - cout << " PORT := rascsi port to connect to, default is 6868\n"; + cout << " HOST := piscsi host to connect to, default is 'localhost'\n"; + cout << " PORT := piscsi port to connect to, default is 6868\n"; cout << " RESERVED_IDS := comma-separated list of IDs to reserve\n"; cout << " LOG_LEVEL := log level {trace|debug|info|warn|err|off}, default is 'info'\n"; cout << " If CMD is 'attach' or 'insert' the FILE parameter is required.\n"; @@ -56,13 +56,13 @@ void RasCtl::Banner(const vector& args) const } } -int RasCtl::run(const vector& args) const +int ScsiCtl::run(const vector& args) const { GOOGLE_PROTOBUF_VERIFY_VERSION; Banner(args); - RasctlParser parser; + ScsictlParser parser; PbCommand command; PbDeviceDefinition* device = command.add_devices(); device->set_id(-1); @@ -216,7 +216,7 @@ int RasCtl::run(const vector& args) const break; case 'v': - cout << "rasctl version: " << rascsi_get_version_string() << endl; + cout << "scsictl version: " << piscsi_get_version_string() << endl; exit(EXIT_SUCCESS); break; @@ -239,7 +239,7 @@ int RasCtl::run(const vector& args) const case 'X': command.set_operation(SHUT_DOWN); - SetParam(command, "mode", "rascsi"); + SetParam(command, "mode", "piscsi"); break; case 'z': @@ -259,7 +259,7 @@ int RasCtl::run(const vector& args) const SetParam(command, "token", token); SetParam(command, "locale", locale); - RasctlCommands rasctl_commands(command, hostname, port); + ScsictlCommands scsictl_commands(command, hostname, port); bool status; try { @@ -268,12 +268,12 @@ int RasCtl::run(const vector& args) const command.clear_devices(); command.set_operation(DEVICES_INFO); - status = rasctl_commands.CommandDevicesInfo(); + status = scsictl_commands.CommandDevicesInfo(); } else { ParseParameters(*device, param); - status = rasctl_commands.Execute(log_level, default_folder, reserved_ids, image_params, filename); + status = scsictl_commands.Execute(log_level, default_folder, reserved_ids, image_params, filename); } } catch(const io_exception& e) { diff --git a/cpp/rasctl/rasctl_core.h b/cpp/scsictl/scsictl_core.h similarity index 69% rename from cpp/rasctl/rasctl_core.h rename to cpp/scsictl/scsictl_core.h index bd4f5c40..a96076f4 100644 --- a/cpp/rasctl/rasctl_core.h +++ b/cpp/scsictl/scsictl_core.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,19 +9,19 @@ #pragma once -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; -class RasCtl +class ScsiCtl { public: - RasCtl() = default; - ~RasCtl() = default; + ScsiCtl() = default; + ~ScsiCtl() = default; int run(const vector&) const; diff --git a/cpp/rasctl/rasctl_display.cpp b/cpp/scsictl/scsictl_display.cpp similarity index 82% rename from cpp/rasctl/rasctl_display.cpp rename to cpp/scsictl/scsictl_display.cpp index 0b38bdac..705fa6a2 100644 --- a/cpp/rasctl/rasctl_display.cpp +++ b/cpp/scsictl/scsictl_display.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -8,17 +8,17 @@ //--------------------------------------------------------------------------- #include "shared/protobuf_util.h" -#include "generated/rascsi_interface.pb.h" -#include "rasctl_display.h" +#include "generated/piscsi_interface.pb.h" +#include "scsictl_display.h" #include #include #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; using namespace protobuf_util; -string RasctlDisplay::DisplayDevicesInfo(const PbDevicesInfo& devices_info) const +string ScsictlDisplay::DisplayDevicesInfo(const PbDevicesInfo& devices_info) const { ostringstream s; @@ -29,7 +29,7 @@ string RasctlDisplay::DisplayDevicesInfo(const PbDevicesInfo& devices_info) cons return s.str(); } -string RasctlDisplay::DisplayDeviceInfo(const PbDevice& pb_device) const +string ScsictlDisplay::DisplayDeviceInfo(const PbDevice& pb_device) const { ostringstream s; @@ -99,11 +99,11 @@ string RasctlDisplay::DisplayDeviceInfo(const PbDevice& pb_device) const return s.str(); } -string RasctlDisplay::DisplayVersionInfo(const PbVersionInfo& version_info) const +string ScsictlDisplay::DisplayVersionInfo(const PbVersionInfo& version_info) const { ostringstream s; - s << "rascsi server version: " << setw(2) << setfill('0') << version_info.major_version() << "." + s << "piscsi server version: " << setw(2) << setfill('0') << version_info.major_version() << "." << setw(2) << setfill('0') << version_info.minor_version(); if (version_info.patch_version() > 0) { @@ -118,7 +118,7 @@ string RasctlDisplay::DisplayVersionInfo(const PbVersionInfo& version_info) cons return s.str(); } -string RasctlDisplay::DisplayLogLevelInfo(const PbLogLevelInfo& log_level_info) const +string ScsictlDisplay::DisplayLogLevelInfo(const PbLogLevelInfo& log_level_info) const { ostringstream s; @@ -126,19 +126,19 @@ string RasctlDisplay::DisplayLogLevelInfo(const PbLogLevelInfo& log_level_info) s << " No log level settings available\n"; } else { - s << "rascsi log levels, sorted by severity:\n"; + s << "piscsi log levels, sorted by severity:\n"; for (const auto& log_level : log_level_info.log_levels()) { s << " " << log_level << '\n'; } } - s << "Current rascsi log level: " << log_level_info.current_log_level() << '\n'; + s << "Current piscsi log level: " << log_level_info.current_log_level() << '\n'; return s.str(); } -string RasctlDisplay::DisplayDeviceTypesInfo(const PbDeviceTypesInfo& device_types_info) const +string ScsictlDisplay::DisplayDeviceTypesInfo(const PbDeviceTypesInfo& device_types_info) const { ostringstream s; @@ -169,7 +169,7 @@ string RasctlDisplay::DisplayDeviceTypesInfo(const PbDeviceTypesInfo& device_typ return s.str(); } -string RasctlDisplay::DisplayReservedIdsInfo(const PbReservedIdsInfo& reserved_ids_info) const +string ScsictlDisplay::DisplayReservedIdsInfo(const PbReservedIdsInfo& reserved_ids_info) const { ostringstream s; @@ -193,7 +193,7 @@ string RasctlDisplay::DisplayReservedIdsInfo(const PbReservedIdsInfo& reserved_i return s.str(); } -string RasctlDisplay::DisplayImageFile(const PbImageFile& image_file_info) const +string ScsictlDisplay::DisplayImageFile(const PbImageFile& image_file_info) const { ostringstream s; @@ -212,7 +212,7 @@ string RasctlDisplay::DisplayImageFile(const PbImageFile& image_file_info) const return s.str(); } -string RasctlDisplay::DisplayImageFilesInfo(const PbImageFilesInfo& image_files_info) const +string ScsictlDisplay::DisplayImageFilesInfo(const PbImageFilesInfo& image_files_info) const { ostringstream s; @@ -237,7 +237,7 @@ string RasctlDisplay::DisplayImageFilesInfo(const PbImageFilesInfo& image_files_ return s.str(); } -string RasctlDisplay::DisplayNetworkInterfaces(const PbNetworkInterfacesInfo& network_interfaces_info) const +string ScsictlDisplay::DisplayNetworkInterfaces(const PbNetworkInterfacesInfo& network_interfaces_info) const { ostringstream s; @@ -263,7 +263,7 @@ string RasctlDisplay::DisplayNetworkInterfaces(const PbNetworkInterfacesInfo& ne return s.str(); } -string RasctlDisplay::DisplayMappingInfo(const PbMappingInfo& mapping_info) const +string ScsictlDisplay::DisplayMappingInfo(const PbMappingInfo& mapping_info) const { ostringstream s; @@ -278,7 +278,7 @@ string RasctlDisplay::DisplayMappingInfo(const PbMappingInfo& mapping_info) cons return s.str(); } -string RasctlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info) const +string ScsictlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info) const { ostringstream s; @@ -299,7 +299,7 @@ string RasctlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info } } - s << "Operations supported by rascsi server and their parameters:\n"; + s << "Operations supported by piscsi server and their parameters:\n"; for (const auto& [name, meta_data] : sorted_operations) { if (!meta_data.server_side_name().empty()) { s << " " << name; @@ -318,7 +318,7 @@ string RasctlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info return s.str(); } -void RasctlDisplay::DisplayParams(ostringstream& s, const PbDevice& pb_device) const +void ScsictlDisplay::DisplayParams(ostringstream& s, const PbDevice& pb_device) const { const map> sorted_params = { pb_device.params().begin(), pb_device.params().end() }; @@ -333,7 +333,7 @@ void RasctlDisplay::DisplayParams(ostringstream& s, const PbDevice& pb_device) c } } -void RasctlDisplay::DisplayAttributes(ostringstream& s, const PbDeviceProperties& properties) const +void ScsictlDisplay::DisplayAttributes(ostringstream& s, const PbDeviceProperties& properties) const { if (properties.read_only() || properties.protectable() || properties.stoppable() || properties.lockable()) { s << "Properties: "; @@ -365,7 +365,7 @@ void RasctlDisplay::DisplayAttributes(ostringstream& s, const PbDeviceProperties } } -void RasctlDisplay::DisplayDefaultParameters(ostringstream& s, const PbDeviceProperties& properties) const +void ScsictlDisplay::DisplayDefaultParameters(ostringstream& s, const PbDeviceProperties& properties) const { if (properties.supports_params() && properties.default_params_size()) { s << "Default parameters: "; @@ -385,7 +385,7 @@ void RasctlDisplay::DisplayDefaultParameters(ostringstream& s, const PbDevicePro } -void RasctlDisplay::DisplayBlockSizes(ostringstream& s, const PbDeviceProperties& properties) const +void ScsictlDisplay::DisplayBlockSizes(ostringstream& s, const PbDeviceProperties& properties) const { if (properties.block_sizes_size()) { s << "Configurable block sizes in bytes: "; @@ -404,7 +404,7 @@ void RasctlDisplay::DisplayBlockSizes(ostringstream& s, const PbDeviceProperties } } -void RasctlDisplay::DisplayParameters(ostringstream& s, const PbOperationMetaData& meta_data) const +void ScsictlDisplay::DisplayParameters(ostringstream& s, const PbOperationMetaData& meta_data) const { list sorted_parameters = { meta_data.parameters().begin(), meta_data.parameters().end() }; sorted_parameters.sort([](const auto& a, const auto& b) { return a.name() < b.name(); }); @@ -426,7 +426,7 @@ void RasctlDisplay::DisplayParameters(ostringstream& s, const PbOperationMetaDat } } -void RasctlDisplay::DisplayPermittedValues(ostringstream& s, const PbOperationParameter& parameter) const +void ScsictlDisplay::DisplayPermittedValues(ostringstream& s, const PbOperationParameter& parameter) const { if (parameter.permitted_values_size()) { s << " Permitted values: "; diff --git a/cpp/rasctl/rasctl_display.h b/cpp/scsictl/scsictl_display.h similarity index 87% rename from cpp/rasctl/rasctl_display.h rename to cpp/scsictl/scsictl_display.h index 3df91fc0..6a7f4c55 100644 --- a/cpp/rasctl/rasctl_display.h +++ b/cpp/scsictl/scsictl_display.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -9,19 +9,19 @@ #pragma once -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; -class RasctlDisplay +class ScsictlDisplay { public: - RasctlDisplay() = default; - ~RasctlDisplay() = default; + ScsictlDisplay() = default; + ~ScsictlDisplay() = default; string DisplayDevicesInfo(const PbDevicesInfo&) const; string DisplayDeviceInfo(const PbDevice&) const; diff --git a/cpp/rasctl/rasctl_parser.cpp b/cpp/scsictl/scsictl_parser.cpp similarity index 77% rename from cpp/rasctl/rasctl_parser.cpp rename to cpp/scsictl/scsictl_parser.cpp index 984aedff..cd9ef35c 100644 --- a/cpp/rasctl/rasctl_parser.cpp +++ b/cpp/scsictl/scsictl_parser.cpp @@ -1,21 +1,21 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "rasctl_parser.h" +#include "scsictl_parser.h" -PbOperation RasctlParser::ParseOperation(const string& operation) const +PbOperation ScsictlParser::ParseOperation(const string& operation) const { const auto& it = operations.find(tolower(operation[0])); return it != operations.end() ? it->second : NO_OPERATION; } -PbDeviceType RasctlParser::ParseType(const string& type) const +PbDeviceType ScsictlParser::ParseType(const string& type) const { string t = type; transform(t.begin(), t.end(), t.begin(), ::toupper); diff --git a/cpp/rasctl/rasctl_parser.h b/cpp/scsictl/scsictl_parser.h similarity index 80% rename from cpp/rasctl/rasctl_parser.h rename to cpp/scsictl/scsictl_parser.h index b0420418..a09dc11a 100644 --- a/cpp/rasctl/rasctl_parser.h +++ b/cpp/scsictl/scsictl_parser.h @@ -1,26 +1,26 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; -class RasctlParser +class ScsictlParser { public: - RasctlParser() = default; - ~RasctlParser() = default; + ScsictlParser() = default; + ~ScsictlParser() = default; PbOperation ParseOperation(const string&) const; PbDeviceType ParseType(const string&) const; diff --git a/cpp/rasdump.cpp b/cpp/scsidump.cpp similarity index 82% rename from cpp/rasdump.cpp rename to cpp/scsidump.cpp index 2523a5c1..d8085e3b 100644 --- a/cpp/rasdump.cpp +++ b/cpp/scsidump.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "rasdump/rasdump_core.h" +#include "scsidump/scsidump_core.h" using namespace std; diff --git a/cpp/rasdump/rasdump_core.cpp b/cpp/scsidump/scsidump_core.cpp similarity index 95% rename from cpp/rasdump/rasdump_core.cpp rename to cpp/scsidump/scsidump_core.cpp index fff03819..bfe01244 100644 --- a/cpp/rasdump/rasdump_core.cpp +++ b/cpp/scsidump/scsidump_core.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -13,13 +13,13 @@ // TODO Send IDENTIFY message in order to support LUNS > 7 #include "shared/log.h" -#include "shared/rasutil.h" -#include "shared/rascsi_exceptions.h" -#include "shared/rascsi_version.h" +#include "shared/piscsi_util.h" +#include "shared/piscsi_exceptions.h" +#include "shared/piscsi_version.h" #include "hal/gpiobus_factory.h" #include "hal/gpiobus.h" #include "hal/systimer.h" -#include "rasdump/rasdump_core.h" +#include "scsidump/scsidump_core.h" #include #include #include @@ -31,7 +31,7 @@ using namespace std; using namespace spdlog; using namespace scsi_defs; -using namespace ras_util; +using namespace piscsi_util; void RasDump::CleanUp() { @@ -49,13 +49,13 @@ void RasDump::KillHandler(int) bool RasDump::Banner(const vector& args) const { - cout << ras_util::Banner("RaSCSI hard disk dump/restore utility"); + cout << piscsi_util::Banner("(Hard Disk Dump/Restore Utility)"); if (args.size() < 2 || string(args[1]) == "-h") { cout << "Usage: " << args[0] << " -t ID[:LUN] [-i BID] -f FILE [-v] [-r] [-s BUFFER_SIZE]\n" << " ID is the target device ID (0-7).\n" << " LUN is the optional target device LUN (0-7). Default is 0.\n" - << " BID is the RaSCSI board ID (0-7). Default is 7.\n" + << " BID is the PiSCSI board ID (0-7). Default is 7.\n" << " FILE is the dump file path.\n" << " BUFFER_SIZE is the transfer buffer size, at least " << to_string(MINIMUM_BUFFER_SIZE / 1024) << " KiB. Default is 1 MiB.\n" @@ -92,7 +92,7 @@ void RasDump::ParseArguments(const vector& args) switch (opt) { case 'i': if (!GetAsUnsignedInt(optarg, initiator_id) || initiator_id > 7) { - throw parser_exception("Invalid RaSCSI board ID " + to_string(initiator_id) + " (0-7)"); + throw parser_exception("Invalid PiSCSI board ID " + to_string(initiator_id) + " (0-7)"); } break; @@ -129,7 +129,7 @@ void RasDump::ParseArguments(const vector& args) } if (target_id == initiator_id) { - throw parser_exception("Target ID and RaSCSI board ID must not be identical"); + throw parser_exception("Target ID and PiSCSI board ID must not be identical"); } if (filename.empty()) { @@ -395,7 +395,7 @@ int RasDump::run(const vector& args) ParseArguments(args); #ifndef USE_SEL_EVENT_ENABLE - cerr << "Error: No RaSCSI hardware support" << endl; + cerr << "Error: No PiSCSI hardware support" << endl; return EXIT_FAILURE; #endif @@ -505,7 +505,7 @@ pair RasDump::GetDeviceInfo() bus->SetRST(false); cout << "Target device ID: " << target_id << ", LUN: " << target_lun << "\n"; - cout << "RaSCSI board ID: " << initiator_id << "\n" << flush; + cout << "PiSCSI board ID: " << initiator_id << "\n" << flush; Inquiry(); diff --git a/cpp/rasdump/rasdump_core.h b/cpp/scsidump/scsidump_core.h similarity index 97% rename from cpp/rasdump/rasdump_core.h rename to cpp/scsidump/scsidump_core.h index 8997f18c..5b4eb2f7 100644 --- a/cpp/rasdump/rasdump_core.h +++ b/cpp/scsidump/scsidump_core.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/scsiloop.cpp b/cpp/scsiloop.cpp index b81158f9..b0e3c6a0 100644 --- a/cpp/scsiloop.cpp +++ b/cpp/scsiloop.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/scsiloop/scsiloop_core.cpp b/cpp/scsiloop/scsiloop_core.cpp index f6b0c378..09b867a3 100644 --- a/cpp/scsiloop/scsiloop_core.cpp +++ b/cpp/scsiloop/scsiloop_core.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded for Raspberry Pi +// SCSI Target Emulator PiSCSI for Raspberry Pi // Loopback tester utility // // Copyright (C) 2022 akuker @@ -8,13 +8,13 @@ // [ Loopback tester utility ] // // For more information, see: -// https://github.com/akuker/RASCSI/wiki/Troubleshooting#Loopback_Testing +// https://github.com/PiSCSI/piscsi/wiki/Troubleshooting#Loopback_Testing // //--------------------------------------------------------------------------- #include "shared/log.h" -#include "shared/rascsi_version.h" -#include "shared/rasutil.h" +#include "shared/piscsi_version.h" +#include "shared/piscsi_util.h" #include "spdlog/sinks/stdout_color_sinks.h" #include "scsiloop/scsiloop_core.h" @@ -44,8 +44,8 @@ string current_log_level = "unknown"; // Some versions of spdlog do not support void ScsiLoop::Banner(const vector &args) const { - cout << ras_util::Banner("SCSI Loopback Test"); - cout << "Connect type: " << CONNECT_DESC << '\n' << flush; + cout << piscsi_util::Banner("(SCSI Loopback Test)"); + cout << "Connection type: " << CONNECT_DESC << '\n' << flush; if ((args.size() > 1 && strcmp(args[1], "-h") == 0) || (args.size() > 1 && strcmp(args[1], "--help") == 0)) { cout << "\nUsage: " << args[0] << " [-L log_level] ...\n\n"; @@ -132,7 +132,7 @@ int ScsiLoop::run(const vector &args) // The -v option should be available for any user, which requires special handling. for (auto this_arg : args) { if (!strcasecmp(this_arg, "-v")) { - cout << rascsi_get_version_string() << endl; + cout << piscsi_get_version_string() << endl; return 0; } } diff --git a/cpp/scsiloop/scsiloop_core.h b/cpp/scsiloop/scsiloop_core.h index cb407e4f..8a0367c1 100644 --- a/cpp/scsiloop/scsiloop_core.h +++ b/cpp/scsiloop/scsiloop_core.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/scsiloop/scsiloop_cout.cpp b/cpp/scsiloop/scsiloop_cout.cpp index 9700b22c..b681fac6 100644 --- a/cpp/scsiloop/scsiloop_cout.cpp +++ b/cpp/scsiloop/scsiloop_cout.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded for Raspberry Pi +// SCSI Target Emulator PiSCSI for Raspberry Pi // Loopback tester utility // // Copyright (C) 2022 akuker diff --git a/cpp/scsiloop/scsiloop_cout.h b/cpp/scsiloop/scsiloop_cout.h index 90fb448a..35d0bc4d 100644 --- a/cpp/scsiloop/scsiloop_cout.h +++ b/cpp/scsiloop/scsiloop_cout.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded for Raspberry Pi +// SCSI Target Emulator PiSCSI for Raspberry Pi // Loopback tester utility // // Copyright (C) 2022 akuker diff --git a/cpp/scsiloop/scsiloop_gpio.cpp b/cpp/scsiloop/scsiloop_gpio.cpp index f7f6a3b5..c4a86a96 100644 --- a/cpp/scsiloop/scsiloop_gpio.cpp +++ b/cpp/scsiloop/scsiloop_gpio.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded for Raspberry Pi +// SCSI Target Emulator PiSCSI for Raspberry Pi // Loopback tester utility // // Copyright (C) 2022 akuker diff --git a/cpp/scsiloop/scsiloop_gpio.h b/cpp/scsiloop/scsiloop_gpio.h index 9e5c217b..d4365682 100644 --- a/cpp/scsiloop/scsiloop_gpio.h +++ b/cpp/scsiloop/scsiloop_gpio.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded for Raspberry Pi +// SCSI Target Emulator PiSCSI for Raspberry Pi // Loopback tester utility // // Copyright (C) 2022 akuker diff --git a/cpp/scsiloop/scsiloop_timer.cpp b/cpp/scsiloop/scsiloop_timer.cpp index 73982684..293c268a 100644 --- a/cpp/scsiloop/scsiloop_timer.cpp +++ b/cpp/scsiloop/scsiloop_timer.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded for Raspberry Pi +// SCSI Target Emulator PiSCSI for Raspberry Pi // Loopback tester utility // // Copyright (C) 2022 akuker diff --git a/cpp/scsiloop/scsiloop_timer.h b/cpp/scsiloop/scsiloop_timer.h index 96394242..ef8fa57a 100644 --- a/cpp/scsiloop/scsiloop_timer.h +++ b/cpp/scsiloop/scsiloop_timer.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded for Raspberry Pi +// SCSI Target Emulator PiSCSI for Raspberry Pi // Loopback tester utility // // Copyright (C) 2022 akuker diff --git a/cpp/scsimon.cpp b/cpp/scsimon.cpp index e6c6287d..b0b00383 100644 --- a/cpp/scsimon.cpp +++ b/cpp/scsimon.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/shared/config.h b/cpp/shared/config.h index a1586aec..9d46f813 100644 --- a/cpp/shared/config.h +++ b/cpp/shared/config.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. @@ -16,8 +16,8 @@ // //--------------------------------------------------------------------------- #define USE_SEL_EVENT_ENABLE // Check SEL signal by event -// This avoids an indefinite loop with warnings if there is no RaSCSI hardware -// and thus helps with running rasctl and unit test on x86 hardware. +// This avoids an indefinite loop with warnings if there is no PiSCSI hardware +// and thus helps with running scsictl and unit test on x86 hardware. #if defined(__x86_64__) || defined(__X86__) || !defined(__linux__) #undef USE_SEL_EVENT_ENABLE #endif diff --git a/cpp/shared/log.h b/cpp/shared/log.h index 9898c221..379a7732 100644 --- a/cpp/shared/log.h +++ b/cpp/shared/log.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Powered by XM6 TypeG Technology. diff --git a/cpp/shared/rascsi_exceptions.h b/cpp/shared/piscsi_exceptions.h similarity index 96% rename from cpp/shared/rascsi_exceptions.h rename to cpp/shared/piscsi_exceptions.h index e39e1f6d..34c58591 100644 --- a/cpp/shared/rascsi_exceptions.h +++ b/cpp/shared/piscsi_exceptions.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet diff --git a/cpp/shared/rasutil.cpp b/cpp/shared/piscsi_util.cpp similarity index 76% rename from cpp/shared/rasutil.cpp rename to cpp/shared/piscsi_util.cpp index 897175e3..6a58a950 100644 --- a/cpp/shared/rasutil.cpp +++ b/cpp/shared/piscsi_util.cpp @@ -1,21 +1,21 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet // //--------------------------------------------------------------------------- -#include "rascsi_version.h" -#include "rasutil.h" +#include "piscsi_version.h" +#include "piscsi_util.h" #include #include #include using namespace std; -bool ras_util::GetAsUnsignedInt(const string& value, int& result) +bool piscsi_util::GetAsUnsignedInt(const string& value, int& result) { if (value.find_first_not_of("0123456789") != string::npos) { return false; @@ -35,7 +35,7 @@ bool ras_util::GetAsUnsignedInt(const string& value, int& result) return true; } -string ras_util::ProcessId(const string& id_spec, int max_luns, int& id, int& lun) +string piscsi_util::ProcessId(const string& id_spec, int max_luns, int& id, int& lun) { assert(max_luns > 0); @@ -66,20 +66,20 @@ string ras_util::ProcessId(const string& id_spec, int max_luns, int& id, int& lu return ""; } -string ras_util::Banner(const string& app) +string piscsi_util::Banner(const string& app) { ostringstream s; - s << "SCSI Target Emulator RaSCSI " << app << " version " << rascsi_get_version_string() - << " (" << __DATE__ << ' ' << __TIME__ << ")\n"; + s << "SCSI Target Emulator PiSCSI " << app << "\n"; + s << "Version " << piscsi_get_version_string() << " (" << __DATE__ << ' ' << __TIME__ << ")\n"; s << "Powered by XM6 TypeG Technology / "; s << "Copyright (C) 2016-2020 GIMONS\n"; - s << "Copyright (C) 2020-2022 Contributors to the RaSCSI Reloaded project\n"; + s << "Copyright (C) 2020-2022 Contributors to the PiSCSI project\n"; return s.str(); } -string ras_util::GetExtensionLowerCase(const string& filename) +string piscsi_util::GetExtensionLowerCase(const string& filename) { string ext; if (const size_t separator = filename.rfind('.'); separator != string::npos) { @@ -92,7 +92,7 @@ string ras_util::GetExtensionLowerCase(const string& filename) // Pin the thread to a specific CPU // TODO Check whether just using a single CPU really makes sense -void ras_util::FixCpu(int cpu) +void piscsi_util::FixCpu(int cpu) { #ifdef __linux__ // Get the number of CPUs diff --git a/cpp/shared/rasutil.h b/cpp/shared/piscsi_util.h similarity index 90% rename from cpp/shared/rasutil.h rename to cpp/shared/piscsi_util.h index 2e733a16..762db353 100644 --- a/cpp/shared/rasutil.h +++ b/cpp/shared/piscsi_util.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -13,7 +13,7 @@ using namespace std; -namespace ras_util +namespace piscsi_util { // Separator for compound options like ID:LUN static const char COMPONENT_SEPARATOR = ':'; diff --git a/cpp/shared/rascsi_version.cpp b/cpp/shared/piscsi_version.cpp similarity index 52% rename from cpp/shared/rascsi_version.cpp rename to cpp/shared/piscsi_version.cpp index 487f1407..59f0c0f7 100644 --- a/cpp/shared/rascsi_version.cpp +++ b/cpp/shared/piscsi_version.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2020 akuker @@ -8,28 +8,28 @@ // //--------------------------------------------------------------------------- -#include "rascsi_version.h" +#include "piscsi_version.h" #include #include // The following should be updated for each release -const int rascsi_major_version = 22; // Last two digits of year -const int rascsi_minor_version = 12; // Month -const int rascsi_patch_version = -1; // Patch number - increment for each update +const int piscsi_major_version = 22; // Last two digits of year +const int piscsi_minor_version = 12; // Month +const int piscsi_patch_version = -1; // Patch number - increment for each update using namespace std; -string rascsi_get_version_string() +string piscsi_get_version_string() { stringstream s; - s << setw(2) << setfill('0') << rascsi_major_version << '.' << rascsi_minor_version; + s << setw(2) << setfill('0') << piscsi_major_version << '.' << piscsi_minor_version; - if (rascsi_patch_version < 0) { + if (piscsi_patch_version < 0) { s << " --DEVELOPMENT BUILD--"; } else { - s << '.' << rascsi_patch_version; + s << '.' << piscsi_patch_version; } return s.str(); diff --git a/cpp/shared/rascsi_version.h b/cpp/shared/piscsi_version.h similarity index 53% rename from cpp/shared/rascsi_version.h rename to cpp/shared/piscsi_version.h index 8283efda..a7bfea24 100644 --- a/cpp/shared/rascsi_version.h +++ b/cpp/shared/piscsi_version.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2020 akuker @@ -11,8 +11,8 @@ #include -extern const int rascsi_major_version; // Last two digits of year -extern const int rascsi_minor_version; // Month -extern const int rascsi_patch_version; // Patch number +extern const int piscsi_major_version; // Last two digits of year +extern const int piscsi_minor_version; // Month +extern const int piscsi_patch_version; // Patch number -std::string rascsi_get_version_string(); +std::string piscsi_get_version_string(); diff --git a/cpp/shared/protobuf_serializer.cpp b/cpp/shared/protobuf_serializer.cpp index 1dd1bb20..ffca4e23 100644 --- a/cpp/shared/protobuf_serializer.cpp +++ b/cpp/shared/protobuf_serializer.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,12 +8,12 @@ //--------------------------------------------------------------------------- #include "shared/protobuf_serializer.h" -#include "shared/rascsi_exceptions.h" -#include "generated/rascsi_interface.pb.h" +#include "shared/piscsi_exceptions.h" +#include "generated/piscsi_interface.pb.h" #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; //--------------------------------------------------------------------------- // diff --git a/cpp/shared/protobuf_serializer.h b/cpp/shared/protobuf_serializer.h index 96e2f886..b9a67302 100644 --- a/cpp/shared/protobuf_serializer.h +++ b/cpp/shared/protobuf_serializer.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/shared/protobuf_util.cpp b/cpp/shared/protobuf_util.cpp index 3ff6a8e0..9557b5bc 100644 --- a/cpp/shared/protobuf_util.cpp +++ b/cpp/shared/protobuf_util.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -8,14 +8,14 @@ //--------------------------------------------------------------------------- #include "log.h" -#include "rasutil.h" +#include "piscsi_util.h" #include "protobuf_serializer.h" #include "protobuf_util.h" #include using namespace std; -using namespace ras_util; -using namespace rascsi_interface; +using namespace piscsi_util; +using namespace piscsi_interface; #define FPRT(fp, ...) fprintf(fp, __VA_ARGS__ ) diff --git a/cpp/shared/protobuf_util.h b/cpp/shared/protobuf_util.h index d3603006..a0dcd760 100644 --- a/cpp/shared/protobuf_util.h +++ b/cpp/shared/protobuf_util.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet @@ -12,12 +12,12 @@ #pragma once #include "google/protobuf/message.h" -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include using namespace std; -using namespace rascsi_interface; +using namespace piscsi_interface; namespace protobuf_util { diff --git a/cpp/test/abstract_controller_test.cpp b/cpp/test/abstract_controller_test.cpp index b6daa7c3..8e1e5352 100644 --- a/cpp/test/abstract_controller_test.cpp +++ b/cpp/test/abstract_controller_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/abstract_controller.h" using namespace scsi_defs; diff --git a/cpp/test/bus_test.cpp b/cpp/test/bus_test.cpp index 4b711dd6..fc78731c 100644 --- a/cpp/test/bus_test.cpp +++ b/cpp/test/bus_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/test/command_context_test.cpp b/cpp/test/command_context_test.cpp index ec798481..d99a1d59 100644 --- a/cpp/test/command_context_test.cpp +++ b/cpp/test/command_context_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,7 +9,7 @@ #include -#include "rascsi/command_context.h" +#include "piscsi/command_context.h" TEST(CommandContext, GetSerializer) { diff --git a/cpp/test/controller_manager_test.cpp b/cpp/test/controller_manager_test.cpp index 996b2f0a..9ae770a4 100644 --- a/cpp/test/controller_manager_test.cpp +++ b/cpp/test/controller_manager_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/test/ctapdriver_test.cpp b/cpp/test/ctapdriver_test.cpp index ecf13a18..031e1acc 100644 --- a/cpp/test/ctapdriver_test.cpp +++ b/cpp/test/ctapdriver_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/test/device_factory_test.cpp b/cpp/test/device_factory_test.cpp index 103bdc19..7f41c415 100644 --- a/cpp/test/device_factory_test.cpp +++ b/cpp/test/device_factory_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,8 +8,8 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" -#include "shared/rascsi_version.h" +#include "shared/piscsi_exceptions.h" +#include "shared/piscsi_version.h" #include "controllers/controller_manager.h" #include "devices/device.h" #include "devices/device_factory.h" @@ -156,7 +156,7 @@ TEST(DeviceFactoryTest, SCHD_Device_Defaults) EXPECT_EQ("QUANTUM", device->GetVendor()) << "Invalid default vendor for Apple drive"; EXPECT_EQ("FIREBALL", device->GetProduct()) << "Invalid default vendor for Apple drive"; - EXPECT_EQ(string(rascsi_get_version_string()).substr(0, 2) + string(rascsi_get_version_string()).substr(3, 2), + EXPECT_EQ(string(piscsi_get_version_string()).substr(0, 2) + string(piscsi_get_version_string()).substr(3, 2), device->GetRevision()); device = device_factory.CreateDevice(UNDEFINED, 0, "test.hds"); @@ -191,9 +191,9 @@ void TestRemovableDrive(PbDeviceType type, const string& filename, const string& EXPECT_TRUE(device->IsStoppable()); EXPECT_FALSE(device->IsStopped()); - EXPECT_EQ("RaSCSI", device->GetVendor()); + EXPECT_EQ("PiSCSI", device->GetVendor()); EXPECT_EQ(product, device->GetProduct()); - EXPECT_EQ(string(rascsi_get_version_string()).substr(0, 2) + string(rascsi_get_version_string()).substr(3, 2), + EXPECT_EQ(string(piscsi_get_version_string()).substr(0, 2) + string(piscsi_get_version_string()).substr(3, 2), device->GetRevision()); } @@ -227,9 +227,9 @@ TEST(DeviceFactoryTest, SCCD_Device_Defaults) EXPECT_TRUE(device->IsStoppable()); EXPECT_FALSE(device->IsStopped()); - EXPECT_EQ("RaSCSI", device->GetVendor()); + EXPECT_EQ("PiSCSI", device->GetVendor()); EXPECT_EQ("SCSI CD-ROM", device->GetProduct()); - EXPECT_EQ(string(rascsi_get_version_string()).substr(0, 2) + string(rascsi_get_version_string()).substr(3, 2), + EXPECT_EQ(string(piscsi_get_version_string()).substr(0, 2) + string(piscsi_get_version_string()).substr(3, 2), device->GetRevision()); } @@ -252,9 +252,9 @@ TEST(DeviceFactoryTest, SCBR_Device_Defaults) EXPECT_FALSE(device->IsStoppable()); EXPECT_FALSE(device->IsStopped()); - EXPECT_EQ("RaSCSI", device->GetVendor()); + EXPECT_EQ("PiSCSI", device->GetVendor()); EXPECT_EQ("RASCSI BRIDGE", device->GetProduct()); - EXPECT_EQ(string(rascsi_get_version_string()).substr(0, 2) + string(rascsi_get_version_string()).substr(3, 2), + EXPECT_EQ(string(piscsi_get_version_string()).substr(0, 2) + string(piscsi_get_version_string()).substr(3, 2), device->GetRevision()); } @@ -301,9 +301,9 @@ TEST(DeviceFactoryTest, SCHS_Device_Defaults) EXPECT_FALSE(device->IsStoppable()); EXPECT_FALSE(device->IsStopped()); - EXPECT_EQ("RaSCSI", device->GetVendor()); + EXPECT_EQ("PiSCSI", device->GetVendor()); EXPECT_EQ("Host Services", device->GetProduct()); - EXPECT_EQ(string(rascsi_get_version_string()).substr(0, 2) + string(rascsi_get_version_string()).substr(3, 2), + EXPECT_EQ(string(piscsi_get_version_string()).substr(0, 2) + string(piscsi_get_version_string()).substr(3, 2), device->GetRevision()); } @@ -326,8 +326,8 @@ TEST(DeviceFactoryTest, SCLP_Device_Defaults) EXPECT_FALSE(device->IsStoppable()); EXPECT_FALSE(device->IsStopped()); - EXPECT_EQ("RaSCSI", device->GetVendor()); + EXPECT_EQ("PiSCSI", device->GetVendor()); EXPECT_EQ("SCSI PRINTER", device->GetProduct()); - EXPECT_EQ(string(rascsi_get_version_string()).substr(0, 2) + string(rascsi_get_version_string()).substr(3, 2), + EXPECT_EQ(string(piscsi_get_version_string()).substr(0, 2) + string(piscsi_get_version_string()).substr(3, 2), device->GetRevision()); } diff --git a/cpp/test/device_test.cpp b/cpp/test/device_test.cpp index f8363dff..740adfbf 100644 --- a/cpp/test/device_test.cpp +++ b/cpp/test/device_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/device.h" TEST(DeviceTest, Properties) diff --git a/cpp/test/disk_test.cpp b/cpp/test/disk_test.cpp index 6ccb9939..82c5a3c5 100644 --- a/cpp/test/disk_test.cpp +++ b/cpp/test/disk_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,7 +9,7 @@ #include "mocks.h" #include "shared/scsi.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/disk.h" #include "devices/scsi_command_util.h" diff --git a/cpp/test/gpiobus_raspberry_test.cpp b/cpp/test/gpiobus_raspberry_test.cpp index 63c3d407..a96e4b7c 100644 --- a/cpp/test/gpiobus_raspberry_test.cpp +++ b/cpp/test/gpiobus_raspberry_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker @@ -41,7 +41,7 @@ uint32_t bcm_host_get_peripheral_address(); TEST(GpiobusRaspberry, GetDtRanges) { - string soc_ranges_file = "/proc/device-tree/soc/ranges"; + const string soc_ranges_file = "/proc/device-tree/soc/ranges"; vector data; // If bytes 4-7 are non-zero, get_peripheral address should return those bytes @@ -231,4 +231,4 @@ TEST(GpiobusRaspberry, GetDP) bus.TestSetGpioPin(PIN_DP, false); bus.Acquire(); EXPECT_EQ(false, bus.GetDP()); -} \ No newline at end of file +} diff --git a/cpp/test/host_services_test.cpp b/cpp/test/host_services_test.cpp index eb4a6f40..58597cff 100644 --- a/cpp/test/host_services_test.cpp +++ b/cpp/test/host_services_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/controller_manager.h" #include "devices/host_services.h" @@ -34,7 +34,7 @@ TEST(HostServicesTest, TestUnitReady) TEST(HostServicesTest, Inquiry) { - TestInquiry(SCHS, device_type::PROCESSOR, scsi_level::SPC_3, "RaSCSI Host Services ", 0x1f, false); + TestInquiry(SCHS, device_type::PROCESSOR, scsi_level::SPC_3, "PiSCSI Host Services ", 0x1f, false); } TEST(HostServicesTest, StartStopUnit) @@ -47,21 +47,21 @@ TEST(HostServicesTest, StartStopUnit) auto& cmd = controller->GetCmd(); // STOP - EXPECT_CALL(*controller, ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_RASCSI)); + EXPECT_CALL(*controller, ScheduleShutdown(AbstractController::piscsi_shutdown_mode::STOP_PISCSI)); EXPECT_CALL(*controller, Status()); services->Dispatch(scsi_command::eCmdStartStop); EXPECT_EQ(status::GOOD, controller->GetStatus()); // LOAD cmd[4] = 0x02; - EXPECT_CALL(*controller, ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_PI)); + EXPECT_CALL(*controller, ScheduleShutdown(AbstractController::piscsi_shutdown_mode::STOP_PI)); EXPECT_CALL(*controller, Status()); services->Dispatch(scsi_command::eCmdStartStop); EXPECT_EQ(status::GOOD, controller->GetStatus()); // UNLOAD cmd[4] = 0x03; - EXPECT_CALL(*controller, ScheduleShutdown(AbstractController::rascsi_shutdown_mode::RESTART_PI)); + EXPECT_CALL(*controller, ScheduleShutdown(AbstractController::piscsi_shutdown_mode::RESTART_PI)); EXPECT_CALL(*controller, Status()); services->Dispatch(scsi_command::eCmdStartStop); EXPECT_EQ(status::GOOD, controller->GetStatus()); diff --git a/cpp/test/linux_os_stubs.cpp b/cpp/test/linux_os_stubs.cpp index 841569cc..41eec33c 100644 --- a/cpp/test/linux_os_stubs.cpp +++ b/cpp/test/linux_os_stubs.cpp @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/test/linux_os_stubs.h b/cpp/test/linux_os_stubs.h index 952ce8b7..111e8a63 100644 --- a/cpp/test/linux_os_stubs.h +++ b/cpp/test/linux_os_stubs.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 akuker diff --git a/cpp/test/localizer_test.cpp b/cpp/test/localizer_test.cpp index 0c1be769..a1473f52 100644 --- a/cpp/test/localizer_test.cpp +++ b/cpp/test/localizer_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,7 +9,7 @@ #include -#include "rascsi/localizer.h" +#include "piscsi/localizer.h" TEST(Localizer, Localize) { diff --git a/cpp/test/mocks.h b/cpp/test/mocks.h index b3645f78..ef49fa6b 100644 --- a/cpp/test/mocks.h +++ b/cpp/test/mocks.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -22,8 +22,8 @@ #include "devices/scsicd.h" #include "devices/scsimo.h" #include "devices/host_services.h" -#include "rascsi/command_context.h" -#include "rascsi/rascsi_executor.h" +#include "piscsi/command_context.h" +#include "piscsi/piscsi_executor.h" #include using namespace testing; @@ -99,8 +99,8 @@ public: class MockAbstractController : public AbstractController //NOSONAR Having many fields/methods cannot be avoided { - friend shared_ptr CreateDevice(rascsi_interface::PbDeviceType, AbstractController&, int); - friend void TestInquiry(rascsi_interface::PbDeviceType, scsi_defs::device_type, scsi_defs::scsi_level, + friend shared_ptr CreateDevice(piscsi_interface::PbDeviceType, AbstractController&, int); + friend void TestInquiry(piscsi_interface::PbDeviceType, scsi_defs::device_type, scsi_defs::scsi_level, scsi_defs::scsi_level, const std::string&, int, bool); FRIEND_TEST(AbstractControllerTest, AllocateCmd); @@ -163,7 +163,7 @@ public: MOCK_METHOD(void, Command, (), ()); MOCK_METHOD(void, MsgIn, (), ()); MOCK_METHOD(void, MsgOut, (), ()); - MOCK_METHOD(void, ScheduleShutdown, (rascsi_shutdown_mode), (override)); + MOCK_METHOD(void, ScheduleShutdown, (piscsi_shutdown_mode), (override)); explicit MockAbstractController(shared_ptr controller_manager, int target_id) : AbstractController(controller_manager, target_id, 32) { @@ -228,7 +228,7 @@ class MockPrimaryDevice : public PrimaryDevice FRIEND_TEST(PrimaryDeviceTest, Inquiry); FRIEND_TEST(PrimaryDeviceTest, GetSetSendDelay); FRIEND_TEST(ScsiControllerTest, RequestSense); - FRIEND_TEST(RascsiExecutorTest, ValidateOperationAgainstDevice); + FRIEND_TEST(PiscsiExecutorTest, ValidateOperationAgainstDevice); public: @@ -349,7 +349,7 @@ class MockSCSIHD : public SCSIHD //NOSONAR Ignore inheritance hierarchy depth in FRIEND_TEST(ScsiHdTest, FinalizeSetup); FRIEND_TEST(ScsiHdTest, GetProductData); FRIEND_TEST(ScsiHdTest, SetUpModePages); - FRIEND_TEST(RascsiExecutorTest, SetSectorSize); + FRIEND_TEST(PiscsiExecutorTest, SetSectorSize); FRIEND_TEST(ScsiHdTest, ModeSelect); using SCSIHD::SCSIHD; @@ -360,7 +360,7 @@ class MockSCSIHD_NEC : public SCSIHD_NEC //NOSONAR Ignore inheritance hierarchy FRIEND_TEST(ScsiHdNecTest, SetUpModePages); FRIEND_TEST(ScsiHdNecTest, TestAddFormatPage); FRIEND_TEST(ScsiHdNecTest, TestAddDrivePage); - FRIEND_TEST(RascsiExecutorTest, ProcessDeviceCmd); + FRIEND_TEST(PiscsiExecutorTest, ProcessDeviceCmd); using SCSIHD_NEC::SCSIHD_NEC; }; @@ -400,12 +400,12 @@ public: ~MockCommandContext() = default; }; -class MockRascsiExecutor : public RascsiExecutor +class MockPiscsiExecutor : public PiscsiExecutor { public: MOCK_METHOD(bool, Start, (shared_ptr, bool), (const)); MOCK_METHOD(bool, Stop, (shared_ptr, bool), (const)); - using RascsiExecutor::RascsiExecutor; + using PiscsiExecutor::PiscsiExecutor; }; diff --git a/cpp/test/mode_page_device_test.cpp b/cpp/test/mode_page_device_test.cpp index a919f0dc..31d0a2a9 100644 --- a/cpp/test/mode_page_device_test.cpp +++ b/cpp/test/mode_page_device_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/mode_page_device.h" using namespace std; diff --git a/cpp/test/phase_handler_test.cpp b/cpp/test/phase_handler_test.cpp index 22a5c733..7af4f6b1 100644 --- a/cpp/test/phase_handler_test.cpp +++ b/cpp/test/phase_handler_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet diff --git a/cpp/test/rascsi_exceptions_test.cpp b/cpp/test/piscsi_exceptions_test.cpp similarity index 81% rename from cpp/test/rascsi_exceptions_test.cpp rename to cpp/test/piscsi_exceptions_test.cpp index 7f9a7eb4..6def9716 100644 --- a/cpp/test/rascsi_exceptions_test.cpp +++ b/cpp/test/piscsi_exceptions_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,11 +9,11 @@ #include -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" using namespace scsi_defs; -TEST(RascsiExceptionsTest, IoException) +TEST(PiscsiExceptionsTest, IoException) { try { throw io_exception("msg"); @@ -23,7 +23,7 @@ TEST(RascsiExceptionsTest, IoException) } } -TEST(RascsiExceptionsTest, FileNotFoundException) +TEST(PiscsiExceptionsTest, FileNotFoundException) { try { throw file_not_found_exception("msg"); @@ -33,7 +33,7 @@ TEST(RascsiExceptionsTest, FileNotFoundException) } } -TEST(RascsiExceptionsTest, ScsiErrorException) +TEST(PiscsiExceptionsTest, ScsiErrorException) { try { throw scsi_exception(sense_key::UNIT_ATTENTION); diff --git a/cpp/test/rascsi_executor_test.cpp b/cpp/test/piscsi_executor_test.cpp similarity index 89% rename from cpp/test/rascsi_executor_test.cpp rename to cpp/test/piscsi_executor_test.cpp index 22b2b0a9..ba9137bc 100644 --- a/cpp/test/rascsi_executor_test.cpp +++ b/cpp/test/piscsi_executor_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -10,31 +10,31 @@ #include "spdlog/spdlog.h" #include "mocks.h" #include "shared/protobuf_util.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/controller_manager.h" #include "devices/device_factory.h" -#include "generated/rascsi_interface.pb.h" -#include "rascsi/command_context.h" -#include "rascsi/rascsi_response.h" -#include "rascsi/rascsi_image.h" -#include "rascsi/rascsi_executor.h" +#include "generated/piscsi_interface.pb.h" +#include "piscsi/command_context.h" +#include "piscsi/piscsi_response.h" +#include "piscsi/piscsi_image.h" +#include "piscsi/piscsi_executor.h" #include using namespace filesystem; -using namespace rascsi_interface; +using namespace piscsi_interface; using namespace protobuf_util; const extern bool enable_logging; // This test fixture is required in order to reset the log level changed by the log level tests -class RascsiExecutorTest : public Test +class PiscsiExecutorTest : public Test { void TearDown() override { spdlog::set_level(enable_logging ? spdlog::level::trace : spdlog::level::off); } }; -TEST_F(RascsiExecutorTest, ProcessDeviceCmd) +TEST_F(PiscsiExecutorTest, ProcessDeviceCmd) { const int ID = 3; const int LUN = 0; @@ -42,8 +42,8 @@ TEST_F(RascsiExecutorTest, ProcessDeviceCmd) auto bus = make_shared(); auto controller_manager = make_shared(*bus); MockAbstractController controller(controller_manager, ID); - RascsiImage rascsi_image; - auto executor = make_shared(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + auto executor = make_shared(piscsi_image, *controller_manager); PbDeviceDefinition definition; PbCommand command; MockCommandContext context; @@ -148,13 +148,13 @@ TEST_F(RascsiExecutorTest, ProcessDeviceCmd) EXPECT_FALSE(executor->ProcessDeviceCmd(context, definition, command, true)); } -TEST_F(RascsiExecutorTest, ProcessCmd) +TEST_F(PiscsiExecutorTest, ProcessCmd) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); MockAbstractController controller(controller_manager, 0); - RascsiImage rascsi_image; - auto executor = make_shared(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + auto executor = make_shared(piscsi_image, *controller_manager); PbCommand command1; PbCommand command2; MockCommandContext context; @@ -192,7 +192,7 @@ TEST_F(RascsiExecutorTest, ProcessCmd) EXPECT_TRUE(executor->ProcessCmd(context, command1)); // The operations below must fail because of missing parameters. - // The respective functionality is tested in rascsi_image_test.cpp. + // The respective functionality is tested in piscsi_image_test.cpp. command1.set_operation(CREATE_IMAGE); EXPECT_FALSE(executor->ProcessCmd(context, command1)); @@ -213,13 +213,13 @@ TEST_F(RascsiExecutorTest, ProcessCmd) EXPECT_FALSE(executor->ProcessCmd(context, command1)); } -TEST_F(RascsiExecutorTest, SetLogLevel) +TEST_F(PiscsiExecutorTest, SetLogLevel) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); MockAbstractController controller(controller_manager, 0); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); EXPECT_TRUE(executor.SetLogLevel("trace")); EXPECT_TRUE(executor.SetLogLevel("debug")); @@ -230,7 +230,7 @@ TEST_F(RascsiExecutorTest, SetLogLevel) EXPECT_FALSE(executor.SetLogLevel("xyz")); } -TEST_F(RascsiExecutorTest, Attach) +TEST_F(PiscsiExecutorTest, Attach) { const int ID = 3; const int LUN = 0; @@ -238,8 +238,8 @@ TEST_F(RascsiExecutorTest, Attach) DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); PbDeviceDefinition definition; MockCommandContext context; @@ -314,13 +314,13 @@ TEST_F(RascsiExecutorTest, Attach) controller_manager->DeleteAllControllers(); } -TEST_F(RascsiExecutorTest, Insert) +TEST_F(PiscsiExecutorTest, Insert) { DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); PbDeviceDefinition definition; MockCommandContext context; @@ -370,7 +370,7 @@ TEST_F(RascsiExecutorTest, Insert) EXPECT_TRUE(result); } -TEST_F(RascsiExecutorTest, Detach) +TEST_F(PiscsiExecutorTest, Detach) { const int ID = 3; const int LUN1 = 0; @@ -379,8 +379,8 @@ TEST_F(RascsiExecutorTest, Detach) DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; auto device1 = device_factory.CreateDevice(SCHS, LUN1, ""); @@ -398,15 +398,15 @@ TEST_F(RascsiExecutorTest, Detach) EXPECT_FALSE(executor.Detach(context, d1, false)); } -TEST_F(RascsiExecutorTest, DetachAll) +TEST_F(PiscsiExecutorTest, DetachAll) { const int ID = 4; DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); auto device = device_factory.CreateDevice(SCHS, 0, ""); EXPECT_TRUE(controller_manager->AttachToScsiController(ID, device)); @@ -418,12 +418,12 @@ TEST_F(RascsiExecutorTest, DetachAll) EXPECT_TRUE(controller_manager->GetAllDevices().empty()); } -TEST_F(RascsiExecutorTest, ShutDown) +TEST_F(PiscsiExecutorTest, ShutDown) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; EXPECT_FALSE(executor.ShutDown(context, "")); @@ -433,13 +433,13 @@ TEST_F(RascsiExecutorTest, ShutDown) EXPECT_FALSE(executor.ShutDown(context, "reboot")); } -TEST_F(RascsiExecutorTest, SetReservedIds) +TEST_F(PiscsiExecutorTest, SetReservedIds) { DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); string error = executor.SetReservedIds("xyz"); EXPECT_FALSE(error.empty()); @@ -473,13 +473,13 @@ TEST_F(RascsiExecutorTest, SetReservedIds) EXPECT_FALSE(error.empty()); } -TEST_F(RascsiExecutorTest, ValidateImageFile) +TEST_F(PiscsiExecutorTest, ValidateImageFile) { DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; string full_path; @@ -491,13 +491,13 @@ TEST_F(RascsiExecutorTest, ValidateImageFile) EXPECT_TRUE(full_path.empty()); } -TEST_F(RascsiExecutorTest, ValidateLunSetup) +TEST_F(PiscsiExecutorTest, ValidateLunSetup) { DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); PbCommand command; auto device1 = command.add_devices(); @@ -515,7 +515,7 @@ TEST_F(RascsiExecutorTest, ValidateLunSetup) EXPECT_TRUE(error.empty()); } -TEST_F(RascsiExecutorTest, VerifyExistingIdAndLun) +TEST_F(PiscsiExecutorTest, VerifyExistingIdAndLun) { const int ID = 1; const int LUN1 = 0; @@ -524,8 +524,8 @@ TEST_F(RascsiExecutorTest, VerifyExistingIdAndLun) DeviceFactory device_factory; auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; EXPECT_FALSE(executor.VerifyExistingIdAndLun(context, ID, LUN1)); @@ -535,12 +535,12 @@ TEST_F(RascsiExecutorTest, VerifyExistingIdAndLun) EXPECT_FALSE(executor.VerifyExistingIdAndLun(context, ID, LUN2)); } -TEST_F(RascsiExecutorTest, CreateDevice) +TEST_F(PiscsiExecutorTest, CreateDevice) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; EXPECT_EQ(nullptr, executor.CreateDevice(context, UNDEFINED, 0, "")); @@ -552,12 +552,12 @@ TEST_F(RascsiExecutorTest, CreateDevice) EXPECT_NE(nullptr, executor.CreateDevice(context, SCHS, 0, "")); } -TEST_F(RascsiExecutorTest, SetSectorSize) +TEST_F(PiscsiExecutorTest, SetSectorSize) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; unordered_set sizes; @@ -571,12 +571,12 @@ TEST_F(RascsiExecutorTest, SetSectorSize) EXPECT_TRUE(executor.SetSectorSize(context, hd, 512)); } -TEST_F(RascsiExecutorTest, ValidateOperationAgainstDevice) +TEST_F(PiscsiExecutorTest, ValidateOperationAgainstDevice) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; auto device = make_shared(0); @@ -624,12 +624,12 @@ TEST_F(RascsiExecutorTest, ValidateOperationAgainstDevice) EXPECT_TRUE(executor.ValidateOperationAgainstDevice(context, *device, UNPROTECT)); } -TEST_F(RascsiExecutorTest, ValidateIdAndLun) +TEST_F(PiscsiExecutorTest, ValidateIdAndLun) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; EXPECT_FALSE(executor.ValidateIdAndLun(context, -1, 0)); @@ -640,12 +640,12 @@ TEST_F(RascsiExecutorTest, ValidateIdAndLun) EXPECT_TRUE(executor.ValidateIdAndLun(context, 7, 31)); } -TEST_F(RascsiExecutorTest, SetProductData) +TEST_F(PiscsiExecutorTest, SetProductData) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiImage rascsi_image; - RascsiExecutor executor(rascsi_image, *controller_manager); + PiscsiImage piscsi_image; + PiscsiExecutor executor(piscsi_image, *controller_manager); MockCommandContext context; PbDeviceDefinition definition; diff --git a/cpp/test/rascsi_image_test.cpp b/cpp/test/piscsi_image_test.cpp similarity index 85% rename from cpp/test/rascsi_image_test.cpp rename to cpp/test/piscsi_image_test.cpp index f43c8ea3..b4a12095 100644 --- a/cpp/test/rascsi_image_test.cpp +++ b/cpp/test/piscsi_image_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,23 +9,23 @@ #include "mocks.h" #include "shared/protobuf_util.h" -#include "generated/rascsi_interface.pb.h" -#include "rascsi/rascsi_image.h" +#include "generated/piscsi_interface.pb.h" +#include "piscsi/piscsi_image.h" -using namespace rascsi_interface; +using namespace piscsi_interface; using namespace protobuf_util; -TEST(RascsiImageTest, SetGetDepth) +TEST(PiscsiImageTest, SetGetDepth) { - RascsiImage image; + PiscsiImage image; image.SetDepth(1); EXPECT_EQ(1, image.GetDepth()); } -TEST(RascsiImageTest, SetGetDefaultFolder) +TEST(PiscsiImageTest, SetGetDefaultFolder) { - RascsiImage image; + PiscsiImage image; EXPECT_NE(string::npos, image.GetDefaultFolder().find("/images")); @@ -33,11 +33,11 @@ TEST(RascsiImageTest, SetGetDefaultFolder) EXPECT_TRUE(!image.SetDefaultFolder("/not_in_home").empty()); } -TEST(RascsiImageTest, CreateImage) +TEST(PiscsiImageTest, CreateImage) { MockCommandContext context; PbCommand command; - RascsiImage image; + PiscsiImage image; EXPECT_FALSE(image.CreateImage(context, command)) << "Filename must be reported as missing"; @@ -57,11 +57,11 @@ TEST(RascsiImageTest, CreateImage) // Further tests would modify the filesystem } -TEST(RascsiImageTest, DeleteImage) +TEST(PiscsiImageTest, DeleteImage) { MockCommandContext context; PbCommand command; - RascsiImage image; + PiscsiImage image; EXPECT_FALSE(image.DeleteImage(context, command)) << "Filename must be reported as missing"; @@ -76,11 +76,11 @@ TEST(RascsiImageTest, DeleteImage) // Further testing would modify the filesystem } -TEST(RascsiImageTest, RenameImage) +TEST(PiscsiImageTest, RenameImage) { MockCommandContext context; PbCommand command; - RascsiImage image; + PiscsiImage image; EXPECT_FALSE(image.RenameImage(context, command)) << "Source filename must be reported as missing"; @@ -93,11 +93,11 @@ TEST(RascsiImageTest, RenameImage) // Further testing would modify the filesystem } -TEST(RascsiImageTest, CopyImage) +TEST(PiscsiImageTest, CopyImage) { MockCommandContext context; PbCommand command; - RascsiImage image; + PiscsiImage image; EXPECT_FALSE(image.CopyImage(context, command)) << "Source filename must be reported as missing"; @@ -110,11 +110,11 @@ TEST(RascsiImageTest, CopyImage) // Further testing would modify the filesystem } -TEST(RascsiImageTest, SetImagePermissions) +TEST(PiscsiImageTest, SetImagePermissions) { MockCommandContext context; PbCommand command; - RascsiImage image; + PiscsiImage image; EXPECT_FALSE(image.SetImagePermissions(context, command)) << "Filename must be reported as missing"; diff --git a/cpp/test/rascsi_response_test.cpp b/cpp/test/piscsi_response_test.cpp similarity index 81% rename from cpp/test/rascsi_response_test.cpp rename to cpp/test/piscsi_response_test.cpp index c3669eec..a735040e 100644 --- a/cpp/test/rascsi_response_test.cpp +++ b/cpp/test/piscsi_response_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,17 +8,17 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_version.h" +#include "shared/piscsi_version.h" #include "controllers/controller_manager.h" #include "devices/device_factory.h" -#include "generated/rascsi_interface.pb.h" -#include "rascsi/rascsi_response.h" +#include "generated/piscsi_interface.pb.h" +#include "piscsi/piscsi_response.h" -using namespace rascsi_interface; +using namespace piscsi_interface; -TEST(RascsiResponseTest, Operation_Count) +TEST(PiscsiResponseTest, Operation_Count) { - RascsiResponse response; + PiscsiResponse response; PbResult result; const auto info = response.GetOperationInfo(result, 0); @@ -30,7 +30,7 @@ void TestNonDiskDevice(PbDeviceType type, int default_param_count) auto bus = make_shared(); auto controller_manager = make_shared(*bus); DeviceFactory device_factory; - RascsiResponse response; + PiscsiResponse response; auto d = device_factory.CreateDevice(type, 0, ""); const unordered_map params; @@ -62,15 +62,15 @@ void TestNonDiskDevice(PbDeviceType type, int default_param_count) } } -TEST(RascsiResponseTest, GetDevices) +TEST(PiscsiResponseTest, GetDevices) { TestNonDiskDevice(SCHS, 0); TestNonDiskDevice(SCLP, 1); } -TEST(RascsiResponseTest, GetImageFile) +TEST(PiscsiResponseTest, GetImageFile) { - RascsiResponse response; + PiscsiResponse response; PbImageFile image_file; EXPECT_FALSE(response.GetImageFile(image_file, "default_folder", "")); @@ -81,9 +81,9 @@ TEST(RascsiResponseTest, GetImageFile) EXPECT_EQ(SCHD, image_file.type()); } -TEST(RascsiResponseTest, GetReservedIds) +TEST(PiscsiResponseTest, GetReservedIds) { - RascsiResponse response; + PiscsiResponse response; unordered_set ids; PbResult result; @@ -98,7 +98,7 @@ TEST(RascsiResponseTest, GetReservedIds) EXPECT_EQ(3, info2->ids()[0]); } -TEST(RascsiResponseTest, GetDevicesInfo) +TEST(PiscsiResponseTest, GetDevicesInfo) { const int ID = 2; const int LUN1 = 0; @@ -107,7 +107,7 @@ TEST(RascsiResponseTest, GetDevicesInfo) auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiResponse response; + PiscsiResponse response; PbCommand command; PbResult result; @@ -151,9 +151,9 @@ TEST(RascsiResponseTest, GetDevicesInfo) EXPECT_FALSE(result.status()) << "Only data for the specified ID and LUN must be returned"; } -TEST(RascsiResponseTest, GetDeviceTypesInfo) +TEST(PiscsiResponseTest, GetDeviceTypesInfo) { - RascsiResponse response; + PiscsiResponse response; PbResult result; const auto& info = response.GetDeviceTypesInfo(result); @@ -161,41 +161,41 @@ TEST(RascsiResponseTest, GetDeviceTypesInfo) EXPECT_EQ(8, info->properties().size()); } -TEST(RascsiResponseTest, GetServerInfo) +TEST(PiscsiResponseTest, GetServerInfo) { auto bus = make_shared(); auto controller_manager = make_shared(*bus); - RascsiResponse response; + PiscsiResponse response; const unordered_set> devices; const unordered_set ids = { 1, 3 }; PbResult result; const auto& info = response.GetServerInfo(devices, result, ids, "log_level", "default_folder", "", "", 1234); EXPECT_TRUE(result.status()); - EXPECT_EQ(rascsi_major_version, info->version_info().major_version()); - EXPECT_EQ(rascsi_minor_version, info->version_info().minor_version()); - EXPECT_EQ(rascsi_patch_version, info->version_info().patch_version()); + EXPECT_EQ(piscsi_major_version, info->version_info().major_version()); + EXPECT_EQ(piscsi_minor_version, info->version_info().minor_version()); + EXPECT_EQ(piscsi_patch_version, info->version_info().patch_version()); EXPECT_EQ("log_level", info->log_level_info().current_log_level()); EXPECT_EQ("default_folder", info->image_files_info().default_image_folder()); EXPECT_EQ(1234, info->image_files_info().depth()); EXPECT_EQ(2, info->reserved_ids_info().ids().size()); } -TEST(RascsiResponseTest, GetVersionInfo) +TEST(PiscsiResponseTest, GetVersionInfo) { - RascsiResponse response; + PiscsiResponse response; PbResult result; const auto& info = response.GetVersionInfo(result); EXPECT_TRUE(result.status()); - EXPECT_EQ(rascsi_major_version, info->major_version()); - EXPECT_EQ(rascsi_minor_version, info->minor_version()); - EXPECT_EQ(rascsi_patch_version, info->patch_version()); + EXPECT_EQ(piscsi_major_version, info->major_version()); + EXPECT_EQ(piscsi_minor_version, info->minor_version()); + EXPECT_EQ(piscsi_patch_version, info->patch_version()); } -TEST(RascsiResponseTest, GetLogLevelInfo) +TEST(PiscsiResponseTest, GetLogLevelInfo) { - RascsiResponse response; + PiscsiResponse response; PbResult result; const auto& info = response.GetLogLevelInfo(result, "level"); @@ -204,9 +204,9 @@ TEST(RascsiResponseTest, GetLogLevelInfo) EXPECT_EQ(6, info->log_levels().size()); } -TEST(RascsiResponseTest, GetNetworkInterfacesInfo) +TEST(PiscsiResponseTest, GetNetworkInterfacesInfo) { - RascsiResponse response; + PiscsiResponse response; PbResult result; const auto& info = response.GetNetworkInterfacesInfo(result); @@ -214,9 +214,9 @@ TEST(RascsiResponseTest, GetNetworkInterfacesInfo) EXPECT_FALSE(info->name().empty()); } -TEST(RascsiResponseTest, GetMappingInfo) +TEST(PiscsiResponseTest, GetMappingInfo) { - RascsiResponse response; + PiscsiResponse response; PbResult result; const auto& info = response.GetMappingInfo(result); diff --git a/cpp/test/rascsi_service_test.cpp b/cpp/test/piscsi_service_test.cpp similarity index 79% rename from cpp/test/rascsi_service_test.cpp rename to cpp/test/piscsi_service_test.cpp index 5fe2b416..a29a8172 100644 --- a/cpp/test/rascsi_service_test.cpp +++ b/cpp/test/piscsi_service_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -11,11 +11,11 @@ #include -#include "rascsi/rascsi_service.h" +#include "piscsi/piscsi_service.h" -TEST(RascsiServiceTest, LifeCycle) +TEST(PiscsiServiceTest, LifeCycle) { - RascsiService service; + PiscsiService service; EXPECT_TRUE(service.Init(nullptr, 65535)); EXPECT_FALSE(service.Init(nullptr, 65536)); diff --git a/cpp/test/rasutil_test.cpp b/cpp/test/piscsi_util_test.cpp similarity index 87% rename from cpp/test/rasutil_test.cpp rename to cpp/test/piscsi_util_test.cpp index 7d607234..bfe2bdd1 100644 --- a/cpp/test/rasutil_test.cpp +++ b/cpp/test/piscsi_util_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,17 +9,17 @@ #include -#include "shared/rasutil.h" -#include "generated/rascsi_interface.pb.h" +#include "shared/piscsi_util.h" +#include "generated/piscsi_interface.pb.h" #ifdef __linux__ #include #endif using namespace std; -using namespace rascsi_interface; -using namespace ras_util; +using namespace piscsi_interface; +using namespace piscsi_util; -TEST(RasUtilTest, ProcessId) +TEST(PiscsiUtilTest, ProcessId) { int id = -1; int lun = -1; @@ -55,7 +55,7 @@ TEST(RasUtilTest, ProcessId) EXPECT_EQ(31, lun); } -TEST(RasUtilTest, GetAsUnsignedInt) +TEST(PiscsiUtilTest, GetAsUnsignedInt) { int result; @@ -69,12 +69,12 @@ TEST(RasUtilTest, GetAsUnsignedInt) EXPECT_EQ(1234, result); } -TEST(RasUtilTest, Banner) +TEST(PiscsiUtilTest, Banner) { EXPECT_FALSE(Banner("Test").empty()); } -TEST(RasUtilTest, GetExtensionLowerCase) +TEST(PiscsiUtilTest, GetExtensionLowerCase) { EXPECT_EQ("", GetExtensionLowerCase("")); EXPECT_EQ("", GetExtensionLowerCase(".")); @@ -86,7 +86,7 @@ TEST(RasUtilTest, GetExtensionLowerCase) } #ifdef __linux__ -TEST(RasUtilTest, FixCpu) +TEST(PiscsiUtilTest, FixCpu) { cpu_set_t mask; diff --git a/cpp/test/primary_device_test.cpp b/cpp/test/primary_device_test.cpp index 402dd04b..233e5f38 100644 --- a/cpp/test/primary_device_test.cpp +++ b/cpp/test/primary_device_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,7 +9,7 @@ #include "mocks.h" #include "shared/scsi.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/primary_device.h" #include "devices/device_factory.h" #include "devices/scsi_command_util.h" diff --git a/cpp/test/protobuf_serializer_test.cpp b/cpp/test/protobuf_serializer_test.cpp index 1c23435a..6cc4e671 100644 --- a/cpp/test/protobuf_serializer_test.cpp +++ b/cpp/test/protobuf_serializer_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,12 +9,12 @@ #include "mocks.h" #include "shared/protobuf_serializer.h" -#include "shared/rascsi_exceptions.h" -#include "generated/rascsi_interface.pb.h" +#include "shared/piscsi_exceptions.h" +#include "generated/piscsi_interface.pb.h" #include using namespace filesystem; -using namespace rascsi_interface; +using namespace piscsi_interface; TEST(ProtobufSerializerTest, SerializeMessage) { diff --git a/cpp/test/protobuf_util_test.cpp b/cpp/test/protobuf_util_test.cpp index ea2a21d1..afd71148 100644 --- a/cpp/test/protobuf_util_test.cpp +++ b/cpp/test/protobuf_util_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,9 +9,9 @@ #include "mocks.h" #include "shared/protobuf_util.h" -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" -using namespace rascsi_interface; +using namespace piscsi_interface; using namespace protobuf_util; void TestSpecialDevice(const string& name) diff --git a/cpp/test/scsi_command_util_test.cpp b/cpp/test/scsi_command_util_test.cpp index 2071f57f..dbfdffa7 100644 --- a/cpp/test/scsi_command_util_test.cpp +++ b/cpp/test/scsi_command_util_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,7 +9,7 @@ #include "mocks.h" #include "shared/scsi.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/device_logger.h" #include "devices/scsi_command_util.h" diff --git a/cpp/test/scsi_controller_test.cpp b/cpp/test/scsi_controller_test.cpp index e14934ab..60a2623f 100644 --- a/cpp/test/scsi_controller_test.cpp +++ b/cpp/test/scsi_controller_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,7 +9,7 @@ #include "mocks.h" #include "shared/scsi.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/scsi_controller.h" using namespace scsi_defs; @@ -72,19 +72,19 @@ TEST(ScsiControllerTest, BusFree) EXPECT_EQ(phase_t::busfree, controller.GetPhase()); EXPECT_EQ(status::GOOD, controller.GetStatus()); - controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::NONE); + controller.ScheduleShutdown(AbstractController::piscsi_shutdown_mode::NONE); controller.SetPhase(phase_t::reserved); controller.BusFree(); - controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_PI); + controller.ScheduleShutdown(AbstractController::piscsi_shutdown_mode::STOP_PI); controller.SetPhase(phase_t::reserved); controller.BusFree(); - controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::RESTART_PI); + controller.ScheduleShutdown(AbstractController::piscsi_shutdown_mode::RESTART_PI); controller.SetPhase(phase_t::reserved); controller.BusFree(); - controller.ScheduleShutdown(AbstractController::rascsi_shutdown_mode::STOP_RASCSI); + controller.ScheduleShutdown(AbstractController::piscsi_shutdown_mode::STOP_PISCSI); controller.SetPhase(phase_t::reserved); EXPECT_EXIT(controller.BusFree(), ExitedWithCode(EXIT_SUCCESS), ""); } diff --git a/cpp/test/scsi_daynaport_test.cpp b/cpp/test/scsi_daynaport_test.cpp index 38ec50e1..122ff69b 100644 --- a/cpp/test/scsi_daynaport_test.cpp +++ b/cpp/test/scsi_daynaport_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/scsi_daynaport.h" TEST(ScsiDaynaportTest, Inquiry) diff --git a/cpp/test/scsi_host_bridge_test.cpp b/cpp/test/scsi_host_bridge_test.cpp index 23ca3f82..42a584da 100644 --- a/cpp/test/scsi_host_bridge_test.cpp +++ b/cpp/test/scsi_host_bridge_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -11,5 +11,5 @@ TEST(ScsiHostBridgeTest, Inquiry) { - TestInquiry(SCBR, device_type::COMMUNICATIONS, scsi_level::SCSI_2, "RaSCSI RASCSI BRIDGE ", 0x27, false); + TestInquiry(SCBR, device_type::COMMUNICATIONS, scsi_level::SCSI_2, "PiSCSI RASCSI BRIDGE ", 0x27, false); } diff --git a/cpp/test/scsi_printer_test.cpp b/cpp/test/scsi_printer_test.cpp index 83d7321a..821d5c5a 100644 --- a/cpp/test/scsi_printer_test.cpp +++ b/cpp/test/scsi_printer_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/controller_manager.h" #include "devices/scsi_printer.h" @@ -45,7 +45,7 @@ TEST(ScsiPrinterTest, TestUnitReady) TEST(ScsiPrinterTest, Inquiry) { - TestInquiry(SCLP, device_type::PRINTER, scsi_level::SCSI_2, "RaSCSI SCSI PRINTER ", 0x1f, false); + TestInquiry(SCLP, device_type::PRINTER, scsi_level::SCSI_2, "PiSCSI SCSI PRINTER ", 0x1f, false); } TEST(ScsiPrinterTest, ReserveUnit) diff --git a/cpp/test/scsicd_test.cpp b/cpp/test/scsicd_test.cpp index 29bda9b0..4d8addbd 100644 --- a/cpp/test/scsicd_test.cpp +++ b/cpp/test/scsicd_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include #include @@ -29,7 +29,7 @@ void ScsiCdTest_SetUpModePages(map>& pages) TEST(ScsiCdTest, Inquiry) { - TestInquiry(SCCD, device_type::CD_ROM, scsi_level::SCSI_2, "RaSCSI SCSI CD-ROM ", 0x1f, true); + TestInquiry(SCCD, device_type::CD_ROM, scsi_level::SCSI_2, "PiSCSI SCSI CD-ROM ", 0x1f, true); } TEST(ScsiCdTest, SetUpModePages) @@ -105,7 +105,7 @@ TEST(ScsiCdTest, Open) filename = CreateTempFile(2* 2048); cd_physical.SetFilename("\\" + string(filename)); - // The respective code in SCSICD appears to be broken, see https://github.com/akuker/RASCSI/issues/919 + // The respective code in SCSICD appears to be broken, see https://github.com/akuker/PISCSI/issues/919 EXPECT_THROW(cd_physical.Open(), io_exception) << "Invalid physical CD-ROM file"; remove(filename); } diff --git a/cpp/test/rasctl_commands_test.cpp b/cpp/test/scsictl_commands_test.cpp similarity index 88% rename from cpp/test/rasctl_commands_test.cpp rename to cpp/test/scsictl_commands_test.cpp index 70c405e4..b9394dd1 100644 --- a/cpp/test/rasctl_commands_test.cpp +++ b/cpp/test/scsictl_commands_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -12,18 +12,18 @@ #include #include "shared/protobuf_util.h" -#include "shared/rascsi_exceptions.h" -#include "generated/rascsi_interface.pb.h" -#include "rasctl/rasctl_commands.h" +#include "shared/piscsi_exceptions.h" +#include "generated/piscsi_interface.pb.h" +#include "scsictl/scsictl_commands.h" using namespace testing; -using namespace rascsi_interface; +using namespace piscsi_interface; using namespace protobuf_util; -TEST(RasctlCommandsTest, Execute) +TEST(ScsictlCommandsTest, Execute) { PbCommand command; - RasctlCommands commands(command, "localhost", 0); + ScsictlCommands commands(command, "localhost", 0); command.set_operation(LOG_LEVEL); EXPECT_THROW(commands.Execute("log_level", "", "", "", ""), io_exception); @@ -96,13 +96,13 @@ TEST(RasctlCommandsTest, Execute) EXPECT_THROW(commands.Execute("", "", "", "", ""), io_exception); } -TEST(RasctlCommandsTest, CommandDevicesInfo) +TEST(ScsictlCommandsTest, CommandDevicesInfo) { PbCommand command; - RasctlCommands commands1(command, "/invalid_host_name", 0); + ScsictlCommands commands1(command, "/invalid_host_name", 0); EXPECT_THROW(commands1.CommandDevicesInfo(), io_exception); - RasctlCommands commands2(command, "localhost", 0); + ScsictlCommands commands2(command, "localhost", 0); EXPECT_THROW(commands2.CommandDevicesInfo(), io_exception); } diff --git a/cpp/test/rasctl_display_test.cpp b/cpp/test/scsictl_display_test.cpp similarity index 90% rename from cpp/test/rasctl_display_test.cpp rename to cpp/test/scsictl_display_test.cpp index b564fb09..4fd8f71c 100644 --- a/cpp/test/rasctl_display_test.cpp +++ b/cpp/test/scsictl_display_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -11,19 +11,19 @@ #include -#include "rasctl/rasctl_display.h" +#include "scsictl/scsictl_display.h" -TEST(RasctlDisplayTest, DisplayDevicesInfo) +TEST(ScsictlDisplayTest, DisplayDevicesInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbDevicesInfo info; EXPECT_FALSE(display.DisplayDevicesInfo(info).empty()); } -TEST(RasctlDisplayTest, DisplayDeviceInfo) +TEST(ScsictlDisplayTest, DisplayDeviceInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbDevice device; EXPECT_FALSE(display.DisplayDeviceInfo(device).empty()); @@ -70,9 +70,9 @@ TEST(RasctlDisplayTest, DisplayDeviceInfo) EXPECT_NE(string::npos, s.find("key2=value2")); } -TEST(RasctlDisplayTest, DisplayVersionInfo) +TEST(ScsictlDisplayTest, DisplayVersionInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbVersionInfo info; info.set_major_version(1); @@ -90,9 +90,9 @@ TEST(RasctlDisplayTest, DisplayVersionInfo) EXPECT_NE(string::npos, s.find("01.02")); } -TEST(RasctlDisplayTest, DisplayLogLevelInfo) +TEST(ScsictlDisplayTest, DisplayLogLevelInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbLogLevelInfo info; string s = display.DisplayLogLevelInfo(info); @@ -104,9 +104,9 @@ TEST(RasctlDisplayTest, DisplayLogLevelInfo) EXPECT_NE(string::npos, s.find("test")); } -TEST(RasctlDisplayTest, DisplayDeviceTypesInfo) +TEST(ScsictlDisplayTest, DisplayDeviceTypesInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbDeviceTypesInfo info; // Start with 2 instead of 1. 1 was the removed SASI drive type. @@ -148,9 +148,9 @@ TEST(RasctlDisplayTest, DisplayDeviceTypesInfo) EXPECT_NE(string::npos, s.find("key2=value2")); } -TEST(RasctlDisplayTest, DisplayReservedIdsInfo) +TEST(ScsictlDisplayTest, DisplayReservedIdsInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbReservedIdsInfo info; string s = display.DisplayReservedIdsInfo(info); @@ -167,9 +167,9 @@ TEST(RasctlDisplayTest, DisplayReservedIdsInfo) EXPECT_NE(string::npos, s.find("5, 6")); } -TEST(RasctlDisplayTest, DisplayNetworkInterfacesInfo) +TEST(ScsictlDisplayTest, DisplayNetworkInterfacesInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbNetworkInterfacesInfo info; string s = display.DisplayNetworkInterfaces(info); @@ -186,9 +186,9 @@ TEST(RasctlDisplayTest, DisplayNetworkInterfacesInfo) EXPECT_NE(string::npos, s.find("eth0, wlan0")); } -TEST(RasctlDisplayTest, DisplayImageFile) +TEST(ScsictlDisplayTest, DisplayImageFile) { - RasctlDisplay display; + ScsictlDisplay display; PbImageFile file; string s = display.DisplayImageFile(file); @@ -214,9 +214,9 @@ TEST(RasctlDisplayTest, DisplayImageFile) EXPECT_NE(string::npos, s.find("SCHD")); } -TEST(RasctlDisplayTest, DisplayImageFilesInfo) +TEST(ScsictlDisplayTest, DisplayImageFilesInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbImageFilesInfo info; string s = display.DisplayImageFilesInfo(info); @@ -230,9 +230,9 @@ TEST(RasctlDisplayTest, DisplayImageFilesInfo) EXPECT_NE(string::npos, s.find("filename")); } -TEST(RasctlDisplayTest, DisplayMappingInfo) +TEST(ScsictlDisplayTest, DisplayMappingInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbMappingInfo info; string s = display.DisplayMappingInfo(info); @@ -245,9 +245,9 @@ TEST(RasctlDisplayTest, DisplayMappingInfo) EXPECT_NE(string::npos, s.find("key->SCHD")); } -TEST(RasctlDisplayTest, DisplayOperationInfo) +TEST(ScsictlDisplayTest, DisplayOperationInfo) { - RasctlDisplay display; + ScsictlDisplay display; PbOperationInfo info; string s = display.DisplayOperationInfo(info); diff --git a/cpp/test/rasctl_parser_test.cpp b/cpp/test/scsictl_parser_test.cpp similarity index 89% rename from cpp/test/rasctl_parser_test.cpp rename to cpp/test/scsictl_parser_test.cpp index 78d9670d..c03aaafb 100644 --- a/cpp/test/rasctl_parser_test.cpp +++ b/cpp/test/scsictl_parser_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -9,11 +9,11 @@ #include -#include "rasctl/rasctl_parser.h" +#include "scsictl/scsictl_parser.h" -TEST(RasctlParserTest, ParseOperation) +TEST(ScsictlParserTest, ParseOperation) { - RasctlParser parser; + ScsictlParser parser; EXPECT_EQ(ATTACH, parser.ParseOperation("A")); EXPECT_EQ(ATTACH, parser.ParseOperation("a")); @@ -26,9 +26,9 @@ TEST(RasctlParserTest, ParseOperation) EXPECT_EQ(NO_OPERATION, parser.ParseOperation("xyz")); } -TEST(RasctlParserTest, ParseType) +TEST(ScsictlParserTest, ParseType) { - RasctlParser parser; + ScsictlParser parser; EXPECT_EQ(SCBR, parser.ParseType("SCBR")); EXPECT_EQ(SCBR, parser.ParseType("scbr")); diff --git a/cpp/test/scsihd_nec_test.cpp b/cpp/test/scsihd_nec_test.cpp index 903436db..9ddf9a11 100644 --- a/cpp/test/scsihd_nec_test.cpp +++ b/cpp/test/scsihd_nec_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "controllers/controller_manager.h" #include "devices/scsihd_nec.h" #include @@ -29,7 +29,7 @@ void ScsiHdNecTest_SetUpModePages(map>& pages) TEST(ScsiHdNecTest, Inquiry) { - TestInquiry(SCHD, device_type::DIRECT_ACCESS, scsi_level::SCSI_1_CCS, "RaSCSI ", 0x1f, false, ".hdn"); + TestInquiry(SCHD, device_type::DIRECT_ACCESS, scsi_level::SCSI_1_CCS, "PiSCSI ", 0x1f, false, ".hdn"); } TEST(ScsiHdNecTest, SetUpModePages) diff --git a/cpp/test/scsihd_test.cpp b/cpp/test/scsihd_test.cpp index 57945ee5..b1ff985e 100644 --- a/cpp/test/scsihd_test.cpp +++ b/cpp/test/scsihd_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/scsihd.h" void ScsiHdTest_SetUpModePages(map>& pages) @@ -23,9 +23,9 @@ void ScsiHdTest_SetUpModePages(map>& pages) TEST(ScsiHdTest, Inquiry) { - TestInquiry(SCHD, device_type::DIRECT_ACCESS, scsi_level::SCSI_2, "RaSCSI ", 0x1f, false); + TestInquiry(SCHD, device_type::DIRECT_ACCESS, scsi_level::SCSI_2, "PiSCSI ", 0x1f, false); - TestInquiry(SCHD, device_type::DIRECT_ACCESS, scsi_level::SCSI_1_CCS, "RaSCSI ", 0x1f, false, ".hd1"); + TestInquiry(SCHD, device_type::DIRECT_ACCESS, scsi_level::SCSI_1_CCS, "PiSCSI ", 0x1f, false, ".hd1"); } TEST(ScsiHdTest, SupportsSaveParameters) diff --git a/cpp/test/scsimo_test.cpp b/cpp/test/scsimo_test.cpp index 2ac0cb93..21447696 100644 --- a/cpp/test/scsimo_test.cpp +++ b/cpp/test/scsimo_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -22,7 +22,7 @@ void ScsiMo_SetUpModePages(map>& pages) TEST(ScsiMoTest, Inquiry) { - TestInquiry(SCMO, device_type::OPTICAL_MEMORY, scsi_level::SCSI_2, "RaSCSI SCSI MO ", 0x1f, true); + TestInquiry(SCMO, device_type::OPTICAL_MEMORY, scsi_level::SCSI_2, "PiSCSI SCSI MO ", 0x1f, true); } TEST(ScsiMoTest, SupportsSaveParameters) diff --git a/cpp/test/storage_device_test.cpp b/cpp/test/storage_device_test.cpp index c632134e..9fbed528 100644 --- a/cpp/test/storage_device_test.cpp +++ b/cpp/test/storage_device_test.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -8,7 +8,7 @@ //--------------------------------------------------------------------------- #include "mocks.h" -#include "shared/rascsi_exceptions.h" +#include "shared/piscsi_exceptions.h" #include "devices/storage_device.h" #include diff --git a/cpp/test/test_setup.cpp b/cpp/test/test_setup.cpp index 3ed7cfaf..cfa0c20d 100644 --- a/cpp/test/test_setup.cpp +++ b/cpp/test/test_setup.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -11,7 +11,7 @@ #include "spdlog/spdlog.h" -// Also used by the RascsiExecutor tests +// Also used by the PiscsiExecutor tests bool enable_logging; //NOSONAR Must be global in order to be shared with the tests class Environment final : public ::testing::Environment diff --git a/cpp/test/test_shared.cpp b/cpp/test/test_shared.cpp index b39ee46c..b78a4def 100644 --- a/cpp/test/test_shared.cpp +++ b/cpp/test/test_shared.cpp @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -10,8 +10,8 @@ #include "test_shared.h" #include "controllers/controller_manager.h" #include "mocks.h" -#include "shared/rascsi_exceptions.h" -#include "shared/rascsi_version.h" +#include "shared/piscsi_exceptions.h" +#include "shared/piscsi_version.h" #include #include #include @@ -23,7 +23,7 @@ using namespace filesystem; // Inlude the process id in the temp file path so that multiple instances of the test procedures // could run on the same host. const path test_data_temp_path(temp_directory_path() / - path(fmt::format("rascsi-test-{}", + path(fmt::format("piscsi-test-{}", getpid()))); // NOSONAR Publicly writable directory is fine here shared_ptr CreateDevice(PbDeviceType type, MockAbstractController &controller, const string &extension) @@ -62,7 +62,7 @@ void TestInquiry(PbDeviceType type, device_type t, scsi_level l, const string &i string product_data; if (ident.size() == 24) { ostringstream s; - s << ident << setw(2) << setfill('0') << rascsi_major_version << rascsi_minor_version; + s << ident << setw(2) << setfill('0') << piscsi_major_version << piscsi_minor_version; product_data = s.str(); } else { product_data = ident; @@ -73,7 +73,7 @@ void TestInquiry(PbDeviceType type, device_type t, scsi_level l, const string &i pair OpenTempFile() { const string filename = - string(test_data_temp_path) + "/rascsi_test-XXXXXX"; // NOSONAR Publicly writable directory is fine here + string(test_data_temp_path) + "/piscsi_test-XXXXXX"; // NOSONAR Publicly writable directory is fine here vector f(filename.begin(), filename.end()); f.push_back(0); @@ -97,7 +97,9 @@ path CreateTempFile(int size) return path(filename); } -void CreateTempFileWithData(string filename, vector &data) +// TODO Replace old-fashinoned C I/O by C++ streams I/O. +// This also avoids potential issues with data type sizes and there is no need for c_str(). +void CreateTempFileWithData(const string& filename, vector &data) { path new_filename = test_data_temp_path; new_filename += path(filename); @@ -110,16 +112,15 @@ void CreateTempFileWithData(string filename, vector &data) return; } - size_t size_written = fwrite(&data[0], sizeof(uint8_t), data.size(), fp); - - if (size_written != sizeof(vector::value_type) * data.size()) { + if (const size_t size_written = fwrite(&data[0], sizeof(uint8_t), data.size(), fp); + size_written != sizeof(vector::value_type) * data.size()) { printf("Expected to write %zu bytes, but only wrote %zu to %s", size_written, sizeof(vector::value_type) * data.size(), filename.c_str()); } fclose(fp); } -void DeleteTempFile(string filename) +void DeleteTempFile(const string& filename) { path temp_file = test_data_temp_path; temp_file += path(filename); diff --git a/cpp/test/test_shared.h b/cpp/test/test_shared.h index c376ab62..c95c6b18 100644 --- a/cpp/test/test_shared.h +++ b/cpp/test/test_shared.h @@ -1,6 +1,6 @@ //--------------------------------------------------------------------------- // -// SCSI Target Emulator RaSCSI Reloaded +// SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet @@ -10,14 +10,14 @@ #pragma once #include "shared/scsi.h" -#include "generated/rascsi_interface.pb.h" +#include "generated/piscsi_interface.pb.h" #include #include #include using namespace std; using namespace filesystem; -using namespace rascsi_interface; +using namespace piscsi_interface; class PrimaryDevice; class MockAbstractController; @@ -34,9 +34,9 @@ path CreateTempFile(int); // create a file with the specified data -void CreateTempFileWithData(string filename, vector &data); +void CreateTempFileWithData(const string&, vector&); -void DeleteTempFile(string filename); +void DeleteTempFile(const string&); // Call this at the end of every test case to make sure things are cleaned up void CleanupAllTempFiles(); diff --git a/doc/rascsi.1 b/doc/piscsi.1 similarity index 78% rename from doc/rascsi.1 rename to doc/piscsi.1 index 4dee42aa..53fadf68 100644 --- a/doc/rascsi.1 +++ b/doc/piscsi.1 @@ -1,8 +1,8 @@ -.TH rascsi 1 +.TH piscsi 1 .SH NAME -rascsi \- Emulates SCSI devices using the Raspberry Pi GPIO pins +piscsi \- Emulates SCSI devices using the Raspberry Pi GPIO pins .SH SYNOPSIS -.B rascsi +.B piscsi [\fB\-F\fR \fIFOLDER\fR] [\fB\-L\fR \fILOG_LEVEL[:ID:[LUN]]\fR] [\fB\-P\fR \fIACCESS_TOKEN_FILE\fR] @@ -17,14 +17,14 @@ rascsi \- Emulates SCSI devices using the Raspberry Pi GPIO pins [\fB\-IDn:[u]\fR \fIFILE\fR] [\fB\-HDn[:u]\fR \fIFILE\fR]... .SH DESCRIPTION -.B rascsi +.B piscsi emulates SCSI devices using the Raspberry Pi GPIO pins. .PP -In the arguments to RaSCSI, one or more SCSI (-IDn[:u]) devices can be specified. +In the arguments to PiSCSI, one or more SCSI (-IDn[:u]) devices can be specified. The number (n) after the ID or HD identifier specifies the ID number for that device. The optional number (u) specifies the LUN (logical unit) for that device. The default LUN is 0. For SCSI: The ID is limited from 0-7. However, typically SCSI ID 7 is reserved for the "initiator" (the host computer). The LUN is limited from 0-31. .PP -RaSCSI will determine the type of device based upon the file extension of the FILE argument. +PiSCSI will determine the type of device based upon the file extension of the FILE argument. hd1: SCSI Hard Disk image (generic, non-removable, SCSI-1) hds: SCSI Hard Disk image (generic, non-removable) hdr: SCSI Hard Disk image (generic, removable) @@ -36,13 +36,15 @@ RaSCSI will determine the type of device based upon the file extension of the FI iso: SCSI CD-ROM or DVD-ROM image (ISO 9660 image) For example, if you want to specify an Apple-compatible HD image on ID 0, you can use the following command: - sudo rascsi -ID0 /path/to/drive/hdimage.hda + sudo piscsi -ID0 /path/to/drive/hdimage.hda -Once RaSCSI starts, it will open a socket (default port is 6868) to allow external management commands. -If another process is using the rascsi port, RaSCSI will terminate, since it is likely another instance of RaSCSI. -Once RaSCSI has initialized, the rasctl utility can be used to send commands. +Note: PiSCSI is a fork of RaSCSI. The two cannot be run in parallel on the same system. -To quit RaSCSI, press Control + C. If it is running in the background, you can kill it using an INT signal. +Once PiSCSI starts, it will open a socket (default port is 6868) to allow external management commands. +If another process is using this port, PiSCSI will terminate, since it is likely another instance of PiSCSI or RaSCSI. +Once PiSCSI has initialized, the scsictl utility can be used to send commands. + +To quit PiSCSI, press Control + C. If it is running in the background, you can kill it using an INT signal. .SH OPTIONS .TP @@ -53,7 +55,7 @@ The optional block size, either 512, 1024, 2048 or 4096 bytes. Default size is 5 The default folder for image files. For files in this folder no absolute path needs to be specified. The initial default folder is '~/images'. .TP .BR \-L\fI " " \fILOG_LEVEL[:ID:[LUN]] -The rascsi log level (trace, debug, info, warn, err, off). The default log level is 'info' for all devices unless a particular device ID and an optional LUN was provided. +The piscsi log level (trace, debug, info, warn, err, off). The default log level is 'info' for all devices unless a particular device ID and an optional LUN was provided. .TP .BR \-P\fI " " \fIACCESS_TOKEN_FILE Enable authentication and read the access token from the specified file. The access token file must be owned by root and must be readable by root only. @@ -68,15 +70,15 @@ Show a help page. Set the vendor, product and revision for the device, to be returned with the INQUIRY data. A complete set of name components must be provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up to 4 characters. Padding with blanks to the maxium length is automatically applied. Once set the name of a device cannot be changed. .TP .BR \-p\fI " " \fIPORT -The rascsi server port, default is 6868. +The piscsi server port, default is 6868. .TP .BR \-r\fI " " \fIRESERVED_IDS Comma-separated list of IDs to reserve. Pass an empty list in order to not reserve anything. .BR \-p\fI " " \fITYPE -The optional case-insensitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, SCBR, SCDP, SCLP, SCHS). If no type is specified for devices that support an image file, rascsi tries to derive the type from the file extension. +The optional case-insensitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, SCBR, SCDP, SCLP, SCHS). If no type is specified for devices that support an image file, piscsi tries to derive the type from the file extension. .TP .BR \-v\fI " " \fI -Display the rascsi version. +Display the piscsi version. .TP .BR \-z\fI " "\fILOCALE Overrides the default locale for client-faces error messages. The client can override the locale. @@ -90,14 +92,14 @@ FILE is the name of the image file to use for the SCSI device. .IP .SH EXAMPLES -Launch RaSCSI with no emulated drives attached: - rascsi +Launch PiSCSI with no emulated drives attached: + piscsi -Launch RaSCSI with an Apple hard drive image as ID 0 and a CD-ROM as ID 2 - rascsi -ID0 /path/to/harddrive.hda -ID2 /path/to/cdimage.iso +Launch PiSCSI with an Apple hard drive image as ID 0 and a CD-ROM as ID 2 + piscsi -ID0 /path/to/harddrive.hda -ID2 /path/to/cdimage.iso -Launch RaSCSI with a removable SCSI drive image as ID 0 and the raw device file /dev/hdb (e.g. a USB stick) and a DaynaPort network adapter as ID 6: - rascsi -ID0 -t scrm /dev/hdb -ID6 -t scdp daynaport +Launch PiSCSI with a removable SCSI drive image as ID 0 and the raw device file /dev/hdb (e.g. a USB stick) and a DaynaPort network adapter as ID 6: + piscsi -ID0 -t scrm /dev/hdb -ID6 -t scdp daynaport To create an empty, 100MiB HD image, use the following command: dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800 @@ -106,6 +108,6 @@ In case the fallocate command is available a much faster alternative to the dd c fallocate -l 104857600 /path/to/newimage.hda .SH SEE ALSO -rasctl(1), scsimon(1), rasdump(1) +scsictl(1), scsimon(1), scsidump(1) -Full documentation is available at: +Full documentation is available at: diff --git a/doc/piscsi_man_page.txt b/doc/piscsi_man_page.txt new file mode 100644 index 00000000..22b64a80 --- /dev/null +++ b/doc/piscsi_man_page.txt @@ -0,0 +1,118 @@ +!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!! +!! ------ The native file is piscsi.1. Re-run 'make docs' after updating + + +piscsi(1) General Commands Manual piscsi(1) + +NAME + piscsi - Emulates SCSI devices using the Raspberry Pi GPIO pins + +SYNOPSIS + piscsi [-F FOLDER] [-L LOG_LEVEL[:ID:[LUN]]] [-P ACCESS_TOKEN_FILE] [-R SCAN_DEPTH] [-h] [-n VENDOR:PRODUCT:REVISION] [-p + PORT] [-r RESERVED_IDS] [-n TYPE] [-v] [-z LOCALE] [-IDn:[u] FILE] [-HDn[:u] FILE]... + +DESCRIPTION + piscsi emulates SCSI devices using the Raspberry Pi GPIO pins. + + In the arguments to PiSCSI, one or more SCSI (-IDn[:u]) devices can be specified. The number (n) after the ID or HD iden‐ + tifier specifies the ID number for that device. The optional number (u) specifies the LUN (logical unit) for that device. + The default LUN is 0. For SCSI: The ID is limited from 0-7. However, typically SCSI ID 7 is reserved for the "initiator" + (the host computer). The LUN is limited from 0-31. + + PiSCSI will determine the type of device based upon the file extension of the FILE argument. + hd1: SCSI Hard Disk image (generic, non-removable, SCSI-1) + hds: SCSI Hard Disk image (generic, non-removable) + hdr: SCSI Hard Disk image (generic, removable) + hdn: SCSI Hard Disk image (NEC compatible - only used with PC-98 computers) + hdi: SCSI Hard Disk image (Anex86 proprietary - only used with PC-98 computers) + nhd: SCSI Hard Disk image (T98Next proprietary - only used with PC-98 computers) + hda: SCSI Hard Disk image (Apple compatible - typically used with Macintosh computers) + mos: SCSI Magneto-Optical image (generic - typically used with NeXT, X68000, etc.) + iso: SCSI CD-ROM or DVD-ROM image (ISO 9660 image) + + For example, if you want to specify an Apple-compatible HD image on ID 0, you can use the following command: + sudo piscsi -ID0 /path/to/drive/hdimage.hda + + Note: PiSCSI is a fork of RaSCSI. The two cannot be run in parallel on the same system. + + Once PiSCSI starts, it will open a socket (default port is 6868) to allow external management commands. If another process + is using this port, PiSCSI will terminate, since it is likely another instance of PiSCSI or RaSCSI. Once PiSCSI has ini‐ + tialized, the scsictl utility can be used to send commands. + + To quit PiSCSI, press Control + C. If it is running in the background, you can kill it using an INT signal. + +OPTIONS + -b BLOCK_SIZE + The optional block size, either 512, 1024, 2048 or 4096 bytes. Default size is 512 bytes. + + -F FOLDER + The default folder for image files. For files in this folder no absolute path needs to be specified. The initial de‐ + fault folder is '~/images'. + + -L LOG_LEVEL[:ID:[LUN]] + The piscsi log level (trace, debug, info, warn, err, off). The default log level is 'info' for all devices unless a + particular device ID and an optional LUN was provided. + + -P ACCESS_TOKEN_FILE + Enable authentication and read the access token from the specified file. The access token file must be owned by root + and must be readable by root only. + + -R SCAN_DEPTH + Scan for image files recursively, up to a depth of SCAN_DEPTH. Depth 0 means to ignore any folders within the de‐ + fault image filder. Be careful when using this option with many sub-folders in the default image folder. The default + depth is 1. + + -h Show a help page. + + -n VENDOR:PRODUCT:REVISION + Set the vendor, product and revision for the device, to be returned with the INQUIRY data. A complete set of name + components must be provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up to 4 characters. Padding with + blanks to the maxium length is automatically applied. Once set the name of a device cannot be changed. + + -p PORT + The piscsi server port, default is 6868. + + -r RESERVED_IDS + Comma-separated list of IDs to reserve. Pass an empty list in order to not reserve anything. -p TYPE The optional + case-insensitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, SCBR, SCDP, SCLP, SCHS). If no type is specified for de‐ + vices that support an image file, piscsi tries to derive the type from the file extension. + + -v Display the piscsi version. + + -z LOCALE + Overrides the default locale for client-faces error messages. The client can override the locale. + + -IDn[:u] FILE + n is the SCSI ID number (0-7). u (0-31) is the optional LUN (logical unit). The default LUN is 0. + + FILE is the name of the image file to use for the SCSI device. For devices that do not support an image file (SCBR, + SCDP, SCLP, SCHS) the filename may have a special meaning or a dummy name can be provided. For SCBR and SCDP it is + an optioinal prioritized list of network interfaces, an optional IP address and netmask, e.g. "inter‐ + face=eth0,eth1,wlan0:inet=10.10.20.1/24". For SCLP it is the print command to be used and a reservation timeout in + seconds, e.g. "cmd=lp -oraw %f:timeout=60". + + FILE is the name of the image file to use for the SCSI device. + +EXAMPLES + Launch PiSCSI with no emulated drives attached: + piscsi + + Launch PiSCSI with an Apple hard drive image as ID 0 and a CD-ROM as ID 2 + piscsi -ID0 /path/to/harddrive.hda -ID2 /path/to/cdimage.iso + + Launch PiSCSI with a removable SCSI drive image as ID 0 and the raw device file /dev/hdb (e.g. a USB stick) and a DaynaPort + network adapter as ID 6: + piscsi -ID0 -t scrm /dev/hdb -ID6 -t scdp daynaport + + To create an empty, 100MiB HD image, use the following command: + dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800 + + In case the fallocate command is available a much faster alternative to the dd command is: + fallocate -l 104857600 /path/to/newimage.hda + +SEE ALSO + scsictl(1), scsimon(1), scsidump(1) + + Full documentation is available at: + + piscsi(1) diff --git a/doc/rascsi_man_page.txt b/doc/rascsi_man_page.txt deleted file mode 100644 index db7e88aa..00000000 --- a/doc/rascsi_man_page.txt +++ /dev/null @@ -1,148 +0,0 @@ -!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!! -!! ------ The native file is rascsi.1. Re-run 'make docs' after updating\n\n -rascsi(1) General Commands Manual rascsi(1) - -NAME - rascsi - Emulates SCSI devices using the Raspberry Pi GPIO pins - -SYNOPSIS - rascsi [-F FOLDER] [-L LOG_LEVEL[:ID:[LUN]]] [-P ACCESS_TOKEN_FILE] [-R - SCAN_DEPTH] [-h] [-n VENDOR:PRODUCT:REVISION] [-p PORT] [-r RE‐ - SERVED_IDS] [-n TYPE] [-v] [-z LOCALE] [-IDn:[u] FILE] [-HDn[:u] - FILE]... - -DESCRIPTION - rascsi emulates SCSI devices using the Raspberry Pi GPIO pins. - - In the arguments to RaSCSI, one or more SCSI (-IDn[:u]) devices can be - specified. The number (n) after the ID or HD identifier specifies the - ID number for that device. The optional number (u) specifies the LUN - (logical unit) for that device. The default LUN is 0. For SCSI: The ID - is limited from 0-7. However, typically SCSI ID 7 is reserved for the - "initiator" (the host computer). The LUN is limited from 0-31. - - RaSCSI will determine the type of device based upon the file extension - of the FILE argument. - hd1: SCSI Hard Disk image (generic, non-removable, SCSI-1) - hds: SCSI Hard Disk image (generic, non-removable) - hdr: SCSI Hard Disk image (generic, removable) - hdn: SCSI Hard Disk image (NEC compatible - only used with PC-98 - computers) - hdi: SCSI Hard Disk image (Anex86 proprietary - only used with - PC-98 computers) - nhd: SCSI Hard Disk image (T98Next proprietary - only used with - PC-98 computers) - hda: SCSI Hard Disk image (Apple compatible - typically used with - Macintosh computers) - mos: SCSI Magneto-Optical image (generic - typically used with - NeXT, X68000, etc.) - iso: SCSI CD-ROM or DVD-ROM image (ISO 9660 image) - - For example, if you want to specify an Apple-compatible HD image on ID - 0, you can use the following command: - sudo rascsi -ID0 /path/to/drive/hdimage.hda - - Once RaSCSI starts, it will open a socket (default port is 6868) to al‐ - low external management commands. If another process is using the - rascsi port, RaSCSI will terminate, since it is likely another instance - of RaSCSI. Once RaSCSI has initialized, the rasctl utility can be used - to send commands. - - To quit RaSCSI, press Control + C. If it is running in the background, - you can kill it using an INT signal. - -OPTIONS - -b BLOCK_SIZE - The optional block size, either 512, 1024, 2048 or 4096 bytes. - Default size is 512 bytes. - - -F FOLDER - The default folder for image files. For files in this folder no - absolute path needs to be specified. The initial default folder - is '~/images'. - - -L LOG_LEVEL[:ID:[LUN]] - The rascsi log level (trace, debug, info, warn, err, off). The - default log level is 'info' for all devices unless a particular - device ID and an optional LUN was provided. - - -P ACCESS_TOKEN_FILE - Enable authentication and read the access token from the speci‐ - fied file. The access token file must be owned by root and must - be readable by root only. - - -R SCAN_DEPTH - Scan for image files recursively, up to a depth of SCAN_DEPTH. - Depth 0 means to ignore any folders within the default image - filder. Be careful when using this option with many sub-folders - in the default image folder. The default depth is 1. - - -h Show a help page. - - -n VENDOR:PRODUCT:REVISION - Set the vendor, product and revision for the device, to be re‐ - turned with the INQUIRY data. A complete set of name components - must be provided. VENDOR may have up to 8, PRODUCT up to 16, RE‐ - VISION up to 4 characters. Padding with blanks to the maxium - length is automatically applied. Once set the name of a device - cannot be changed. - - -p PORT - The rascsi server port, default is 6868. - - -r RESERVED_IDS - Comma-separated list of IDs to reserve. Pass an empty list in - order to not reserve anything. -p TYPE The optional case-insen‐ - sitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, SCBR, SCDP, - SCLP, SCHS). If no type is specified for devices that support an - image file, rascsi tries to derive the type from the file exten‐ - sion. - - -v Display the rascsi version. - - -z LOCALE - Overrides the default locale for client-faces error messages. - The client can override the locale. - - -IDn[:u] FILE - n is the SCSI ID number (0-7). u (0-31) is the optional LUN - (logical unit). The default LUN is 0. - - FILE is the name of the image file to use for the SCSI device. - For devices that do not support an image file (SCBR, SCDP, SCLP, - SCHS) the filename may have a special meaning or a dummy name - can be provided. For SCBR and SCDP it is an optioinal priori‐ - tized list of network interfaces, an optional IP address and - netmask, e.g. "interface=eth0,eth1,wlan0:inet=10.10.20.1/24". - For SCLP it is the print command to be used and a reservation - timeout in seconds, e.g. "cmd=lp -oraw %f:timeout=60". - - FILE is the name of the image file to use for the SCSI device. - -EXAMPLES - Launch RaSCSI with no emulated drives attached: - rascsi - - Launch RaSCSI with an Apple hard drive image as ID 0 and a CD-ROM as ID - 2 - rascsi -ID0 /path/to/harddrive.hda -ID2 /path/to/cdimage.iso - - Launch RaSCSI with a removable SCSI drive image as ID 0 and the raw de‐ - vice file /dev/hdb (e.g. a USB stick) and a DaynaPort network adapter - as ID 6: - rascsi -ID0 -t scrm /dev/hdb -ID6 -t scdp daynaport - - To create an empty, 100MiB HD image, use the following command: - dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800 - - In case the fallocate command is available a much faster alternative to - the dd command is: - fallocate -l 104857600 /path/to/newimage.hda - -SEE ALSO - rasctl(1), scsimon(1), rasdump(1) - - Full documentation is available at: - - - rascsi(1) diff --git a/doc/rasctl_man_page.txt b/doc/rasctl_man_page.txt deleted file mode 100644 index dee66667..00000000 --- a/doc/rasctl_man_page.txt +++ /dev/null @@ -1,170 +0,0 @@ -!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!! -!! ------ The native file is rasctl.1. Re-run 'make docs' after updating\n\n -rascsi(1) General Commands Manual rascsi(1) - -NAME - rasctl - Sends management commands to the rascsi process - -SYNOPSIS - rasctl -e | -l | -m | -o | -s | -v | -D | -I | -L | -O | -P | -T | -V | - -X | [-C FILENAME:FILESIZE] [-E FILENAME] [-F IMAGE_FOLDER] [-R CUR‐ - RENT_NAME:NEW_NAME] [-c CMD] [-f FILE|PARAM] [-g LOG_LEVEL] [-h HOST] - [-i ID[:LUN] [-n NAME] [-p PORT] [-r RESERVED_IDS] [-t TYPE] [-x CUR‐ - RENT_NAME:NEW_NAME] [-z LOCALE] - -DESCRIPTION - rasctl sends commands to the rascsi process to make configuration ad‐ - justments at runtime or to check the status of the devices. - - Either the -i or -l option should be specified at one time. Not both. - - You do NOT need root privileges to use rasctl. - - Note: The command and type arguments are case insensitive. Only the - first letter of the command/type is evaluated by the tool. - -OPTIONS - -C FILENAME:FILESIZE - Create an image file in the default image folder with the speci‐ - fied name and size in bytes. - - -D Detach all devices. - - -E FILENAME - Display information on an image file. - - -F IMAGE_FOLDER - Set the default image folder. - - -I Gets the list of reserved device IDs. - - -L LOG_LEVEL - Set the rascsi log level (trace, debug, info, warn, err, off). - - -h HOST - The rascsi host to connect to, default is 'localhost'. - - -e List all images files in the default image folder. - - -N Lists all available network interfaces provided that they are - up. - - -O Display the available rascsi server log levels and the current - log level. - - -P Prompt for the access token in case rascsi requires authentica‐ - tion. - - -l List all of the devices that are currently being emulated by - RaSCSI, as well as their current status. - - -m List all file extensions recognized by RaSCSI and the device - types they map to. - - -o Display operation meta data information. - - -R CURRENT_NAME:NEW_NAME - Rename an image file in the default image folder. - - -p PORT - The rascsi port to connect to, default is 6868. - - -r RESERVED_IDS - Comma-separated list of IDs to reserve. Pass an empty list in - order to not reserve anything. - - -s Display server-side settings like available images or supported - device types. - - -T Display all device types and their properties. - - -v Display the rascsi server version. - - -V Display the rasctl version. - - -X Shut down the rascsi process. - - -d FILENAME - Delete an image file in the default image folder. - - -x CURRENT_NAME:NEW_NAME - Copy an image file in the default image folder. - - -z LOCALE - Overrides the default locale for client-facing error messages. - - -i ID[:LUN] - The SCSI ID and optional LUN that you want to control. - (0-7:0-31) - - -c CMD Command is the operation being requested. Options are: - a(ttach): Attach disk - d(etach): Detach disk - i(nsert): Insert media (removable media devices only) - e(ject): Eject media (removable media devices only) - p(rotect): Write protect the medium (not for CD-ROMs, which - are always read-only) - u(nprotect): Remove write protection from the medium (not for - CD-ROMs, which are always read-only) - s(how): Display device information - - eject, protect and unprotect are idempotent. - - -b BLOCK_SIZE - The optional block size, either 512, 1024, 2048 or 4096 bytes. - The default size is 512 bytes. - - -f FILE|PARAM - Device-specific: Either a path to a disk image file, or a param‐ - eter for a non-disk device. See the rascsi(1) man page for per‐ - mitted file types. - - -t TYPE - Specifies the device type. This type overrides the type derived - from the file extension of the specified image. See the - rascsi(1) man page for the available device types. For some - types there are shortcuts (only the first letter is required): - hd: SCSI hard disk drive - rm: SCSI removable media drive - cd: CD-ROM - mo: Magneto-Optical disk - lp: SCSI printer - bridge: Bridge device (Only applicable to the Sharp X68000) - daynaport: DaynaPort network adapter - services: Host services device - - -n VENDOR:PRODUCT:REVISION - The vendor, product and revision for the device, to be returned - with the INQUIRY data. A complete set of name components must be - provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up - to 4 characters. Padding with blanks to the maxium length is au‐ - tomatically applied. Once set the name of a device cannot be - changed. - - -u UNIT - Unit number (0-31). This will default to 0. This option is only - used when there are multiple SCSI devices on a shared SCSI con‐ - troller. (This is not common) - -EXAMPLES - Show a listing of all of the SCSI devices and their current status. - rasctl -l - - Example output: - +----+-----+------+------------------------------------- - | ID | LUN | TYPE | IMAGE FILE - +----+-----+------+------------------------------------- - | 0 | 1 | SCHD | /home/pi/harddisk.hda - +----+-----+------+------------------------------------- - - Request the RaSCSI process to attach a disk (assumed) to SCSI ID 0 with - the contents of the file system image "HDIIMAGE0.HDS". - rasctl -i 0 -f HDIIMAGE0.HDS - -SEE ALSO - rascsi(1), scsimon(1), rasdump(1) - - Full documentation is available at: - - - rascsi(1) diff --git a/doc/rasdump_man_page.txt b/doc/rasdump_man_page.txt deleted file mode 100644 index 876a4dce..00000000 --- a/doc/rasdump_man_page.txt +++ /dev/null @@ -1,42 +0,0 @@ -!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!! -!! ------ The native file is rasdump.1. Re-run 'make docs' after updating\n\n -rasdump(1) General Commands Manual rasdump(1) - -NAME - rasdump - SCSI disk dumping tool for RaSCSI - -SYNOPSIS - rasdump -t ID[:LUN] [-i BID] -f FILE [-s BUFFER_SIZE] [-r] [-v] - -DESCRIPTION - rasdump samples the data on physical SCSI storage media, including hard - drives and MO drives, and stores it to an image file. It can also re‐ - store from a dumped file onto physical SCSI storage media. Can be con‐ - nected directly, through a STANDARD RaSCSI board, or a FULLSPEC RaSCSI - board. - - Set its own ID with the BID option. Defaults to 7 if ommitted. - -OPTIONS - -t ID[:LUN] - SCSI ID and optional LUN of the target device. - - -i BID SCSI ID of the RaSCSI device. - - -f FILE - Path to the dump file. - - -s BUFFER_SIZE - The transfer buffer size, at least 64 KiB. Default is 64 KiB. - - -r Run in restore mode. - - -v Enable verbose logging. - -SEE ALSO - rasctl(1), rascsi(1), scsimon(1) - - Full documentation is available at: - - - rasdump(1) diff --git a/doc/rasctl.1 b/doc/scsictl.1 similarity index 81% rename from doc/rasctl.1 rename to doc/scsictl.1 index 35fa8676..98a12f05 100644 --- a/doc/rasctl.1 +++ b/doc/scsictl.1 @@ -1,8 +1,8 @@ -.TH rascsi 1 +.TH piscsi 1 .SH NAME -rasctl \- Sends management commands to the rascsi process +scsictl \- Sends management commands to the piscsi process .SH SYNOPSIS -.B rasctl +.B scsictl \fB\-e\fR | \fB\-l\fR | \fB\-m\fR | @@ -33,12 +33,12 @@ rasctl \- Sends management commands to the rascsi process [\fB\-x\fR \fICURRENT_NAME:NEW_NAME\fR] [\fB\-z\fR \fILOCALE\fR] .SH DESCRIPTION -.B rasctl -sends commands to the rascsi process to make configuration adjustments at runtime or to check the status of the devices. +.B scsictl +sends commands to the piscsi process to make configuration adjustments at runtime or to check the status of the devices. Either the -i or -l option should be specified at one time. Not both. -You do NOT need root privileges to use rasctl. +You do NOT need root privileges to use scsictl. Note: The command and type arguments are case insensitive. Only the first letter of the command/type is evaluated by the tool. @@ -60,10 +60,10 @@ Set the default image folder. Gets the list of reserved device IDs. .TP .BR \-L\fI " "\fILOG_LEVEL -Set the rascsi log level (trace, debug, info, warn, err, off). +Set the piscsi log level (trace, debug, info, warn, err, off). .TP .BR \-h\fI " " \fIHOST -The rascsi host to connect to, default is 'localhost'. +The piscsi host to connect to, default is 'localhost'. .TP .BR \-e\fI List all images files in the default image folder. @@ -72,16 +72,16 @@ List all images files in the default image folder. Lists all available network interfaces provided that they are up. .TP .BR \-O\fI -Display the available rascsi server log levels and the current log level. +Display the available piscsi server log levels and the current log level. .TP .BR \-P\fI -Prompt for the access token in case rascsi requires authentication. +Prompt for the access token in case piscsi requires authentication. .TP .BR \-l\fI -List all of the devices that are currently being emulated by RaSCSI, as well as their current status. +List all of the devices that are currently being emulated by PiSCSI, as well as their current status. .TP .BR \-m\fI -List all file extensions recognized by RaSCSI and the device types they map to. +List all file extensions recognized by PiSCSI and the device types they map to. .TP .BR \-o\fI Display operation meta data information. @@ -90,7 +90,7 @@ Display operation meta data information. Rename an image file in the default image folder. .TP .BR \-p\fI " " \fIPORT -The rascsi port to connect to, default is 6868. +The piscsi port to connect to, default is 6868. .TP .BR \-r\fI " " \fIRESERVED_IDS Comma-separated list of IDs to reserve. Pass an empty list in order to not reserve anything. @@ -102,13 +102,13 @@ Display server-side settings like available images or supported device types. Display all device types and their properties. .TP .BR \-v\fI " " \fI -Display the rascsi server version. +Display the piscsi server version. .TP .BR \-V\fI " " \fI -Display the rasctl version. +Display the scsictl version. .TP .BR \-X\fI " " \fI -Shut down the rascsi process. +Shut down the piscsi process. .TP .BR \-d\fI " "\fIFILENAME Delete an image file in the default image folder. @@ -138,10 +138,10 @@ eject, protect and unprotect are idempotent. The optional block size, either 512, 1024, 2048 or 4096 bytes. The default size is 512 bytes. .TP .BR \-f\fI " " \fIFILE|PARAM -Device-specific: Either a path to a disk image file, or a parameter for a non-disk device. See the rascsi(1) man page for permitted file types. +Device-specific: Either a path to a disk image file, or a parameter for a non-disk device. See the piscsi(1) man page for permitted file types. .TP .BR \-t\fI " " \fITYPE -Specifies the device type. This type overrides the type derived from the file extension of the specified image. See the rascsi(1) man page for the available device types. For some types there are shortcuts (only the first letter is required): +Specifies the device type. This type overrides the type derived from the file extension of the specified image. See the piscsi(1) man page for the available device types. For some types there are shortcuts (only the first letter is required): hd: SCSI hard disk drive rm: SCSI removable media drive cd: CD-ROM @@ -159,7 +159,7 @@ Unit number (0-31). This will default to 0. This option is only used when there .SH EXAMPLES Show a listing of all of the SCSI devices and their current status. - rasctl -l + scsictl -l Example output: @@ -169,10 +169,10 @@ Example output: | 0 | 1 | SCHD | /home/pi/harddisk.hda +----+-----+------+------------------------------------- -Request the RaSCSI process to attach a disk (assumed) to SCSI ID 0 with the contents of the file system image "HDIIMAGE0.HDS". - rasctl -i 0 -f HDIIMAGE0.HDS +Request the PiSCSI process to attach a disk (assumed) to SCSI ID 0 with the contents of the file system image "HDIIMAGE0.HDS". + scsictl -i 0 -f HDIIMAGE0.HDS .SH SEE ALSO -rascsi(1), scsimon(1), rasdump(1) +piscsi(1), scsimon(1), scsidump(1) -Full documentation is available at: +Full documentation is available at: diff --git a/doc/scsictl_man_page.txt b/doc/scsictl_man_page.txt new file mode 100644 index 00000000..9281242c --- /dev/null +++ b/doc/scsictl_man_page.txt @@ -0,0 +1,151 @@ +!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!! +!! ------ The native file is scsictl.1. Re-run 'make docs' after updating + + +piscsi(1) General Commands Manual piscsi(1) + +NAME + scsictl - Sends management commands to the piscsi process + +SYNOPSIS + scsictl -e | -l | -m | -o | -s | -v | -D | -I | -L | -O | -P | -T | -V | -X | [-C FILENAME:FILESIZE] [-E FILENAME] [-F IM‐ + AGE_FOLDER] [-R CURRENT_NAME:NEW_NAME] [-c CMD] [-f FILE|PARAM] [-g LOG_LEVEL] [-h HOST] [-i ID[:LUN] [-n NAME] [-p PORT] + [-r RESERVED_IDS] [-t TYPE] [-x CURRENT_NAME:NEW_NAME] [-z LOCALE] + +DESCRIPTION + scsictl sends commands to the piscsi process to make configuration adjustments at runtime or to check the status of the de‐ + vices. + + Either the -i or -l option should be specified at one time. Not both. + + You do NOT need root privileges to use scsictl. + + Note: The command and type arguments are case insensitive. Only the first letter of the command/type is evaluated by the + tool. + +OPTIONS + -C FILENAME:FILESIZE + Create an image file in the default image folder with the specified name and size in bytes. + + -D Detach all devices. + + -E FILENAME + Display information on an image file. + + -F IMAGE_FOLDER + Set the default image folder. + + -I Gets the list of reserved device IDs. + + -L LOG_LEVEL + Set the piscsi log level (trace, debug, info, warn, err, off). + + -h HOST + The piscsi host to connect to, default is 'localhost'. + + -e List all images files in the default image folder. + + -N Lists all available network interfaces provided that they are up. + + -O Display the available piscsi server log levels and the current log level. + + -P Prompt for the access token in case piscsi requires authentication. + + -l List all of the devices that are currently being emulated by PiSCSI, as well as their current status. + + -m List all file extensions recognized by PiSCSI and the device types they map to. + + -o Display operation meta data information. + + -R CURRENT_NAME:NEW_NAME + Rename an image file in the default image folder. + + -p PORT + The piscsi port to connect to, default is 6868. + + -r RESERVED_IDS + Comma-separated list of IDs to reserve. Pass an empty list in order to not reserve anything. + + -s Display server-side settings like available images or supported device types. + + -T Display all device types and their properties. + + -v Display the piscsi server version. + + -V Display the scsictl version. + + -X Shut down the piscsi process. + + -d FILENAME + Delete an image file in the default image folder. + + -x CURRENT_NAME:NEW_NAME + Copy an image file in the default image folder. + + -z LOCALE + Overrides the default locale for client-facing error messages. + + -i ID[:LUN] + The SCSI ID and optional LUN that you want to control. (0-7:0-31) + + -c CMD Command is the operation being requested. Options are: + a(ttach): Attach disk + d(etach): Detach disk + i(nsert): Insert media (removable media devices only) + e(ject): Eject media (removable media devices only) + p(rotect): Write protect the medium (not for CD-ROMs, which are always read-only) + u(nprotect): Remove write protection from the medium (not for CD-ROMs, which are always read-only) + s(how): Display device information + + eject, protect and unprotect are idempotent. + + -b BLOCK_SIZE + The optional block size, either 512, 1024, 2048 or 4096 bytes. The default size is 512 bytes. + + -f FILE|PARAM + Device-specific: Either a path to a disk image file, or a parameter for a non-disk device. See the piscsi(1) man + page for permitted file types. + + -t TYPE + Specifies the device type. This type overrides the type derived from the file extension of the specified image. See + the piscsi(1) man page for the available device types. For some types there are shortcuts (only the first letter is + required): + hd: SCSI hard disk drive + rm: SCSI removable media drive + cd: CD-ROM + mo: Magneto-Optical disk + lp: SCSI printer + bridge: Bridge device (Only applicable to the Sharp X68000) + daynaport: DaynaPort network adapter + services: Host services device + + -n VENDOR:PRODUCT:REVISION + The vendor, product and revision for the device, to be returned with the INQUIRY data. A complete set of name compo‐ + nents must be provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up to 4 characters. Padding with blanks + to the maxium length is automatically applied. Once set the name of a device cannot be changed. + + -u UNIT + Unit number (0-31). This will default to 0. This option is only used when there are multiple SCSI devices on a + shared SCSI controller. (This is not common) + +EXAMPLES + Show a listing of all of the SCSI devices and their current status. + scsictl -l + + Example output: + +----+-----+------+------------------------------------- + | ID | LUN | TYPE | IMAGE FILE + +----+-----+------+------------------------------------- + | 0 | 1 | SCHD | /home/pi/harddisk.hda + +----+-----+------+------------------------------------- + + Request the PiSCSI process to attach a disk (assumed) to SCSI ID 0 with the contents of the file system image "HDIIM‐ + AGE0.HDS". + scsictl -i 0 -f HDIIMAGE0.HDS + +SEE ALSO + piscsi(1), scsimon(1), scsidump(1) + + Full documentation is available at: + + piscsi(1) diff --git a/doc/rasdump.1 b/doc/scsidump.1 similarity index 71% rename from doc/rasdump.1 rename to doc/scsidump.1 index 64f9313e..3f8cd93d 100644 --- a/doc/rasdump.1 +++ b/doc/scsidump.1 @@ -1,8 +1,8 @@ -.TH rasdump 1 +.TH scsidump 1 .SH NAME -rasdump \- SCSI disk dumping tool for RaSCSI +scsidump \- SCSI disk dumping tool for PiSCSI .SH SYNOPSIS -.B rasdump +.B scsidump \fB\-t\fR \fIID[:LUN]\fR [\fB\-i\fR \fIBID\fR] \fB\-f\fR \fIFILE\fR @@ -10,8 +10,8 @@ rasdump \- SCSI disk dumping tool for RaSCSI [\fB\-r\fR] [\fB\-v\fR] .SH DESCRIPTION -.B rasdump -samples the data on physical SCSI storage media, including hard drives and MO drives, and stores it to an image file. It can also restore from a dumped file onto physical SCSI storage media. Can be connected directly, through a STANDARD RaSCSI board, or a FULLSPEC RaSCSI board. +.B scsidump +samples the data on physical SCSI storage media, including hard drives and MO drives, and stores it to an image file. It can also restore from a dumped file onto physical SCSI storage media. Can be connected directly, through a STANDARD PiSCSI board, or a FULLSPEC PiSCSI board. Set its own ID with the BID option. Defaults to 7 if ommitted. @@ -21,7 +21,7 @@ Set its own ID with the BID option. Defaults to 7 if ommitted. SCSI ID and optional LUN of the target device. .TP .BR \-i\fI " "\fIBID -SCSI ID of the RaSCSI device. +SCSI ID of the PiSCSI device. .TP .BR \-f\fI " "\fIFILE Path to the dump file. @@ -36,6 +36,6 @@ Run in restore mode. Enable verbose logging. .SH SEE ALSO -rasctl(1), rascsi(1), scsimon(1) +scsictl(1), piscsi(1), scsimon(1) -Full documentation is available at: +Full documentation is available at: diff --git a/doc/scsidump_man_page.txt b/doc/scsidump_man_page.txt new file mode 100644 index 00000000..9dcfc72b --- /dev/null +++ b/doc/scsidump_man_page.txt @@ -0,0 +1,41 @@ +!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!! +!! ------ The native file is scsidump.1. Re-run 'make docs' after updating + + +scsidump(1) General Commands Manual scsidump(1) + +NAME + scsidump - SCSI disk dumping tool for PiSCSI + +SYNOPSIS + scsidump -t ID[:LUN] [-i BID] -f FILE [-s BUFFER_SIZE] [-r] [-v] + +DESCRIPTION + scsidump samples the data on physical SCSI storage media, including hard drives and MO drives, and stores it to an image + file. It can also restore from a dumped file onto physical SCSI storage media. Can be connected directly, through a STAN‐ + DARD PiSCSI board, or a FULLSPEC PiSCSI board. + + Set its own ID with the BID option. Defaults to 7 if ommitted. + +OPTIONS + -t ID[:LUN] + SCSI ID and optional LUN of the target device. + + -i BID SCSI ID of the PiSCSI device. + + -f FILE + Path to the dump file. + + -s BUFFER_SIZE + The transfer buffer size, at least 64 KiB. Default is 64 KiB. + + -r Run in restore mode. + + -v Enable verbose logging. + +SEE ALSO + scsictl(1), piscsi(1), scsimon(1) + + Full documentation is available at: + + scsidump(1) diff --git a/doc/scsiloop.1 b/doc/scsiloop.1 index 0ef620d0..785b5b4d 100644 --- a/doc/scsiloop.1 +++ b/doc/scsiloop.1 @@ -1,12 +1,12 @@ .TH scsiloop 1 .SH NAME -scsiloop \- Tool for testing the RaSCSI board with a loopback adapter installed +scsiloop \- Tool for testing the PiSCSI board with a loopback adapter installed .SH SYNOPSIS .B scsiloop [\fB\-L\fR \fILOG_LEVEL\fR] .SH DESCRIPTION .B scsiloop -Performs a self-test of the RaSCSI hardware to ensure that the board is functioning properly. In order for this tool to work, a special loopback cable MUST be attached to the RaSCSI SCSI connector. +Performs a self-test of the PiSCSI hardware to ensure that the board is functioning properly. In order for this tool to work, a special loopback cable MUST be attached to the PiSCSI SCSI connector. In addition to testing the GPIO signals, scsiloop will perform a self-test of the hardware timers that are built into the system on a chip (SoC). @@ -27,9 +27,9 @@ The loopback connections for the DB25 connector are shown here: .SH OPTIONS .TP .BR \-L\fI " " \fILOG_LEVEL -The rascsi log level (trace, debug, info, warn, err, off). The default log level is 'info'. +The piscsi log level (trace, debug, info, warn, err, off). The default log level is 'info'. .SH SEE ALSO -rasctl(1), rascsi(1), scsimon(1) +scsictl(1), piscsi(1), scsimon(1) -Full documentation is available at: +Full documentation is available at: diff --git a/doc/scsiloop_man_page.txt b/doc/scsiloop_man_page.txt index be3049fd..7ccccf9e 100644 --- a/doc/scsiloop_man_page.txt +++ b/doc/scsiloop_man_page.txt @@ -2,18 +2,20 @@ !! ------ The native file is scsiloop.1. Re-run 'make docs' after updating -scsiloop(1) General Commands Manual scsiloop(1) +scsiloop(1) General Commands Manual scsiloop(1) NAME - scsiloop - Tool for testing the RaSCSI board with a loopback adapter installed + scsiloop - Tool for testing the PiSCSI board with a loopback adapter installed SYNOPSIS scsiloop [-L LOG_LEVEL] DESCRIPTION - scsiloop Performs a self-test of the RaSCSI hardware to ensure that the board is functioning properly. In order for this tool to work, a special loopback cable MUST be attached to the RaSCSI SCSI connector. + scsiloop Performs a self-test of the PiSCSI hardware to ensure that the board is functioning properly. In order for this + tool to work, a special loopback cable MUST be attached to the PiSCSI SCSI connector. - In addition to testing the GPIO signals, scsiloop will perform a self-test of the hardware timers that are built into the system on a chip (SoC). + In addition to testing the GPIO signals, scsiloop will perform a self-test of the hardware timers that are built into the + system on a chip (SoC). The loopback connections for the DB25 connector are shown here: @@ -31,11 +33,11 @@ DESCRIPTION OPTIONS -L LOG_LEVEL - The rascsi log level (trace, debug, info, warn, err, off). The default log level is 'info'. + The piscsi log level (trace, debug, info, warn, err, off). The default log level is 'info'. SEE ALSO - rasctl(1), rascsi(1), scsimon(1) + scsictl(1), piscsi(1), scsimon(1) - Full documentation is available at: + Full documentation is available at: - scsiloop(1) + scsiloop(1) diff --git a/doc/scsimon.1 b/doc/scsimon.1 index a5c1c880..48a76230 100644 --- a/doc/scsimon.1 +++ b/doc/scsimon.1 @@ -5,7 +5,7 @@ scsimon \- Acts as a data capture tool for all traffic on the SCSI bus. Data is .B scsimon .SH DESCRIPTION .B scsimon -monitors all of the traffic on the SCSI bus, using a RaSCSI device. The data is cached in memory while the tool is running. A circular buffer is used so that only the most recent 1,000,000 transactions are stored. The tool will continue to run until the user presses CTRL-C, or the process receives a SIGINT signal. +monitors all of the traffic on the SCSI bus, using a PiSCSI device. The data is cached in memory while the tool is running. A circular buffer is used so that only the most recent 1,000,000 transactions are stored. The tool will continue to run until the user presses CTRL-C, or the process receives a SIGINT signal. .PP The logged data is stored in a file called "log.vcd" in the current working directory from where scsimon was launched. @@ -18,10 +18,10 @@ To quit scsimon, press Control + C. None .SH EXAMPLES -Launch scsimon to capture all SCSI traffic available to the RaSCSI hardware: +Launch scsimon to capture all SCSI traffic available to the PiSCSI hardware: scsimon .SH SEE ALSO -rasctl(1), rascsi(1), rasdump(1) +scsictl(1), piscsi(1), scsidump(1) -Full documentation is available at: +Full documentation is available at: diff --git a/doc/scsimon_man_page.txt b/doc/scsimon_man_page.txt index a35d48e5..97b7e1bf 100644 --- a/doc/scsimon_man_page.txt +++ b/doc/scsimon_man_page.txt @@ -11,7 +11,7 @@ SYNOPSIS scsimon DESCRIPTION - scsimon monitors all of the traffic on the SCSI bus, using a RaSCSI device. The data is cached in memory while the tool is + scsimon monitors all of the traffic on the SCSI bus, using a PiSCSI device. The data is cached in memory while the tool is running. A circular buffer is used so that only the most recent 1,000,000 transactions are stored. The tool will continue to run until the user presses CTRL-C, or the process receives a SIGINT signal. @@ -25,12 +25,12 @@ OPTIONS None EXAMPLES - Launch scsimon to capture all SCSI traffic available to the RaSCSI hardware: + Launch scsimon to capture all SCSI traffic available to the PiSCSI hardware: scsimon SEE ALSO - rasctl(1), rascsi(1), rasdump(1) + scsictl(1), piscsi(1), scsidump(1) - Full documentation is available at: + Full documentation is available at: scsimon(1) diff --git a/docker/README.md b/docker/README.md index 02ba4d87..afb007a3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,8 +1,8 @@ # Docker Environment for Development and Testing -⚠️ **Important:** The Docker environment is unable to connect to the RaSCSI board and is -intended for development and testing purposes only. To setup RaSCSI on a Raspberry Pi -refer to the [setup instructions](https://github.com/akuker/RASCSI/wiki/Setup-Instructions) +⚠️ **Important:** The Docker environment is unable to connect to the PiSCSI board and is +intended for development and testing purposes only. To setup PiSCSI on a Raspberry Pi +refer to the [setup instructions](https://github.com/PiSCSI/piscsi/wiki/Setup-Instructions) on the wiki instead. ## Introduction @@ -20,7 +20,7 @@ cd docker docker compose up ``` -Containers will be built and started for the RaSCSI server and the web UI. +Containers will be built and started for the PiSCSI server and the web UI. The web UI can be accessed at: @@ -40,10 +40,10 @@ The following environment variables are available when using Docker Compose: | `WEB_HTTP_PORT` | 8080 | | `WEB_HTTPS_PORT` | 8443 | | `WEB_LOG_LEVEL` | info | -| `RASCSI_HOST` | backend | -| `RASCSI_PORT` | 6868 | -| `RASCSI_PASSWORD` | *[None]* | -| `RASCSI_LOG_LEVEL` | debug | +| `BACKEND_HOST` | backend | +| `BACKEND_PORT` | 6868 | +| `BACKEND_PASSWORD` | *[None]* | +| `BACKEND_LOG_LEVEL` | debug | **Examples:** @@ -64,7 +64,7 @@ When using Docker Compose the following volumes will be mounted automatically: | Local Path | Container Path | | ----------------------- | ------------------------ | | docker/volumes/images/ | /home/pi/images/ | -| docker/volumes/config/ | /home/pi/.config/rascsi/ | +| docker/volumes/config/ | /home/pi/.config/piscsi/ | ## How To @@ -72,7 +72,7 @@ When using Docker Compose the following volumes will be mounted automatically: ### Rebuild Containers You should rebuild the container images after checking out a different version of -RaSCSI or making changes which affect the environment at build time, e.g. +PiSCSI or making changes which affect the environment at build time, e.g. `easyinstall.sh`. ``` @@ -90,7 +90,7 @@ docker compose exec [CONTAINER] bash ### Setup Live Editing for the Web UI Use a `docker-compose.override.yml` to mount the local `python` directory to -`/home/pi/RASCSI/python/` in the `web` container. +`/home/pi/piscsi/python/` in the `web` container. Any changes to *.py files on the host computer (i.e. in your IDE) will trigger the web UI process to be restarted in the container. @@ -100,14 +100,14 @@ the web UI process to be restarted in the container. services: web: volumes: - - ../python:/home/pi/RASCSI/python:delegated + - ../python:/home/pi/piscsi/python:delegated ``` -### Connect the Web UI to a Real RaSCSI +### Connect the Web UI to a Real PiSCSI -This can be useful for testing, but there are some caveats, e.g. the RaSCSI and the +This can be useful for testing, but there are some caveats, e.g. the PiSCSI and the web UI will be accessing separate `images` directories. ``` -RASCSI_HOST=foo RASCSI_PASSWORD=bar docker compose up -``` \ No newline at end of file +BACKEND_HOST=foo BACKEND_PASSWORD=bar docker compose up +``` diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile index 7245484e..3a74e7ee 100644 --- a/docker/backend/Dockerfile +++ b/docker/backend/Dockerfile @@ -7,7 +7,7 @@ RUN groupadd pi \ && echo "pi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers USER pi -WORKDIR /home/pi/RASCSI +WORKDIR /home/pi/piscsi COPY --chown=pi:pi easyinstall.sh . COPY --chown=pi:pi cpp cpp @@ -18,8 +18,8 @@ FROM debian:bullseye-slim AS runner USER root WORKDIR /home/pi -COPY --from=build /home/pi/RASCSI/cpp/bin/fullspec/* /usr/local/bin/ -COPY docker/backend/rascsi_wrapper.sh /usr/local/bin/rascsi_wrapper.sh +COPY --from=build /home/pi/piscsi/cpp/bin/fullspec/* /usr/local/bin/ +COPY docker/backend/piscsi_wrapper.sh /usr/local/bin/piscsi_wrapper.sh RUN chmod +x /usr/local/bin/* RUN mkdir -p /home/pi/images @@ -30,7 +30,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* EXPOSE 6868 -ENTRYPOINT ["/usr/local/bin/rascsi_wrapper.sh", "-r", "7", "-F", "/home/pi/images"] +ENTRYPOINT ["/usr/local/bin/piscsi_wrapper.sh", "-r", "7", "-F", "/home/pi/images"] CMD ["-L", "trace"] -HEALTHCHECK --interval=5m --timeout=1s CMD rasctl -v +HEALTHCHECK --interval=5m --timeout=1s CMD scsictl -v diff --git a/docker/backend/piscsi_wrapper.sh b/docker/backend/piscsi_wrapper.sh new file mode 100644 index 00000000..0fab4dbe --- /dev/null +++ b/docker/backend/piscsi_wrapper.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [[ $BACKEND_PASSWORD ]]; then + TOKEN_FILE="/home/pi/.config/piscsi/piscsi_secret" + mkdir -p /home/pi/.config/piscsi || true + echo $BACKEND_PASSWORD > $TOKEN_FILE + chmod 700 $TOKEN_FILE + /usr/local/bin/piscsi "$@" -P $TOKEN_FILE +else + /usr/local/bin/piscsi "$@" +fi diff --git a/docker/backend/rascsi_wrapper.sh b/docker/backend/rascsi_wrapper.sh deleted file mode 100644 index 4e750ac3..00000000 --- a/docker/backend/rascsi_wrapper.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -if [[ $RASCSI_PASSWORD ]]; then - TOKEN_FILE="/home/pi/.config/rascsi/rascsi_secret" - mkdir -p /home/pi/.config/rascsi || true - echo $RASCSI_PASSWORD > $TOKEN_FILE - chmod 700 $TOKEN_FILE - /usr/local/bin/rascsi "$@" -P $TOKEN_FILE -else - /usr/local/bin/rascsi "$@" -fi diff --git a/docker/docker-compose.ci.yml b/docker/docker-compose.ci.yml index db5866f3..40bd95e6 100644 --- a/docker/docker-compose.ci.yml +++ b/docker/docker-compose.ci.yml @@ -20,7 +20,7 @@ services: volumes: - ./volumes/images:/home/pi/images:delegated init: true - command: ["--rascsi-host=backend", "--log-level=debug"] + command: ["--backend-host=backend", "--log-level=debug"] healthcheck: interval: 5s start_period: 5s @@ -39,4 +39,4 @@ services: working_dir: /src volumes: - ./volumes/pytest:/src/tests/output:delegated - command: ["-vv"] \ No newline at end of file + command: ["-vv"] diff --git a/docker/docker-compose.override.yml.example b/docker/docker-compose.override.yml.example index 53134ebb..1d457acd 100644 --- a/docker/docker-compose.override.yml.example +++ b/docker/docker-compose.override.yml.example @@ -1,7 +1,7 @@ services: web: volumes: - - ../python:/home/pi/RASCSI/python:delegated + - ../python:/home/pi/piscsi/python:delegated pytest: volumes: - ../python/web:/src:delegated diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index dc93b3dd..4ae30d27 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,27 +1,27 @@ services: backend: - container_name: rascsi_backend - image: rascsi-backend + container_name: piscsi_backend + image: piscsi-backend pull_policy: never build: context: .. dockerfile: docker/backend/Dockerfile volumes: - ./volumes/images:/home/pi/images:delegated - - ./volumes/config:/home/pi/.config/rascsi:delegated + - ./volumes/config:/home/pi/.config/piscsi:delegated ports: - - "127.0.0.1:${RASCSI_PORT:-6868}:6868" + - "127.0.0.1:${BACKEND_PORT:-6868}:6868" environment: - - RASCSI_PASSWORD=${RASCSI_PASSWORD:-} + - BACKEND_PASSWORD=${BACKEND_PASSWORD:-} init: true command: [ "-L", - "${RASCSI_LOG_LEVEL:-trace}", + "${BACKEND_LOG_LEVEL:-trace}", ] web: - container_name: rascsi_web - image: rascsi-web:${OS_VERSION:-buster} + container_name: piscsi_web + image: piscsi-web:${OS_VERSION:-buster} pull_policy: never build: context: .. @@ -30,23 +30,23 @@ services: - OS_VERSION=${OS_VERSION:-buster} volumes: - ./volumes/images:/home/pi/images:delegated - - ./volumes/config:/home/pi/.config/rascsi:delegated + - ./volumes/config:/home/pi/.config/piscsi:delegated ports: - "127.0.0.1:${WEB_HTTP_PORT:-8080}:80" - "127.0.0.1:${WEB_HTTPS_PORT:-8443}:443" environment: - - RASCSI_PASSWORD=${RASCSI_PASSWORD:-} + - BACKEND_PASSWORD=${BACKEND_PASSWORD:-} init: true command: [ - "--rascsi-host=${RASCSI_HOST:-backend}", - "--rascsi-port=${RASCSI_PORT:-6868}", + "--backend-host=${BACKEND_HOST:-backend}", + "--backend-port=${BACKEND_PORT:-6868}", "--log-level=${WEB_LOG_LEVEL:-debug}", "--dev-mode" ] pytest: - container_name: rascsi_pytest - image: rascsi-pytest + container_name: piscsi_pytest + image: piscsi-pytest pull_policy: never profiles: - webui-tests @@ -54,4 +54,4 @@ services: context: .. dockerfile: docker/pytest/Dockerfile working_dir: /src - command: ["-vv"] \ No newline at end of file + command: ["-vv"] diff --git a/docker/web/Dockerfile b/docker/web/Dockerfile index 48e958f6..62124639 100644 --- a/docker/web/Dockerfile +++ b/docker/web/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update \ RUN groupadd pi \ && useradd --create-home --shell /bin/bash -g pi pi \ && echo "pi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ - && echo "pi:rascsi" | chpasswd + && echo "pi:piscsi" | chpasswd # Allows custom PATH for mock commands to work when executing with sudo RUN sed -i 's/^Defaults\tsecure_path/#Defaults\tsecure_path./' /etc/sudoers @@ -22,16 +22,16 @@ RUN mkdir -p /home/pi/shared_files \ && touch /etc/dhcpcd.conf USER pi -WORKDIR /home/pi/RASCSI +WORKDIR /home/pi/piscsi -RUN mkdir /home/pi/RASCSI/{python,cpp} +RUN mkdir /home/pi/piscsi/{python,cpp} COPY --chown=pi:pi easyinstall.sh . COPY --chown=pi:pi cpp/os_integration cpp/os_integration -COPY --chown=pi:pi cpp/rascsi_interface.proto cpp/rascsi_interface.proto +COPY --chown=pi:pi cpp/piscsi_interface.proto cpp/piscsi_interface.proto COPY --chown=pi:pi python/web python/web COPY --chown=pi:pi python/common python/common -# Install standalone RaSCSI web UI +# Install standalone PiSCSI Web UI RUN ./easyinstall.sh --run_choice=11 \ && sudo apt-get remove build-essential --yes \ && sudo apt autoremove -y \ @@ -47,11 +47,11 @@ RUN ./easyinstall.sh --run_choice=5 --headless USER root WORKDIR /home/pi RUN pip3 install --no-cache-dir PyYAML watchdog -COPY docker/web/start.sh /usr/local/bin/start.sh -RUN chmod +x /usr/local/bin/start.sh +COPY docker/web/web_start_wrapper.sh /usr/local/bin/web_start_wrapper.sh +RUN chmod +x /usr/local/bin/web_start_wrapper.sh EXPOSE 80 443 -ENTRYPOINT ["/usr/local/bin/start.sh"] +ENTRYPOINT ["/usr/local/bin/web_start_wrapper.sh"] HEALTHCHECK --interval=5m --timeout=3s \ CMD wget --quiet --server-response http://localhost/healthcheck 2>&1 | grep "200 OK" diff --git a/docker/web/start.sh b/docker/web/start.sh deleted file mode 100644 index 3b027018..00000000 --- a/docker/web/start.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -if ! [[ -f "/home/pi/RASCSI/python/common/src/rascsi_interface_pb2.py" ]]; then - # Build rascsi_interface_pb2.py with the protobuf compiler - protoc \ - -I=/home/pi/RASCSI/cpp \ - --python_out=/home/pi/RASCSI/python/common/src \ - rascsi_interface.proto -fi - -# Start Nginx service -nginx - -# Use mock commands -export PATH="/home/pi/RASCSI/python/web/mock/bin:$PATH" - -# Pass args to web UI start script -if [[ $RASCSI_PASSWORD ]]; then - /home/pi/RASCSI/python/web/start.sh "$@" --password=$RASCSI_PASSWORD -else - /home/pi/RASCSI/python/web/start.sh "$@" -fi diff --git a/docker/web/web_start_wrapper.sh b/docker/web/web_start_wrapper.sh new file mode 100644 index 00000000..40055b55 --- /dev/null +++ b/docker/web/web_start_wrapper.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +if ! [[ -f "/home/pi/piscsi/python/common/src/piscsi_interface_pb2.py" ]]; then + # Build piscsi_interface_pb2.py with the protobuf compiler + protoc \ + -I=/home/pi/piscsi/cpp \ + --python_out=/home/pi/piscsi/python/common/src \ + piscsi_interface.proto +fi + +# Start Nginx service +nginx + +# Use mock commands +export PATH="/home/pi/piscsi/python/web/mock/bin:$PATH" + +# Pass args to web UI start script +if [[ $BACKEND_PASSWORD ]]; then + /home/pi/piscsi/python/web/start.sh "$@" --password=$BACKEND_PASSWORD +else + /home/pi/piscsi/python/web/start.sh "$@" +fi diff --git a/easyinstall.sh b/easyinstall.sh index 0458b8fe..27471488 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -4,7 +4,7 @@ # Author @sonique6784 # Copyright (c) 2020, sonique6784 -function showRaSCSILogo(){ +function showPiSCSILogo(){ logo="""     .~~.   .~~.\n   '. \ ' ' / .'\n @@ -13,7 +13,7 @@ logo="""  ~ (║|_____|║) ~\n ( : ║ .  __ ║ : )\n  ~ .╚╦═════╦╝. ~\n -  (  ¯¯¯¯¯¯¯  ) RaSCSI Reloaded Assistant\n +  (  ¯¯¯¯¯¯¯  ) PiSCSI Assistant\n    '~ .~~~. ~'\n        '~'\n """ @@ -53,7 +53,7 @@ USER=$(whoami) BASE=$(dirname "$(readlink -f "${0}")") CPP_PATH="$BASE/cpp" VIRTUAL_DRIVER_PATH="$HOME/images" -CFG_PATH="$HOME/.config/rascsi" +CFG_PATH="$HOME/.config/piscsi" WEB_INSTALL_PATH="$BASE/python/web" OLED_INSTALL_PATH="$BASE/python/oled" CTRLBOARD_INSTALL_PATH="$BASE/python/ctrlboard" @@ -65,7 +65,7 @@ HFDISK_BIN=/usr/bin/hfdisk GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) GIT_REMOTE=${GIT_REMOTE:-origin} TOKEN="" -SECRET_FILE="$HOME/.config/rascsi/rascsi_secret" +SECRET_FILE="$HOME/.config/piscsi/piscsi_secret" FILE_SHARE_PATH="$HOME/shared_files" FILE_SHARE_NAME="Pi File Server" @@ -94,7 +94,7 @@ function sudoCheck() { sudo -v } -# install all dependency packages for RaSCSI Service +# install all dependency packages for PiSCSI Service function installPackages() { if [[ $SKIP_PACKAGES ]]; then echo "Skipping package installation" @@ -107,7 +107,7 @@ function installPackages() { $APT_PACKAGES_WEB } -# install Debian packages for RaSCSI standalone +# install Debian packages for PiSCSI standalone function installPackagesStandalone() { if [[ $SKIP_PACKAGES ]]; then echo "Skipping package installation" @@ -118,7 +118,7 @@ function installPackagesStandalone() { $APT_PACKAGES_BACKEND } -# install Debian packages for RaSCSI web UI standalone +# install Debian packages for PiSCSI web UI standalone function installPackagesWeb() { if [[ $SKIP_PACKAGES ]]; then echo "Skipping package installation" @@ -138,8 +138,8 @@ function cachePipPackages(){ popd } -# compile the RaSCSI binaries -function compileRaScsi() { +# compile the PiSCSI binaries +function compilePiscsi() { cd "$CPP_PATH" || exit 1 echo "Compiling $CONNECT_TYPE with $COMPILER on $CORES simultaneous cores..." @@ -155,13 +155,13 @@ function cleanupOutdatedManPage() { fi } -# install the RaSCSI binaries and modify the service configuration -function installRaScsi() { +# install the PiSCSI binaries and modify the service configuration +function installPiscsi() { # clean up outdated man pages if they exist - cleanupOutdatedManPage "rascsi.1" - cleanupOutdatedManPage "rasctl.1" + cleanupOutdatedManPage "piscsi.1" + cleanupOutdatedManPage "scsictl.1" cleanupOutdatedManPage "scsimon.1" - cleanupOutdatedManPage "rasdump.1" + cleanupOutdatedManPage "scsidump.1" cleanupOutdatedManPage "sasidump.1" # install @@ -169,57 +169,57 @@ function installRaScsi() { # update launch parameters if [[ -f $SECRET_FILE ]]; then - sudo sed -i "\@^ExecStart.*@ s@@& -F $VIRTUAL_DRIVER_PATH -P $SECRET_FILE@" "$SYSTEMD_PATH/rascsi.service" + sudo sed -i "\@^ExecStart.*@ s@@& -F $VIRTUAL_DRIVER_PATH -P $SECRET_FILE@" "$SYSTEMD_PATH/piscsi.service" echo "Secret token file $SECRET_FILE detected. Using it to enable back-end authentication." else - sudo sed -i "\@^ExecStart.*@ s@@& -F $VIRTUAL_DRIVER_PATH@" "$SYSTEMD_PATH/rascsi.service" + sudo sed -i "\@^ExecStart.*@ s@@& -F $VIRTUAL_DRIVER_PATH@" "$SYSTEMD_PATH/piscsi.service" fi - echo "Configured rascsi.service to use $VIRTUAL_DRIVER_PATH as default image dir." + echo "Configured piscsi.service to use $VIRTUAL_DRIVER_PATH as default image dir." } function preparePythonCommon() { - if [ -f "$WEB_INSTALL_PATH/src/rascsi_interface_pb2.py" ]; then - sudo rm "$WEB_INSTALL_PATH/src/rascsi_interface_pb2.py" - echo "Deleting old Python protobuf library $WEB_INSTALL_PATH/src/rascsi_interface_pb2.py" + if [ -f "$WEB_INSTALL_PATH/src/piscsi_interface_pb2.py" ]; then + sudo rm "$WEB_INSTALL_PATH/src/piscsi_interface_pb2.py" + echo "Deleting old Python protobuf library $WEB_INSTALL_PATH/src/piscsi_interface_pb2.py" fi - if [ -f "$OLED_INSTALL_PATH/src/rascsi_interface_pb2.py" ]; then - sudo rm "$OLED_INSTALL_PATH/src/rascsi_interface_pb2.py" - echo "Deleting old Python protobuf library $OLED_INSTALL_PATH/src/rascsi_interface_pb2.py" + if [ -f "$OLED_INSTALL_PATH/src/piscsi_interface_pb2.py" ]; then + sudo rm "$OLED_INSTALL_PATH/src/piscsi_interface_pb2.py" + echo "Deleting old Python protobuf library $OLED_INSTALL_PATH/src/piscsi_interface_pb2.py" fi - if [ -f "$PYTHON_COMMON_PATH/src/rascsi_interface_pb2.py" ]; then - sudo rm "$PYTHON_COMMON_PATH/src/rascsi_interface_pb2.py" - echo "Deleting old Python protobuf library $PYTHON_COMMON_PATH/src/rascsi_interface_pb2.py" + if [ -f "$PYTHON_COMMON_PATH/src/piscsi_interface_pb2.py" ]; then + sudo rm "$PYTHON_COMMON_PATH/src/piscsi_interface_pb2.py" + echo "Deleting old Python protobuf library $PYTHON_COMMON_PATH/src/piscsi_interface_pb2.py" fi - echo "Compiling the Python protobuf library rascsi_interface_pb2.py..." - protoc -I="$CPP_PATH" --python_out="$PYTHON_COMMON_PATH/src" rascsi_interface.proto + echo "Compiling the Python protobuf library piscsi_interface_pb2.py..." + protoc -I="$CPP_PATH" --python_out="$PYTHON_COMMON_PATH/src" piscsi_interface.proto } # install everything required to run an HTTP server (Nginx + Python Flask App) -function installRaScsiWebInterface() { +function installPiscsiWebInterface() { sudo cp -f "$WEB_INSTALL_PATH/service-infra/nginx-default.conf" /etc/nginx/sites-available/default sudo cp -f "$WEB_INSTALL_PATH/service-infra/502.html" /var/www/html/502.html sudo usermod -a -G $USER www-data - if [ -f "$SSL_CERTS_PATH/rascsi-web.crt" ]; then - echo "SSL certificate $SSL_CERTS_PATH/rascsi-web.crt already exists." + if [ -f "$SSL_CERTS_PATH/piscsi-web.crt" ]; then + echo "SSL certificate $SSL_CERTS_PATH/piscsi-web.crt already exists." else - echo "SSL certificate $SSL_CERTS_PATH/rascsi-web.crt does not exist; creating self-signed certificate..." + echo "SSL certificate $SSL_CERTS_PATH/piscsi-web.crt does not exist; creating self-signed certificate..." sudo mkdir -p "$SSL_CERTS_PATH" || true sudo mkdir -p "$SSL_KEYS_PATH" || true sudo openssl req -x509 -nodes -sha256 -days 3650 \ -newkey rsa:4096 \ - -keyout "$SSL_KEYS_PATH/rascsi-web.key" \ - -out "$SSL_CERTS_PATH/rascsi-web.crt" \ - -subj '/CN=rascsi' \ - -addext 'subjectAltName=DNS:rascsi' \ + -keyout "$SSL_KEYS_PATH/piscsi-web.key" \ + -out "$SSL_CERTS_PATH/piscsi-web.crt" \ + -subj '/CN=piscsi' \ + -addext 'subjectAltName=DNS:piscsi' \ -addext 'extendedKeyUsage=serverAuth' fi sudo systemctl reload nginx || true } -# Creates the dir that RaSCSI uses to store image files +# Creates the dir that PiSCSI uses to store image files function createImagesDir() { if [ -d "$VIRTUAL_DRIVER_PATH" ]; then echo "The $VIRTUAL_DRIVER_PATH directory already exists." @@ -241,20 +241,20 @@ function createCfgDir() { fi } -# Stops the rascsi-web and apache2 processes +# Stops the piscsi-web and apache2 processes function stopOldWebInterface() { - stopRaScsiWeb + stopPiscsiWeb APACHE_STATUS=$(sudo systemctl status apache2 &> /dev/null; echo $?) if [ "$APACHE_STATUS" -eq 0 ] ; then - echo "Stopping old Apache2 RaSCSI Web..." + echo "Stopping old Apache2 PiSCSI Web..." sudo systemctl disable apache2 sudo systemctl stop apache2 fi } # Checks for upstream changes to the git repo and fast-forwards changes if needed -function updateRaScsiGit() { +function updatePiscsiGit() { cd "$BASE" || exit 1 set +e @@ -267,8 +267,8 @@ function updateRaScsiGit() { stashed=0 if [[ $(git diff --stat) != '' ]]; then - echo "There are local changes to the RaSCSI code; we will stash and reapply them." - git -c user.name="${GIT_COMMITTER_NAME-rascsi}" -c user.email="${GIT_COMMITTER_EMAIL-rascsi@rascsi.com}" stash + echo "There are local changes to the PiSCSI code; we will stash and reapply them." + git -c user.name="${GIT_COMMITTER_NAME-piscsi}" -c user.email="${GIT_COMMITTER_EMAIL-piscsi@piscsi.com}" stash stashed=1 fi @@ -285,18 +285,18 @@ function updateRaScsiGit() { fi } -# Takes a backup copy of the rascsi.service file if it exists -function backupRaScsiService() { - if [ -f "$SYSTEMD_PATH/rascsi.service" ]; then - sudo mv "$SYSTEMD_PATH/rascsi.service" "$SYSTEMD_PATH/rascsi.service.old" +# Takes a backup copy of the piscsi.service file if it exists +function backupPiscsiService() { + if [ -f "$SYSTEMD_PATH/piscsi.service" ]; then + sudo mv "$SYSTEMD_PATH/piscsi.service" "$SYSTEMD_PATH/piscsi.service.old" SYSTEMD_BACKUP=true - echo "Existing version of rascsi.service detected; Backing up to rascsi.service.old" + echo "Existing version of piscsi.service detected; Backing up to piscsi.service.old" else SYSTEMD_BACKUP=false fi } -# Offers the choice of enabling token-based authentication for RaSCSI, or disables it if enabled +# Offers the choice of enabling token-based authentication for PiSCSI, or disables it if enabled function configureTokenAuth() { if [[ -f "$HOME/.rascsi_secret" ]]; then sudo rm "$HOME/.rascsi_secret" @@ -305,16 +305,16 @@ function configureTokenAuth() { if [[ -f $SECRET_FILE ]]; then sudo rm "$SECRET_FILE" - echo "RaSCSI token file $SECRET_FILE already exists. Do you want to disable authentication? (y/N)" + echo "PiSCSI token file $SECRET_FILE already exists. Do you want to disable authentication? (y/N)" read REPLY if [[ $REPLY =~ ^[Yy]$ ]]; then - sudo sed -i 's@-P '"$SECRET_FILE"'@@' "$SYSTEMD_PATH/rascsi.service" + sudo sed -i 's@-P '"$SECRET_FILE"'@@' "$SYSTEMD_PATH/piscsi.service" return fi fi - echo -n "Enter the token password for protecting RaSCSI: " + echo -n "Enter the token password for protecting PiSCSI: " read -r TOKEN echo "$TOKEN" > "$SECRET_FILE" @@ -323,24 +323,24 @@ function configureTokenAuth() { sudo chown root:root "$SECRET_FILE" sudo chmod 600 "$SECRET_FILE" - sudo sed -i "s@^ExecStart.*@& -P $SECRET_FILE@" "$SYSTEMD_PATH/rascsi.service" + sudo sed -i "s@^ExecStart.*@& -P $SECRET_FILE@" "$SYSTEMD_PATH/piscsi.service" echo "" - echo "Configured RaSCSI to use $SECRET_FILE for authentication. This file is readable by root only." - echo "Make note of your password: you will need it to use rasctl and other RaSCSI clients." - echo "If you have RaSCSI clients installed, please re-run the installation scripts, or update the systemd config manually." + echo "Configured PiSCSI to use $SECRET_FILE for authentication. This file is readable by root only." + echo "Make note of your password: you will need it to use scsictl and other PiSCSI clients." + echo "If you have PiSCSI clients installed, please re-run the installation scripts, or update the systemd config manually." } -# Enables and starts the rascsi service -function enableRaScsiService() { +# Enables and starts the piscsi service +function enablePiscsiService() { sudo systemctl daemon-reload sudo systemctl restart rsyslog - sudo systemctl enable rascsi # optional - start rascsi at boot - sudo systemctl start rascsi + sudo systemctl enable piscsi # optional - start piscsi at boot + sudo systemctl start piscsi } -# Modifies and installs the rascsi-web service +# Modifies and installs the piscsi-web service function installWebInterfaceService() { if [[ -f "$SECRET_FILE" && -z "$TOKEN" ]] ; then echo "" @@ -348,48 +348,49 @@ function installWebInterfaceService() { read -r TOKEN fi - echo "Installing the rascsi-web.service configuration..." - sudo cp -f "$WEB_INSTALL_PATH/service-infra/rascsi-web.service" "$SYSTEMD_PATH/rascsi-web.service" - sudo sed -i /^ExecStart=/d "$SYSTEMD_PATH/rascsi-web.service" + echo "Installing the piscsi-web.service configuration..." + sudo cp -f "$WEB_INSTALL_PATH/service-infra/piscsi-web.service" "$SYSTEMD_PATH/piscsi-web.service" + sudo sed -i /^ExecStart=/d "$SYSTEMD_PATH/piscsi-web.service" if [ ! -z "$TOKEN" ]; then - sudo sed -i "8 i ExecStart=$WEB_INSTALL_PATH/start.sh --password=$TOKEN" "$SYSTEMD_PATH/rascsi-web.service" + sudo sed -i "8 i ExecStart=$WEB_INSTALL_PATH/start.sh --password=$TOKEN" "$SYSTEMD_PATH/piscsi-web.service" # Make the service file readable by root only, to protect the token string - sudo chmod 600 "$SYSTEMD_PATH/rascsi-web.service" - echo "Granted access to the Web Interface with the token password that you configured for RaSCSI." + sudo chmod 600 "$SYSTEMD_PATH/piscsi-web.service" + echo "Granted access to the Web Interface with the token password that you configured for PiSCSI." else - sudo sed -i "8 i ExecStart=$WEB_INSTALL_PATH/start.sh" "$SYSTEMD_PATH/rascsi-web.service" + sudo sed -i "8 i ExecStart=$WEB_INSTALL_PATH/start.sh" "$SYSTEMD_PATH/piscsi-web.service" fi sudo systemctl daemon-reload - sudo systemctl enable rascsi-web - sudo systemctl start rascsi-web + sudo systemctl enable piscsi-web + sudo systemctl start piscsi-web } -# Stops the rascsi service if it is running -function stopRaScsi() { - if [[ -f "$SYSTEMD_PATH/rascsi.service" ]]; then - SERVICE_RASCSI_RUNNING=0 - sudo systemctl is-active --quiet rascsi.service >/dev/null 2>&1 || SERVICE_RASCSI_RUNNING=$? - if [[ $SERVICE_RASCSI_RUNNING -eq 0 ]]; then - sudo systemctl stop rascsi.service +# Stops the piscsi service if it is running +function stopPiscsi() { + if [[ -f "$SYSTEMD_PATH/piscsi.service" ]]; then + SERVICE_PISCSI_RUNNING=0 + sudo systemctl is-active --quiet piscsi.service >/dev/null 2>&1 || SERVICE_PISCSI_RUNNING=$? + if [[ $SERVICE_PISCSI_RUNNING -eq 0 ]]; then + sudo systemctl stop piscsi.service fi fi } -# Stops the rascsi-web service if it is running -function stopRaScsiWeb() { - if [[ -f "$SYSTEMD_PATH/rascsi-web.service" ]]; then - SERVICE_RASCSI_WEB_RUNNING=0 - sudo systemctl is-active --quiet rascsi-web.service >/dev/null 2>&1 || SERVICE_RASCSI_WEB_RUNNING=$? - if [[ $SERVICE_RASCSI_WEB_RUNNING -eq 0 ]]; then - sudo systemctl stop rascsi-web.service +# Stops the piscsi-web service if it is running +function stopPiscsiWeb() { + if [[ -f "$SYSTEMD_PATH/piscsi-web.service" ]]; then + SERVICE_PISCSI_WEB_RUNNING=0 + sudo systemctl is-active --quiet piscsi-web.service >/dev/null 2>&1 || SERVICE_PISCSI_WEB_RUNNING=$? + if [[ $SERVICE_PISCSI_WEB_RUNNING -eq 0 ]]; then + sudo systemctl stop piscsi-web.service fi fi } -# Stops the rascsi-oled service if it is running -function stopRaScsiScreen() { +# Stops the piscsi-oled service if it is running +function stopPiscsiScreen() { + # monitor_rascsi is a legacy name for this service if [[ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]]; then SERVICE_MONITOR_RASCSI_RUNNING=0 sudo systemctl is-active --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_MONITOR_RASCSI_RUNNING=$? @@ -397,74 +398,74 @@ function stopRaScsiScreen() { sudo systemctl stop monitor_rascsi.service fi fi - if [[ -f "$SYSTEMD_PATH/rascsi-oled.service" ]]; then - SERVICE_RASCSI_OLED_RUNNING=0 - sudo systemctl is-active --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_RUNNING=$? - if [[ $SERVICE_RASCSI_OLED_RUNNING -eq 0 ]]; then - sudo systemctl stop rascsi-oled.service + if [[ -f "$SYSTEMD_PATH/piscsi-oled.service" ]]; then + SERVICE_PISCSI_OLED_RUNNING=0 + sudo systemctl is-active --quiet piscsi-oled.service >/dev/null 2>&1 || SERVICE_PISCSI_OLED_RUNNING=$? + if [[ $SERVICE_PISCSI_OLED_RUNNING -eq 0 ]]; then + sudo systemctl stop piscsi-oled.service fi fi } -# Stops the rascsi-ctrlboard service if it is running -function stopRaScsiCtrlBoard() { - if [[ -f "$SYSTEMD_PATH/rascsi-ctrlboard.service" ]]; then - SERVICE_RASCSI_CTRLBOARD_RUNNING=0 - sudo systemctl is-active --quiet rascsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_RASCSI_CTRLBOARD_RUNNING=$? - if [[ SERVICE_RASCSI_CTRLBOARD_RUNNING -eq 0 ]]; then - sudo systemctl stop rascsi-ctrlboard.service +# Stops the piscsi-ctrlboard service if it is running +function stopPiscsiCtrlBoard() { + if [[ -f "$SYSTEMD_PATH/piscsi-ctrlboard.service" ]]; then + SERVICE_PISCSI_CTRLBOARD_RUNNING=0 + sudo systemctl is-active --quiet piscsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_PISCSI_CTRLBOARD_RUNNING=$? + if [[ SERVICE_PISCSI_CTRLBOARD_RUNNING -eq 0 ]]; then + sudo systemctl stop piscsi-ctrlboard.service fi fi } -# disables and removes the old monitor_rascsi service -function disableOldRaScsiMonitorService() { - if [ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]; then - SERVICE_MONITOR_RASCSI_RUNNING=0 - sudo systemctl is-active --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_MONITOR_RASCSI_RUNNING=$? - if [[ $SERVICE_MONITOR_RASCSI_RUNNING -eq 0 ]]; then - sudo systemctl stop monitor_rascsi.service +# disables and removes the old monitor_piscsi service +function disableOldPiscsiMonitorService() { + if [ -f "$SYSTEMD_PATH/monitor_piscsi.service" ]; then + SERVICE_MONITOR_PISCSI_RUNNING=0 + sudo systemctl is-active --quiet monitor_piscsi.service >/dev/null 2>&1 || SERVICE_MONITOR_PISCSI_RUNNING=$? + if [[ $SERVICE_MONITOR_PISCSI_RUNNING -eq 0 ]]; then + sudo systemctl stop monitor_piscsi.service fi - SERVICE_MONITOR_RASCSI_ENABLED=0 - sudo systemctl is-enabled --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_MONITOR_RASCSI_ENABLED=$? - if [[ $SERVICE_MONITOR_RASCSI_ENABLED -eq 0 ]]; then - sudo systemctl disable monitor_rascsi.service + SERVICE_MONITOR_PISCSI_ENABLED=0 + sudo systemctl is-enabled --quiet monitor_piscsi.service >/dev/null 2>&1 || SERVICE_MONITOR_PISCSI_ENABLED=$? + if [[ $SERVICE_MONITOR_PISCSI_ENABLED -eq 0 ]]; then + sudo systemctl disable monitor_piscsi.service fi - sudo rm $SYSTEMD_PATH/monitor_rascsi.service + sudo rm $SYSTEMD_PATH/monitor_piscsi.service fi } -# disables the rascsi-oled service -function disableRaScsiOledService() { - if [ -f "$SYSTEMD_PATH/rascsi-oled.service" ]; then - SERVICE_RASCSI_OLED_RUNNING=0 - sudo systemctl is-active --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_RUNNING=$? - if [[ $SERVICE_RASCSI_OLED_RUNNING -eq 0 ]]; then - sudo systemctl stop rascsi-oled.service +# disables the piscsi-oled service +function disablePiscsiOledService() { + if [ -f "$SYSTEMD_PATH/piscsi-oled.service" ]; then + SERVICE_PISCSI_OLED_RUNNING=0 + sudo systemctl is-active --quiet piscsi-oled.service >/dev/null 2>&1 || SERVICE_PISCSI_OLED_RUNNING=$? + if [[ $SERVICE_PISCSI_OLED_RUNNING -eq 0 ]]; then + sudo systemctl stop piscsi-oled.service fi - SERVICE_RASCSI_OLED_ENABLED=0 - sudo systemctl is-enabled --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_ENABLED=$? - if [[ $SERVICE_RASCSI_OLED_ENABLED -eq 0 ]]; then - sudo systemctl disable rascsi-oled.service + SERVICE_PISCSI_OLED_ENABLED=0 + sudo systemctl is-enabled --quiet piscsi-oled.service >/dev/null 2>&1 || SERVICE_PISCSI_OLED_ENABLED=$? + if [[ $SERVICE_PISCSI_OLED_ENABLED -eq 0 ]]; then + sudo systemctl disable piscsi-oled.service fi fi } -# disables the rascsi-ctrlboard service -function disableRaScsiCtrlBoardService() { - if [ -f "$SYSTEMD_PATH/rascsi-ctrlboard.service" ]; then - SERVICE_RASCSI_CTRLBOARD_RUNNING=0 - sudo systemctl is-active --quiet rascsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_RASCSI_CTRLBOARD_RUNNING=$? - if [[ $SERVICE_RASCSI_CTRLBOARD_RUNNING -eq 0 ]]; then - sudo systemctl stop rascsi-ctrlboard.service +# disables the piscsi-ctrlboard service +function disablePiscsiCtrlBoardService() { + if [ -f "$SYSTEMD_PATH/piscsi-ctrlboard.service" ]; then + SERVICE_PISCSI_CTRLBOARD_RUNNING=0 + sudo systemctl is-active --quiet piscsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_PISCSI_CTRLBOARD_RUNNING=$? + if [[ $SERVICE_PISCSI_CTRLBOARD_RUNNING -eq 0 ]]; then + sudo systemctl stop piscsi-ctrlboard.service fi - SERVICE_RASCSI_CTRLBOARD_ENABLED=0 - sudo systemctl is-enabled --quiet rascsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_RASCSI_CTRLBOARD_ENABLED=$? - if [[ $SERVICE_RASCSI_CTRLBOARD_ENABLED -eq 0 ]]; then - sudo systemctl disable rascsi-ctrlboard.service + SERVICE_PISCSI_CTRLBOARD_ENABLED=0 + sudo systemctl is-enabled --quiet piscsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_PISCSI_CTRLBOARD_ENABLED=$? + if [[ $SERVICE_PISCSI_CTRLBOARD_ENABLED -eq 0 ]]; then + sudo systemctl disable piscsi-ctrlboard.service fi fi } @@ -476,72 +477,72 @@ function stopMacproxy() { fi } -# Checks whether the rascsi-oled service is installed -function isRaScsiScreenInstalled() { - SERVICE_RASCSI_OLED_ENABLED=0 - if [[ -f "$SYSTEMD_PATH/rascsi-oled.service" ]]; then - sudo systemctl is-enabled --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_ENABLED=$? - elif [[ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]]; then - sudo systemctl is-enabled --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_ENABLED=$? +# Checks whether the piscsi-oled service is installed +function isPiscsiScreenInstalled() { + SERVICE_PISCSI_OLED_ENABLED=0 + if [[ -f "$SYSTEMD_PATH/piscsi-oled.service" ]]; then + sudo systemctl is-enabled --quiet piscsi-oled.service >/dev/null 2>&1 || SERVICE_PISCSI_OLED_ENABLED=$? + elif [[ -f "$SYSTEMD_PATH/monitor_piscsi.service" ]]; then + sudo systemctl is-enabled --quiet monitor_piscsi.service >/dev/null 2>&1 || SERVICE_PISCSI_OLED_ENABLED=$? else - SERVICE_RASCSI_OLED_ENABLED=1 + SERVICE_PISCSI_OLED_ENABLED=1 fi - echo $SERVICE_RASCSI_OLED_ENABLED + echo $SERVICE_PISCSI_OLED_ENABLED } -# Checks whether the rascsi-ctrlboard service is installed -function isRaScsiCtrlBoardInstalled() { - SERVICE_RASCSI_CTRLBOARD_ENABLED=0 - if [[ -f "$SYSTEMD_PATH/rascsi-ctrlboard.service" ]]; then - sudo systemctl is-enabled --quiet rascsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_RASCSI_CTRLBOARD_ENABLED=$? +# Checks whether the piscsi-ctrlboard service is installed +function isPiscsiCtrlBoardInstalled() { + SERVICE_PISCSI_CTRLBOARD_ENABLED=0 + if [[ -f "$SYSTEMD_PATH/piscsi-ctrlboard.service" ]]; then + sudo systemctl is-enabled --quiet piscsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_PISCSI_CTRLBOARD_ENABLED=$? else - SERVICE_RASCSI_CTRLBOARD_ENABLED=1 + SERVICE_PISCSI_CTRLBOARD_ENABLED=1 fi - echo $SERVICE_RASCSI_CTRLBOARD_ENABLED + echo $SERVICE_PISCSI_CTRLBOARD_ENABLED } -# Checks whether the rascsi-oled service is running -function isRaScsiScreenRunning() { - SERVICE_RASCSI_OLED_RUNNING=0 - if [[ -f "$SYSTEMD_PATH/rascsi-oled.service" ]]; then - sudo systemctl is-active --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_RUNNING=$? - elif [[ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]]; then - sudo systemctl is-active --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_RUNNING=$? +# Checks whether the piscsi-oled service is running +function isPiscsiScreenRunning() { + SERVICE_PISCSI_OLED_RUNNING=0 + if [[ -f "$SYSTEMD_PATH/piscsi-oled.service" ]]; then + sudo systemctl is-active --quiet piscsi-oled.service >/dev/null 2>&1 || SERVICE_PISCSI_OLED_RUNNING=$? + elif [[ -f "$SYSTEMD_PATH/monitor_piscsi.service" ]]; then + sudo systemctl is-active --quiet monitor_piscsi.service >/dev/null 2>&1 || SERVICE_PISCSI_OLED_RUNNING=$? else - SERVICE_RASCSI_OLED_RUNNING=1 + SERVICE_PISCSI_OLED_RUNNING=1 fi - echo $SERVICE_RASCSI_OLED_RUNNING + echo $SERVICE_PISCSI_OLED_RUNNING } -# Checks whether the rascsi-oled service is running -function isRaScsiCtrlBoardRunning() { - SERVICE_RASCSI_CTRLBOARD_RUNNING=0 - if [[ -f "$SYSTEMD_PATH/rascsi-ctrlboard.service" ]]; then - sudo systemctl is-active --quiet rascsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_RASCSI_CTRLBOARD_RUNNING=$? +# Checks whether the piscsi-oled service is running +function isPiscsiCtrlBoardRunning() { + SERVICE_PISCSI_CTRLBOARD_RUNNING=0 + if [[ -f "$SYSTEMD_PATH/piscsi-ctrlboard.service" ]]; then + sudo systemctl is-active --quiet piscsi-ctrlboard.service >/dev/null 2>&1 || SERVICE_PISCSI_CTRLBOARD_RUNNING=$? else - SERVICE_RASCSI_CTRLBOARD_RUNNING=1 + SERVICE_PISCSI_CTRLBOARD_RUNNING=1 fi - echo $SERVICE_RASCSI_CTRLBOARD_RUNNING + echo $SERVICE_PISCSI_CTRLBOARD_RUNNING } -# Starts the rascsi-oled service if installed -function startRaScsiScreen() { - if [[ $(isRaScsiScreenInstalled) -eq 0 ]] && [[ $(isRaScsiScreenRunning) -ne 1 ]]; then - sudo systemctl start rascsi-oled.service - showRaScsiScreenStatus +# Starts the piscsi-oled service if installed +function startPiscsiScreen() { + if [[ $(isPiscsiScreenInstalled) -eq 0 ]] && [[ $(isPiscsiScreenRunning) -ne 1 ]]; then + sudo systemctl start piscsi-oled.service + showPiscsiScreenStatus fi } -# Starts the rascsi-ctrlboard service if installed -function startRaScsiCtrlBoard() { - if [[ $(isRaScsiCtrlBoardInstalled) -eq 0 ]] && [[ $(isRaScsiCtrlBoardRunning) -ne 1 ]]; then - sudo systemctl start rascsi-ctrlboard.service - showRaScsiCtrlBoardStatus +# Starts the piscsi-ctrlboard service if installed +function startPiscsiCtrlBoard() { + if [[ $(isPiscsiCtrlBoardInstalled) -eq 0 ]] && [[ $(isPiscsiCtrlBoardRunning) -ne 1 ]]; then + sudo systemctl start piscsi-ctrlboard.service + showPiscsiCtrlBoardStatus fi } @@ -553,24 +554,24 @@ function startMacproxy() { fi } -# Shows status for the rascsi service -function showRaScsiStatus() { - systemctl status rascsi | tee +# Shows status for the piscsi service +function showPiscsiStatus() { + systemctl status piscsi | tee } -# Shows status for the rascsi-web service -function showRaScsiWebStatus() { - systemctl status rascsi-web | tee +# Shows status for the piscsi-web service +function showPiscsiWebStatus() { + systemctl status piscsi-web | tee } -# Shows status for the rascsi-oled service -function showRaScsiScreenStatus() { - systemctl status rascsi-oled | tee +# Shows status for the piscsi-oled service +function showPiscsiScreenStatus() { + systemctl status piscsi-oled | tee } -# Shows status for the rascsi-ctrlboard service -function showRaScsiCtrlBoardStatus() { - systemctl status rascsi-ctrlboard | tee +# Shows status for the piscsi-ctrlboard service +function showPiscsiCtrlBoardStatus() { + systemctl status piscsi-ctrlboard | tee } # Shows status for the macproxy service @@ -666,13 +667,13 @@ function setupWiredNetworking() { echo "Modified /etc/dhcpcd.conf" # default config file is made for eth0, this will set the right net interface - sudo bash -c 'sed s/eth0/'"$LAN_INTERFACE"'/g '"$CPP_PATH"'/os_integration/rascsi_bridge > /etc/network/interfaces.d/rascsi_bridge' - echo "Modified /etc/network/interfaces.d/rascsi_bridge" + sudo bash -c 'sed s/eth0/'"$LAN_INTERFACE"'/g '"$CPP_PATH"'/os_integration/piscsi_bridge > /etc/network/interfaces.d/piscsi_bridge' + echo "Modified /etc/network/interfaces.d/piscsi_bridge" echo "Configuration completed!" - echo "Please make sure you attach a DaynaPORT network adapter to your RaSCSI configuration." + echo "Please make sure you attach a DaynaPORT network adapter to your PiSCSI configuration." echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6):" - echo "rasctl -i 6 -c attach -t scdp -f $LAN_INTERFACE" + echo "scsictl -i 6 -c attach -t scdp -f $LAN_INTERFACE" echo "" if [[ $HEADLESS ]]; then @@ -759,9 +760,9 @@ function setupWirelessNetworking() { echo "Configuration completed!" echo "" - echo "Please make sure you attach a DaynaPORT network adapter to your RaSCSI configuration" + echo "Please make sure you attach a DaynaPORT network adapter to your PiSCSI configuration" echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6):" - echo "rasctl -i 6 -c attach -t scdp -f $WLAN_INTERFACE:$ROUTER_IP/$CIDR" + echo "scsictl -i 6 -c attach -t scdp -f $WLAN_INTERFACE:$ROUTER_IP/$CIDR" echo "" echo "We need to reboot your Pi" echo "Press Enter to reboot or CTRL-C to exit" @@ -837,11 +838,11 @@ function shareImagesWithNetatalk() { sudo systemctl stop afpd echo "Appended to AppleVolumes.default:" - echo "$VIRTUAL_DRIVER_PATH \"RaSCSI Images\"" | sudo tee -a "$APPLEVOLUMES_PATH" + echo "$VIRTUAL_DRIVER_PATH \"PiSCSI Images\"" | sudo tee -a "$APPLEVOLUMES_PATH" sudo systemctl start afpd echo - echo "WARNING: Do not inadvertently move or rename image files that are in use by RaSCSI." + echo "WARNING: Do not inadvertently move or rename image files that are in use by PiSCSI." echo "Doing so may lead to data loss." echo } @@ -948,15 +949,15 @@ function installSamba() { } # updates configuration files and installs packages needed for the OLED screen script -function installRaScsiScreen() { +function installPiscsiScreen() { if [[ -f "$SECRET_FILE" && -z "$TOKEN" ]] ; then echo "" echo "Secret token file $SECRET_FILE detected. You must enter the password, or press Ctrl+C to cancel installation." read -r TOKEN fi - echo "IMPORTANT: This configuration requires a OLED screen to be installed onto your RaSCSI board." - echo "See wiki for more information: https://github.com/akuker/RASCSI/wiki/OLED-Status-Display-(Optional)" + echo "IMPORTANT: This configuration requires a OLED screen to be installed onto your PiSCSI board." + echo "See wiki for more information: https://github.com/akuker/PISCSI/wiki/OLED-Status-Display-(Optional)" echo "" echo "Choose screen rotation:" echo " 1) 0 degrees" @@ -985,9 +986,9 @@ function installRaScsiScreen() { SCREEN_HEIGHT="32" fi - stopRaScsiScreen - disableRaScsiCtrlBoardService - updateRaScsiGit + stopPiscsiScreen + disablePiscsiCtrlBoardService + updatePiscsiGit sudo apt-get update && sudo apt-get install libjpeg-dev libpng-dev libopenjp2-7-dev i2c-tools raspi-config -y Menu: @@ -55,8 +55,8 @@ class CtrlBoardMenuBuilder(MenuBuilder): # pylint: disable=unused-argument def create_scsi_id_list_menu(self, context_object=None): """Method creates the menu displaying the 7 scsi slots""" - devices = self._rascsi_client.list_devices() - reserved_ids = self._rascsi_client.get_reserved_ids() + devices = self._piscsi_client.list_devices() + reserved_ids = self._piscsi_client.get_reserved_ids() devices_by_id = {} for device in devices["device_list"]: @@ -179,7 +179,7 @@ class CtrlBoardMenuBuilder(MenuBuilder): menu = Menu(CtrlBoardMenuBuilder.DEVICEINFO_MENU) menu.add_entry("Return", {"context": self.DEVICEINFO_MENU, "action": self.ACTION_RETURN}) - device_info = self._rascsi_client.list_devices(context_object["scsi_id"]) + device_info = self._piscsi_client.list_devices(context_object["scsi_id"]) if not device_info["device_list"]: return menu @@ -210,6 +210,6 @@ class CtrlBoardMenuBuilder(MenuBuilder): return menu - def get_rascsi_client(self): - """Returns an instance of the rascsi client""" - return self._rascsi_client + def get_piscsi_client(self): + """Returns an instance of the piscsi client""" + return self._piscsi_client diff --git a/python/ctrlboard/src/main.py b/python/ctrlboard/src/main.py index c9ceb333..926bf345 100644 --- a/python/ctrlboard/src/main.py +++ b/python/ctrlboard/src/main.py @@ -1,4 +1,4 @@ -"""Module is the entry point for the RaSCSI Control Board UI""" +"""Module is the entry point for the PiSCSI Control Board UI""" import argparse import sys import logging @@ -12,21 +12,21 @@ from ctrlboard_event_handler.ctrlboard_menu_update_event_handler import ( from ctrlboard_menu_builder import CtrlBoardMenuBuilder from menu.menu_renderer_config import MenuRendererConfig from menu.menu_renderer_luma_oled import MenuRendererLumaOled -from rascsi.exceptions import ( +from piscsi.exceptions import ( EmptySocketChunkException, InvalidProtobufResponse, FailedSocketConnectionException, ) -from rascsi.ractl_cmds import RaCtlCmds -from rascsi.socket_cmds import SocketCmds +from piscsi.piscsi_cmds import PiscsiCmds +from piscsi.socket_cmds import SocketCmds -from rascsi_menu_controller import RascsiMenuController +from piscsi_menu_controller import PiscsiMenuController def parse_config(): - """Parses the command line parameters and configured the RaSCSI Control Board UI accordingly""" + """Parses the command line parameters and configured the PiSCSI Control Board UI accordingly""" config = CtrlboardConfig() - cmdline_args_parser = argparse.ArgumentParser(description="RaSCSI ctrlboard service") + cmdline_args_parser = argparse.ArgumentParser(description="PiSCSI ctrlboard service") cmdline_args_parser.add_argument( "--rotation", type=int, @@ -44,25 +44,25 @@ def parse_config(): help="The pixel height of the screen buffer. Default: 64", ) cmdline_args_parser.add_argument( - "--rascsi-host", + "--piscsi-host", type=str, default="localhost", action="store", - help="RaSCSI host. Default: localhost", + help="PiSCSI host. Default: localhost", ) cmdline_args_parser.add_argument( - "--rascsi-port", + "--piscsi-port", type=int, default=6868, action="store", - help="RaSCSI port. Default: 6868", + help="PiSCSI port. Default: 6868", ) cmdline_args_parser.add_argument( "--password", type=str, default="", action="store", - help="Token password string for authenticating with RaSCSI", + help="Token password string for authenticating with PiSCSI", ) cmdline_args_parser.add_argument( "--loglevel", @@ -93,19 +93,19 @@ def parse_config(): config.TOKEN = args.password config.WIDTH = 128 config.BORDER = 5 - config.RASCSI_HOST = args.rascsi_host - config.RASCSI_PORT = args.rascsi_port + config.PISCSI_HOST = args.piscsi_host + config.PISCSI_PORT = args.piscsi_port config.LOG_LEVEL = args.loglevel config.TRANSITIONS = bool(args.transitions) return config -def check_rascsi_connection(ractl_cmd): - """Checks whether a RaSCSI connection exists by polling the RaSCSI server info. +def check_piscsi_connection(piscsi_cmd): + """Checks whether a PiSCSI connection exists by polling the PiSCSI server info. Returns true if connection works, false if connection fails.""" try: - info = ractl_cmd.get_reserved_ids() + info = piscsi_cmd.get_reserved_ids() return bool(info["status"] is True) except FailedSocketConnectionException: log = logging.getLogger(__name__) @@ -114,40 +114,40 @@ def check_rascsi_connection(ractl_cmd): def main(): - """Main function for the RaSCSI Control Board UI""" + """Main function for the PiSCSI Control Board UI""" config = parse_config() log_format = "%(asctime)s:%(name)s:%(levelname)s - %(message)s" logging.basicConfig(stream=sys.stdout, format=log_format, level=config.LOG_LEVEL) log = logging.getLogger(__name__) - log.debug("RaSCSI ctrlboard service started.") + log.debug("PiSCSI ctrlboard service started.") ctrlboard_hw = CtrlBoardHardware( display_i2c_address=config.DISPLAY_I2C_ADDRESS, pca9554_i2c_address=config.PCA9554_I2C_ADDRESS, ) - # for now, we require the complete rascsi ctrlboard hardware. + # for now, we require the complete piscsi ctrlboard hardware. # Oled only will be supported as well at some later point in time. - if ctrlboard_hw.rascsi_controlboard_detected is False: + if ctrlboard_hw.piscsi_controlboard_detected is False: log.error("Ctrlboard hardware not detected. Stopping service") exit(1) sock_cmd = None - ractl_cmd = None + piscsi_cmd = None try: - sock_cmd = SocketCmds(host=config.RASCSI_HOST, port=config.RASCSI_PORT) - ractl_cmd = RaCtlCmds(sock_cmd=sock_cmd, token=config.TOKEN) + sock_cmd = SocketCmds(host=config.PISCSI_HOST, port=config.PISCSI_PORT) + piscsi_cmd = PiscsiCmds(sock_cmd=sock_cmd, token=config.TOKEN) except EmptySocketChunkException: - log.error("Retrieved empty data from RaSCSI. Stopping service") + log.error("Retrieved empty data from PiSCSI. Stopping service") exit(1) except InvalidProtobufResponse: - log.error("Retrieved unexpected data from RaSCSI. Stopping service") + log.error("Retrieved unexpected data from PiSCSI. Stopping service") exit(1) - if check_rascsi_connection(ractl_cmd) is False: + if check_piscsi_connection(piscsi_cmd) is False: log.error( - "Communication with RaSCSI failed. Please check if password token must be set " + "Communication with PiSCSI failed. Please check if password token must be set " "and whether is set correctly." ) exit(1) @@ -160,8 +160,8 @@ def main(): menu_renderer_config.i2c_address = CtrlBoardHardwareConstants.DISPLAY_I2C_ADDRESS menu_renderer_config.rotation = config.ROTATION - menu_builder = CtrlBoardMenuBuilder(ractl_cmd) - menu_controller = RascsiMenuController( + menu_builder = CtrlBoardMenuBuilder(piscsi_cmd) + menu_controller = PiscsiMenuController( config.MENU_REFRESH_INTERVAL, menu_builder=menu_builder, menu_renderer=MenuRendererLumaOled(menu_renderer_config), @@ -174,7 +174,7 @@ def main(): menu_controller.show_splash_screen("resources/splash_start_64.bmp") menu_update_event_handler = CtrlBoardMenuUpdateEventHandler( - menu_controller, sock_cmd=sock_cmd, ractl_cmd=ractl_cmd + menu_controller, sock_cmd=sock_cmd, piscsi_cmd=piscsi_cmd ) ctrlboard_hw.attach(menu_update_event_handler) menu_controller.set_active_menu(CtrlBoardMenuBuilder.SCSI_ID_MENU) diff --git a/python/ctrlboard/src/menu/cycler.py b/python/ctrlboard/src/menu/cycler.py index c0249a7a..e3144af7 100644 --- a/python/ctrlboard/src/menu/cycler.py +++ b/python/ctrlboard/src/menu/cycler.py @@ -1,7 +1,7 @@ """Module that implements a button cycling functionality""" from abc import abstractmethod from menu.timer import Timer -from rascsi.file_cmds import FileCmds +from piscsi.file_cmds import FileCmds class Cycler: @@ -13,7 +13,7 @@ class Cycler: self, menu_controller, sock_cmd, - ractl_cmd, + piscsi_cmd, cycle_timeout=3, return_string="Return ->", return_entry=True, @@ -22,8 +22,8 @@ class Cycler: self._cycle_profile_timer_flag = Timer(activation_delay=cycle_timeout) self._menu_controller = menu_controller self.sock_cmd = sock_cmd - self.ractl_cmd = ractl_cmd - self.file_cmd = FileCmds(sock_cmd=self.sock_cmd, ractl=self.ractl_cmd) + self.piscsi_cmd = piscsi_cmd + self.file_cmd = FileCmds(sock_cmd=self.sock_cmd, piscsi=self.piscsi_cmd) self.cycle_entries = self.populate_cycle_entries() self.return_string = return_string self.return_entry = return_entry diff --git a/python/ctrlboard/src/rascsi_menu_controller.py b/python/ctrlboard/src/piscsi_menu_controller.py similarity index 89% rename from python/ctrlboard/src/rascsi_menu_controller.py rename to python/ctrlboard/src/piscsi_menu_controller.py index d16e57b2..6e7ae6cf 100644 --- a/python/ctrlboard/src/rascsi_menu_controller.py +++ b/python/ctrlboard/src/piscsi_menu_controller.py @@ -1,4 +1,4 @@ -"""Module implementing the RaSCSI Control Board UI specific menu controller""" +"""Module implementing the PiSCSI Control Board UI specific menu controller""" from ctrlboard_menu_builder import CtrlBoardMenuBuilder from menu.menu_builder import MenuBuilder from menu.menu_controller import MenuController @@ -6,8 +6,8 @@ from menu.menu_renderer import MenuRenderer from menu.timer import Timer -class RascsiMenuController(MenuController): - """Class implementing a RaSCSI Control Board UI specific menu controller""" +class PiscsiMenuController(MenuController): + """Class implementing a PiSCSI Control Board UI specific menu controller""" def __init__( self, diff --git a/python/ctrlboard/start.sh b/python/ctrlboard/start.sh index bf268346..7fcaa472 100755 --- a/python/ctrlboard/start.sh +++ b/python/ctrlboard/start.sh @@ -50,7 +50,7 @@ if [ $ERROR = 1 ] ; then fi if pgrep -f "python3 src/main.py" &> /dev/null; then - echo "Detected active rascsi control board service" + echo "Detected active piscsi control board service" echo "Terminating before launching a new one." sudo pkill -f "python3 src/main.py" fi @@ -79,7 +79,7 @@ fi # Create the venv if it doesn't exist if ! test -e venv; then - echo "Creating python venv for RaSCSI control board service" + echo "Creating python venv for PiSCSI control board service" python3 -m venv venv --system-site-packages echo "Activating venv" source venv/bin/activate @@ -115,7 +115,7 @@ set -e export PYTHONPATH=${PWD}/src:${PWD}/../common/src -echo "Starting RaSCSI control board service..." +echo "Starting PiSCSI control board service..." if [[ ${PI_MODEL} =~ "Raspberry Pi 4" ]] || [[ ${PI_MODEL} =~ "Raspberry Pi 3" ]] || [[ ${PI_MODEL} =~ "Raspberry Pi Zero 2" ]]; then diff --git a/python/loopback_test/test.py b/python/loopback_test/test.py index 3e9e33bb..2e27dd00 100644 --- a/python/loopback_test/test.py +++ b/python/loopback_test/test.py @@ -57,11 +57,11 @@ scsi_io_gpio = 22 scsi_bsy_gpio = 37 scsi_sel_gpio = 13 -# Pin numbers of the direction controllers of the RaSCSI board -rascsi_ind_gpio = 31 -rascsi_tad_gpio = 26 -rascsi_dtd_gpio = 24 -rascsi_none = -1 +# Pin numbers of the direction controllers of the PiSCSI board +piscsi_ind_gpio = 31 +piscsi_tad_gpio = 26 +piscsi_dtd_gpio = 24 +piscsi_none = -1 # Matrix showing all of the SCSI signals, along what signal they're looped back to. # dir_ctrl indicates which direction control pin is associated with that output @@ -69,92 +69,92 @@ gpio_map = [ { "gpio_num": scsi_d0_gpio, "attached_to": scsi_ack_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_d1_gpio, "attached_to": scsi_sel_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_d2_gpio, "attached_to": scsi_atn_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_d3_gpio, "attached_to": scsi_rst_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_d4_gpio, "attached_to": scsi_cd_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_d5_gpio, "attached_to": scsi_io_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_d6_gpio, "attached_to": scsi_msg_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_d7_gpio, "attached_to": scsi_req_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_dp_gpio, "attached_to": scsi_bsy_gpio, - "dir_ctrl": rascsi_dtd_gpio, + "dir_ctrl": piscsi_dtd_gpio, }, { "gpio_num": scsi_atn_gpio, "attached_to": scsi_d2_gpio, - "dir_ctrl": rascsi_ind_gpio, + "dir_ctrl": piscsi_ind_gpio, }, { "gpio_num": scsi_rst_gpio, "attached_to": scsi_d3_gpio, - "dir_ctrl": rascsi_ind_gpio, + "dir_ctrl": piscsi_ind_gpio, }, { "gpio_num": scsi_ack_gpio, "attached_to": scsi_d0_gpio, - "dir_ctrl": rascsi_ind_gpio, + "dir_ctrl": piscsi_ind_gpio, }, { "gpio_num": scsi_req_gpio, "attached_to": scsi_d7_gpio, - "dir_ctrl": rascsi_tad_gpio, + "dir_ctrl": piscsi_tad_gpio, }, { "gpio_num": scsi_msg_gpio, "attached_to": scsi_d6_gpio, - "dir_ctrl": rascsi_tad_gpio, + "dir_ctrl": piscsi_tad_gpio, }, { "gpio_num": scsi_cd_gpio, "attached_to": scsi_d4_gpio, - "dir_ctrl": rascsi_tad_gpio, + "dir_ctrl": piscsi_tad_gpio, }, { "gpio_num": scsi_io_gpio, "attached_to": scsi_d5_gpio, - "dir_ctrl": rascsi_tad_gpio, + "dir_ctrl": piscsi_tad_gpio, }, { "gpio_num": scsi_bsy_gpio, "attached_to": scsi_dp_gpio, - "dir_ctrl": rascsi_tad_gpio, + "dir_ctrl": piscsi_tad_gpio, }, { "gpio_num": scsi_sel_gpio, "attached_to": scsi_d1_gpio, - "dir_ctrl": rascsi_ind_gpio, + "dir_ctrl": piscsi_ind_gpio, }, ] @@ -194,47 +194,47 @@ def print_all(): # Set transceivers IC1 and IC2 to OUTPUT def set_dtd_out(): - gpio.output(rascsi_dtd_gpio, gpio.LOW) + gpio.output(piscsi_dtd_gpio, gpio.LOW) # Set transceivers IC1 and IC2 to INPUT def set_dtd_in(): - gpio.output(rascsi_dtd_gpio, gpio.HIGH) + gpio.output(piscsi_dtd_gpio, gpio.HIGH) # Set transceiver IC4 to OUTPUT def set_ind_out(): - gpio.output(rascsi_ind_gpio, gpio.HIGH) + gpio.output(piscsi_ind_gpio, gpio.HIGH) # Set transceiver IC4 to INPUT def set_ind_in(): - gpio.output(rascsi_ind_gpio, gpio.LOW) + gpio.output(piscsi_ind_gpio, gpio.LOW) # Set transceiver IC3 to OUTPUT def set_tad_out(): - gpio.output(rascsi_tad_gpio, gpio.HIGH) + gpio.output(piscsi_tad_gpio, gpio.HIGH) # Set transceiver IC3 to INPUT def set_tad_in(): - gpio.output(rascsi_tad_gpio, gpio.LOW) + gpio.output(piscsi_tad_gpio, gpio.LOW) # Set the specified transciever to an OUTPUT. All of the other transceivers # will be set to inputs. If a non-existent direction gpio is specified, this # will set all of the transceivers to inputs. def set_output_channel(out_gpio): - if out_gpio == rascsi_tad_gpio: + if out_gpio == piscsi_tad_gpio: set_tad_out() else: set_tad_in() - if out_gpio == rascsi_dtd_gpio: + if out_gpio == piscsi_dtd_gpio: set_dtd_out() else: set_dtd_in() - if out_gpio == rascsi_ind_gpio: + if out_gpio == piscsi_ind_gpio: set_ind_out() else: set_ind_in() @@ -288,7 +288,7 @@ def test_gpio_pin(gpio_rec): ############################################ # set the transceivers to input - set_output_channel(rascsi_none) + set_output_channel(piscsi_none) time.sleep(pin_settle_delay) @@ -357,9 +357,9 @@ def setup(): gpio.setup(cur_gpio["gpio_num"], gpio.OUT, initial=gpio.HIGH) # Setup direction control - gpio.setup(rascsi_ind_gpio, gpio.OUT) - gpio.setup(rascsi_tad_gpio, gpio.OUT) - gpio.setup(rascsi_dtd_gpio, gpio.OUT) + gpio.setup(piscsi_ind_gpio, gpio.OUT) + gpio.setup(piscsi_tad_gpio, gpio.OUT) + gpio.setup(piscsi_dtd_gpio, gpio.OUT) # Main functions for running the actual test. diff --git a/python/oled/README.md b/python/oled/README.md index f1ae8744..987a265e 100644 --- a/python/oled/README.md +++ b/python/oled/README.md @@ -1,4 +1,4 @@ -# RaSCSI OLED Screen +# PiSCSI OLED Screen ## Run as standalone script for development / troubleshooting @@ -9,7 +9,7 @@ $ python3 -m venv venv $ source venv/bin/activate # Install requirements $ pip3 install -r requirements.txt -$ PYTHONPATH=$PWD/src:$(dirname $PWD)/common/src python3 src/rascsi_oled_monitor.py +$ PYTHONPATH=$PWD/src:$(dirname $PWD)/common/src python3 src/piscsi_oled_monitor.py ``` ### Parameters @@ -20,7 +20,7 @@ The script takes two positional parameters: Ex. ``` -$ python3 rascsi_oled_monitor.py --rotation 180 --height 64 +$ python3 piscsi_oled_monitor.py --rotation 180 --height 64 ``` _Note:_ Both parameters must be passed for the script to read them. Ordering is also important. diff --git a/python/oled/service-infra/rascsi-oled.service b/python/oled/service-infra/piscsi-oled.service similarity index 51% rename from python/oled/service-infra/rascsi-oled.service rename to python/oled/service-infra/piscsi-oled.service index 5bd46146..a339e6a2 100644 --- a/python/oled/service-infra/rascsi-oled.service +++ b/python/oled/service-infra/piscsi-oled.service @@ -1,16 +1,16 @@ [Unit] -Description=RaSCSI-OLED service -After=network.target rascsi.service +Description=PiSCSI-OLED Monitor service +After=network.target piscsi.service [Service] Type=simple Restart=always RestartSec=2s -ExecStart=/home/pi/RASCSI/python/oled/start.sh -ExecStop=/bin/pkill --signal 2 -f "python3 src/rascsi_oled_monitor.py" +ExecStart=/home/pi/piscsi/python/oled/start.sh +ExecStop=/bin/pkill --signal 2 -f "python3 src/piscsi_oled_monitor.py" # Sleep 2s as a crude way for the python interrupt handler to take effect and show the shutdown splash ExecStop=/bin/sleep 2 -SyslogIdentifier=RASCSIMON +SyslogIdentifier=PISCSIMON [Install] WantedBy=multi-user.target diff --git a/python/oled/src/rascsi_oled_monitor.py b/python/oled/src/piscsi_oled_monitor.py old mode 100755 new mode 100644 similarity index 92% rename from python/oled/src/rascsi_oled_monitor.py rename to python/oled/src/piscsi_oled_monitor.py index f815d464..99d65e0f --- a/python/oled/src/rascsi_oled_monitor.py +++ b/python/oled/src/piscsi_oled_monitor.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 """ - RaSCSI Updates: - Updates to output rascsi status to an OLED display + PiSCSI Updates: + Updates to output piscsi status to an OLED display Copyright (C) 2020 Tony Kuker Author: Tony Kuker Developed for: @@ -40,11 +40,11 @@ from board import I2C from adafruit_ssd1306 import SSD1306_I2C from PIL import Image, ImageDraw, ImageFont from interrupt_handler import GracefulInterruptHandler -from rascsi.ractl_cmds import RaCtlCmds -from rascsi.socket_cmds import SocketCmds -from rascsi.sys_cmds import SysCmds +from piscsi.piscsi_cmds import PiscsiCmds +from piscsi.socket_cmds import SocketCmds +from piscsi.sys_cmds import SysCmds -parser = argparse.ArgumentParser(description="RaSCSI OLED Monitor script") +parser = argparse.ArgumentParser(description="PiSCSI OLED Monitor script") parser.add_argument( "--rotation", type=int, @@ -107,7 +107,7 @@ elif args.height == 32: TOKEN = args.password sock_cmd = SocketCmds(host=args.host, port=args.port) -ractl_cmd = RaCtlCmds(sock_cmd=sock_cmd, token=TOKEN) +piscsi_cmd = PiscsiCmds(sock_cmd=sock_cmd, token=TOKEN) sys_cmd = SysCmds() WIDTH = 128 @@ -158,8 +158,8 @@ LINE_SPACING = 8 # Some other nice fonts to try: http://www.dafont.com/bitmap.php FONT = ImageFont.truetype("resources/type_writer.ttf", FONT_SIZE) -REMOVABLE_DEVICE_TYPES = ractl_cmd.get_removable_device_types() -PERIPHERAL_DEVICE_TYPES = ractl_cmd.get_peripheral_device_types() +REMOVABLE_DEVICE_TYPES = piscsi_cmd.get_removable_device_types() +PERIPHERAL_DEVICE_TYPES = piscsi_cmd.get_peripheral_device_types() # After how many screen updates the network data should be refreshed NETWORK_REFRESH_TICKS = 10 @@ -182,10 +182,10 @@ def formatted_output(): Formats the strings to be displayed on the Screen Returns a (list) of (str) output """ - device_list = ractl_cmd.list_devices()["device_list"] + device_list = piscsi_cmd.list_devices()["device_list"] output = [] - if not TOKEN and not ractl_cmd.is_token_auth()["status"]: + if not TOKEN and not piscsi_cmd.is_token_auth()["status"]: output += ["Permission denied!"] elif device_list: has_luns = False @@ -204,8 +204,8 @@ def formatted_output(): line += [unidecode(device["file"])] elif device["device_type"] in REMOVABLE_DEVICE_TYPES: line += ["[No Media]"] - # Print only the Vendor/Product info if it's not generic RaSCSI - if device["vendor"] not in "RaSCSI": + # Print only the Vendor/Product info if it's not generic PiSCSI + if device["vendor"] not in "PiSCSI": line += [device["vendor"], device["product"]] output += [" ".join(line)] else: diff --git a/python/oled/start.sh b/python/oled/start.sh index efafe252..9b8b415e 100755 --- a/python/oled/start.sh +++ b/python/oled/start.sh @@ -47,10 +47,10 @@ if [ $ERROR = 1 ] ; then exit 1 fi -if pgrep -f "python3 src/rascsi_oled_monitor.py" &> /dev/null; then - echo "Detected active rascsi_oled_monitor.py process" +if pgrep -f "python3 src/piscsi_oled_monitor.py" &> /dev/null; then + echo "Detected active piscsi_oled_monitor.py process" echo "Terminating before launching a new one." - sudo pkill -f "python3 src/rascsi_oled_monitor.py" + sudo pkill -f "python3 src/piscsi_oled_monitor.py" fi if ! i2cdetect -y 1 &> /dev/null ; then @@ -155,4 +155,4 @@ fi PYTHON_COMMON_PATH=$(dirname $PWD)/common/src export PYTHONPATH=$PWD/src:${PYTHON_COMMON_PATH} -python3 src/rascsi_oled_monitor.py ${ROTATION} ${HEIGHT} ${INTERVAL} ${PASSWORD} +python3 src/piscsi_oled_monitor.py ${ROTATION} ${HEIGHT} ${INTERVAL} ${PASSWORD} diff --git a/python/web/README.md b/python/web/README.md index 6487bf9c..55f1404e 100644 --- a/python/web/README.md +++ b/python/web/README.md @@ -1,4 +1,4 @@ -# RaSCSI Web +# PiSCSI Web ## Setup local dev env @@ -18,16 +18,16 @@ $ BASE_DIR=/tmp/images/ PATH=$PATH:`pwd`/mock/bin/ cd python/web && PYTHON_COMMO ### Mocks for local development You may edit the files under `mock/bin` to simulate Linux command responses. -TODO: rascsi-web uses protobuf commands to send and receive data from rascsi. +TODO: piscsi-web uses protobuf commands to send and receive data from piscsi. A separate mocking solution will be needed for this interface. ## (Optional) Pushing to the Pi via git This is a setup for pushing code changes from your local development environment to the Raspberry Pi without a roundtrip to the remote GitHub repository. -Setup a bare repo on the rascsi +Setup a bare repo on the piscsi ``` -$ ssh pi@rascsi +$ ssh pi@piscsi $ mkdir /home/pi/dev.git && cd /home/pi/dev.git $ git --bare init Initialized empty Git repository in /home/pi/dev.git @@ -35,8 +35,8 @@ Initialized empty Git repository in /home/pi/dev.git Locally ``` -$ cd ~/source/RASCSI -$ git remote add pi ssh://pi@rascsi/home/pi/dev.git +$ cd ~/source/PISCSI +$ git remote add pi ssh://pi@piscsi/home/pi/dev.git $ git push pi master ``` @@ -54,8 +54,8 @@ $ pybabel --help ``` To create a new localization, it needs to be added to the LANGAUGES constant in -web/settings.py. To localize messages coming from the RaSCSI backend, update also code in -raspberrypi/localizer.cpp in the RaSCSI C++ code. +web/settings.py. To localize messages coming from the PiSCSI backend, update also code in +raspberrypi/localizer.cpp in the PiSCSI C++ code. Once this is done, it is time to localize the Python code. The below steps are derived from the [Flask-Babel documentation](https://python-babel.github.io/flask-babel/index.html#translating-applications). @@ -118,7 +118,7 @@ msgstr "" ### Contributing to the project -New or updated localizations are treated just like any other code change. See the [project README](https://github.com/akuker/RASCSI/tree/rdmark-readme-contributions#how-do-i-contribute) for further information. +New or updated localizations are treated just like any other code change. See the [project README](https://github.com/PiSCSI/piscsi/tree/master#how-do-i-contribute) for further information. ### (Optional) See translation stats for a localization Install the gettext package and use msgfmt to see the translation progress. diff --git a/python/web/mock/bin/brctl b/python/web/mock/bin/brctl index 176fe42d..e9a76095 100755 --- a/python/web/mock/bin/brctl +++ b/python/web/mock/bin/brctl @@ -1,9 +1,9 @@ #!/usr/bin/env bash -# Mock responses to rascsi-web +# Mock responses to piscsi-web case $1 in "show") - echo "rascsi_bridge 8000.dca632b05dd1 no eth0" + echo "piscsi_bridge 8000.dca632b05dd1 no eth0" ;; **) diff --git a/python/web/mock/bin/journalctl b/python/web/mock/bin/journalctl index 69e33536..0011b93b 100755 --- a/python/web/mock/bin/journalctl +++ b/python/web/mock/bin/journalctl @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Mock responses to rascsi-web +# Mock responses to piscsi-web case $1 in -n) echo "logs $*" diff --git a/python/web/mock/bin/systemctl b/python/web/mock/bin/systemctl index 9cdfa631..a58c67dc 100755 --- a/python/web/mock/bin/systemctl +++ b/python/web/mock/bin/systemctl @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Mock responses to rascsi-web +# Mock responses to piscsi-web case $1 in is-active) echo "is-active" diff --git a/python/web/service-infra/502.html b/python/web/service-infra/502.html index 2d131214..5cbc8d0a 100644 --- a/python/web/service-infra/502.html +++ b/python/web/service-infra/502.html @@ -1,15 +1,15 @@ - RaSCSI-Web is Starting + PiSCSI Web UI is Starting
-

RaSCSI-Web is Starting....

+

PiSCSI Web UI is Starting....

This page will automatically refresh.

First boot and upgrades can take a second while resolving dependencies.

-

If you're seeing this page for over a minute please check the logs at sudo journalctl -f

+

If you're seeing this page for over a minute, please check the logs at sudo journalctl -f

diff --git a/python/web/service-infra/nginx-default.conf b/python/web/service-infra/nginx-default.conf index 2e3c62f1..575bca56 100644 --- a/python/web/service-infra/nginx-default.conf +++ b/python/web/service-infra/nginx-default.conf @@ -1,13 +1,13 @@ # /etc/nginx/sites-available/default -# Simple proxy_pass for RaSCSI-web +# Simple proxy_pass for PiSCSI-web server { listen [::]:80 default_server; listen 80 default_server; listen 443 ssl http2; listen [::]:443 ssl http2; - ssl_certificate /etc/ssl/certs/rascsi-web.crt; - ssl_certificate_key /etc/ssl/private/rascsi-web.key; + ssl_certificate /etc/ssl/certs/piscsi-web.crt; + ssl_certificate_key /etc/ssl/private/piscsi-web.key; ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; ssl_session_tickets off; diff --git a/python/web/service-infra/rascsi-web.service b/python/web/service-infra/piscsi-web.service similarity index 50% rename from python/web/service-infra/rascsi-web.service rename to python/web/service-infra/piscsi-web.service index 0b681a60..cf7c8b85 100644 --- a/python/web/service-infra/rascsi-web.service +++ b/python/web/service-infra/piscsi-web.service @@ -1,12 +1,12 @@ [Unit] -Description=RaSCSI-Web service +Description=PiSCSI-Web service After=network.target [Service] Type=simple Restart=always -ExecStart=/home/pi/RASCSI/python/web/start.sh -SyslogIdentifier=RASCSIWEB +ExecStart=/home/pi/piscsi/python/web/start.sh +SyslogIdentifier=PISCSIWEB [Install] WantedBy=multi-user.target diff --git a/python/web/src/drive_properties.json b/python/web/src/drive_properties.json index 34e6399b..22c51a17 100644 --- a/python/web/src/drive_properties.json +++ b/python/web/src/drive_properties.json @@ -357,7 +357,7 @@ "name": "Iomega Floptical 1.44MB", "file_type": "hdr", "description": "Iomega Floptical 1.44MB SCSI drive", - "url": "https://github.com/akuker/RASCSI/wiki/Iomega-Floptical" + "url": "https://github.com/PiSCSI/piscsi/wiki/Iomega-Floptical" }, { "device_type": "SCRM", diff --git a/python/web/src/pwa/manifest.json b/python/web/src/pwa/manifest.json index 15c5ce09..6846c19c 100644 --- a/python/web/src/pwa/manifest.json +++ b/python/web/src/pwa/manifest.json @@ -1,5 +1,5 @@ { - "name": "RaSCSI", + "name": "PiSCSI", "icons": [ { "src": "\/pwa\/android-icon-36x36.png", diff --git a/python/web/src/return_code_mapper.py b/python/web/src/return_code_mapper.py index f5572ca5..6ff3ba15 100644 --- a/python/web/src/return_code_mapper.py +++ b/python/web/src/return_code_mapper.py @@ -1,6 +1,6 @@ """Module for mapping between return codes and translated strings""" -from rascsi.return_codes import ReturnCodes +from piscsi.return_codes import ReturnCodes from flask_babel import _, lazy_gettext diff --git a/python/web/src/settings.py b/python/web/src/settings.py index e0d033e4..474ec102 100644 --- a/python/web/src/settings.py +++ b/python/web/src/settings.py @@ -3,7 +3,7 @@ Constant definitions used by other modules """ from os import getenv, getcwd -import rascsi.common_settings +import piscsi.common_settings WEB_DIR = getcwd() HOME_DIR = "/".join(WEB_DIR.split("/")[0:3]) @@ -12,15 +12,15 @@ FILE_SERVER_DIR = f"{HOME_DIR}/shared_files" MAX_FILE_SIZE = getenv("MAX_FILE_SIZE", str(1024 * 1024 * 1024 * 4)) # 4gb -# The file name of the default config file that loads when rascsi-web starts -DEFAULT_CONFIG = f"default.{rascsi.common_settings.CONFIG_FILE_SUFFIX}" +# The file name of the default config file that loads when piscsi-web starts +DEFAULT_CONFIG = f"default.{piscsi.common_settings.CONFIG_FILE_SUFFIX}" # File containing canonical drive properties DRIVE_PROPERTIES_FILE = WEB_DIR + "/drive_properties.json" # The user group that is used for webapp authentication -AUTH_GROUP = "rascsi" +AUTH_GROUP = "piscsi" -# The language locales supported by RaSCSI +# The language locales supported by PiSCSI LANGUAGES = ["en", "de", "sv", "fr", "es"] # Available themes diff --git a/python/web/src/socket_cmds_flask.py b/python/web/src/socket_cmds_flask.py index 4e7e098d..1bdf5db7 100644 --- a/python/web/src/socket_cmds_flask.py +++ b/python/web/src/socket_cmds_flask.py @@ -1,21 +1,21 @@ """ -Module for sending and receiving data over a socket connection with the RaSCSI backend +Module for sending and receiving data over a socket connection with the PiSCSI backend """ from flask import abort from flask_babel import _ -from rascsi.exceptions import ( +from piscsi.exceptions import ( EmptySocketChunkException, InvalidProtobufResponse, FailedSocketConnectionException, ) -from rascsi.socket_cmds import SocketCmds +from piscsi.socket_cmds import SocketCmds class SocketCmdsFlask(SocketCmds): """ - Class for sending and receiving data over a socket connection with the RaSCSI backend + Class for sending and receiving data over a socket connection with the PiSCSI backend """ # pylint: disable=useless-super-delegation @@ -25,7 +25,7 @@ class SocketCmdsFlask(SocketCmds): def send_pb_command(self, payload): """ Takes a (str) containing a serialized protobuf as argument. - Establishes a socket connection with RaSCSI. + Establishes a socket connection with PiSCSI. """ try: return super().send_pb_command(payload) @@ -34,8 +34,8 @@ class SocketCmdsFlask(SocketCmds): abort( 404, _( - "The RaSCSI Web Interface failed to connect to RaSCSI at " - "%(host)s:%(port)s with error: %(error_msg)s. The RaSCSI " + "The PiSCSI Web Interface failed to connect to PiSCSI at " + "%(host)s:%(port)s with error: %(error_msg)s. The PiSCSI " "process is not running or may have crashed.", host=self.host, port=self.port, @@ -52,7 +52,7 @@ class SocketCmdsFlask(SocketCmds): abort( 503, _( - "The RaSCSI Web Interface lost connection to RaSCSI. " + "The PiSCSI Web Interface lost connection to PiSCSI. " "Please go back and try again. " "If the issue persists, please report a bug." ), @@ -62,7 +62,7 @@ class SocketCmdsFlask(SocketCmds): abort( 500, _( - "The RaSCSI Web Interface did not get a valid response from RaSCSI. " + "The PiSCSI Web Interface did not get a valid response from PiSCSI. " "Please go back and try again. " "If the issue persists, please report a bug." ), diff --git a/python/web/src/static/themes/modern/style.css b/python/web/src/static/themes/modern/style.css index 301463c3..5e269791 100644 --- a/python/web/src/static/themes/modern/style.css +++ b/python/web/src/static/themes/modern/style.css @@ -525,7 +525,7 @@ section > details ul { /* ------------------------------------------------------------------------------ - Index > Section: Current RaSCSI configuration + Index > Section: Current PiSCSI configuration ------------------------------------------------------------------------------ */ body:not(.logged-in) section:not(#current-config, #manual) { diff --git a/python/web/src/templates/base.html b/python/web/src/templates/base.html index 3a31c9ef..354363a5 100644 --- a/python/web/src/templates/base.html +++ b/python/web/src/templates/base.html @@ -1,7 +1,7 @@ - {{ _("RaSCSI Reloaded Control Page") }} [{{ env["host"] }}] + {{ _("PiSCSI Control Page") }} [{{ env["host"] }}] @@ -66,13 +66,13 @@ {% endif %} {% else %} {% endif %} @@ -125,7 +125,7 @@ {% endif %}
- {{ _("RaSCSI Reloaded version:") }} {{ env["version"] }} {{ env["running_env"]["git"][:7] }} + {{ _("PiSCSI version:") }} {{ env["version"] }} {{ env["running_env"]["git"][:7] }}
{{ _("Hardware and OS:") }} {{ env["running_env"]["env"] }} diff --git a/python/web/src/templates/drives.html b/python/web/src/templates/drives.html index f8c6ebe8..500baacb 100644 --- a/python/web/src/templates/drives.html +++ b/python/web/src/templates/drives.html @@ -2,7 +2,7 @@ {% block content %}

{{ _("Disclaimer") }}

-

{{ _("These device profiles are provided as-is with no guarantee to work equally to the actual physical device they are named after. You may need to provide appropirate device drivers and/or configuration parameters for them to function properly. If you would like to see data modified, or have additional devices to add to the list, please raise an issue ticket at GitHub.", url="https://github.com/akuker/RASCSI/issues") }}

+

{{ _("These device profiles are provided as-is with no guarantee to work equally to the actual physical device they are named after. You may need to provide appropirate device drivers and/or configuration parameters for them to function properly. If you would like to see data modified, or have additional devices to add to the list, please raise an issue ticket at GitHub.", url="https://github.com/PiSCSI/piscsi/issues") }}

{{ _("Hard Disk Drives") }}

diff --git a/python/web/src/templates/index.html b/python/web/src/templates/index.html index f8675d18..57b07ade 100644 --- a/python/web/src/templates/index.html +++ b/python/web/src/templates/index.html @@ -4,11 +4,11 @@
- {{ _("Current RaSCSI Configuration") }} + {{ _("Current PiSCSI Configuration") }}
  • {{ _("Save and load device configurations, stored as json files in %(config_dir)s", config_dir=CFG_DIR) }}
  • -
  • {{ _("To have a particular device configuration load when RaSCSI starts, save it as default.") }}
  • +
  • {{ _("To have a particular device configuration load when PiSCSI starts, save it as default.") }}
@@ -112,11 +112,11 @@ {% endif %}
@@ -180,7 +180,7 @@ {{ _("Image File Management") }}
    -
  • {{ _("Manage image files in the active RaSCSI image directory: %(directory)s with a scan depth of %(scan_depth)s.", directory=env["image_dir"], scan_depth=scan_depth) }}
  • +
  • {{ _("Manage image files in the active PiSCSI image directory: %(directory)s with a scan depth of %(scan_depth)s.", directory=env["image_dir"], scan_depth=scan_depth) }}
  • {{ _("Select a valid SCSI ID and LUN to attach to. Unless you know what you're doing, always use LUN 0.", url="https://en.wikipedia.org/wiki/Logical_unit_number") }}
  • @@ -361,13 +361,13 @@
      {% if bridge_configured %} -
    • {{ _("The rascsi_bridge network bridge is active and ready to be used by an emulated network adapter!") }}
    • +
    • {{ _("The piscsi_bridge network bridge is active and ready to be used by an emulated network adapter!") }}
    • {% else %} -
    • {{ _("Please configure the rascsi_bridge network bridge before attaching an emulated network adapter!") }}
    • +
    • {{ _("Please configure the piscsi_bridge network bridge before attaching an emulated network adapter!") }}
    • {% endif %} -
    • {{ _("To browse the modern web, install a vintage web proxy such as Macproxy.", url="https://github.com/akuker/RASCSI/wiki/Vintage-Web-Proxy#macproxy") }}
    • +
    • {{ _("To browse the modern web, install a vintage web proxy such as Macproxy.", url="https://github.com/PiSCSI/piscsi/wiki/Vintage-Web-Proxy#macproxy") }}
    • -
    • {{ _("Read more about supported device types on the wiki.", url="https://github.com/akuker/RASCSI/wiki/Supported-Device-Types") }} +
    • {{ _("Read more about supported device types on the wiki.", url="https://github.com/PiSCSI/piscsi/wiki/Supported-Device-Types") }}
    @@ -587,7 +587,7 @@ {{ _("Create Empty Disk Image File") }}
      -
    • {{ _("Please refer to wiki documentation to learn more about the supported image file types.", url="https://github.com/akuker/RASCSI/wiki/Supported-Device-Types#image-types") }}
    • +
    • {{ _("Please refer to wiki documentation to learn more about the supported image file types.", url="https://github.com/PiSCSI/piscsi/wiki/Supported-Device-Types#image-types") }}
    • {{ _("It is not recommended to use the Lido hard disk driver with the Macintosh Plus.") }}
    @@ -661,17 +661,17 @@ - - - - @@ -759,7 +759,7 @@
    -

    {{ _("Read the RaSCSI Manual") }}

    +

    {{ _("Read the PiSCSI Manual") }}

    {% endblock content %} diff --git a/python/web/src/translations/de/LC_MESSAGES/messages.po b/python/web/src/translations/de/LC_MESSAGES/messages.po index e3a34dec..83f1cf20 100644 --- a/python/web/src/translations/de/LC_MESSAGES/messages.po +++ b/python/web/src/translations/de/LC_MESSAGES/messages.po @@ -1,12 +1,12 @@ -# German translations for RaSCSI. +# German translations for PiSCSI. # Copyright (C) 2021 akuker -# This file is distributed under the same license as the RaSCSI project. +# This file is distributed under the same license as the PiSCSI project. # Christian Victor , 2021. # msgid "" msgstr "" -"Project-Id-Version: RaSCSI 68kmla Edition\n" -"Report-Msgid-Bugs-To: https://github.com/akuker/RASCSI/issues\n" +"Project-Id-Version: PiSCSI 68kmla Edition\n" +"Report-Msgid-Bugs-To: https://github.com/akuker/PISCSI/issues\n" "POT-Creation-Date: 2022-05-06 18:47+0200\n" "PO-Revision-Date: 2022-05-06 20:22+0200\n" "Last-Translator: Christian Victor \n" @@ -104,36 +104,36 @@ msgstr "" #: src/socket_cmds_flask.py:34 #, python-format msgid "" -"The RaSCSI Web Interface failed to connect to RaSCSI at %(host)s:%(port)s with " -"error: %(error_msg)s. The RaSCSI process is not running or may have crashed." +"The PiSCSI Web Interface failed to connect to PiSCSI at %(host)s:%(port)s with " +"error: %(error_msg)s. The PiSCSI process is not running or may have crashed." msgstr "" -"Das RaSCSI-Webinterface konnte sich mit Fehler %(error_msg)s nicht mit RaSCSI " -"an %(host)s:%(port)s verbinden. Der RaSCSI-Prozess läuft nicht oder könnte " +"Das PiSCSI-Webinterface konnte sich mit Fehler %(error_msg)s nicht mit PiSCSI " +"an %(host)s:%(port)s verbinden. Der PiSCSI-Prozess läuft nicht oder könnte " "abgestürzt sein." #: src/socket_cmds_flask.py:45 msgid "" -"The RaSCSI Web Interface lost connection to RaSCSI. Please go back and try " +"The PiSCSI Web Interface lost connection to PiSCSI. Please go back and try " "again. If the issue persists, please report a bug." msgstr "" -"Das RaSCSI-Webinterface hat die Verbindung verloren. Bitte gehe zurück und " +"Das PiSCSI-Webinterface hat die Verbindung verloren. Bitte gehe zurück und " "versuche es nochmals. Wenn das Problem bestehen bleibt, melde bitte einen Bug." #: src/socket_cmds_flask.py:54 msgid "" -"The RaSCSI Web Interface did not get a valid response from RaSCSI. Please go " +"The PiSCSI Web Interface did not get a valid response from PiSCSI. Please go " "back and try again. If the issue persists, please report a bug." msgstr "" -"Das RaSCSI-Webinterface hat keine gültige Antwort von RaSCSI bekommen. Bitte " +"Das PiSCSI-Webinterface hat keine gültige Antwort von PiSCSI bekommen. Bitte " "gehe zurück und versuche es nochmals. Wenn das Problem bestehen bleibt, melde " "bitte einen Bug." #: src/web.py:105 msgid "" -"RaSCSI is password protected. Start the Web Interface with the --password " +"PiSCSI is password protected. Start the Web Interface with the --password " "parameter." msgstr "" -"RaSCSI ist passwortgeschützt. Starte das Webinterface mit dem —password " +"PiSCSI ist passwortgeschützt. Starte das Webinterface mit dem —password " "Parameter." #: src/web.py:209 @@ -184,11 +184,11 @@ msgstr "" #, python-format msgid "" "The image file size %(file_size)s bytes is not a multiple of %(block_size)s. " -"RaSCSI will ignore the trailing data. The image may be corrupted, so proceed " +"PiSCSI will ignore the trailing data. The image may be corrupted, so proceed " "with caution." msgstr "" "Die Imagedateigröße %(file_size)s Bytes ist kein Vielfaches von %(block_size)s. " -"RaSCSI wird die hinten überstehenden Daten ignorieren. Das Image könnte " +"PiSCSI wird die hinten überstehenden Daten ignorieren. Das Image könnte " "beschädigt werden. Verfahre bitte mit Vorsicht." #: src/web.py:576 @@ -434,8 +434,8 @@ msgid "File upload successful!" msgstr "Dateiupload erfolgreich!" #: src/templates/base.html:4 src/templates/base.html:67 -msgid "RaSCSI Control Page" -msgstr "RaSCSI Kontrollseite" +msgid "PiSCSI Control Page" +msgstr "PiSCSI Kontrollseite" #: src/templates/base.html:29 msgid "" @@ -484,8 +484,8 @@ msgid "See Wiki for more information" msgstr "Siehe Wiki für mehr Informationen" #: src/templates/base.html:92 -msgid "RaSCSI version: " -msgstr "RaSCSI-Version: " +msgid "PiSCSI version: " +msgstr "PiSCSI-Version: " #: src/templates/base.html:93 msgid "Pi environment: " @@ -585,8 +585,8 @@ msgid "%(disk_space)s MB disk space remaining on the Pi" msgstr "%(disk_space)s MB Festplattenplatz auf dem Pi übrig" #: src/templates/index.html:6 -msgid "Current RaSCSI Configuration" -msgstr "Aktuelle RaSCSI-Konfiguration" +msgid "Current PiSCSI Configuration" +msgstr "Aktuelle PiSCSI-Konfiguration" #: src/templates/index.html:9 msgid "Displays the currently attached devices for each available SCSI ID." @@ -603,10 +603,10 @@ msgstr "" #: src/templates/index.html:11 msgid "" -"To have a particular device configuration load when RaSCSI starts, save it as " +"To have a particular device configuration load when PiSCSI starts, save it as " "default." msgstr "" -"Um eine bestimmte Gerätekonfiguration zu laden wenn RaSCSI startet, speichere " +"Um eine bestimmte Gerätekonfiguration zu laden wenn PiSCSI startet, speichere " "sie als default." #: src/templates/index.html:25 @@ -718,10 +718,10 @@ msgstr "Image-Dateiverwaltung" #: src/templates/index.html:155 #, python-format msgid "" -"Manage image files in the active RaSCSI image directory: %(directory)s " +"Manage image files in the active PiSCSI image directory: %(directory)s " "with a scan depth of %(scan_depth)s." msgstr "" -"Verwalte Imagedateien im aktiven RaSCSI Imageverzeichnis %(directory)s " +"Verwalte Imagedateien im aktiven PiSCSI Imageverzeichnis %(directory)s " "mit einer Scantiefe von %(scan_depth)s." #: src/templates/index.html:156 @@ -735,10 +735,10 @@ msgstr "" #: src/templates/index.html:158 msgid "" -"If RaSCSI was unable to detect the media type associated with the image, you " +"If PiSCSI was unable to detect the media type associated with the image, you " "get to choose the type from the dropdown." msgstr "" -"Wenn RaSCSI den zugehörigen Medientyp des Images nicht erkennen konnte, kannst " +"Wenn PiSCSI den zugehörigen Medientyp des Images nicht erkennen konnte, kannst " "Du ihn im Dropdown auswählen." #: src/templates/index.html:166 @@ -828,10 +828,10 @@ msgstr "" #: src/templates/index.html:310 msgid "" -"The rascsi_bridge network bridge is active and ready to be used by an " +"The piscsi_bridge network bridge is active and ready to be used by an " "emulated network adapter!" msgstr "" -"Die rascsi_bridge-Netzwerk-Bridge ist aktiv und bereit vom emulierten " +"Die piscsi_bridge-Netzwerk-Bridge ist aktiv und bereit vom emulierten " "Netzwerkadapter verwendet zu werden!" #: src/templates/index.html:314 @@ -1090,11 +1090,11 @@ msgstr "" #: src/templates/index.html:540 msgid "" -"APPLE GENUINE (.hda) and NEC GENUINE (.hdn) image types will make RaSCSI behave " +"APPLE GENUINE (.hda) and NEC GENUINE (.hdn) image types will make PiSCSI behave " "as a particular drive type that are recognized by Mac and PC98 systems, " "respectively." msgstr "" -"APPLE GENUINE (.hda) und NEC GENUINE (.hdn) Imagetypen lassen RaSCSI sich wie " +"APPLE GENUINE (.hda) und NEC GENUINE (.hdn) Imagetypen lassen PiSCSI sich wie " "ein bestimmter Laufwerkstyp, der von jeweils Mac und PC98-Systemen erkannt " "wird, verhalten." @@ -1151,10 +1151,10 @@ msgstr "" #: src/templates/index.html:584 msgid "" -"This will make RaSCSI use certain vendor strings and block sizes that may " +"This will make PiSCSI use certain vendor strings and block sizes that may " "improve compatibility with certain systems." msgstr "" -"Dies bewirkt daß RaSCSI bestimmte Vendor-Strings und Blockgrößen verwendet die " +"Dies bewirkt daß PiSCSI bestimmte Vendor-Strings und Blockgrößen verwendet die " "die Kompatibilität mit bestimmten Systemen verbessern könnten." #: src/templates/index.html:587 @@ -1191,8 +1191,8 @@ msgid "Server Log Level" msgstr "Server Log Level" #: src/templates/index.html:636 -msgid "Change the log level of the RaSCSI backend process." -msgstr "Ändere den Log-Level des RaSCSI Hintergrundprozesses." +msgid "Change the log level of the PiSCSI backend process." +msgstr "Ändere den Log-Level des PiSCSI Hintergrundprozesses." #: src/templates/index.html:637 msgid "The current dropdown selection indicates the active log level." @@ -1227,8 +1227,8 @@ msgid "Raspberry Pi Operations" msgstr "Raspberry Pi Operationen" #: src/templates/index.html:693 -msgid "Reboot or shut down the Raspberry Pi that RaSCSI is running on." -msgstr "Den Raspberry Pi auf dem RaSCSI läuft neustarten oder herunterfahren." +msgid "Reboot or shut down the Raspberry Pi that PiSCSI is running on." +msgstr "Den Raspberry Pi auf dem PiSCSI läuft neustarten oder herunterfahren." #: src/templates/index.html:694 msgid "" diff --git a/python/web/src/translations/es/LC_MESSAGES/messages.po b/python/web/src/translations/es/LC_MESSAGES/messages.po index d2dc5d04..8c7d449b 100644 --- a/python/web/src/translations/es/LC_MESSAGES/messages.po +++ b/python/web/src/translations/es/LC_MESSAGES/messages.po @@ -1,13 +1,13 @@ -# Spanish translations for RaSCSI. +# Spanish translations for PiSCSI. # Copyright (C) 2022 akuker -# This file is distributed under the same license as the RaSCSI 68kmla +# This file is distributed under the same license as the PiSCSI 68kmla # project. # Nemanja Lukic , 2022. # msgid "" msgstr "" -"Project-Id-Version: RaSCSI 68kmla Edition\n" -"Report-Msgid-Bugs-To: https://github.com/akuker/RASCSI/issues\n" +"Project-Id-Version: PiSCSI 68kmla Edition\n" +"Report-Msgid-Bugs-To: https://github.com/akuker/PISCSI/issues\n" "POT-Creation-Date: 2022-10-09 17:19+0200\n" "PO-Revision-Date: 2022-10-10 08:38+0200\n" "Last-Translator: n4al \n" @@ -113,35 +113,35 @@ msgstr "No se puede extraer el archivo: %(error)s" #: src/socket_cmds_flask.py:34 #, python-format msgid "" -"The RaSCSI Web Interface failed to connect to RaSCSI at %(host)s:%(port)s with " -"error: %(error_msg)s. The RaSCSI process is not running or may have crashed." +"The PiSCSI Web Interface failed to connect to PiSCSI at %(host)s:%(port)s with " +"error: %(error_msg)s. The PiSCSI process is not running or may have crashed." msgstr "" -"La interfaz web de RaSCSI no pudo conectarse a RaSCSI en %(host)s:%(port)s con " -"el error: %(error_msg)s. El proceso RaSCSI no se está ejecutando o puede haber " +"La interfaz web de PiSCSI no pudo conectarse a PiSCSI en %(host)s:%(port)s con " +"el error: %(error_msg)s. El proceso PiSCSI no se está ejecutando o puede haber " "fallado." #: src/socket_cmds_flask.py:45 msgid "" -"The RaSCSI Web Interface lost connection to RaSCSI. Please go back and try " +"The PiSCSI Web Interface lost connection to PiSCSI. Please go back and try " "again. If the issue persists, please report a bug." msgstr "" -"La interfaz web de RaSCSI ha perdido la conexión con RaSCSI. Por favor, vuelva " +"La interfaz web de PiSCSI ha perdido la conexión con PiSCSI. Por favor, vuelva " "a intentarlo. Si el problema persiste, informe de un error." #: src/socket_cmds_flask.py:54 msgid "" -"The RaSCSI Web Interface did not get a valid response from RaSCSI. Please go " +"The PiSCSI Web Interface did not get a valid response from PiSCSI. Please go " "back and try again. If the issue persists, please report a bug." msgstr "" -"La interfaz web de RaSCSI no ha obtenido una respuesta válida de RaSCSI. Por " +"La interfaz web de PiSCSI no ha obtenido una respuesta válida de PiSCSI. Por " "favor, vuelva a intentarlo. Si el problema persiste, informe de un error." #: src/web.py:182 msgid "" -"RaSCSI is password protected. Start the Web Interface with the --password " +"PiSCSI is password protected. Start the Web Interface with the --password " "parameter." msgstr "" -"RaSCSI está protegido por contraseña. Inicie la Interfaz Web con el parámetro —" +"PiSCSI está protegido por contraseña. Inicie la Interfaz Web con el parámetro —" "password." #: src/web.py:318 @@ -162,8 +162,8 @@ msgstr "Se ha producido un error al obtener la información del disco: %(error)s #: src/web.py:493 #, python-format -msgid "%(app)s is not a recognized RaSCSI app" -msgstr "%(app)s no es una aplicación RaSCSI reconocida" +msgid "%(app)s is not a recognized PiSCSI app" +msgstr "%(app)s no es una aplicación PiSCSI reconocida" #: src/web.py:527 #, python-format @@ -211,11 +211,11 @@ msgstr "" #, python-format msgid "" "The image file size %(file_size)s bytes is not a multiple of %(block_size)s. " -"RaSCSI will ignore the trailing data. The image may be corrupted, so proceed " +"PiSCSI will ignore the trailing data. The image may be corrupted, so proceed " "with caution." msgstr "" "El tamaño del archivo de imagen %(file_size)s bytes no es un múltiplo de " -"%(block_size)s. RaSCSI ignorará los datos finales. La imagen puede estar " +"%(block_size)s. PiSCSI ignorará los datos finales. La imagen puede estar " "corrupta, así que proceda con precaución." #: src/web.py:698 @@ -428,8 +428,8 @@ msgid "File upload successful!" msgstr "¡La carga de archivos se ha realizado con éxito!" #: src/templates/base.html:4 src/templates/base.html:68 -msgid "RaSCSI Reloaded Control Page" -msgstr "Página de control RaSCSI Reloaded" +msgid "PiSCSI Control Page" +msgstr "Página de control PiSCSI" #: src/templates/base.html:29 msgid "" @@ -498,8 +498,8 @@ msgid "Macproxy is running at %(ip_addr)s (default port 5000)" msgstr "Macproxy se está ejecutando en %(ip_addr)s (puerto por defecto: 5000)" #: src/templates/base.html:104 -msgid "RaSCSI Reloaded version: " -msgstr "Versión de RaSCSI Reloaded: " +msgid "PiSCSI version: " +msgstr "Versión de PiSCSI: " #: src/templates/base.html:107 msgid "Pi environment: " @@ -643,8 +643,8 @@ msgid "%(disk_space)s MiB disk space remaining on the Pi" msgstr "%(disk_space)s MiB de espacio en disco restante en la Pi" #: src/templates/index.html:6 -msgid "Current RaSCSI Configuration" -msgstr "Configuración actual de RaSCSI" +msgid "Current PiSCSI Configuration" +msgstr "Configuración actual de PiSCSI" #: src/templates/index.html:9 #, python-format @@ -657,11 +657,11 @@ msgstr "" #: src/templates/index.html:10 msgid "" -"To have a particular device configuration load when RaSCSI starts, save it as " +"To have a particular device configuration load when PiSCSI starts, save it as " "default." msgstr "" "Para que se cargue una configuración de dispositivo concreta cuando se inicie " -"RaSCSI, guárdela como default." +"PiSCSI, guárdela como default." #: src/templates/index.html:16 src/templates/index.html:37 #: src/templates/index.html:71 @@ -762,11 +762,11 @@ msgstr "Gestión de archivos de imagen" #: src/templates/index.html:174 #, python-format msgid "" -"Manage image files in the active RaSCSI image directory: %(directory)s " +"Manage image files in the active PiSCSI image directory: %(directory)s " "with a scan depth of %(scan_depth)s." msgstr "" "Gestionar los archivos de imagen en el directorio activo de las imágenes de " -"RaSCSI: %(directory)s con la profundidad de escaneo de %(scan_depth)s." +"PiSCSI: %(directory)s con la profundidad de escaneo de %(scan_depth)s." #: src/templates/index.html:175 #, python-format @@ -857,18 +857,18 @@ msgstr "Conectar dispositivo periférico" #: src/templates/index.html:345 msgid "" -"The rascsi_bridge network bridge is active and ready to be used by an " +"The piscsi_bridge network bridge is active and ready to be used by an " "emulated network adapter!" msgstr "" -"¡El puente de red rascsi_bridge está activo y listo para ser utilizado " +"¡El puente de red piscsi_bridge está activo y listo para ser utilizado " "por un adaptador de red emulado!" #: src/templates/index.html:347 msgid "" -"Please configure the rascsi_bridge network bridge before attaching an " +"Please configure the piscsi_bridge network bridge before attaching an " "emulated network adapter!" msgstr "" -"Configure el puente de red rascsi_bridge antes de conectar un " +"Configure el puente de red piscsi_bridge antes de conectar un " "adaptador de red emulado!" #: src/templates/index.html:349 @@ -1171,8 +1171,8 @@ msgid "Shut Down Raspberry Pi" msgstr "Apagar la Raspberry Pi" #: src/templates/index.html:689 -msgid "Read the RaSCSI Manual" -msgstr "Lea el manual de RaSCSI" +msgid "Read the PiSCSI Manual" +msgstr "Lea el manual de PiSCSI" #: src/templates/logs.html:4 #, python-format diff --git a/python/web/src/translations/fr/LC_MESSAGES/messages.po b/python/web/src/translations/fr/LC_MESSAGES/messages.po index 8f5f034c..497769f6 100644 --- a/python/web/src/translations/fr/LC_MESSAGES/messages.po +++ b/python/web/src/translations/fr/LC_MESSAGES/messages.po @@ -1,12 +1,12 @@ -# French translations for RaSCSI. +# French translations for PiSCSI. # Copyright (C) 2021 akuker -# This file is distributed under the same license as the RaSCSI project. +# This file is distributed under the same license as the PiSCSI project. # Kamel Makhloufi , 2021. # msgid "" msgstr "" -"Project-Id-Version: RaSCSI 68kmla Edition\n" -"Report-Msgid-Bugs-To: https://github.com/akuker/RASCSI/issues\n" +"Project-Id-Version: PiSCSI 68kmla Edition\n" +"Report-Msgid-Bugs-To: https://github.com/akuker/PISCSI/issues\n" "POT-Creation-Date: 2022-05-07 17:26+0200\n" "PO-Revision-Date: 2022-05-07 17:28+0200\n" "Last-Translator: Kamel Makhloufi \n" @@ -108,35 +108,35 @@ msgstr "code_retour" #: src/socket_cmds_flask.py:34 #, python-format msgid "" -"The RaSCSI Web Interface failed to connect to RaSCSI at %(host)s:%(port)s with " -"error: %(error_msg)s. The RaSCSI process is not running or may have crashed." +"The PiSCSI Web Interface failed to connect to PiSCSI at %(host)s:%(port)s with " +"error: %(error_msg)s. The PiSCSI process is not running or may have crashed." msgstr "" -"L’interface web RaSCSI n’as pas pu se connecter à RaSCSI à l’adresse %(host)s:" -"%(port)s avec l’erreur : %(error_msg)s. Le processus RaSCSI n’est peut-être pas " +"L’interface web PiSCSI n’as pas pu se connecter à PiSCSI à l’adresse %(host)s:" +"%(port)s avec l’erreur : %(error_msg)s. Le processus PiSCSI n’est peut-être pas " "en cours d’exécution ou a planté." #: src/socket_cmds_flask.py:45 msgid "" -"The RaSCSI Web Interface lost connection to RaSCSI. Please go back and try " +"The PiSCSI Web Interface lost connection to PiSCSI. Please go back and try " "again. If the issue persists, please report a bug." msgstr "" -"L’interface web RaSCSI à perdu la connexion à RaSCSI. Merci de réessayer. Si le " +"L’interface web PiSCSI à perdu la connexion à PiSCSI. Merci de réessayer. Si le " "problème persiste, merci de faire remonter un bug." #: src/socket_cmds_flask.py:54 msgid "" -"The RaSCSI Web Interface did not get a valid response from RaSCSI. Please go " +"The PiSCSI Web Interface did not get a valid response from PiSCSI. Please go " "back and try again. If the issue persists, please report a bug." msgstr "" -"L’interface web RaSCSI à reçu une réponse invalide de RaSCSI. Merci de " +"L’interface web PiSCSI à reçu une réponse invalide de PiSCSI. Merci de " "réessayer. Si le problème persiste, merci de faire remonter un bug." #: src/web.py:105 msgid "" -"RaSCSI is password protected. Start the Web Interface with the --password " +"PiSCSI is password protected. Start the Web Interface with the --password " "parameter." msgstr "" -"RaSCSI est protégé par un mot de passe. Merci de démarrer l’interface web avec " +"PiSCSI est protégé par un mot de passe. Merci de démarrer l’interface web avec " "le paramètre --password." #: src/web.py:209 @@ -189,11 +189,11 @@ msgstr "" #, python-format msgid "" "The image file size %(file_size)s bytes is not a multiple of %(block_size)s. " -"RaSCSI will ignore the trailing data. The image may be corrupted, so proceed " +"PiSCSI will ignore the trailing data. The image may be corrupted, so proceed " "with caution." msgstr "" "La taille du fichier image %(file_size)s octets n’est pas un multiple de " -"%(block_size)s. RaSCSI va ignorer les données de fin. L’image peut être " +"%(block_size)s. PiSCSI va ignorer les données de fin. L’image peut être " "corrompue, merci de continuer avec précaution." #: src/web.py:576 @@ -439,8 +439,8 @@ msgid "File upload successful!" msgstr "Transfert de fichier réussi !" #: src/templates/base.html:4 src/templates/base.html:67 -msgid "RaSCSI Control Page" -msgstr "Page de contrôle de RaSCSI" +msgid "PiSCSI Control Page" +msgstr "Page de contrôle de PiSCSI" #: src/templates/base.html:29 msgid "" @@ -490,8 +490,8 @@ msgstr "" "Voir le Wiki pour plus d’informations" #: src/templates/base.html:92 -msgid "RaSCSI version: " -msgstr "RaSCSI version : " +msgid "PiSCSI version: " +msgstr "PiSCSI version : " #: src/templates/base.html:93 msgid "Pi environment: " @@ -591,8 +591,8 @@ msgid "%(disk_space)s MB disk space remaining on the Pi" msgstr "%(disk_space)s MO d’espace disque restant sur le Pi" #: src/templates/index.html:6 -msgid "Current RaSCSI Configuration" -msgstr "Configuration RaSCSI actuelle" +msgid "Current PiSCSI Configuration" +msgstr "Configuration PiSCSI actuelle" #: src/templates/index.html:9 msgid "Displays the currently attached devices for each available SCSI ID." @@ -609,11 +609,11 @@ msgstr "" #: src/templates/index.html:11 msgid "" -"To have a particular device configuration load when RaSCSI starts, save it as " +"To have a particular device configuration load when PiSCSI starts, save it as " "default." msgstr "" "Pour avoir une configuration de périphérique en particulier chargée au " -"démarrage de RaSCSI, sauvegardez la en tant que default." +"démarrage de PiSCSI, sauvegardez la en tant que default." #: src/templates/index.html:25 msgid "No saved configurations" @@ -726,10 +726,10 @@ msgstr "Gestion des fichiers d'image" #: src/templates/index.html:155 #, python-format msgid "" -"Manage image files in the active RaSCSI image directory: %(directory)s " +"Manage image files in the active PiSCSI image directory: %(directory)s " "with a scan depth of %(scan_depth)s." msgstr "" -"Gérer les fichiers image dans le dossier image RaSCSI actif : " +"Gérer les fichiers image dans le dossier image PiSCSI actif : " "%(directory)s avec un profondeur de scan de %(scan_depth)s." #: src/templates/index.html:156 @@ -743,10 +743,10 @@ msgstr "" #: src/templates/index.html:158 msgid "" -"If RaSCSI was unable to detect the media type associated with the image, you " +"If PiSCSI was unable to detect the media type associated with the image, you " "get to choose the type from the dropdown." msgstr "" -"Si RaSCSI n'as pas pu détecter le type de média associé à l'image, vous pouvez " +"Si PiSCSI n'as pas pu détecter le type de média associé à l'image, vous pouvez " "choisir le type depuis le menu déroulant." #: src/templates/index.html:166 @@ -837,10 +837,10 @@ msgstr "" #: src/templates/index.html:310 msgid "" -"The rascsi_bridge network bridge is active and ready to be used by an " +"The piscsi_bridge network bridge is active and ready to be used by an " "emulated network adapter!" msgstr "" -"L'interface rascsi_bridge est active et prête à être utilisée par un " +"L'interface piscsi_bridge est active et prête à être utilisée par un " "adaptateur réseau émulé!" #: src/templates/index.html:314 @@ -1103,12 +1103,12 @@ msgstr "Le type d'image générique est recommandé pour la plupart des platefor #: src/templates/index.html:540 msgid "" -"APPLE GENUINE (.hda) and NEC GENUINE (.hdn) image types will make RaSCSI behave " +"APPLE GENUINE (.hda) and NEC GENUINE (.hdn) image types will make PiSCSI behave " "as a particular drive type that are recognized by Mac and PC98 systems, " "respectively." msgstr "" "Les types d'image APPLE AUTHENTIQUE (.hda) et NEC AUTHENTIQUE (.hdn) feront que " -"RaSCSI se comportera comme un type de disque particulier qui sont reconnus par " +"PiSCSI se comportera comme un type de disque particulier qui sont reconnus par " "les systèmes Mac et PC98 respectivement." #: src/templates/index.html:541 @@ -1164,10 +1164,10 @@ msgstr "" #: src/templates/index.html:584 msgid "" -"This will make RaSCSI use certain vendor strings and block sizes that may " +"This will make PiSCSI use certain vendor strings and block sizes that may " "improve compatibility with certain systems." msgstr "" -"RaSCSI utilisera certains noms de vendeurs et tailles de blocs afin d'améliorer " +"PiSCSI utilisera certains noms de vendeurs et tailles de blocs afin d'améliorer " "la compatibilité avec certains systèmes." #: src/templates/index.html:587 @@ -1205,8 +1205,8 @@ msgid "Server Log Level" msgstr "Niveau de journalisation du serveur" #: src/templates/index.html:636 -msgid "Change the log level of the RaSCSI backend process." -msgstr "Changer le niveau de journalisation des processus principaux RaSCSI." +msgid "Change the log level of the PiSCSI backend process." +msgstr "Changer le niveau de journalisation des processus principaux PiSCSI." #: src/templates/index.html:637 msgid "The current dropdown selection indicates the active log level." @@ -1241,8 +1241,8 @@ msgid "Raspberry Pi Operations" msgstr "Opérations Raspberry Pi" #: src/templates/index.html:693 -msgid "Reboot or shut down the Raspberry Pi that RaSCSI is running on." -msgstr "Redémarrer ou éteindre le Raspberry Pi sur lequel RaSCSI s'exécute." +msgid "Reboot or shut down the Raspberry Pi that PiSCSI is running on." +msgstr "Redémarrer ou éteindre le Raspberry Pi sur lequel PiSCSI s'exécute." #: src/templates/index.html:694 msgid "" diff --git a/python/web/src/translations/sv/LC_MESSAGES/messages.po b/python/web/src/translations/sv/LC_MESSAGES/messages.po index 6a5ba950..ce9a8ffb 100644 --- a/python/web/src/translations/sv/LC_MESSAGES/messages.po +++ b/python/web/src/translations/sv/LC_MESSAGES/messages.po @@ -1,12 +1,12 @@ -# Swedish translations for RaSCSI. +# Swedish translations for PiSCSI. # Copyright (C) 2021 akuker -# This file is distributed under the same license as the RaSCSI project. +# This file is distributed under the same license as the PiSCSI project. # Daniel Markstedt , 2021. # msgid "" msgstr "" -"Project-Id-Version: RaSCSI Reloaded\n" -"Report-Msgid-Bugs-To: https://github.com/akuker/RASCSI/issues\n" +"Project-Id-Version: PiSCSI\n" +"Report-Msgid-Bugs-To: https://github.com/akuker/PISCSI/issues\n" "POT-Creation-Date: 2022-10-07 21:10-0700\n" "PO-Revision-Date: 2022-10-07 20:16-0800\n" "Last-Translator: Daniel Markstedt \n" @@ -112,36 +112,36 @@ msgstr "Kunde ej packa upp arkivet: %(error)s" #: src/socket_cmds_flask.py:34 #, python-format msgid "" -"The RaSCSI Web Interface failed to connect to RaSCSI at %(host)s:%(port)s" -" with error: %(error_msg)s. The RaSCSI process is not running or may have" +"The PiSCSI Web Interface failed to connect to PiSCSI at %(host)s:%(port)s" +" with error: %(error_msg)s. The PiSCSI process is not running or may have" " crashed." msgstr "" -"RaSCSIs webbgränssnitt kunde inte ansluta till RaSCSI på " -"%(host)s:%(port)s med felmeddelandet %(error_msg)s. RaSCSI-processen är " +"PiSCSIs webbgränssnitt kunde inte ansluta till PiSCSI på " +"%(host)s:%(port)s med felmeddelandet %(error_msg)s. PiSCSI-processen är " "antingen avslagen eller har krashat." #: src/socket_cmds_flask.py:45 msgid "" -"The RaSCSI Web Interface lost connection to RaSCSI. Please go back and " +"The PiSCSI Web Interface lost connection to PiSCSI. Please go back and " "try again. If the issue persists, please report a bug." msgstr "" -"RaSCSIs webbgränssnitt tappade kontaken med RaSCSI. Gå tillbaks och " +"PiSCSIs webbgränssnitt tappade kontaken med PiSCSI. Gå tillbaks och " "försök igen. Om samma fel upprepas så rapportera en bugg." #: src/socket_cmds_flask.py:54 msgid "" -"The RaSCSI Web Interface did not get a valid response from RaSCSI. Please" +"The PiSCSI Web Interface did not get a valid response from PiSCSI. Please" " go back and try again. If the issue persists, please report a bug." msgstr "" -"RaSCSIs webbgränssnitt fick en ogiltig respons från RaSCSI. Gå tillbaks " +"PiSCSIs webbgränssnitt fick en ogiltig respons från PiSCSI. Gå tillbaks " "och försök igen. Om samma fel upprepas så rapportera en bugg." #: src/web.py:182 msgid "" -"RaSCSI is password protected. Start the Web Interface with the --password" +"PiSCSI is password protected. Start the Web Interface with the --password" " parameter." msgstr "" -"RaSCSI är lösenordsskyddat. Start webbgränssnittet med parametern " +"PiSCSI är lösenordsskyddat. Start webbgränssnittet med parametern " "--password ." #: src/web.py:318 @@ -161,8 +161,8 @@ msgstr "Ett fel inträffade när vi hämtade skivinfo: %(error)s" #: src/web.py:493 #, python-format -msgid "%(app)s is not a recognized RaSCSI app" -msgstr "%(app)s är inte en giltig RaSCSI-app" +msgid "%(app)s is not a recognized PiSCSI app" +msgstr "%(app)s är inte en giltig PiSCSI-app" #: src/web.py:527 #, python-format @@ -212,11 +212,11 @@ msgstr "" #, python-format msgid "" "The image file size %(file_size)s bytes is not a multiple of " -"%(block_size)s. RaSCSI will ignore the trailing data. The image may be " +"%(block_size)s. PiSCSI will ignore the trailing data. The image may be " "corrupted, so proceed with caution." msgstr "" "Filstorleken %(file_size)s byte är inte en multipel av %(block_size)s. " -"RaSCSI ignorerar den överflödiga datan. Skivbilden är möjligen förstörd, " +"PiSCSI ignorerar den överflödiga datan. Skivbilden är möjligen förstörd, " "så var försiktig när du använder den." #: src/web.py:698 @@ -432,8 +432,8 @@ msgid "File upload successful!" msgstr "Filen har laddas upp!" #: src/templates/base.html:4 src/templates/base.html:68 -msgid "RaSCSI Reloaded Control Page" -msgstr "RaSCSI Reloaded kontrollsida" +msgid "PiSCSI Control Page" +msgstr "PiSCSI kontrollsida" #: src/templates/base.html:29 msgid "" @@ -501,8 +501,8 @@ msgid "Macproxy is running at %(ip_addr)s (default port 5000)" msgstr "Macproxy är tillgängligt på %(ip_addr)s (vanligtvis port 5000)" #: src/templates/base.html:104 -msgid "RaSCSI Reloaded version: " -msgstr "RaSCSI Reloaded-version: " +msgid "PiSCSI version: " +msgstr "PiSCSI-version: " #: src/templates/base.html:107 msgid "Pi environment: " @@ -646,8 +646,8 @@ msgid "%(disk_space)s MiB disk space remaining on the Pi" msgstr "%(disk_space)s MiB återstår på Pi-systemets skiva" #: src/templates/index.html:6 -msgid "Current RaSCSI Configuration" -msgstr "Nuvarande RaSCSI-konfiguration" +msgid "Current PiSCSI Configuration" +msgstr "Nuvarande PiSCSI-konfiguration" #: src/templates/index.html:9 #, python-format @@ -660,11 +660,11 @@ msgstr "" #: src/templates/index.html:10 msgid "" -"To have a particular device configuration load when RaSCSI starts, save " +"To have a particular device configuration load when PiSCSI starts, save " "it as default." msgstr "" "Om du sparar en enhetskonfiguration som default så laddas den " -"när RaSCSI startar." +"när PiSCSI startar." #: src/templates/index.html:16 src/templates/index.html:37 #: src/templates/index.html:71 @@ -764,7 +764,7 @@ msgstr "Bildfilshanterare" #: src/templates/index.html:174 #, python-format msgid "" -"Manage image files in the active RaSCSI image directory: " +"Manage image files in the active PiSCSI image directory: " "%(directory)s with a scan depth of %(scan_depth)s." msgstr "" "Hantera filer i den aktiva bildfilskatalogen: %(directory)s med " @@ -858,18 +858,18 @@ msgstr "Anslut tillbehör" #: src/templates/index.html:345 msgid "" -"The rascsi_bridge network bridge is active and ready to be used " +"The piscsi_bridge network bridge is active and ready to be used " "by an emulated network adapter!" msgstr "" -"Nätverksbryggan rascsi_bridge är påslagen och kan användas av " +"Nätverksbryggan piscsi_bridge är påslagen och kan användas av " "det emulerade gränssnittet!" #: src/templates/index.html:347 msgid "" -"Please configure the rascsi_bridge network bridge before " +"Please configure the piscsi_bridge network bridge before " "attaching an emulated network adapter!" msgstr "" -"Se till att ställa in och sätta på rascsi_bridge innan du " +"Se till att ställa in och sätta på piscsi_bridge innan du " "ansluter det emulerade nätverksgränssnittet!" #: src/templates/index.html:349 @@ -1170,8 +1170,8 @@ msgid "Shut Down Raspberry Pi" msgstr "Stäng av Raspberry Pi" #: src/templates/index.html:689 -msgid "Read the RaSCSI Manual" -msgstr "Läs manualen för RaSCSI" +msgid "Read the PiSCSI Manual" +msgstr "Läs manualen för PiSCSI" #: src/templates/logs.html:4 #, python-format diff --git a/python/web/src/web.py b/python/web/src/web.py index 42f0f5f3..c18d5868 100644 --- a/python/web/src/web.py +++ b/python/web/src/web.py @@ -10,7 +10,7 @@ from functools import wraps from grp import getgrall import bjoern -from rascsi.return_codes import ReturnCodes +from piscsi.return_codes import ReturnCodes from simplepam import authenticate from flask_babel import Babel, Locale, refresh, _ @@ -28,11 +28,11 @@ from flask import ( jsonify, ) -from rascsi.ractl_cmds import RaCtlCmds -from rascsi.file_cmds import FileCmds -from rascsi.sys_cmds import SysCmds +from piscsi.piscsi_cmds import PiscsiCmds +from piscsi.file_cmds import FileCmds +from piscsi.sys_cmds import SysCmds -from rascsi.common_settings import ( +from piscsi.common_settings import ( CFG_DIR, CONFIG_FILE_SUFFIX, PROPERTIES_SUFFIX, @@ -79,7 +79,7 @@ def get_env_info(): """ Get information about the app/host environment """ - server_info = ractl_cmd.get_server_info() + server_info = piscsi_cmd.get_server_info() ip_addr, host = sys_cmd.get_ip_and_host() if "username" in session: @@ -198,18 +198,18 @@ def index(): """ Sets up data structures for and renders the index page """ - if not ractl_cmd.is_token_auth()["status"] and not APP.config["RASCSI_TOKEN"]: + if not piscsi_cmd.is_token_auth()["status"] and not APP.config["PISCSI_TOKEN"]: abort( 403, _( - "RaSCSI is password protected. " + "PiSCSI is password protected. " "Start the Web Interface with the --password parameter." ), ) - server_info = ractl_cmd.get_server_info() - devices = ractl_cmd.list_devices() - device_types = map_device_types_and_names(ractl_cmd.get_device_types()["device_types"]) + server_info = piscsi_cmd.get_server_info() + devices = piscsi_cmd.list_devices() + device_types = map_device_types_and_names(piscsi_cmd.get_device_types()["device_types"]) image_files = file_cmd.list_images() config_files = file_cmd.list_config_files() ip_addr, host = sys_cmd.get_ip_and_host() @@ -251,7 +251,7 @@ def index(): return response( template="index.html", locales=get_supported_locales(), - netinfo=ractl_cmd.get_network_info(), + netinfo=piscsi_cmd.get_network_info(), bridge_configured=sys_cmd.is_bridge_setup(), devices=formatted_devices, attached_images=attached_images, @@ -267,16 +267,16 @@ def index(): image_suffixes_to_create=image_suffixes_to_create, valid_image_suffixes=valid_image_suffixes, max_file_size=int(int(MAX_FILE_SIZE) / 1024 / 1024), - drive_properties=format_drive_properties(APP.config["RASCSI_DRIVE_PROPERTIES"]), + drive_properties=format_drive_properties(APP.config["PISCSI_DRIVE_PROPERTIES"]), RESERVATIONS=RESERVATIONS, CFG_DIR=CFG_DIR, FILE_SERVER_DIR=FILE_SERVER_DIR, PROPERTIES_SUFFIX=PROPERTIES_SUFFIX, ARCHIVE_FILE_SUFFIXES=ARCHIVE_FILE_SUFFIXES, CONFIG_FILE_SUFFIX=CONFIG_FILE_SUFFIX, - REMOVABLE_DEVICE_TYPES=ractl_cmd.get_removable_device_types(), - DISK_DEVICE_TYPES=ractl_cmd.get_disk_device_types(), - PERIPHERAL_DEVICE_TYPES=ractl_cmd.get_peripheral_device_types(), + REMOVABLE_DEVICE_TYPES=piscsi_cmd.get_removable_device_types(), + DISK_DEVICE_TYPES=piscsi_cmd.get_disk_device_types(), + PERIPHERAL_DEVICE_TYPES=piscsi_cmd.get_peripheral_device_types(), ) @@ -297,7 +297,7 @@ def drive_list(): return response( template="drives.html", files=file_cmd.list_images()["files"], - drive_properties=format_drive_properties(APP.config["RASCSI_DRIVE_PROPERTIES"]), + drive_properties=format_drive_properties(APP.config["PISCSI_DRIVE_PROPERTIES"]), ) @@ -365,7 +365,7 @@ def drive_create(): drive_name = request.form.get("drive_name") file_name = Path(request.form.get("file_name")).name - properties = get_properties_by_drive_name(APP.config["RASCSI_DRIVE_PROPERTIES"], drive_name) + properties = get_properties_by_drive_name(APP.config["PISCSI_DRIVE_PROPERTIES"], drive_name) if not properties: return response( @@ -409,7 +409,7 @@ def drive_cdrom(): # Creating the drive properties file file_name = f"{file_name}.{PROPERTIES_SUFFIX}" - properties = get_properties_by_drive_name(APP.config["RASCSI_DRIVE_PROPERTIES"], drive_name) + properties = get_properties_by_drive_name(APP.config["PISCSI_DRIVE_PROPERTIES"], drive_name) if not properties: return response( @@ -478,7 +478,7 @@ def show_diskinfo(): safe_path = is_safe_path(file_name) if not safe_path["status"]: return response(error=True, message=safe_path["msg"]) - server_info = ractl_cmd.get_server_info() + server_info = piscsi_cmd.get_server_info() returncode, diskinfo = sys_cmd.get_diskinfo(Path(server_info["image_dir"]) / file_name) if returncode == 0: return response( @@ -498,12 +498,12 @@ def show_manpage(): """ Displays manpage """ - app_allowlist = ["rascsi", "rasctl", "rasdump", "scsimon"] + app_allowlist = ["piscsi", "scsictl", "scsidump", "scsimon"] app = request.args.get("app", type=str) if app not in app_allowlist: - return response(error=True, message=_("%(app)s is not a recognized RaSCSI app", app=app)) + return response(error=True, message=_("%(app)s is not a recognized PiSCSI app", app=app)) file_path = f"{WEB_DIR}/../../../doc/{app}.1" html_to_strip = [ @@ -567,11 +567,11 @@ def show_logs(): @login_required def log_level(): """ - Sets RaSCSI backend log level + Sets PiSCSI backend log level """ level = request.form.get("level") or "info" - process = ractl_cmd.set_log_level(level) + process = piscsi_cmd.set_log_level(level) if process["status"]: return response(message=_("Log level set to %(value)s", value=level)) @@ -595,7 +595,7 @@ def attach_device(): # Attempt to fetch the drive properties based on drive name drive_props = None if drive_name: - for drive in APP.config["RASCSI_DRIVE_PROPERTIES"]: + for drive in APP.config["PISCSI_DRIVE_PROPERTIES"]: if drive["name"] == drive_name: drive_props = drive break @@ -625,7 +625,7 @@ def attach_device(): kwargs["revision"] = drive_props["revision"] kwargs["block_size"] = drive_props["block_size"] - process = ractl_cmd.attach_device(scsi_id, **kwargs) + process = piscsi_cmd.attach_device(scsi_id, **kwargs) process = ReturnCodeMapper.add_msg(process) if process["status"]: return response( @@ -661,7 +661,7 @@ def attach_image(): if device_type: kwargs["device_type"] = device_type - device_types = ractl_cmd.get_device_types() + device_types = piscsi_cmd.get_device_types() expected_block_size = min(device_types["device_types"][device_type]["block_sizes"]) # Attempt to load the device properties file: @@ -679,13 +679,13 @@ def attach_image(): kwargs["block_size"] = conf["block_size"] expected_block_size = conf["block_size"] - process = ractl_cmd.attach_device(scsi_id, **kwargs) + process = piscsi_cmd.attach_device(scsi_id, **kwargs) process = ReturnCodeMapper.add_msg(process) if process["status"]: if int(file_size) % int(expected_block_size): logging.warning( "The image file size %s bytes is not a multiple of %s. " - "RaSCSI will ignore the trailing data. " + "PiSCSI will ignore the trailing data. " "The image may be corrupted, so proceed with caution.", file_size, expected_block_size, @@ -710,7 +710,7 @@ def detach_all_devices(): """ Detaches all currently attached devices """ - process = ractl_cmd.detach_all() + process = piscsi_cmd.detach_all() if process["status"]: return response(message=_("Detached all SCSI devices")) @@ -725,7 +725,7 @@ def detach(): """ scsi_id = request.form.get("scsi_id") unit = request.form.get("unit") - process = ractl_cmd.detach_by_id(scsi_id, unit) + process = piscsi_cmd.detach_by_id(scsi_id, unit) if process["status"]: return response( message=_( @@ -747,7 +747,7 @@ def eject(): scsi_id = request.form.get("scsi_id") unit = request.form.get("unit") - process = ractl_cmd.eject_by_id(scsi_id, unit) + process = piscsi_cmd.eject_by_id(scsi_id, unit) if process["status"]: return response( message=_( @@ -765,7 +765,7 @@ def device_info(): """ Displays detailed info for all attached devices """ - process = ractl_cmd.list_devices() + process = piscsi_cmd.list_devices() if process["status"]: return response( template="deviceinfo.html", @@ -783,9 +783,9 @@ def reserve_id(): """ scsi_id = request.form.get("scsi_id") memo = request.form.get("memo") - reserved_ids = ractl_cmd.get_reserved_ids()["ids"] + reserved_ids = piscsi_cmd.get_reserved_ids()["ids"] reserved_ids.extend(scsi_id) - process = ractl_cmd.reserve_scsi_ids(reserved_ids) + process = piscsi_cmd.reserve_scsi_ids(reserved_ids) if process["status"]: RESERVATIONS[int(scsi_id)] = memo return response(message=_("Reserved SCSI ID %(id_number)s", id_number=scsi_id)) @@ -800,9 +800,9 @@ def release_id(): Releases the reservation of a SCSI ID as well as the memo for the reservation """ scsi_id = request.form.get("scsi_id") - reserved_ids = ractl_cmd.get_reserved_ids()["ids"] + reserved_ids = piscsi_cmd.get_reserved_ids()["ids"] reserved_ids.remove(scsi_id) - process = ractl_cmd.reserve_scsi_ids(reserved_ids) + process = piscsi_cmd.reserve_scsi_ids(reserved_ids) if process["status"]: RESERVATIONS[int(scsi_id)] = "" return response( @@ -896,7 +896,7 @@ def download_to_iso(): ), ) - process_attach = ractl_cmd.attach_device( + process_attach = piscsi_cmd.attach_device( scsi_id, device_type="SCCD", params={"file": process["file_name"]}, @@ -936,7 +936,7 @@ def download_file(): if destination == "file_server": destination_dir = FILE_SERVER_DIR else: - server_info = ractl_cmd.get_server_info() + server_info = piscsi_cmd.get_server_info() destination_dir = server_info["image_dir"] process = file_cmd.download_to_dir(url, destination_dir, Path(url).name) process = ReturnCodeMapper.add_msg(process) @@ -967,7 +967,7 @@ def upload_file(): if destination == "file_server": destination_dir = FILE_SERVER_DIR else: - server_info = ractl_cmd.get_server_info() + server_info = piscsi_cmd.get_server_info() destination_dir = server_info["image_dir"] return upload_with_dropzonejs(destination_dir) @@ -1056,7 +1056,7 @@ def create_file(): # Creating the drive properties file, if one is chosen if drive_name: - properties = get_properties_by_drive_name(APP.config["RASCSI_DRIVE_PROPERTIES"], drive_name) + properties = get_properties_by_drive_name(APP.config["PISCSI_DRIVE_PROPERTIES"], drive_name) if properties: prop_file_name = f"{full_file_name}.{PROPERTIES_SUFFIX}" process = file_cmd.write_drive_properties(prop_file_name, properties) @@ -1095,7 +1095,7 @@ def download(): safe_path = is_safe_path(file_name) if not safe_path["status"]: return response(error=True, message=safe_path["msg"]) - server_info = ractl_cmd.get_server_info() + server_info = piscsi_cmd.get_server_info() return send_from_directory(server_info["image_dir"], str(file_name), as_attachment=True) @@ -1262,7 +1262,7 @@ def change_language(): """ locale = request.form.get("locale") session["language"] = locale - ractl_cmd.locale = session["language"] + piscsi_cmd.locale = session["language"] file_cmd.locale = session["language"] refresh() @@ -1297,7 +1297,7 @@ def detect_locale(): This requires the Flask app to have started first. """ session["language"] = get_locale() - ractl_cmd.locale = session["language"] + piscsi_cmd.locale = session["language"] file_cmd.locale = session["language"] @@ -1318,11 +1318,11 @@ def log_http_request(): if __name__ == "__main__": - APP.secret_key = "rascsi_is_awesome_insecure_secret_key" + APP.secret_key = "piscsi_is_awesome_insecure_secret_key" APP.config["SESSION_TYPE"] = "filesystem" APP.config["MAX_CONTENT_LENGTH"] = int(MAX_FILE_SIZE) - parser = argparse.ArgumentParser(description="RaSCSI Web Interface command line arguments") + parser = argparse.ArgumentParser(description="PiSCSI Web Interface command line arguments") parser.add_argument( "--port", type=int, @@ -1335,21 +1335,21 @@ if __name__ == "__main__": type=str, default="", action="store", - help="Token password string for authenticating with RaSCSI", + help="Token password string for authenticating with PiSCSI", ) parser.add_argument( - "--rascsi-host", + "--backend-host", type=str, default="localhost", action="store", - help="RaSCSI host. Default: localhost", + help="PiSCSI backend hostname. Default: localhost", ) parser.add_argument( - "--rascsi-port", + "--backend-port", type=int, default=6868, action="store", - help="RaSCSI port. Default: 6868", + help="PiSCSI backend port number. Default: 6868", ) parser.add_argument( "--log-level", @@ -1366,7 +1366,7 @@ if __name__ == "__main__": ) arguments = parser.parse_args() - APP.config["RASCSI_TOKEN"] = arguments.password + APP.config["PISCSI_TOKEN"] = arguments.password logging.config.dictConfig( { @@ -1389,9 +1389,9 @@ if __name__ == "__main__": } ) - sock_cmd = SocketCmdsFlask(host=arguments.rascsi_host, port=arguments.rascsi_port) - ractl_cmd = RaCtlCmds(sock_cmd=sock_cmd, token=APP.config["RASCSI_TOKEN"]) - file_cmd = FileCmds(sock_cmd=sock_cmd, ractl=ractl_cmd, token=APP.config["RASCSI_TOKEN"]) + sock_cmd = SocketCmdsFlask(host=arguments.backend_host, port=arguments.backend_port) + piscsi_cmd = PiscsiCmds(sock_cmd=sock_cmd, token=APP.config["PISCSI_TOKEN"]) + file_cmd = FileCmds(sock_cmd=sock_cmd, piscsi=piscsi_cmd, token=APP.config["PISCSI_TOKEN"]) sys_cmd = SysCmds() if Path(f"{CFG_DIR}/{DEFAULT_CONFIG}").is_file(): @@ -1399,12 +1399,12 @@ if __name__ == "__main__": if Path(f"{DRIVE_PROPERTIES_FILE}").is_file(): process = file_cmd.read_drive_properties(DRIVE_PROPERTIES_FILE) if process["status"]: - APP.config["RASCSI_DRIVE_PROPERTIES"] = process["conf"] + APP.config["PISCSI_DRIVE_PROPERTIES"] = process["conf"] else: - APP.config["RASCSI_DRIVE_PROPERTIES"] = [] + APP.config["PISCSI_DRIVE_PROPERTIES"] = [] logging.error(process["msg"]) else: - APP.config["RASCSI_DRIVE_PROPERTIES"] = [] + APP.config["PISCSI_DRIVE_PROPERTIES"] = [] logging.warning("Could not read drive properties from %s", DRIVE_PROPERTIES_FILE) logging.info("Starting WSGI server...") diff --git a/python/web/src/web_utils.py b/python/web/src/web_utils.py index 0b608256..c9a42dc4 100644 --- a/python/web/src/web_utils.py +++ b/python/web/src/web_utils.py @@ -1,5 +1,5 @@ """ -Module for RaSCSI Web Interface utility methods +Module for PiSCSI Web Interface utility methods """ import logging @@ -12,7 +12,7 @@ from flask import request, make_response from flask_babel import _ from werkzeug.utils import secure_filename -from rascsi.sys_cmds import SysCmds +from piscsi.sys_cmds import SysCmds def get_valid_scsi_ids(devices, reserved_ids): @@ -79,7 +79,7 @@ def sort_and_format_devices(devices): def map_device_types_and_names(device_types): """ - Takes a (dict) corresponding to the data structure returned by RaCtlCmds.get_device_types() + Takes a (dict) corresponding to the data structure returned by PiscsiCmds.get_device_types() Returns a (dict) of device_type:device_name mappings of localized device names """ for device in device_types.keys(): @@ -229,7 +229,7 @@ def is_bridge_configured(interface): PATH_SYSCTL = "/etc/sysctl.conf" PATH_IPTV4 = "/etc/iptables/rules.v4" PATH_DHCPCD = "/etc/dhcpcd.conf" - PATH_BRIDGE = "/etc/network/interfaces.d/rascsi_bridge" + PATH_BRIDGE = "/etc/network/interfaces.d/piscsi_bridge" return_msg = _("Configure the network bridge for %(interface)s first: ", interface=interface) to_configure = [] sys_cmd = SysCmds() diff --git a/python/web/start.sh b/python/web/start.sh index e9a0a50c..44a6ebed 100755 --- a/python/web/start.sh +++ b/python/web/start.sh @@ -100,11 +100,11 @@ while [ "$1" != "" ]; do -P | --password) ARG_PASSWORD="--password $VALUE" ;; - -h | --rascsi-host) - ARG_RASCSI_HOST="--rascsi-host $VALUE" + -h | --backend-host) + ARG_BACKEND_HOST="--backend-host $VALUE" ;; - -o | --rascsi-port) - ARG_RASCSI_PORT="--rascsi-port $VALUE" + -o | --backend-port) + ARG_BACKEND_PORT="--backend-port $VALUE" ;; -l | --log-level) ARG_LOG_LEVEL="--log-level $VALUE" @@ -122,13 +122,13 @@ done PYTHON_COMMON_PATH=$(dirname $PWD)/common/src export PYTHONPATH=$PWD/src:${PYTHON_COMMON_PATH} -cd src +cd src || exit 1 if [[ $ARG_DEV_MODE ]]; then - echo "Starting web UI (dev mode) ..." + echo "Starting PiSCSI Web UI (dev mode) ..." watchmedo auto-restart --directory=../../ --pattern=*.py --recursive -- \ - python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE} + python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_BACKEND_HOST} ${ARG_BACKEND_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE} else - echo "Starting web UI ..." - python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE} -fi \ No newline at end of file + echo "Starting PiSCSI Web UI ..." + python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_BACKEND_HOST} ${ARG_BACKEND_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE} +fi diff --git a/python/web/tests/api/test_auth.py b/python/web/tests/api/test_auth.py index c2376e19..1261aa58 100644 --- a/python/web/tests/api/test_auth.py +++ b/python/web/tests/api/test_auth.py @@ -3,12 +3,12 @@ from conftest import STATUS_SUCCESS, STATUS_ERROR # route("/login", methods=["POST"]) def test_login_with_valid_credentials(pytestconfig, http_client_unauthenticated): - # Note: This test depends on the rascsi group existing and 'username' a member the group + # Note: This test depends on the piscsi group existing and 'username' a member the group response = http_client_unauthenticated.post( "/login", data={ - "username": pytestconfig.getoption("rascsi_username"), - "password": pytestconfig.getoption("rascsi_password"), + "username": pytestconfig.getoption("piscsi_username"), + "password": pytestconfig.getoption("piscsi_password"), }, ) @@ -34,7 +34,7 @@ def test_login_with_invalid_credentials(http_client_unauthenticated): assert response.status_code == 401 assert response_data["status"] == STATUS_ERROR assert response_data["messages"][0]["message"] == ( - "You must log in with valid credentials for a user in the 'rascsi' group" + "You must log in with valid credentials for a user in the 'piscsi' group" ) diff --git a/python/web/tests/api/test_misc.py b/python/web/tests/api/test_misc.py index ce822730..727ffa0e 100644 --- a/python/web/tests/api/test_misc.py +++ b/python/web/tests/api/test_misc.py @@ -107,11 +107,11 @@ def test_create_image_with_properties_file(http_client, delete_file): # route("/sys/manpage", methods=["POST"]) def test_show_manpage(http_client): - response = http_client.get("/sys/manpage?app=rascsi") + response = http_client.get("/sys/manpage?app=piscsi") response_data = response.json() assert response.status_code == 200 - assert "rascsi" in response_data["data"]["manpage"] + assert "piscsi" in response_data["data"]["manpage"] # route("/healthcheck", methods=["GET"]) diff --git a/python/web/tests/api/test_settings.py b/python/web/tests/api/test_settings.py index 81ac312c..fffbc943 100644 --- a/python/web/tests/api/test_settings.py +++ b/python/web/tests/api/test_settings.py @@ -61,7 +61,7 @@ def test_show_logs(http_client): "/logs/show", data={ "lines": 100, - "scope": "rascsi", + "scope": "piscsi", }, ) @@ -69,7 +69,7 @@ def test_show_logs(http_client): assert response.status_code == 200 assert response_data["data"]["lines"] == "100" - assert response_data["data"]["scope"] == "rascsi" + assert response_data["data"]["scope"] == "piscsi" # route("/config/save", methods=["POST"]) diff --git a/python/web/tests/conftest.py b/python/web/tests/conftest.py index ab80bd7e..b08bb10a 100644 --- a/python/web/tests/conftest.py +++ b/python/web/tests/conftest.py @@ -11,8 +11,8 @@ def pytest_addoption(parser): parser.addoption("--base_url", action="store", default=default_base_url) parser.addoption("--httpserver_host", action="store", default=socket.gethostname()) parser.addoption("--httpserver_listen_address", action="store", default="0.0.0.0") - parser.addoption("--rascsi_username", action="store", default="pi") - parser.addoption("--rascsi_password", action="store", default="rascsi") + parser.addoption("--piscsi_username", action="store", default="pi") + parser.addoption("--piscsi_password", action="store", default="piscsi") @pytest.fixture(scope="session") @@ -21,7 +21,7 @@ def env(pytestconfig): return { "is_docker": bool(os.getenv("DOCKER")), "home_dir": home_dir, - "cfg_dir": f"{home_dir}/.config/rascsi", + "cfg_dir": f"{home_dir}/.config/piscsi", "images_dir": f"{home_dir}/images", "file_server_dir": f"{home_dir}/shared_files", } @@ -63,8 +63,8 @@ def create_http_client(pytestconfig): session.post( "/login", data={ - "username": pytestconfig.getoption("rascsi_username"), - "password": pytestconfig.getoption("rascsi_password"), + "username": pytestconfig.getoption("piscsi_username"), + "password": pytestconfig.getoption("piscsi_password"), }, ) return session
- {% if device.vendor != "RaSCSI" %} + {% if device.vendor != "PiSCSI" %} {{ device.vendor }} {% endif %} {{ device.product }} - {% if device.vendor != "RaSCSI" %} + {% if device.vendor != "PiSCSI" %} {{ device.revision }} {% endif %}