From: Kevin Wolf <[email protected]> The property default values from include/hw/block/block.h were duplicated in scsi_bus_legacy_handle_cmdline(), allowing them to go out of sync easily. There doesn't seem a good way to avoid the duplication, but moving them next to each other in the header file should help to avoid this problem in the future.
Signed-off-by: Kevin Wolf <[email protected]> Message-ID: <[email protected]> Signed-off-by: Kevin Wolf <[email protected]> (cherry picked from commit a1310cc6281d22ac948f4aa198dcc55d58fc039d) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index ece1107ee8..35ff216510 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -482,12 +482,7 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus) Location loc; DriveInfo *dinfo; int unit; - BlockConf conf = { - .bootindex = -1, - .share_rw = false, - .rerror = BLOCKDEV_ON_ERROR_AUTO, - .werror = BLOCKDEV_ON_ERROR_AUTO, - }; + BlockConf conf = DEFAULT_BLOCK_CONF; loc_push_none(&loc); for (unit = 0; unit <= bus->info->max_target; unit++) { diff --git a/include/hw/block/block.h b/include/hw/block/block.h index de3946a5f1..1f140c01a4 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -49,6 +49,13 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) return exp; } +#define DEFAULT_BLOCK_CONF (BlockConf) { \ + .bootindex = -1, \ + .share_rw = false, \ + .rerror = BLOCKDEV_ON_ERROR_AUTO, \ + .werror = BLOCKDEV_ON_ERROR_AUTO, \ +} + #define DEFINE_BLOCK_PROPERTIES_BASE(_state, _conf) \ DEFINE_PROP_ON_OFF_AUTO("backend_defaults", _state, \ _conf.backend_defaults, ON_OFF_AUTO_AUTO), \ -- 2.47.3
