]> www.infradead.org Git - users/sagi/blktests.git/commit
common/scsi_debug: introduce _configure_scsi_debug
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 25 Apr 2023 11:47:43 +0000 (20:47 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 23 May 2023 07:16:44 +0000 (16:16 +0900)
commit17dd9690f94262387cd1d6a67baf79a3f641c43f
tree68a03eca691e791fcc9d0470abf31ed78592af88
parentb4f448b350a3c8390bca2ed81d8113797d337d81
common/scsi_debug: introduce _configure_scsi_debug

To set up scsi_debug devices with built-in scsi_debug module, introduce
a new helper function _configure_scsi_debug. It works in similar manner
as _init_scsi_debug which sets up scsi_debug devices with loadable
scsi_debug module.

_configure_scsi_debug takes parameters of scsi_debug devices in format
of 'key=value' as its arguments. It calls another new helper function
_scsi_debug_key_path to find sysfs files corresponding to the keys in
/sys/module/scsi_debug/parameters or /sys/bus/pseudo/drivers/scsi_debug.
When the file is found, write the value to the file.

Before setting the parameters through sysfs files, save current values
of scsi_debug parameters in ORIG_SCSI_DEBUG_PARAMS. Use the saved values
to restore parameters in _exit_scsi_debug. Do this value restore not
only for the parameters modified in _configure_scsi_debug but also for
the parameters modified by test cases.

Among the parameters, 'add_host' has special meaning to add new hosts.
Then handle it separately so that it is set at last in
_configure_scsi_debug, and restored at first in _exit_scsi_debug.

Also record the hosts which exist before _configure_scsi_debug in the
array ORIG_SCSI_DEBUG_HOSTS. Those hosts should not be used for testing,
then do not add them to SCSI_DEBUG_HOSTS.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
common/scsi_debug