Commit Graph

547 Commits

Author SHA1 Message Date
Tony Kuker 5768827af8 Update revision number for release 2022-10-21 22:43:03 +01:00
Uwe Seimet 0c8d54f055
Fixed validation of full (absolute) filename (#910)
* Fixed validation of full (absolute) filename

* Added missing CR/LF in rasctl output
2022-10-12 22:10:56 +02:00
Uwe Seimet dede2a6f35
Fix logging for Data Out phase, fixed offset (#907)
Fixed issues found while testing for release 22.10
2022-10-11 17:04:17 +02:00
Uwe Seimet 4e4c5b205a
Bugfix: MODE SELECT for format page is incorrect (issue #818) (#899)
* Fix issue with MODE SELECT (#818)

* Replaced strncpy because it was causing a compilation issue
2022-10-10 08:16:47 +02:00
Uwe Seimet ca23d9b7a3
Merged FileSupport into Disk, improved granularity, more unit tests, code cleanup (#897)
* Merged FileSupport into Disk

* Improved code granularity

* Made classes previously directly writing to cout testable

* Added numerous unit tests

* Fixed minor issues uncovered by unit tests
 
* Fixed SonarCloud issues

* Replaced remaining proprietary data types (WORD/DWORD) except for files in hal/
2022-10-08 19:26:04 +02:00
Uwe Seimet a30438279e
Moved rascsi/rasctl specific classes to sub-folders, cleaned up code, fixed SonarCloud issues (#889)
* Moved rasctl/rascsi core code to folders

* Improved granularity in order to add more unit tests

* Pointer handling update

* Updated ID and controller handling

* Updated memory management

* Added unit tests

* Fixed SonarCloud issues
2022-10-06 16:15:19 +02:00
Uwe Seimet efbfb54d26
More unit tests, replacement of raw pointers and C arrays, separation of concerns (#878)
* Added unit tests

* Fixed SonarCloud issues

* Updated error handling

* Updated deletion of controllers

* Image folder handling cleanup

* Fixed clang warning

* Removed duplicate code

* Reduced code complexity

* Updated array handling

* Initialize device with ID and LUN

* Use smart pointers

* Updated memory management

* Logging updates

* Extracted methods

* Split scsi.h
2022-10-04 17:23:42 +02:00
Uwe Seimet 255a6e139f
Updated memory management, added unit tests, fixed SonarCloud issues (#862)
* Updated memory management. Final goal is to get rid of raw pointers everywhere.

* Added unit tests

* Fixed SonarCloud issues
2022-10-01 17:56:06 +02:00
Daniel Markstedt 05e0a785fa
Merge pull request #851 from akuker/rdmark-rename-host-bridge
Rename the Host Bridge INQUIRY product to RASCSI BRIDGE
2022-09-30 18:57:51 -07:00
Daniel Markstedt 71e070b59e
Merge pull request #853 from akuker/rdmark-issue852
Calculate image sizes for the Product string using MiB/KiB units
2022-09-29 19:31:42 -07:00
Daniel Markstedt b04962d9ac
Swedish translations in localizer.cpp (#865)
* Swedish translations

* Fix typos
2022-09-27 06:09:18 -07:00
Uwe Seimet 016a616b72
Added unit tests and convenience methods, fixed SonarCloud issues, include file cleanup (#849)
* Added unit tests, add convenience methods, fixed SonarCloud issues

* Replaced C-style arrays by C++ arrays

* Replaced ASSERT

* Constants cleanup

* Include cleanup

* Moved _LARGEFILE64_SOURCE to Makefile, so that os.h is not always needed

* os.h cleanup

* Fixed clang++ warnings

* Split protobuf_util

* Fixed SonarCloud issues

* Removed duplicate code

* DeviceFactory is not a singleton anymore

* Replaced macros

* Removed obsolete interface

* Replaced DWORD

* Improved locality of code

* Removed duplicate code

* Extracted CDTrack

* Split disk_track_cache

* Replaced localtime by localtime_r

* Moved CTapDriver cleanup to destructor

* Removed redunant struct keywords
2022-09-25 23:49:24 +02:00
Daniel Markstedt 12b61ada84
Consistently use SI-compliant notation for file sizes (B/KiB/MiB/GiB/TiB) where appropriate. (#855) 2022-09-25 16:37:36 -05:00
Daniel Markstedt 922c3b214a Calculate image sizes for the Product string using MiB/KiB units 2022-09-22 11:50:47 -07:00
Daniel Markstedt 1938a8b45f Rename the Host Bridge INQUIRY product to RASCSI BRIDGE, as expected by the RASETHER.SYS driver. 2022-09-22 09:03:36 -07:00
n4al e6ade9d510
Adding new translations for Spanish (#848)
* Updating the Spanish translation

* Spanish localisation for new strings
2022-09-21 11:12:10 +02:00
Uwe Seimet 119dd55ef0
Cleanup (memory management, STL containers, type safety) based on SonarCloud report (#845)
* Removed static/global variable

* No need for ControllerManager as a singleton

* Updated factory handling

* Replaced loops

* Added const

* Added translations, fixed TODO, simplified operation creation

* Fixed SonarCloud warnings

* Replaced void * by BYTE *

* Added explicit mode_page_datetime struct

* Unit test updates

* Use enum classes

* Upddated file size check

* Use C++ output formatting

* Removed unused code

* Use array for garbage buffer

* Fixed data returned by READ CAPACITY(10)

* For mode pages: Replaced BYTE by std::byte

* Use std::byte for INQUIRY

* Use std::byte for REQUEST SENSE

* Replaced C array by vector

* Replaced C style array

* Replaced BYTE by std::byte

* Replaced DWORD

* Use more byte arreys

* Updated CTapDriver initialization/deletion

* Made status uint32_t instead of DWORD

* Replaced command byte array by vector

* Updated error handling

* Removed obsolete casts

* Improved locality of code

* rw_command has become obsolete

* Dynamically allocate command byte buffer

* Simplified receiving commands

* Use references

* Type safety update, dispatcher update

* Removed macros, replaced BOOL/FALSE/TRUE
2022-09-21 08:27:51 +02:00
Uwe Seimet 241e739d3a
Memory management update, SonarCloud fixes, fix for issue #841 (#842)
- Memory management updates, more fixed Sonar issues
* Replaced macros, fixed other sonar issues
* Added const, replaced enum with a single value by constant
* Updated object initializations
* Fixed potential strncpy overflow reported by gcc 8.3
2022-09-15 23:01:10 +02:00
akuker e64c2f7254
Breakup GPIOBUS (#843)
* moved gpiobus

* moved gpiobus and systimer into hardware abstraction layer

* split up gpiobus by connection type

* merge develop changes

* revert compiler setting change

* registers working

* updates

* updates

* Revert "updates"

This reverts commit 0134b81061.

* Revert "updates"

This reverts commit 4bf0416ab4.

* Revert "registers working"

This reverts commit f5ee073eaf.

* Address comment in #843. Restore -Wextra

Co-authored-by: Tony Kuker <akuker@gmail.com>
2022-09-10 16:40:24 -05:00
Uwe Seimet f0c36fba77
SonarCloud coverage setup, fixed numerous SonarCloud issues (#840)
* SonarCloud coverage setup, fixed numerous SonarCloud issues

* Code cleanup
2022-09-10 07:59:41 +02:00
Uwe Seimet d80fbec03d
Added support for .hd1 (SCSI-1) image files (#828)
* Added support for .hd1 (SCSI-1) image files

* Update c-cpp.yml

* Fixed unit test warnings

* Fixed wrong scan default default (must be 1, not -1)

* Updated max length check

* Removed file not present in develop branch

* Added unit test

* Added workflow configurations and README updates (#832)

* automated test try 1

* filter branches

* filter branches

* filter branches

* filter branches

* filter branches

* Configured build and test CI workflows

* enable for all branches

* Update README.md

* Update README.md

Co-authored-by: Tony Kuker <akuker@gmail.com>

* Fix simple SonarCloud issues (#834)

* Fixing SonarCloud issues, first round

* Fixing SonarCLoud issues, next round

* Fixing SonarQube issues, next round

* Fixed warning

* Replaced empty constructors/destructors with = default;

* Fixed warning

* Replaced new

* Use constants instead of macros

* Use structured binding declarations

* Use init statements for if

* Use string views

* Use enum class, use using instead of typedef

* Fixed more SonarCloud warnings

* Replaced redundant/duplicate types with auto

* Devlared methods const

* Memory management update

* Fixed warning

* Added missing const

* Improved RaScsiResponse memory management

* Improved memory management

* Improved memory management

* Replaced macros by constants, removed unused constants

* Made member private

* Fixed warning

* Added comment

* Fixed shadowing warnings

* Cleanup

* Cleanup

* Cleanup

* Fixed shadowing warning

* Removed unused code

* Fixed more warnings

* Removed obsolete casts

* Fixed warnings

* Removed unused field

* Removed library not needed by rasctl

* Include cleanup

* Updated platform check for better compatibility

* Improved check for invalid option. This prevents rasctl to break on macos.

* Updated option check

* Fixed typo

* Added TODO

* Removed macro

* Scope update

* Replaced macro

* Added TODO, update memory management

* Fixed typo

* Replaced NULL by nullptr

* Use more structured bindings

* Added TODO

* Use calloc instead of mallco to not need memset

* Fixed warnings

* Fixed SonarQube initialization issues

* Fixed warning

* Cleaned up override/virtual/final

* Fixed warnings

* Constructor update

* Fixed tests

* Improved memory management

* Added missing const

* Added const

* Fixed two bugs reported by SonarCloud

* Fix SonarCloud hotspot

* Fixed memory management

* Memory management update

* Addressing hotspot by using strncpy

* Fixed SonarCloud issues

* Fixed SonarQube issues

* Added missing const

* Added const

* Added const

* Suppress false positive

* Added SonarQube suppressions for false positives

* Added suppresoin

* Fixed code smells

* Reverted changes that is a SonarQube issue, but caused problems with -O3

* Removed TODO based on review

* Update c-cpp.yml

* Finalized merge

Co-authored-by: akuker <34318535+akuker@users.noreply.github.com>
Co-authored-by: Tony Kuker <akuker@gmail.com>
2022-09-07 21:45:00 -05:00
Troy a56aae6d78
Apple Mode Page support for SCHD & SCCD (#835)
Co-authored-by: Troy <jokker@gmail.com>
2022-09-07 21:37:07 -05:00
Uwe Seimet 05db0e4688
Fix simple SonarCloud issues (#834)
* Fixing SonarCloud issues, first round

* Fixing SonarCLoud issues, next round

* Fixing SonarQube issues, next round

* Fixed warning

* Replaced empty constructors/destructors with = default;

* Fixed warning

* Replaced new

* Use constants instead of macros

* Use structured binding declarations

* Use init statements for if

* Use string views

* Use enum class, use using instead of typedef

* Fixed more SonarCloud warnings

* Replaced redundant/duplicate types with auto

* Devlared methods const

* Memory management update

* Fixed warning

* Added missing const

* Improved RaScsiResponse memory management

* Improved memory management

* Improved memory management

* Replaced macros by constants, removed unused constants

* Made member private

* Fixed warning

* Added comment

* Fixed shadowing warnings

* Cleanup

* Cleanup

* Cleanup

* Fixed shadowing warning

* Removed unused code

* Fixed more warnings

* Removed obsolete casts

* Fixed warnings

* Removed unused field

* Removed library not needed by rasctl

* Include cleanup

* Updated platform check for better compatibility

* Improved check for invalid option. This prevents rasctl to break on macos.

* Updated option check

* Fixed typo

* Added TODO

* Removed macro

* Scope update

* Replaced macro

* Added TODO, update memory management

* Fixed typo

* Replaced NULL by nullptr

* Use more structured bindings

* Added TODO

* Use calloc instead of mallco to not need memset

* Fixed warnings

* Fixed SonarQube initialization issues

* Fixed warning

* Cleaned up override/virtual/final

* Fixed warnings

* Constructor update

* Fixed tests

* Improved memory management

* Added missing const

* Added const

* Fixed two bugs reported by SonarCloud

* Fix SonarCloud hotspot

* Fixed memory management

* Memory management update

* Addressing hotspot by using strncpy

* Fixed SonarCloud issues

* Fixed SonarQube issues

* Added missing const

* Added const

* Added const

* Suppress false positive

* Added SonarQube suppressions for false positives

* Added suppresoin

* Fixed code smells

* Reverted changes that is a SonarQube issue, but caused problems with -O3

* Removed TODO based on review
2022-09-07 09:38:42 -05:00
Uwe Seimet ddeede2beb
SASI code removal, error handling update, bug fixes, code cleanup (#806)
Summary ov most important changes triggered by the SASI code removal:

- Removed the SASI controller code
- New controller management. There is a new controller base class AbstractController and a class ControllerManager managing the controller lifecycle. The lifecycle management was removed from rasci.cpp and is covered by unit tests.
- New device management. The DeviceFactory manages the device lifecycle instead of rascsi.cpp. The new code is covered by unit tests.
- The lifecycle managment uses C++ collections with variable size instead of arrays with hard-coded sizes.
- The ScsiController method contains most of what was previously contained in scsidev_ctrl.cpp plus the code from sasidev_ctrl.cpp that was relevant for SCSI.
- scsi_command_util contains helper methods used for identical SCSI command implementations of more than one device
- Devices know their controllers, so that the controller instance does not need to be passed to each SCSI command. This change helps to decouple the devices from the controller. The phase_handler interface is also part of this decoupling.
- Use scsi_command_exception for propagating SCSI command execution errors, This resolves issues with the previous error handling, which was based on return values and often on magic numbers.
- Removed legacy SCSI error codes, all errors are now encoded by sense_key::, asc:: and status::.
- Fixed various warnings reported with -Wextra, -Weffc++ and -Wpedantic.
- Use constructor member initialization lists (recommended for ISO C++)
- Consistently use new/delete instead of malloc/free (recommended for ISO C++), resulting in better type safety and error handling
- Replaced variable sized arrays on the stack (violates ISO C++ and can cause a stack overflow)
- Replaced NULL by nullptr (recommended for C++), resulting in better type safety
- Use more const member functions in order to avoid side effects
- The format device page can now also be changed for hard disk drives (Fujitsu M2624S supports this, for instance), not just for MOs.
- Better encapsulation, updated access specifiers in many places
- Removed unused methods and method arguments
- Fixed a number of TODOs
- Added/updated unit tests for a lot of non-legacy classes
- Makefile support for creating HTML coverage reports with lcov/genhtml
2022-09-03 16:53:53 +02:00
Uwe Seimet e649a014d5
Removed unused binary file foo.hda (#817) 2022-08-31 13:19:37 -05:00
Tony Kuker 06dfb48fdc Update version for next development version 2022-08-28 22:22:17 +01:00
Tony Kuker b5ddb88e6a Update revision number for release 22.08.01 2022-08-28 22:19:06 +01:00
Uwe Seimet 7fc84c4217
Initial unit tests based on GoogleTest and GoogleMock (#802)
* Initial dummy test

* Makefile update

* Make protected method visible

* Test update

* Test update

* Updated mode page device

* Only build tests with explicit test target

* make test builds and executes tests

* Replaced constant

* Added TODO

* Merged develop

* Added unit test

* Comment update

* Unit test update

* Added tests

* Added tests

* Test cleanup

* Updated error handling

* Reverted MODE SENSE change

* Reverted last change

* Use GoogleMock

* Comment update

* Signature update

* Cleanup

* Cleanup

* Further cleanup

* Removed obsolete comment

* Updated error handling

* Cleanup

* Added TODO

* Added test

* Added test

* Renaming

* Added test

* Cleanup

* Header update

* Added two tests

* Renaming

* Fixed test argument order

* Namespaces are needed in order to avoid name clashes

* Added test

* Added tests

* Added tests

* Added tests

* Added tests

* Updated host services test

* Merge with develop

* Moved code

* Renaming

* Added tests

* Added tests

* Initial device tests

* Test cleanup

* Added test

* Removed cast

* RASCSI_TEST target has to depend on SRC_PROTOBUF
2022-08-28 12:25:08 -05:00
Uwe Seimet eeae12ac4d
Host services do not support an image file (#812) 2022-08-26 09:50:18 -05:00
akuker c6da145f0f
handle the return value of write() (#810)
Co-authored-by: Tony Kuker <akuker@gmail.com>
2022-08-26 10:19:42 +02:00
Daniel Markstedt 15c14e0404
Rebrand to RaSCSI Reloaded in C++ codebase (#805) 2022-08-25 20:01:39 -05:00
Uwe Seimet 440fa65009
Return partial mode page data depending on allocation length (#793) 2022-08-19 19:34:31 -05:00
akuker b902ae6ff9
#782 compiler interprets 08 as octal, which is invalid (#784)
Co-authored-by: Tony Kuker <akuker@gmail.com>
2022-08-02 16:31:15 +02:00
Tony Kuker 136e915f0c Update version for next development version 2022-08-01 01:43:29 +01:00
Tony Kuker ca3ded37f2 Update revision number for release 2022-08-01 01:41:10 +01:00
Daniel Markstedt e51517ca60
Rebrand to RaSCSI Reloaded in key places in the code (#772)
* Add Reloaded to readme

* Add Reloaded to prominent places in the web app

* Add Reloaded to the rascsi startup message
2022-07-26 10:20:50 -05:00
Tony Kuker a5d397b3fc Update version for next development ersion 2022-05-08 20:24:34 +01:00
Tony Kuker 4cb2b64a23 Updated version for 22.5.02 release 2022-05-08 20:19:30 +01:00
Uwe Seimet a3a53354cc
Fix issue 750 (Daynaport problems in develop branch) (#754)
INQUIRY for the Daynaport can return up to 37 bytes. The additional length field for the Daynaport is now 0x20 instead of 0x1b.
2022-04-26 22:08:28 +02:00
Uwe Seimet cb3011de99
Mode page value improvements (#734)
* Updated mode page values

* Page size update

* Caching parameters are not changeable
2022-03-13 19:47:54 -05:00
Uwe Seimet 32fb022a41
Updated MODE SENSE error handling in case of an overflow (#732)
* Updated MODE SENSE error handling

* Updated range check
2022-03-13 19:46:43 -05:00
Uwe Seimet 08156f763f
Only return RTC page if not changeable pages are requested (#731) 2022-03-13 19:45:52 -05:00
Uwe Seimet f32c20883e
Ignore unknown parameters and log a warning (#730)
* Ignore unknown parameters and log a warning

* Added comment

* Updated logging
2022-03-13 19:44:16 -05:00
Uwe Seimet 9099d7249c
SASI FORMAT opcode fix, SASI segfault fix, added SASI INQUIRY/READ CAPACITY, 512 bytes per sector SASI drives (#724)
* Fixed opcode

* Fixed segfault

* Re-added 0x06 as additional SASI FORMAT opcode

* Added support of SASI drives with 512 bytes

* SASI LUN must always be taken from CDB and must be 0 or 1

* Fixed typo

* Fixed one more SASI segfault

* Removed duplicate code

* Updated error handling

* Updated error handling

* Logging update

* Added enum value for SPC-6

* Comment update

* Added support for SASI Inquiry

* Updated SASI LUN check

* Updated SASI LUN handling

* Comment update

* Revert "Comment update"

This reverts commit c6adbde25c.

* Updated logging

* Implemented SASI READ CAPACITY

* Validate SASI block count

* Do not support ICD semantics for SASI drives

* SASI READ CAPACITY is a group 1 command with 10 bytes

* Comment update
2022-03-06 09:17:23 -06:00
Uwe Seimet af9638ce48
Validate SEEK block address (#719)
* Validate SEEK block address

* Ignore block count for SEEK

* Updated REPORT LUNS
2022-03-03 12:53:11 -06:00
Uwe Seimet 305a7fb99d
Use enums for device type and scsi level (#718)
* Use enums for device type and scsi level

* Renaming

* Use new enum instead of magic values

* Comment update

* Fixed REQUEST SENSE regression
2022-03-02 11:31:42 -06:00
Uwe Seimet 1df7cdb1f3
Use vector for INQUIRY data, LUN list can have gaps, made methods const (#713)
* Use vector for INQUIRY data, Inquiry() is const, moved EVPD check

* Moved code

* Fixed warning

* Updated memcpy

* Set length

* Limit result vector size

* Limit result buffer size

* Inquiry() result buffer handling update

* Logging update

* Inquiry cleanup

* NEC drive can also use PrimaryDevice::Inquiry()

* NEC drive is never removable

* Comment update

* Bridge can also use PrimaryDevice::Inquiry()

* Removed unused method argument

* Comment update

* Updated comment

* Updated REQUEST SENSE buffer handling

* Fixed typo

* Fixed typo

* Re-added comment

* Updated additional length handling

* Check for INQUIRY command support first

* Added assertion

* Size handling update

* Renaming

* Renaming

* Removed obsolete casts

* Cleanup

* Moved error codes to scsi_defs namespace

* Fixed ReadDefectData10

* Comment update

* Updated buffer handling

* Data type update

* SendDiagnostic is now const

* Removed obsolete forward declaration

* removed unused enum

* Reduced method visibility

* Renaming

* GetSendDelay() can be const

* Made method const

* Made method const

* Added TODO

* Use iterator

* Made method const

* Revert "Made method const"

This reverts commit 38412b8ddd.

* No need to sort all set/maps

* Do not sort all sets

* Removed more unnecessary sorting

* Cleaned up includes

* More include cleanups

* Updated REPORT LUNS

* LUNs must not be consecutive anymore

* Updated detaching of LUN

* Improvements for devices without LUN 0

* Assume LUN 0 is always present

* Enforce presence of LUN 0

* Updated error handling
2022-03-01 20:25:22 -06:00
Uwe Seimet 0e8d89e827
Code cleanup, in particular related to MODE SENSE (#699)
* Replace member functions

* Fixed TODO

* Added TODOs

* Added TODOs

* Removed duplicate code

* Fixed return value

* CD-ROM mode pages are provided by the CD-ROM implementation

* MO mode pages are provided by the MO implementation

* Comment update

* Removed duplicate code

* Removed more duplicate code

* Optimization

* Updated mode page size handling

* Addec TODO

* Started more flexible mode page handling

* Map mode pages

* Page 0 must be last

* Error handling update

* Updated size handling

* Updated map handling

* Use map references

* Move superclass call

* Added comment

* Host services also support mode page 0x3f (all pages)

* Updated handling of page 0

* Removed duplicate code

* Updated buffer size handling

* Code cleanup

* Removed duplicate code

* Use calloc()

* Removed duplicate code

* Comment update

* Fixed buffer offset

* Fixed TODO

* Added buffer size check

* Comment udpate

* Logging update

* Updated logging

* Avoid potential memory leak

* Updated handling of page 0

* Added TODO

* Comment update

* Fixed error message

* Use vector instead of byte array

* Optimization

* More optimizations

* Removed duplicate code

* Do not try to add more pages when buffer is full

* Updated error message

* Comment update, fixed host services message length handling

* Code cleanup, optimizations

* Updated payload handling for page 0

* Fixed TODO

* Updated handling of PS field

* Fixed offsets

* Updated handling for page 0

* Code cleanup

* More cleanup

* Updated block descriptor handling

* Result of REPORT LUNS must not depend on whether a device is ready or not

* Printer uses a dynamically allocated buffer

* Use realloc

* Updated memory handling

* Added assertion

* Comment update

* Fixed initialization

* Reset byte transfer flag

* Updated usage of realloc

* Reverted some changes

* Re-added buffer size check

* Renaming

* Inquiry for hard disk must also work when drive is not ready

* Primary device checks EVPD

* Added page code check to Inquiry

* Explicitly set response level format

* Added comment

* Removed useless cast

* Fixed inconsistencies in setting the additional length

* Logging uodate

* Updated logging

* Made methods const

* Moved code

* Added TODO

* Added vendor page

* Reduced visibility

* Code cleanup

* Mark override

* Removed duplicate cast

* Synchronized host services mode page handling with other code

* Added TODO

* Signature update

* Moved code

* Removed duplicate code

* Fixed TODO

* Removed duplicate code

* Added buffer size check

* Improved buffer size check

* Code cleanup

* Removed useless assertions

* Cleanup

* Renaming

* Added overrides

* Removed unnecessary casts

* Cleanup

* Added TODO

* Removed obsolete memset

* Removed duplicate code

* Logging update

* Logging update

* Assertion update

* Removed useless comments

* Code cleanup

* Removed obsolete casts

* User super typedef

* Updated log messages

* Fixed #712

* Updated error handling

* Removed useless assertions

* Reduced casts to Disk*

* Updated sector size list argument

* Removed obsolete casts

* Removed comment
2022-02-27 15:58:01 -06:00
Uwe Seimet 33bfe42017
Replaced zlib by internal crc32() method (#698) 2022-02-27 15:24:50 -06:00
Uwe Seimet f5f5c002aa
Added reboot support (#696) 2022-02-22 19:08:22 -08:00