From: Andrew Cooper Date: Thu, 21 Mar 2019 15:34:35 +0000 (+0000) Subject: block: Fix compilation with CentOS 6 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Ffix-build;p=seabios.git block: Fix compilation with CentOS 6 GCC 4.4 from CentOS 6 chokes in the following way: src/hw/blockcmd.c: In function 'scsi_rep_luns_scan': src/hw/blockcmd.c:229: error: unknown field 'cdbcmd' specified in initializer src/hw/blockcmd.c:229: warning: missing braces around initializer src/hw/blockcmd.c:229: warning: (near initialization for 'op.') src/hw/blockcmd.c:229: warning: initialization makes integer from pointer without a cast Avoid using an initialiser list. Signed-off-by: Andrew Cooper --- Discovered while adding CentOS 6 to Xen's CI system. If this patch is acceptable, what are the chances of having it backported to 1.12-stable ? --- diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c index 1f15081..a40f37c 100644 --- a/src/hw/blockcmd.c +++ b/src/hw/blockcmd.c @@ -222,16 +222,17 @@ int scsi_rep_luns_scan(struct drive_s *tmp_drive, scsi_add_lun add_lun) struct cdb_report_luns cdb = { .command = CDB_CMD_REPORT_LUNS, }; - struct disk_op_s op = { - .drive_fl = tmp_drive, - .command = CMD_SCSI, - .count = 1, - .cdbcmd = &cdb, - }; + /* GCC 4.4 (CentOS 6) can't initialise anonymous unions. */ + struct disk_op_s op = {}; struct cdbres_report_luns *resp; ASSERT32FLAT(); + op.drive_fl = tmp_drive; + op.command = CMD_SCSI; + op.count = 1; + op.cdbcmd = &cdb; + while (1) { op.blocksize = sizeof(struct cdbres_report_luns) + maxluns * sizeof(struct scsi_lun);