OSDN Git Service

Expand virtio_block check to other virtual devices
authorAlistair Delva <adelva@google.com>
Thu, 14 May 2020 23:35:03 +0000 (16:35 -0700)
committerAlistair Delva <adelva@google.com>
Sat, 16 May 2020 00:00:44 +0000 (17:00 -0700)
commitff1fc9bc417c8a4b6bffb2b12ab69a705676c17a
tree26f269cd503a1fcc0bc9f7eb88be687c95aa8725
parentdbc0da396a7913a896ef14f5134db7fa2e62be4b
Expand virtio_block check to other virtual devices

The Android Emulator isn't the only virtual device the virtio-block
detection code is useful for, and those platforms might not set any
discriminating properties to indicate that they are virtual.

Rework the virtio-block major detection to use /proc/devices instead
of hardcoding the assumption that any virtual platform can have
virtio-block at any experimental major; the new code permits only the
exact experimental major assigned to virtio-block.

The new code runs everywhere, but it will only run once and could be
expanded later to detect dynamic or experimental majors.

Bug: 156286088
Change-Id: Ieae805d08fddd0124a397636f04d99194a9ef7e5
Utils.cpp
Utils.h
VolumeManager.cpp
model/Disk.cpp