On 04/14/22 17:43, Richard W.M. Jones wrote:
On Thu, Apr 14, 2022 at 04:40:25PM +0100, Richard W.M. Jones wrote:
+ (* For IDE disks, IDE CD-ROMs, SCSI disks, SCSI CD-ROMs, and floppies, we + * need host-bus adapters (HBAs) between these devices and the PCI(e) root + * bus. Some machine types create these HBAs automatically (despite + * "-no-user-config -nodefaults"), some don't... + *) + let parent_ctrl_needed target_bus dev_filter = + try ignore (List.find dev_filter (Array.to_list target_bus)); true + with Not_found -> false
You can Array.exists here, but it might also be worth converting ^ use everything to a list earlier on in the file, eg:
let target_virtio_blk_bus = Array.to_list target_buses.target_virtio_blk_bus and target_ide_bus = Array.to_list target_buses.target_ide_bus [etc]
and then using List.exists here and List.iter{,i} below.
Turns out that using Array.exists is less work. Laszlo