On 04/25/2018 11:15 AM, Peter Krempa wrote:
Add detection mechanism which will allow to check whether a path to
a
block device is a physical CDROM drive. This will be useful once we will
need to pass it to hypervisors.
The linux implementation uses an ioctl to do the detection, while the
fallback uses a simple string prefix match.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virfile.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++-
src/util/virfile.h | 2 ++
3 files changed, 58 insertions(+), 1 deletion(-)
Because it's "easier" to find and it sticks out more, please consider
using CDROM instead Cdrom. You could also change @filename to be @path,
but that's just a nit.
I agree this is better than qemuDomainFilePathIsHostCDROM and should be
used instead. Since it's the same logic as qemu it's a fairly safe bet
for having no issues on all the various platforms w/r/t the ioctl -
famous last words though for all the variants we compile on...
Altering the existing code can be a followup - unless of course you have
the urge to post a followup after this patch or the next one.
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John