disk_info_from_fd(): get major/minor from buf.st_rdev

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html :

  The <sys/stat.h> header shall define the structure of the data returned
  by the fstat(), lstat(), and stat() functions.

  The <sys/stat.h> header shall define the stat structure, which shall
  include at least the following members:

  [...]
  dev_t st_dev    Device ID of device containing file.
  [...]
  dev_t st_rdev   Device ID (if file is character or block special).
  [...]

In disk_info_from_fd(), we don't care about the device containing the
special file -- we care about the device the special file identifies.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
disk_get_pci(): expose detected interface type

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
produce virtio-blk device paths under EDD 3.0

OVMF is "UEFI boot firmware for virtual machines", hence a new use case
for efibootmgr. A virtual machine can have virtio-blk disks, and OVMF
supports them with the VirtioBlkDxe driver. Let's recognize such disks,
and produce correct boot options for them.

For now the user has to specify "-e 3" on the command line, to enable EDD
3.0 support under OVMF. (The autodetection code in get_edd_version() seems
to be EFI inheritance, it doesn't work under UEFI / edk2.)

With this patch, efibootmgr generates the following device path scheme for
virtio-blk disks, matching the ones installed by VirtioBlkDxe:

  ACPI(a0341d0,0)PCI(7,0)\
  HD(1,800,64000,87b09cbe-32b9-4737-8ecc-c1e65702cfb6)\
  File(\EFI\redhat\grub.efi)

Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=998611

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
disk_info_from_fd(): group output parameters into struct disk_info

Also expose the major and minor device numbers.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
disk_get_virt_pci(): generalize to arbitrary major & minor device numbers

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
prevent out-of-bounds access with SCSI_IOCTL_GET_PCI

SCSI_IOCTL_GET_PCI can store up to 20 non-NUL characters, and it doesn't
store a NUL character at all.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
produce virtio-scsi device paths under EDD 3.0

With this patch, efibootmgr generates the following device path scheme for
virtio-scsi disks, matching the ones installed by OVMF's VirtioScsiDxe:

  ACPI(a0341d0,0)PCI(4,0)SCSI(5,6)\
  HD(1,800,64000,87b09cbe-32b9-4737-8ecc-c1e65702cfb6)\
  File(\EFI\redhat\grub.efi)

For now the user has to specify "-e 3" on the command line, to enable EDD
3.0 support under OVMF. (The autodetection code in get_edd_version() seems
to be EFI inheritance, it doesn't work under UEFI / edk2.)

Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=998611

Signed-off-by: Laszlo Ersek <lersek@redhat.com>